Inverted Hoppers

Closes #10
This commit is contained in:
Shadowfacts 2017-01-15 11:46:04 -05:00
parent 109c887ac0
commit 1058b3282f
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
32 changed files with 710 additions and 103 deletions

View File

@ -9,8 +9,7 @@ import net.minecraft.item.ItemStack
object EHCreativeTab: CreativeTabs(MOD_ID) { object EHCreativeTab: CreativeTabs(MOD_ID) {
override fun getTabIconItem(): ItemStack { override fun getTabIconItem(): ItemStack {
return ItemStack(ExtraHoppers.blocks.fluidHopper) return ItemStack(ExtraHoppers.blocks.woodenHopper)
// TODO: change me to the wooden hopper
} }
} }

View File

@ -11,8 +11,8 @@ import net.minecraftforge.fml.common.registry.GameRegistry
import net.minecraftforge.fml.relauncher.Side import net.minecraftforge.fml.relauncher.Side
import net.minecraftforge.fml.relauncher.SideOnly import net.minecraftforge.fml.relauncher.SideOnly
import net.shadowfacts.extrahoppers.block.ModBlocks import net.shadowfacts.extrahoppers.block.ModBlocks
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
import net.shadowfacts.extrahoppers.block.fluid.TESRFluidHopper import net.shadowfacts.extrahoppers.block.fluid.TESRFluidHopper
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
import net.shadowfacts.extrahoppers.block.wooden_fluid.TileEntityWoodenFluidHopper import net.shadowfacts.extrahoppers.block.wooden_fluid.TileEntityWoodenFluidHopper
import net.shadowfacts.extrahoppers.event.ClientEventHandler import net.shadowfacts.extrahoppers.event.ClientEventHandler
import net.shadowfacts.extrahoppers.gui.GUIHandler import net.shadowfacts.extrahoppers.gui.GUIHandler

View File

