Rename things

This commit is contained in:
Shadowfacts 2019-10-26 22:12:02 -04:00
parent 6e87092dde
commit d3c1cbdb5b
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
5 changed files with 17 additions and 20 deletions

View File

@ -5,8 +5,8 @@ import net.minecraft.block.entity.BlockEntity
import net.minecraft.block.entity.BlockEntityType
import net.minecraft.util.Identifier
import net.minecraft.util.registry.Registry
import net.shadowfacts.phycon.network.block.networkinterface.NetworkInterfaceBlock
import net.shadowfacts.phycon.network.block.networkinterface.NetworkInterfaceBlockEntity
import net.shadowfacts.phycon.network.block.netinterface.InterfaceBlock
import net.shadowfacts.phycon.network.block.netinterface.InterfaceBlockEntity
import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
import net.shadowfacts.phycon.network.block.terminal.TerminalBlockEntity
@ -15,7 +15,7 @@ import net.shadowfacts.phycon.network.block.terminal.TerminalBlockEntity
*/
object PhyBlockEntities {
val NETWORK_INTERFACE = create(::NetworkInterfaceBlockEntity, PhyBlocks.NETWORK_INTERFACE)
val INTERFACE = create(::InterfaceBlockEntity, PhyBlocks.INTERFACE)
val TERMINAL = create(::TerminalBlockEntity, PhyBlocks.TERMINAL)
private fun <T: BlockEntity> create(builder: () -> T, block: Block): BlockEntityType<T> {
@ -23,7 +23,7 @@ object PhyBlockEntities {
}
fun init() {
register(NetworkInterfaceBlock.ID, NETWORK_INTERFACE)
register(InterfaceBlock.ID, INTERFACE)
register(TerminalBlock.ID, TERMINAL)
}

View File

@ -3,7 +3,7 @@ package net.shadowfacts.phycon.init
import net.minecraft.block.Block
import net.minecraft.util.Identifier
import net.minecraft.util.registry.Registry
import net.shadowfacts.phycon.network.block.networkinterface.NetworkInterfaceBlock
import net.shadowfacts.phycon.network.block.netinterface.InterfaceBlock
import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
/**
@ -11,11 +11,11 @@ import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
*/
object PhyBlocks {
val NETWORK_INTERFACE = NetworkInterfaceBlock()
val INTERFACE = InterfaceBlock()
val TERMINAL = TerminalBlock()
fun init() {
register(NetworkInterfaceBlock.ID, NETWORK_INTERFACE)
register(InterfaceBlock.ID, INTERFACE)
register(TerminalBlock.ID, TERMINAL)
}
@ -23,4 +23,4 @@ object PhyBlocks {
Registry.register(Registry.BLOCK, id, block)
}
}
}

View File

@ -4,7 +4,7 @@ import net.minecraft.item.BlockItem
import net.minecraft.item.Item
import net.minecraft.util.Identifier
import net.minecraft.util.registry.Registry
import net.shadowfacts.phycon.network.block.networkinterface.NetworkInterfaceBlock
import net.shadowfacts.phycon.network.block.netinterface.InterfaceBlock
import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
/**
@ -12,11 +12,11 @@ import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
*/
object PhyItems {
val NETWORK_INTERFACE = BlockItem(PhyBlocks.NETWORK_INTERFACE, Item.Settings())
val INTERFACE = BlockItem(PhyBlocks.INTERFACE, Item.Settings())
val TERMINAL = BlockItem(PhyBlocks.TERMINAL, Item.Settings())
fun init() {
register(NetworkInterfaceBlock.ID, NETWORK_INTERFACE)
register(InterfaceBlock.ID, INTERFACE)
register(TerminalBlock.ID, TERMINAL)
}

View File

@ -1,4 +1,4 @@
package net.shadowfacts.phycon.network.block.networkinterface
package net.shadowfacts.phycon.network.block.netinterface
import alexiil.mc.lib.attributes.AttributeList
import alexiil.mc.lib.attributes.AttributeProvider
@ -6,14 +6,11 @@ import net.minecraft.block.Block
import net.minecraft.block.BlockState
import net.minecraft.block.Material
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.item.ItemPlacementContext
import net.minecraft.item.ItemStack
import net.minecraft.state.StateFactory
import net.minecraft.state.property.Properties
import net.minecraft.util.Hand
import net.minecraft.util.Identifier
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.math.BlockPos
import net.minecraft.world.BlockView
import net.minecraft.world.World
@ -23,7 +20,7 @@ import net.shadowfacts.phycon.block.BlockWithEntity
/**
* @author shadowfacts
*/
class NetworkInterfaceBlock: BlockWithEntity<NetworkInterfaceBlockEntity>(Settings.of(Material.METAL)), AttributeProvider {
class InterfaceBlock: BlockWithEntity<InterfaceBlockEntity>(Settings.of(Material.METAL)), AttributeProvider {
companion object {
val ID = Identifier(PhysicalConnectivity.MODID, "network_interface")
val FACING = Properties.FACING
@ -34,7 +31,7 @@ class NetworkInterfaceBlock: BlockWithEntity<NetworkInterfaceBlockEntity>(Settin
builder.add(FACING)
}
override fun createBlockEntity(world: BlockView) = NetworkInterfaceBlockEntity()
override fun createBlockEntity(world: BlockView) = InterfaceBlockEntity()
override fun getPlacementState(context: ItemPlacementContext): BlockState {
val facing = if (context.player?.isSneaking == true) context.playerFacing else context.playerFacing.opposite

View File

@ -1,4 +1,4 @@
package net.shadowfacts.phycon.network.block.networkinterface
package net.shadowfacts.phycon.network.block.netinterface
import alexiil.mc.lib.attributes.SearchOptions
import alexiil.mc.lib.attributes.item.GroupedItemInv
@ -14,10 +14,10 @@ import net.shadowfacts.phycon.network.packet.RequestReadAllPacket
/**
* @author shadowfacts
*/
class NetworkInterfaceBlockEntity: DeviceBlockEntity(PhyBlockEntities.NETWORK_INTERFACE) {
class InterfaceBlockEntity: DeviceBlockEntity(PhyBlockEntities.INTERFACE) {
private val facing: Direction
get() = world!!.getBlockState(pos)[NetworkInterfaceBlock.FACING]
get() = world!!.getBlockState(pos)[InterfaceBlock.FACING]
// todo: should this be a weak ref?
private var inventory: GroupedItemInv? = null