Rename things
This commit is contained in:
parent
6e87092dde
commit
d3c1cbdb5b
|
@ -5,8 +5,8 @@ import net.minecraft.block.entity.BlockEntity
|
||||||
import net.minecraft.block.entity.BlockEntityType
|
import net.minecraft.block.entity.BlockEntityType
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import net.minecraft.util.registry.Registry
|
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.networkinterface.NetworkInterfaceBlockEntity
|
import net.shadowfacts.phycon.network.block.netinterface.InterfaceBlockEntity
|
||||||
import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
|
import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
|
||||||
import net.shadowfacts.phycon.network.block.terminal.TerminalBlockEntity
|
import net.shadowfacts.phycon.network.block.terminal.TerminalBlockEntity
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import net.shadowfacts.phycon.network.block.terminal.TerminalBlockEntity
|
||||||
*/
|
*/
|
||||||
object PhyBlockEntities {
|
object PhyBlockEntities {
|
||||||
|
|
||||||
val NETWORK_INTERFACE = create(::NetworkInterfaceBlockEntity, PhyBlocks.NETWORK_INTERFACE)
|
val INTERFACE = create(::InterfaceBlockEntity, PhyBlocks.INTERFACE)
|
||||||
val TERMINAL = create(::TerminalBlockEntity, PhyBlocks.TERMINAL)
|
val TERMINAL = create(::TerminalBlockEntity, PhyBlocks.TERMINAL)
|
||||||
|
|
||||||
private fun <T: BlockEntity> create(builder: () -> T, block: Block): BlockEntityType<T> {
|
private fun <T: BlockEntity> create(builder: () -> T, block: Block): BlockEntityType<T> {
|
||||||
|
@ -23,7 +23,7 @@ object PhyBlockEntities {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun init() {
|
fun init() {
|
||||||
register(NetworkInterfaceBlock.ID, NETWORK_INTERFACE)
|
register(InterfaceBlock.ID, INTERFACE)
|
||||||
register(TerminalBlock.ID, TERMINAL)
|
register(TerminalBlock.ID, TERMINAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package net.shadowfacts.phycon.init
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import net.minecraft.util.registry.Registry
|
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
|
import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,11 +11,11 @@ import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
|
||||||
*/
|
*/
|
||||||
object PhyBlocks {
|
object PhyBlocks {
|
||||||
|
|
||||||
val NETWORK_INTERFACE = NetworkInterfaceBlock()
|
val INTERFACE = InterfaceBlock()
|
||||||
val TERMINAL = TerminalBlock()
|
val TERMINAL = TerminalBlock()
|
||||||
|
|
||||||
fun init() {
|
fun init() {
|
||||||
register(NetworkInterfaceBlock.ID, NETWORK_INTERFACE)
|
register(InterfaceBlock.ID, INTERFACE)
|
||||||
register(TerminalBlock.ID, TERMINAL)
|
register(TerminalBlock.ID, TERMINAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import net.minecraft.item.BlockItem
|
||||||
import net.minecraft.item.Item
|
import net.minecraft.item.Item
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import net.minecraft.util.registry.Registry
|
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
|
import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,11 +12,11 @@ import net.shadowfacts.phycon.network.block.terminal.TerminalBlock
|
||||||
*/
|
*/
|
||||||
object PhyItems {
|
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())
|
val TERMINAL = BlockItem(PhyBlocks.TERMINAL, Item.Settings())
|
||||||
|
|
||||||
fun init() {
|
fun init() {
|
||||||
register(NetworkInterfaceBlock.ID, NETWORK_INTERFACE)
|
register(InterfaceBlock.ID, INTERFACE)
|
||||||
register(TerminalBlock.ID, TERMINAL)
|
register(TerminalBlock.ID, TERMINAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.AttributeList
|
||||||
import alexiil.mc.lib.attributes.AttributeProvider
|
import alexiil.mc.lib.attributes.AttributeProvider
|
||||||
|
@ -6,14 +6,11 @@ import net.minecraft.block.Block
|
||||||
import net.minecraft.block.BlockState
|
import net.minecraft.block.BlockState
|
||||||
import net.minecraft.block.Material
|
import net.minecraft.block.Material
|
||||||
import net.minecraft.entity.LivingEntity
|
import net.minecraft.entity.LivingEntity
|
||||||
import net.minecraft.entity.player.PlayerEntity
|
|
||||||
import net.minecraft.item.ItemPlacementContext
|
import net.minecraft.item.ItemPlacementContext
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.state.StateFactory
|
import net.minecraft.state.StateFactory
|
||||||
import net.minecraft.state.property.Properties
|
import net.minecraft.state.property.Properties
|
||||||
import net.minecraft.util.Hand
|
|
||||||
import net.minecraft.util.Identifier
|
import net.minecraft.util.Identifier
|
||||||
import net.minecraft.util.hit.BlockHitResult
|
|
||||||
import net.minecraft.util.math.BlockPos
|
import net.minecraft.util.math.BlockPos
|
||||||
import net.minecraft.world.BlockView
|
import net.minecraft.world.BlockView
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
|
@ -23,7 +20,7 @@ import net.shadowfacts.phycon.block.BlockWithEntity
|
||||||
/**
|
/**
|
||||||
* @author shadowfacts
|
* @author shadowfacts
|
||||||
*/
|
*/
|
||||||
class NetworkInterfaceBlock: BlockWithEntity<NetworkInterfaceBlockEntity>(Settings.of(Material.METAL)), AttributeProvider {
|
class InterfaceBlock: BlockWithEntity<InterfaceBlockEntity>(Settings.of(Material.METAL)), AttributeProvider {
|
||||||
companion object {
|
companion object {
|
||||||
val ID = Identifier(PhysicalConnectivity.MODID, "network_interface")
|
val ID = Identifier(PhysicalConnectivity.MODID, "network_interface")
|
||||||
val FACING = Properties.FACING
|
val FACING = Properties.FACING
|
||||||
|
@ -34,7 +31,7 @@ class NetworkInterfaceBlock: BlockWithEntity<NetworkInterfaceBlockEntity>(Settin
|
||||||
builder.add(FACING)
|
builder.add(FACING)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createBlockEntity(world: BlockView) = NetworkInterfaceBlockEntity()
|
override fun createBlockEntity(world: BlockView) = InterfaceBlockEntity()
|
||||||
|
|
||||||
override fun getPlacementState(context: ItemPlacementContext): BlockState {
|
override fun getPlacementState(context: ItemPlacementContext): BlockState {
|
||||||
val facing = if (context.player?.isSneaking == true) context.playerFacing else context.playerFacing.opposite
|
val facing = if (context.player?.isSneaking == true) context.playerFacing else context.playerFacing.opposite
|
|
@ -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.SearchOptions
|
||||||
import alexiil.mc.lib.attributes.item.GroupedItemInv
|
import alexiil.mc.lib.attributes.item.GroupedItemInv
|
||||||
|
@ -14,10 +14,10 @@ import net.shadowfacts.phycon.network.packet.RequestReadAllPacket
|
||||||
/**
|
/**
|
||||||
* @author shadowfacts
|
* @author shadowfacts
|
||||||
*/
|
*/
|
||||||
class NetworkInterfaceBlockEntity: DeviceBlockEntity(PhyBlockEntities.NETWORK_INTERFACE) {
|
class InterfaceBlockEntity: DeviceBlockEntity(PhyBlockEntities.INTERFACE) {
|
||||||
|
|
||||||
private val facing: Direction
|
private val facing: Direction
|
||||||
get() = world!!.getBlockState(pos)[NetworkInterfaceBlock.FACING]
|
get() = world!!.getBlockState(pos)[InterfaceBlock.FACING]
|
||||||
|
|
||||||
// todo: should this be a weak ref?
|
// todo: should this be a weak ref?
|
||||||
private var inventory: GroupedItemInv? = null
|
private var inventory: GroupedItemInv? = null
|
Loading…
Reference in New Issue