@ -19,8 +19,6 @@ abstract class BlockTE<out TE: BaseTileEntity>(name: String, material: Material
setCreativeTab(EHCreativeTab) setCreativeTab(EHCreativeTab)
} }
abstract fun registerTileEntity()
abstract override fun createTileEntity(world: World, state: IBlockState): TE abstract override fun createTileEntity(world: World, state: IBlockState): TE
override fun hasTileEntity(state: IBlockState): Boolean { override fun hasTileEntity(state: IBlockState): Boolean {

View File

@ -1,9 +1,14 @@
package net.shadowfacts.extrahoppers.block package net.shadowfacts.extrahoppers.block
import net.minecraft.block.Block import net.minecraftforge.fml.common.registry.GameRegistry
import net.shadowfacts.extrahoppers.block.fluid.BlockFluidHopper import net.shadowfacts.extrahoppers.block.fluid.BlockFluidHopper
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
import net.shadowfacts.extrahoppers.block.inverted.BlockInvertedHopper
import net.shadowfacts.extrahoppers.block.inverted.TileEntityInvertedHopper
import net.shadowfacts.extrahoppers.block.wooden.BlockWoodenHopper import net.shadowfacts.extrahoppers.block.wooden.BlockWoodenHopper
import net.shadowfacts.extrahoppers.block.wooden.TileEntityWoodenHopper
import net.shadowfacts.extrahoppers.block.wooden_fluid.BlockWoodenFluidHopper import net.shadowfacts.extrahoppers.block.wooden_fluid.BlockWoodenFluidHopper
import net.shadowfacts.extrahoppers.block.wooden_fluid.TileEntityWoodenFluidHopper
import net.shadowfacts.shadowmc.block.ModBlocks import net.shadowfacts.shadowmc.block.ModBlocks
/** /**
@ -11,21 +16,27 @@ import net.shadowfacts.shadowmc.block.ModBlocks
*/ */
object ModBlocks: ModBlocks() { object ModBlocks: ModBlocks() {
val fluidHopper = BlockFluidHopper() val invertedHopper = BlockInvertedHopper()
val woodenHopper = BlockWoodenHopper() val fluidHopper = BlockFluidHopper(false)
val woodenFluidHopper = BlockWoodenFluidHopper() val invertedFluidHopper = BlockFluidHopper(true)
val woodenHopper = BlockWoodenHopper(false)
val invertedWoodenHopper = BlockWoodenHopper(true)
val woodenFluidHopper = BlockWoodenFluidHopper(false)
val invertedWoodenFluidHopper = BlockWoodenFluidHopper(true)
override fun init() { override fun init() {
register(invertedHopper)
register(fluidHopper) register(fluidHopper)
register(invertedFluidHopper)
register(woodenHopper) register(woodenHopper)
register(invertedWoodenHopper)
register(woodenFluidHopper) register(woodenFluidHopper)
} register(invertedWoodenFluidHopper)
override fun <T: Block> register(block: T): T { GameRegistry.registerTileEntity(TileEntityInvertedHopper::class.java, invertedHopper.registryName.toString())
if (block is BlockTE<*>) { GameRegistry.registerTileEntityWithAlternatives(TileEntityFluidHopper::class.java, fluidHopper.registryName.toString(), "funnels:funnel")
block.registerTileEntity() GameRegistry.registerTileEntity(TileEntityWoodenHopper::class.java, woodenHopper.registryName.toString())
} GameRegistry.registerTileEntity(TileEntityWoodenFluidHopper::class.java, woodenFluidHopper.registryName.toString())
return super.register(block)
} }
} }

View File

@ -18,10 +18,10 @@ import net.shadowfacts.shadowmc.tileentity.BaseTileEntity
/** /**
* @author shadowfacts * @author shadowfacts
*/ */
abstract class BlockHopperBase<out TE: BaseTileEntity>(name: String, material: Material = Material.ROCK): BlockTE<TE>(name, material = material) { abstract class BlockHopperBase<out TE: BaseTileEntity>(val inverted: Boolean, name: String, material: Material = Material.ROCK): BlockTE<TE>(if (inverted) "inverted_$name" else name, material = material) {
companion object { companion object {
val FACING: PropertyDirection = PropertyDirection.create("facing") { side -> side != EnumFacing.UP } val FACING: PropertyDirection = PropertyDirection.create("facing")
val BASE_AABB = AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.625, 1.0) val BASE_AABB = AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.625, 1.0)
val SOUTH_AABB = AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 0.125) val SOUTH_AABB = AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 0.125)
@ -63,7 +63,11 @@ abstract class BlockHopperBase<out TE: BaseTileEntity>(name: String, material: M
override fun getStateForPlacement(world: World, pos: BlockPos, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float, meta: Int, placer: EntityLivingBase, hand: EnumHand): IBlockState { override fun getStateForPlacement(world: World, pos: BlockPos, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float, meta: Int, placer: EntityLivingBase, hand: EnumHand): IBlockState {
var side = facing.opposite var side = facing.opposite
if (inverted) {
if (side == EnumFacing.DOWN) side = EnumFacing.UP
} else {
if (side == EnumFacing.UP) side = EnumFacing.DOWN if (side == EnumFacing.UP) side = EnumFacing.DOWN
}
return defaultState.withProperty(FACING, side) return defaultState.withProperty(FACING, side)
} }

View File

@ -0,0 +1,37 @@
package net.shadowfacts.extrahoppers.block.base
import net.minecraft.entity.player.InventoryPlayer
import net.minecraft.inventory.Slot
import net.minecraft.util.math.BlockPos
import net.minecraftforge.items.SlotItemHandler
import net.shadowfacts.extrahoppers.block.inverted.TileEntityInvertedHopper
import net.shadowfacts.shadowmc.inventory.ContainerBase
/**
* @author shadowfacts
*/
class ContainerInvertedHopper(hopper: TileEntityInvertedHopper, playerInv: InventoryPlayer, pos: BlockPos): ContainerBase(pos) {
init {
for (i in 0.until(hopper.inventory.slots)) {
addSlotToContainer(SlotHopper(hopper, i, 44 + i * 18, 21))
}
for (l in 0..2) {
for (k in 0..8) {
addSlotToContainer(Slot(playerInv, k + l * 9 + 9, 8 + k * 18, l * 18 + 52))
}
}
for (i1 in 0..8) {
addSlotToContainer(Slot(playerInv, i1, 8 + i1 * 18, 110))
}
}
private class SlotHopper(val hopper: TileEntityInvertedHopper, index: Int, x: Int, y: Int): SlotItemHandler(hopper.inventory, index, x, y) {
override fun onSlotChanged() {
hopper.markDirty()
}
}
}

View File

@ -1,15 +1,28 @@
package net.shadowfacts.extrahoppers.block.base package net.shadowfacts.extrahoppers.block.base
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.EnumFacing import net.minecraft.util.EnumFacing
import net.shadowfacts.shadowmc.tileentity.BaseTileEntity import net.shadowfacts.shadowmc.tileentity.BaseTileEntity
/** /**
* @author shadowfacts * @author shadowfacts
*/ */
abstract class TileEntityHopperBase: BaseTileEntity() { abstract class TileEntityHopperBase(var inverted: Boolean): BaseTileEntity() {
constructor(): this(false)
fun getHopperFacing(): EnumFacing { fun getHopperFacing(): EnumFacing {
return world.getBlockState(pos).getValue(BlockHopperBase.FACING) return world.getBlockState(pos).getValue(BlockHopperBase.FACING)
} }
override fun writeToNBT(tag: NBTTagCompound): NBTTagCompound {
tag.setBoolean("inverted", inverted)
return super.writeToNBT(tag)
}
override fun readFromNBT(tag: NBTTagCompound) {
inverted = tag.getBoolean("inverted")
super.readFromNBT(tag)
}
} }

View File

@ -12,7 +12,6 @@ import net.minecraft.util.math.BlockPos
import net.minecraft.world.World import net.minecraft.world.World
import net.minecraftforge.fluids.FluidUtil import net.minecraftforge.fluids.FluidUtil
import net.minecraftforge.fluids.capability.CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY import net.minecraftforge.fluids.capability.CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY
import net.minecraftforge.fml.common.registry.GameRegistry
import net.shadowfacts.extrahoppers.ExtraHoppers import net.shadowfacts.extrahoppers.ExtraHoppers
import net.shadowfacts.extrahoppers.block.base.BlockHopperBase import net.shadowfacts.extrahoppers.block.base.BlockHopperBase
import net.shadowfacts.extrahoppers.gui.GUIHandler import net.shadowfacts.extrahoppers.gui.GUIHandler
@ -20,7 +19,7 @@ import net.shadowfacts.extrahoppers.gui.GUIHandler
/** /**
* @author shadowfacts * @author shadowfacts
*/ */
open class BlockFluidHopper(name: String = "fluid_hopper", material: Material = Material.IRON): BlockHopperBase<TileEntityFluidHopper>(name, material = material) { open class BlockFluidHopper(inverted: Boolean, name: String = "fluid_hopper", material: Material = Material.IRON): BlockHopperBase<TileEntityFluidHopper>(inverted, name, material = material) {
init { init {
setHardness(3.5f) setHardness(3.5f)
@ -44,15 +43,11 @@ open class BlockFluidHopper(name: String = "fluid_hopper", material: Material =
} }
override fun addInformation(stack: ItemStack, player: EntityPlayer, tooltip: MutableList<String>, advanced: Boolean) { override fun addInformation(stack: ItemStack, player: EntityPlayer, tooltip: MutableList<String>, advanced: Boolean) {
tooltip.add(I18n.format("$unlocalizedName.tooltip")) tooltip.add(I18n.format("tile.extrahoppers:fluid_hopper.tooltip"))
}
override fun registerTileEntity() {
GameRegistry.registerTileEntityWithAlternatives(TileEntityFluidHopper::class.java, registryName.toString(), "funnels:funnel")
} }
override fun createTileEntity(world: World, state: IBlockState): TileEntityFluidHopper { override fun createTileEntity(world: World, state: IBlockState): TileEntityFluidHopper {
return TileEntityFluidHopper() return TileEntityFluidHopper(inverted)
} }
} }

View File

@ -5,7 +5,7 @@ import net.minecraft.inventory.Container
import net.minecraft.util.ResourceLocation import net.minecraft.util.ResourceLocation
import net.shadowfacts.extrahoppers.MOD_ID import net.shadowfacts.extrahoppers.MOD_ID
import net.shadowfacts.extrahoppers.gui.element.UIFluidIndicator import net.shadowfacts.extrahoppers.gui.element.UIFluidIndicator
import net.shadowfacts.shadowmc.ui.dsl.* import net.shadowfacts.shadowmc.ui.dsl.container
/** /**
* @author shadowfacts * @author shadowfacts

View File

@ -3,14 +3,10 @@ package net.shadowfacts.extrahoppers.block.fluid
import net.minecraft.client.Minecraft import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.GlStateManager
import net.minecraft.client.renderer.Tessellator import net.minecraft.client.renderer.Tessellator
import net.minecraft.client.renderer.VertexBuffer
import net.minecraft.client.renderer.texture.TextureAtlasSprite
import net.minecraft.client.renderer.texture.TextureMap import net.minecraft.client.renderer.texture.TextureMap
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
import net.minecraft.client.renderer.vertex.DefaultVertexFormats import net.minecraft.client.renderer.vertex.DefaultVertexFormats
import net.minecraft.util.EnumFacing import net.minecraft.util.EnumFacing
import net.minecraftforge.fluids.FluidStack
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
import net.shadowfacts.shadowmc.util.RenderHelper import net.shadowfacts.shadowmc.util.RenderHelper
import org.lwjgl.opengl.GL11 import org.lwjgl.opengl.GL11
@ -20,7 +16,9 @@ import org.lwjgl.opengl.GL11
object TESRFluidHopper: TileEntitySpecialRenderer<TileEntityFluidHopper>() { object TESRFluidHopper: TileEntitySpecialRenderer<TileEntityFluidHopper>() {
override fun renderTileEntityAt(te: TileEntityFluidHopper, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int) { override fun renderTileEntityAt(te: TileEntityFluidHopper, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int) {
if (te.tank.fluid != null && !te.world.getBlockState(te.pos.up()).isSideSolid(te.world, te.pos.up(), EnumFacing.DOWN)) { val pos = if (te.inverted) te.pos.down() else te.pos.up()
if (te.tank.fluid != null && !te.world.getBlockState(pos).isSideSolid(te.world, pos, EnumFacing.DOWN)) {
val fluid = te.tank.fluid val fluid = te.tank.fluid
val tessellator = Tessellator.getInstance() val tessellator = Tessellator.getInstance()
@ -46,7 +44,7 @@ object TESRFluidHopper: TileEntitySpecialRenderer<TileEntityFluidHopper>() {
val still = Minecraft.getMinecraft().textureMapBlocks.getAtlasSprite(fluid.fluid.getStill(fluid).toString()) val still = Minecraft.getMinecraft().textureMapBlocks.getAtlasSprite(fluid.fluid.getStill(fluid).toString())
RenderHelper.putTexturedQuad(renderer, still, 2 / 16.0, 14 / 16.0, 2 / 16.0, 12 / 16.0, 0.0, 12 / 16.0, EnumFacing.UP, color, brightness) RenderHelper.putTexturedQuad(renderer, still, 2 / 16.0, 14 / 16.0, 2 / 16.0, 12 / 16.0, 0.0, 12 / 16.0, if (te.inverted) EnumFacing.DOWN else EnumFacing.UP, color, brightness)
tessellator.draw() tessellator.draw()

View File

@ -8,22 +8,21 @@ import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.fluids.Fluid.BUCKET_VOLUME import net.minecraftforge.fluids.Fluid.BUCKET_VOLUME
import net.minecraftforge.fluids.FluidStack import net.minecraftforge.fluids.FluidStack
import net.minecraftforge.fluids.FluidTank import net.minecraftforge.fluids.FluidTank
import net.minecraftforge.fluids.capability.CapabilityFluidHandler
import net.minecraftforge.fluids.capability.CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY import net.minecraftforge.fluids.capability.CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY
import net.minecraftforge.fluids.capability.IFluidHandler
import net.minecraftforge.fml.common.network.NetworkRegistry import net.minecraftforge.fml.common.network.NetworkRegistry
import net.shadowfacts.extrahoppers.util.FluidUtils
import net.shadowfacts.extrahoppers.EHConfig import net.shadowfacts.extrahoppers.EHConfig
import net.shadowfacts.extrahoppers.block.base.TileEntityHopperBase import net.shadowfacts.extrahoppers.block.base.TileEntityHopperBase
import net.shadowfacts.extrahoppers.util.FluidUtils
import net.shadowfacts.shadowmc.ShadowMC import net.shadowfacts.shadowmc.ShadowMC
import net.shadowfacts.shadowmc.capability.CapHolder
import net.shadowfacts.shadowmc.network.PacketRequestTEUpdate import net.shadowfacts.shadowmc.network.PacketRequestTEUpdate
import net.shadowfacts.shadowmc.network.PacketUpdateTE import net.shadowfacts.shadowmc.network.PacketUpdateTE
/** /**
* @author shadowfacts * @author shadowfacts
*/ */
open class TileEntityFluidHopper: TileEntityHopperBase(), ITickable { open class TileEntityFluidHopper(inverted: Boolean): TileEntityHopperBase(inverted), ITickable {
constructor(): this(false)
companion object { companion object {
val HANDLER_COOLDOWN = 8 val HANDLER_COOLDOWN = 8
@ -31,8 +30,12 @@ open class TileEntityFluidHopper: TileEntityHopperBase(), ITickable {
} }
internal var tank = object: FluidTank(EHConfig.fhSize) { internal var tank = object: FluidTank(EHConfig.fhSize) {
override fun canFillFluidType(fluid: FluidStack): Boolean { override fun onContentsChanged() {
return fluidValiator(fluid) save()
}
override fun canFillFluidType(fluid: FluidStack?): Boolean {
return fluid == null || fluidValiator(fluid)
} }
} }
@ -79,7 +82,7 @@ open class TileEntityFluidHopper: TileEntityHopperBase(), ITickable {
private fun transferIn(): Boolean { private fun transferIn(): Boolean {
if (tank.fluidAmount < tank.capacity) { if (tank.fluidAmount < tank.capacity) {
val handlerPos = pos.up() val handlerPos = if (inverted) pos.down() else pos.up()
val te = world.getTileEntity(handlerPos) val te = world.getTileEntity(handlerPos)
if (te != null && te.hasCapability(FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN)) { if (te != null && te.hasCapability(FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN)) {
val handler = te.getCapability(FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN) val handler = te.getCapability(FLUID_HANDLER_CAPABILITY, EnumFacing.DOWN)
@ -116,10 +119,11 @@ open class TileEntityFluidHopper: TileEntityHopperBase(), ITickable {
private fun pickupFromWorld(): Boolean { private fun pickupFromWorld(): Boolean {
if (EHConfig.fhPickupWorldFluids && tank.fluidAmount <= tank.capacity - BUCKET_VOLUME) { if (EHConfig.fhPickupWorldFluids && tank.fluidAmount <= tank.capacity - BUCKET_VOLUME) {
if (FluidUtils.isFluidBlock(world, pos.up())) { val pickupPos = if (inverted) pos.down() else pos.up()
val toDrain = FluidUtils.drainFluidBlock(world, pos.up(), false)!! if (FluidUtils.isFluidBlock(world, pickupPos)) {
val toDrain = FluidUtils.drainFluidBlock(world, pickupPos, false)!!
if (toDrain.amount <= tank.capacity - tank.fluidAmount && tank.fill(toDrain, false) === 1000) { if (toDrain.amount <= tank.capacity - tank.fluidAmount && tank.fill(toDrain, false) === 1000) {
tank.fill(FluidUtils.drainFluidBlock(world, pos.up(), true), true) tank.fill(FluidUtils.drainFluidBlock(world, pickupPos, true), true)
return true return true
} }
} }

View File

@ -0,0 +1,35 @@
package net.shadowfacts.extrahoppers.block.inverted
import net.minecraft.block.SoundType
import net.minecraft.block.material.Material
import net.minecraft.block.state.IBlockState
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumHand
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
import net.shadowfacts.extrahoppers.ExtraHoppers
import net.shadowfacts.extrahoppers.block.base.BlockHopperBase
import net.shadowfacts.extrahoppers.gui.GUIHandler
/**
* @author shadowfacts
*/
class BlockInvertedHopper: BlockHopperBase<TileEntityInvertedHopper>(true, "hopper", Material.IRON) {
init {
setHardness(3.5f)
setResistance(8f)
soundType = SoundType.METAL
}
override fun onBlockActivated(world: World, pos: BlockPos, state: IBlockState, player: EntityPlayer, hand: EnumHand, facing: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): Boolean {
player.openGui(ExtraHoppers, GUIHandler.INVERTED_HOPPER, world, pos.x, pos.y, pos.z)
return true
}
override fun createTileEntity(world: World, state: IBlockState): TileEntityInvertedHopper {
return TileEntityInvertedHopper()
}
}

View File

@ -0,0 +1,26 @@
package net.shadowfacts.extrahoppers.block.inverted
import net.minecraft.inventory.Container
import net.minecraft.util.ResourceLocation
import net.shadowfacts.shadowmc.ui.element.button.UIImage
import net.shadowfacts.shadowmc.ui.element.view.UIFixedView
import net.shadowfacts.shadowmc.ui.mcwrapper.UIContainerWrapper
/**
* @author shadowfacts
*/
class GUIInvertedHopper(container: Container): UIContainerWrapper(container) {
private val BG = ResourceLocation("minecraft", "textures/gui/container/hopper.png")
init {
add(UIFixedView(176, 133, "root").apply {
add(UIImage(BG, 176, 133, "bg"))
})
layout()
xSize = 176
ySize = 133
}
}

View File

@ -0,0 +1,182 @@
package net.shadowfacts.extrahoppers.block.inverted
import net.minecraft.entity.item.EntityItem
import net.minecraft.inventory.IInventory
import net.minecraft.inventory.ISidedInventory
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.EnumFacing
import net.minecraft.util.ITickable
import net.minecraft.util.math.AxisAlignedBB
import net.minecraftforge.common.capabilities.Capability
import net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY
import net.minecraftforge.items.ItemStackHandler
import net.shadowfacts.extrahoppers.block.base.TileEntityHopperBase
import net.shadowfacts.extrahoppers.util.insert
import net.shadowfacts.forgelin.extensions.get
import net.shadowfacts.forgelin.extensions.isEmpty
/**
* @author shadowfacts
*/
class TileEntityInvertedHopper: TileEntityHopperBase(), ITickable {
companion object {
val COOLDOWN = 8
}
val inventory = ItemStackHandler(5)
var cooldown = COOLDOWN
override fun update() {
if (!world.isRemote) {
cooldown--
if (cooldown <= 0) {
val pulled = pull()
val pushed = push()
if (pulled || pushed) {
cooldown = COOLDOWN
markDirty()
}
}
}
}
private fun push(): Boolean {
if (!inventory.isEmpty) {
val facing = getHopperFacing()
val tile = world.getTileEntity(pos.offset(facing))
if (tile is ISidedInventory) {
val slots = tile.getSlotsForFace(facing.opposite)
for (i in slots) {
for (slot in 0.until(inventory.slots)) {
val remainder = tile.insert(inventory.extractItem(slot, 1, true), i)
if (remainder.isEmpty) {
inventory.extractItem(slot, 1, false)
return true
}
}
}
} else if (tile is IInventory) {
for (i in 0.until(tile.sizeInventory)) {
for (slot in 0.until(inventory.slots)) {
val remainder = tile.insert(inventory.extractItem(slot, 1, true), i)
if (remainder.isEmpty) {
inventory.extractItem(slot, 1, false)
return true
}
}
}
} else if (tile != null && tile.hasCapability(ITEM_HANDLER_CAPABILITY, facing.opposite)) {
val handler = tile.getCapability(ITEM_HANDLER_CAPABILITY, facing.opposite)!!
for (i in 0.until(handler.slots)) {
for (slot in 0.until(inventory.slots)) {
val remainder = handler.insertItem(i, inventory.extractItem(slot, 1, true), false)
if (remainder.isEmpty) {
inventory.extractItem(slot, 1, false)
return true
}
}
}
}
}
return false
}
private fun pull(): Boolean {
val items = world.getEntitiesWithinAABB(EntityItem::class.java, AxisAlignedBB(pos.x.toDouble(), pos.y - 0.5, pos.z.toDouble(), pos.x + 1.0, pos.y + 0.5, pos.z + 1.0))
for (item in items) {
for (slot in 0.until(inventory.slots)) {
val result = inventory.insertItem(slot, item.entityItem, true)
if (result.count != item.entityItem.count) {
inventory.insertItem(slot, item.entityItem, false)
if (result.isEmpty) {
item.setDead()
} else {
item.setEntityItemStack(result)
}
return true
}
}
}
val tile = world.getTileEntity(pos.down())
if (tile is ISidedInventory) {
val slots = tile.getSlotsForFace(EnumFacing.UP)
for (i in slots) {
for (slot in 0.until(inventory.slots)) {
val current = tile[i]
if (!current.isEmpty) {
val copy = current.copy()
copy.count = 1
val remainder = inventory.insertItem(slot, copy, false)
if (remainder.isEmpty) {
current.shrink(1)
return true
}
}
}
}
} else if (tile is IInventory) {
for (i in 0.until(tile.sizeInventory)) {
for (slot in 0.until(inventory.slots)) {
val current = tile[i]
if (!current.isEmpty) {
val copy = current.copy()
copy.count = 1
val remainder = inventory.insertItem(slot, copy, false)
if (remainder.isEmpty) {
current.shrink(1)
return true
}
}
}
}
} else if (tile != null && tile.hasCapability(ITEM_HANDLER_CAPABILITY, EnumFacing.UP)) {
val handler = tile.getCapability(ITEM_HANDLER_CAPABILITY, EnumFacing.UP)!!
for (i in 0.until(handler.slots)) {
for (slot in 0.until(inventory.slots)) {
val remainder = inventory.insertItem(slot, handler.extractItem(i, 1, true), false)
if (remainder.isEmpty) {
handler.extractItem(i, 1, false)
return true
}
}
}
}
return false
}
override fun writeToNBT(tag: NBTTagCompound): NBTTagCompound {
tag.setTag("inventory", inventory.serializeNBT())
tag.setInteger("cooldown", cooldown)
return super.writeToNBT(tag)
}
override fun readFromNBT(tag: NBTTagCompound) {
inventory.deserializeNBT(tag.getCompoundTag("inventory"))
cooldown = tag.getInteger("cooldown")
super.readFromNBT(tag)
}
override fun hasCapability(capability: Capability<*>, facing: EnumFacing?): Boolean {
if (capability == ITEM_HANDLER_CAPABILITY) {
return facing == EnumFacing.DOWN || facing == getHopperFacing()
}
return super.hasCapability(capability, facing)
}
override fun <T: Any?> getCapability(capability: Capability<T>, facing: EnumFacing?): T? {
if (capability == ITEM_HANDLER_CAPABILITY) {
if (facing == EnumFacing.DOWN || facing == getHopperFacing()) {
return inventory as T
}
}
return super.getCapability(capability, facing)
}
}

View File

@ -8,7 +8,6 @@ import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumHand import net.minecraft.util.EnumHand
import net.minecraft.util.math.BlockPos import net.minecraft.util.math.BlockPos
import net.minecraft.world.World import net.minecraft.world.World
import net.minecraftforge.fml.common.registry.GameRegistry
import net.shadowfacts.extrahoppers.ExtraHoppers import net.shadowfacts.extrahoppers.ExtraHoppers
import net.shadowfacts.extrahoppers.block.base.BlockHopperBase import net.shadowfacts.extrahoppers.block.base.BlockHopperBase
import net.shadowfacts.extrahoppers.gui.GUIHandler import net.shadowfacts.extrahoppers.gui.GUIHandler
@ -16,7 +15,7 @@ import net.shadowfacts.extrahoppers.gui.GUIHandler
/** /**
* @author shadowfacts * @author shadowfacts
*/ */
class BlockWoodenHopper: BlockHopperBase<TileEntityWoodenHopper>("wooden_hopper", Material.WOOD) { class BlockWoodenHopper(inverted: Boolean): BlockHopperBase<TileEntityWoodenHopper>(inverted, "wooden_hopper", Material.WOOD) {
init { init {
setHardness(1.5f) setHardness(1.5f)
@ -29,10 +28,6 @@ class BlockWoodenHopper: BlockHopperBase<TileEntityWoodenHopper>("wooden_hopper"
return true return true
} }
override fun registerTileEntity() {
GameRegistry.registerTileEntity(TileEntityWoodenHopper::class.java, registryName.toString())
}
override fun createTileEntity(world: World, state: IBlockState): TileEntityWoodenHopper { override fun createTileEntity(world: World, state: IBlockState): TileEntityWoodenHopper {
return TileEntityWoodenHopper() return TileEntityWoodenHopper()
} }

View File

@ -20,12 +20,12 @@ class ContainerWoodenHopper(hopper: TileEntityWoodenHopper, playerInv: Inventory
for (l in 0..2) { for (l in 0..2) {
for (k in 0..8) { for (k in 0..8) {
this.addSlotToContainer(Slot(playerInv, k + l * 9 + 9, 8 + k * 18, l * 18 + 52)) addSlotToContainer(Slot(playerInv, k + l * 9 + 9, 8 + k * 18, l * 18 + 52))
} }
} }
for (i1 in 0..8) { for (i1 in 0..8) {
this.addSlotToContainer(Slot(playerInv, i1, 8 + i1 * 18, 110)) addSlotToContainer(Slot(playerInv, i1, 8 + i1 * 18, 110))
} }
} }

View File

@ -1,16 +1,11 @@
package net.shadowfacts.extrahoppers.block.wooden package net.shadowfacts.extrahoppers.block.wooden
import net.minecraft.client.gui.inventory.GuiContainer
import net.minecraft.inventory.Container import net.minecraft.inventory.Container
import net.minecraft.util.ResourceLocation import net.minecraft.util.ResourceLocation
import net.shadowfacts.extrahoppers.MOD_ID import net.shadowfacts.extrahoppers.MOD_ID
import net.shadowfacts.shadowmc.ui.dsl.*
import net.shadowfacts.shadowmc.ui.element.button.UIImage import net.shadowfacts.shadowmc.ui.element.button.UIImage
import net.shadowfacts.shadowmc.ui.element.view.UIFixedView import net.shadowfacts.shadowmc.ui.element.view.UIFixedView
import net.shadowfacts.shadowmc.ui.mcwrapper.UIContainerWrapper import net.shadowfacts.shadowmc.ui.mcwrapper.UIContainerWrapper
import net.shadowfacts.shadowmc.ui.style.UIAttribute
import net.shadowfacts.shadowmc.ui.style.UIHorizontalLayoutMode
import net.shadowfacts.shadowmc.ui.style.UIVerticalLayoutMode
/** /**
* @author shadowfacts * @author shadowfacts
@ -20,33 +15,13 @@ class GUIWoodenHopper(container: Container): UIContainerWrapper(container) {
private val BG = ResourceLocation(MOD_ID, "textures/gui/wooden_hopper.png") private val BG = ResourceLocation(MOD_ID, "textures/gui/wooden_hopper.png")
init { init {
val fixed = UIFixedView(176, 133, "root") add(UIFixedView(176, 133, "root").apply {
val bg = UIImage(BG, 176, 133, "bg") add(UIImage(BG, 176, 133, "bg"))
fixed.add(bg) })
add(fixed)
layout() layout()
xSize = 176 xSize = 176
ySize = 133 ySize = 133
} }
// private fun container(): GuiContainer
// fun create(container: Container): GuiContainer {
// return container(container) {
// fixed {
// id = "root"
// width = 176
// height = 133
//
// image {
// id = "bg"
// width = 176
// height = 133
// texture = BG
// }
// }
// }
// }
} }

View File

@ -25,7 +25,7 @@ class TileEntityWoodenHopper: TileEntityHopperBase(), ITickable {
val inventory = ItemStackHandler(1) val inventory = ItemStackHandler(1)
var cooldown: Int = COOLDOWN var cooldown = COOLDOWN
override fun update() { override fun update() {
if (!world.isRemote) { if (!world.isRemote) {
@ -57,7 +57,6 @@ class TileEntityWoodenHopper: TileEntityHopperBase(), ITickable {
return true return true
} }
} }
return true
} else if (tile is IInventory) { } else if (tile is IInventory) {
for (i in 0.until(tile.sizeInventory)) { for (i in 0.until(tile.sizeInventory)) {
val remainder = tile.insert(inventory.extractItem(0, 1, true), i) val remainder = tile.insert(inventory.extractItem(0, 1, true), i)
@ -66,7 +65,6 @@ class TileEntityWoodenHopper: TileEntityHopperBase(), ITickable {
return true return true
} }
} }
return true
} else if (tile != null && tile.hasCapability(ITEM_HANDLER_CAPABILITY, facing.opposite)) { } else if (tile != null && tile.hasCapability(ITEM_HANDLER_CAPABILITY, facing.opposite)) {
val handler = tile.getCapability(ITEM_HANDLER_CAPABILITY, facing.opposite)!! val handler = tile.getCapability(ITEM_HANDLER_CAPABILITY, facing.opposite)!!
for (i in 0.until(handler.slots)) { for (i in 0.until(handler.slots)) {
@ -82,7 +80,8 @@ class TileEntityWoodenHopper: TileEntityHopperBase(), ITickable {
} }
private fun pull(): Boolean { private fun pull(): Boolean {
val items = world.getEntitiesWithinAABB(EntityItem::class.java, AxisAlignedBB(pos.x.toDouble(), pos.y + 0.5, pos.z.toDouble(), pos.x + 1.0, pos.y + 1.5, pos.z + 1.0)) val yOffset = if (inverted) -1 else 0
val items = world.getEntitiesWithinAABB(EntityItem::class.java, AxisAlignedBB(pos.x.toDouble(), pos.y + 0.5 + yOffset, pos.z.toDouble(), pos.x + 1.0, pos.y + 1.5 + yOffset, pos.z + 1.0))
for (item in items) { for (item in items) {
val result = inventory.insertItem(0, item.entityItem, true) val result = inventory.insertItem(0, item.entityItem, true)
if (result.count != item.entityItem.count) { if (result.count != item.entityItem.count) {
@ -96,10 +95,11 @@ class TileEntityWoodenHopper: TileEntityHopperBase(), ITickable {
} }
} }
val tile = world.getTileEntity(pos.up()) val tile = world.getTileEntity(if (inverted) pos.down() else pos.up())
val side = if (inverted) EnumFacing.UP else EnumFacing.DOWN
if (tile is ISidedInventory) { if (tile is ISidedInventory) {
val slots = tile.getSlotsForFace(EnumFacing.DOWN) val slots = tile.getSlotsForFace(side)
for (i in slots) { for (i in slots) {
val current = tile[i] val current = tile[i]
if (!current.isEmpty) { if (!current.isEmpty) {
@ -125,8 +125,8 @@ class TileEntityWoodenHopper: TileEntityHopperBase(), ITickable {
} }
} }
} }
} else if (tile != null && tile.hasCapability(ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) { } else if (tile != null && tile.hasCapability(ITEM_HANDLER_CAPABILITY, side)) {
val handler = tile.getCapability(ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)!! val handler = tile.getCapability(ITEM_HANDLER_CAPABILITY, side)!!
for (i in 0.until(handler.slots)) { for (i in 0.until(handler.slots)) {
val remainder = inventory.insertItem(0, handler.extractItem(i, 1, true), false) val remainder = inventory.insertItem(0, handler.extractItem(i, 1, true), false)
if (remainder.isEmpty) { if (remainder.isEmpty) {
@ -153,14 +153,14 @@ class TileEntityWoodenHopper: TileEntityHopperBase(), ITickable {
override fun hasCapability(capability: Capability<*>, facing: EnumFacing?): Boolean { override fun hasCapability(capability: Capability<*>, facing: EnumFacing?): Boolean {
if (capability == ITEM_HANDLER_CAPABILITY) { if (capability == ITEM_HANDLER_CAPABILITY) {
return facing == EnumFacing.UP || facing == getHopperFacing() return facing == (if (inverted) EnumFacing.DOWN else EnumFacing.UP) || facing == getHopperFacing()
} }
return super.hasCapability(capability, facing) return super.hasCapability(capability, facing)
} }
override fun <T: Any?> getCapability(capability: Capability<T>, facing: EnumFacing?): T? { override fun <T: Any?> getCapability(capability: Capability<T>, facing: EnumFacing?): T? {
if (capability == ITEM_HANDLER_CAPABILITY) { if (capability == ITEM_HANDLER_CAPABILITY) {
if (facing == EnumFacing.UP || facing == getHopperFacing()) { if (facing == (if (inverted) EnumFacing.DOWN else EnumFacing.UP) || facing == getHopperFacing()) {
return inventory as T return inventory as T
} }
} }

View File

@ -9,7 +9,6 @@ import net.minecraft.util.EnumFacing
import net.minecraft.util.EnumHand import net.minecraft.util.EnumHand
import net.minecraft.util.math.BlockPos import net.minecraft.util.math.BlockPos
import net.minecraft.world.World import net.minecraft.world.World
import net.minecraftforge.fml.common.registry.GameRegistry
import net.shadowfacts.extrahoppers.ExtraHoppers import net.shadowfacts.extrahoppers.ExtraHoppers
import net.shadowfacts.extrahoppers.block.fluid.BlockFluidHopper import net.shadowfacts.extrahoppers.block.fluid.BlockFluidHopper
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
@ -18,7 +17,7 @@ import net.shadowfacts.extrahoppers.gui.GUIHandler
/** /**
* @author shadowfacts * @author shadowfacts
*/ */
class BlockWoodenFluidHopper: BlockFluidHopper(name = "wooden_fluid_hopper", material = Material.WOOD) { class BlockWoodenFluidHopper(inverted: Boolean): BlockFluidHopper(inverted, name = "wooden_fluid_hopper", material = Material.WOOD) {
init { init {
setHardness(1.5f) setHardness(1.5f)
@ -36,10 +35,6 @@ class BlockWoodenFluidHopper: BlockFluidHopper(name = "wooden_fluid_hopper", mat
} }
} }
override fun registerTileEntity() {
GameRegistry.registerTileEntity(TileEntityWoodenFluidHopper::class.java, registryName.toString())
}
override fun addInformation(stack: ItemStack, player: EntityPlayer, tooltip: MutableList<String>, advanced: Boolean) { override fun addInformation(stack: ItemStack, player: EntityPlayer, tooltip: MutableList<String>, advanced: Boolean) {
} }

View File

@ -7,7 +7,7 @@ import net.shadowfacts.extrahoppers.MOD_ID
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
import net.shadowfacts.extrahoppers.gui.GUIHandler import net.shadowfacts.extrahoppers.gui.GUIHandler
import net.shadowfacts.extrahoppers.gui.element.UIFluidIndicator import net.shadowfacts.extrahoppers.gui.element.UIFluidIndicator
import net.shadowfacts.shadowmc.ui.dsl.* import net.shadowfacts.shadowmc.ui.dsl.container
/** /**
* @author shadowfacts * @author shadowfacts

View File

@ -3,7 +3,6 @@ package net.shadowfacts.extrahoppers.gui
import net.minecraft.client.Minecraft import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiScreen import net.minecraft.client.gui.GuiScreen
import net.minecraftforge.fml.client.IModGuiFactory import net.minecraftforge.fml.client.IModGuiFactory
import net.shadowfacts.extrahoppers.gui.EHConfigGUI
/** /**
* @author shadowfacts * @author shadowfacts

View File

@ -5,8 +5,11 @@ import net.minecraft.inventory.Container
import net.minecraft.util.math.BlockPos import net.minecraft.util.math.BlockPos
import net.minecraft.world.World import net.minecraft.world.World
import net.minecraftforge.fml.common.network.IGuiHandler import net.minecraftforge.fml.common.network.IGuiHandler
import net.shadowfacts.extrahoppers.block.base.ContainerInvertedHopper
import net.shadowfacts.extrahoppers.block.fluid.GUIFluidHopper import net.shadowfacts.extrahoppers.block.fluid.GUIFluidHopper
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
import net.shadowfacts.extrahoppers.block.inverted.GUIInvertedHopper
import net.shadowfacts.extrahoppers.block.inverted.TileEntityInvertedHopper
import net.shadowfacts.extrahoppers.block.wooden.ContainerWoodenHopper import net.shadowfacts.extrahoppers.block.wooden.ContainerWoodenHopper
import net.shadowfacts.extrahoppers.block.wooden.GUIWoodenHopper import net.shadowfacts.extrahoppers.block.wooden.GUIWoodenHopper
import net.shadowfacts.extrahoppers.block.wooden.TileEntityWoodenHopper import net.shadowfacts.extrahoppers.block.wooden.TileEntityWoodenHopper
@ -18,15 +21,17 @@ import net.shadowfacts.shadowmc.inventory.ContainerPlayerInv
*/ */
object GUIHandler: IGuiHandler { object GUIHandler: IGuiHandler {
val FLUID_HOPPER = 0 val INVERTED_HOPPER = 0
val WOODEN_HOPPER = 1 val FLUID_HOPPER = 1
val WOODEN_FLUID_HOPPER = 2 val WOODEN_HOPPER = 2
val WOODEN_FLUID_HOPPER = 3
var woodenFluidHopperOpen = false var woodenFluidHopperOpen = false
override fun getClientGuiElement(ID: Int, player: EntityPlayer, world: World, x: Int, y: Int, z: Int): Any? { override fun getClientGuiElement(ID: Int, player: EntityPlayer, world: World, x: Int, y: Int, z: Int): Any? {
val pos = BlockPos(x, y, z) val pos = BlockPos(x, y, z)
return when (ID) { return when (ID) {
INVERTED_HOPPER -> GUIInvertedHopper(getServerGuiElement(ID, player, world, x, y, z)!!)
FLUID_HOPPER -> GUIFluidHopper.create(world.getTileEntity(pos) as TileEntityFluidHopper, getServerGuiElement(ID, player, world, x, y, z)!!) FLUID_HOPPER -> GUIFluidHopper.create(world.getTileEntity(pos) as TileEntityFluidHopper, getServerGuiElement(ID, player, world, x, y, z)!!)
WOODEN_HOPPER -> GUIWoodenHopper(getServerGuiElement(ID, player, world, x, y, z)!!) WOODEN_HOPPER -> GUIWoodenHopper(getServerGuiElement(ID, player, world, x, y, z)!!)
WOODEN_FLUID_HOPPER -> GUIWoodenFluidHopper.create(world.getTileEntity(pos) as TileEntityFluidHopper, getServerGuiElement(ID, player, world, x, y, z)!!) WOODEN_FLUID_HOPPER -> GUIWoodenFluidHopper.create(world.getTileEntity(pos) as TileEntityFluidHopper, getServerGuiElement(ID, player, world, x, y, z)!!)
@ -37,6 +42,7 @@ object GUIHandler: IGuiHandler {
override fun getServerGuiElement(ID: Int, player: EntityPlayer, world: World, x: Int, y: Int, z: Int): Container? { override fun getServerGuiElement(ID: Int, player: EntityPlayer, world: World, x: Int, y: Int, z: Int): Container? {
val pos = BlockPos(x, y, z) val pos = BlockPos(x, y, z)
return when (ID) { return when (ID) {
INVERTED_HOPPER -> ContainerInvertedHopper(world.getTileEntity(pos) as TileEntityInvertedHopper, player.inventory, pos)
FLUID_HOPPER, WOODEN_FLUID_HOPPER -> ContainerPlayerInv(pos, player.inventory) FLUID_HOPPER, WOODEN_FLUID_HOPPER -> ContainerPlayerInv(pos, player.inventory)
WOODEN_HOPPER -> ContainerWoodenHopper(world.getTileEntity(pos) as TileEntityWoodenHopper, player.inventory, pos) WOODEN_HOPPER -> ContainerWoodenHopper(world.getTileEntity(pos) as TileEntityWoodenHopper, player.inventory, pos)
else -> null else -> null

View File

@ -6,6 +6,9 @@
"transform": "forge:default-block" "transform": "forge:default-block"
}, },
"facing": { "facing": {
"up": {
"model": "hopper_down"
},
"down": { "down": {
"model": "hopper_down" "model": "hopper_down"
}, },

View File

@ -0,0 +1,32 @@
{
"forge_marker": 1,
"variants": {
"inventory": {
"model": "extrahoppers:hopper_up",
"transform": "forge:default-block"
},
"facing": {
"up": {
"model": "extrahoppers:hopper_up"
},
"down": {
"model": "extrahoppers:hopper_up"
},
"north": {
"model": "extrahoppers:inverted_hopper_side"
},
"south": {
"model": "extrahoppers:inverted_hopper_side",
"y": 180
},
"west": {
"model": "extrahoppers:inverted_hopper_side",
"y": 270
},
"east": {
"model": "extrahoppers:inverted_hopper_side",
"y": 90
}
}
}
}

View File

@ -0,0 +1,32 @@
{
"forge_marker": 1,
"variants": {
"inventory": {
"model": "extrahoppers:hopper_up",
"transform": "forge:default-block"
},
"facing": {
"up": {
"model": "extrahoppers:hopper_up"
},
"down": {
"model": "extrahoppers:hopper_up"
},
"north": {
"model": "extrahoppers:inverted_hopper_side"
},
"south": {
"model": "extrahoppers:inverted_hopper_side",
"y": 180
},
"west": {
"model": "extrahoppers:inverted_hopper_side",
"y": 270
},
"east": {
"model": "extrahoppers:inverted_hopper_side",
"y": 90
}
}
}
}

View File

@ -0,0 +1,40 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"particle": "blocks/planks_oak",
"top": "blocks/planks_oak",
"side": "blocks/planks_oak",
"inside": "blocks/planks_oak"
}
},
"variants": {
"inventory": {
"model": "extrahoppers:hopper_up",
"transform": "forge:default-block"
},
"facing": {
"up": {
"model": "extrahoppers:hopper_up"
},
"down": {
"model": "extrahoppers:hopper_up"
},
"north": {
"model": "extrahoppers:inverted_hopper_side"
},
"south": {
"model": "extrahoppers:inverted_hopper_side",
"y": 180
},
"west": {
"model": "extrahoppers:inverted_hopper_side",
"y": 270
},
"east": {
"model": "extrahoppers:inverted_hopper_side",
"y": 90
}
}
}
}

View File

@ -0,0 +1,40 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"particle": "blocks/planks_oak",
"top": "blocks/planks_oak",
"side": "blocks/planks_oak",
"inside": "blocks/planks_oak"
}
},
"variants": {
"inventory": {
"model": "extrahoppers:hopper_up",
"transform": "forge:default-block"
},
"facing": {
"up": {
"model": "extrahoppers:hopper_up"
},
"down": {
"model": "extrahoppers:hopper_up"
},
"north": {
"model": "extrahoppers:inverted_hopper_side"
},
"south": {
"model": "extrahoppers:inverted_hopper_side",
"y": 180
},
"west": {
"model": "extrahoppers:inverted_hopper_side",
"y": 270
},
"east": {
"model": "extrahoppers:inverted_hopper_side",
"y": 90
}
}
}
}

View File

@ -14,6 +14,9 @@
"transform": "forge:default-block" "transform": "forge:default-block"
}, },
"facing": { "facing": {
"up": {
"model": "hopper_down"
},
"down": { "down": {
"model": "hopper_down" "model": "hopper_down"
}, },

View File

@ -14,6 +14,9 @@
"transform": "forge:default-block" "transform": "forge:default-block"
}, },
"facing": { "facing": {
"up": {
"model": "hopper_down"
},
"down": { "down": {
"model": "hopper_down" "model": "hopper_down"
}, },

View File

@ -1,9 +1,15 @@
tile.extrahoppers:inverted_hopper.name=Inverted Hopper
tile.extrahoppers:fluid_hopper.name=Fluid Hopper tile.extrahoppers:fluid_hopper.name=Fluid Hopper
tile.extrahoppers:fluid_hopper.tooltip=Formerly the Funnel tile.extrahoppers:fluid_hopper.tooltip=Formerly the Funnel
tile.extrahoppers:inverted_fluid_hopper.name=Inverted Fluid Hopper
tile.extrahoppers:wooden_hopper.name=Wooden Hopper tile.extrahoppers:wooden_hopper.name=Wooden Hopper
tile.extrahoppers:inverted_wooden_hopper.name=Inverted Wooden Hopper
tile.extrahoppers:wooden_fluid_hopper.name=Wooden Fluid Hopper tile.extrahoppers:wooden_fluid_hopper.name=Wooden Fluid Hopper
tile.extrahoppers:inverted_wooden_fluid_hopper.name=Inverted Wooden Fluid Hopper
extrahoppers.wooden_fluid_hopper.temperature=Temperature: %s%dK extrahoppers.wooden_fluid_hopper.temperature=Temperature: %s%dK
extrahoppers.config.gui.title=Extra Hoppers Config extrahoppers.config.gui.title=Extra Hoppers Config
extrahoppers.config.gui.category.general=General extrahoppers.config.gui.category.fluidhopper=Fluid Hopper
itemGroup.extrahoppers=Extra Hoppers

View File

@ -0,0 +1,88 @@
{
"ambientocclusion": false,
"textures": {
"particle": "blocks/hopper_outside",
"top": "blocks/hopper_top",
"side": "blocks/hopper_outside",
"inside": "blocks/hopper_inside"
},
"elements": [
{ "from": [ 0, 5, 0 ],
"to": [ 16, 6, 16 ],
"faces": {
"down": { "texture": "#inside" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 0, 0, 0 ],
"to": [ 2, 5, 16 ],
"faces": {
"down": { "texture": "#top" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 14, 0, 0 ],
"to": [ 16, 5, 16 ],
"faces": {
"down": { "texture": "#top" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 2, 0, 0 ],
"to": [ 14, 5, 2 ],
"faces": {
"down": { "texture": "#top" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 2, 0, 14 ],
"to": [ 14, 5, 16 ],
"faces": {
"down": { "texture": "#top" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 4, 6, 4 ],
"to": [ 12, 12, 12 ],
"faces": {
"down": { "texture": "#side" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 6, 12, 6 ],
"to": [ 10, 16, 10 ],
"faces": {
"down": { "texture": "#side" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
}
]
}

View File

@ -0,0 +1,88 @@
{
"ambientocclusion": false,
"textures": {
"particle": "blocks/hopper_outside",
"top": "blocks/hopper_top",
"side": "blocks/hopper_outside",
"inside": "blocks/hopper_inside"
},
"elements": [
{ "from": [ 0, 5, 0 ],
"to": [ 16, 6, 16 ],
"faces": {
"down": { "texture": "#inside" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 0, 0, 0 ],
"to": [ 2, 5, 16 ],
"faces": {
"down": { "texture": "#top" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 14, 0, 0 ],
"to": [ 16, 5, 16 ],
"faces": {
"down": { "texture": "#top" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 2, 0, 0 ],
"to": [ 14, 5, 2 ],
"faces": {
"down": { "texture": "#top" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 2, 0, 14 ],
"to": [ 14, 5, 16 ],
"faces": {
"down": { "texture": "#top" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 4, 6, 4 ],
"to": [ 12, 12, 12 ],
"faces": {
"down": { "texture": "#side" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
},
{ "from": [ 6, 8, 0 ],
"to": [ 10, 12, 4 ],
"faces": {
"down": { "texture": "#side" },
"up": { "texture": "#side" },
"north": { "texture": "#side" },
"south": { "texture": "#side" },
"west": { "texture": "#side" },
"east": { "texture": "#side" }
}
}
]
}