ExtraHoppers/src/main/kotlin/net/shadowfacts/extrahoppers/block/wood/WoodHopperContainer.kt

33 lines
1.1 KiB
Kotlin

package net.shadowfacts.extrahoppers.block.wood
import net.minecraft.container.Slot
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.inventory.Inventory
import net.minecraft.util.Identifier
import net.minecraft.util.PacketByteBuf
import net.shadowfacts.extrahoppers.block.base.BaseHopperContainer
import net.shadowfacts.extrahoppers.init.EHBlocks
class WoodHopperContainer(
syncId: Int,
playerInv: PlayerInventory,
hopper: WoodHopperBlockEntity
): BaseHopperContainer<WoodHopperBlockEntity>(syncId, playerInv, hopper) {
companion object {
val ID = Identifier("extrahoppers", "wood_hopper")
fun create(syncId: Int, identifier: Identifier, player: PlayerEntity, buf: PacketByteBuf): WoodHopperContainer {
val pos = buf.readBlockPos()
val blockEntity = EHBlocks.WOOD_HOPPER.getBlockEntity(player.world, pos)!!
return WoodHopperContainer(syncId, player.inventory, blockEntity)
}
}
override fun addHopperSlots() {
addSlot(Slot(hopper, 0, 80, 20))
}
}