parent
2bdd96a4e5
commit
c6a646d2a6
|
@ -17,9 +17,11 @@ object EHConfig {
|
||||||
// Fluid Hopper
|
// Fluid Hopper
|
||||||
var fhSize: Int by ConfigInt("fluidHopper", "size", 1000, 1000, 64000, "The size (in millibuckets) of the Fluid Hopper")
|
var fhSize: Int by ConfigInt("fluidHopper", "size", 1000, 1000, 64000, "The size (in millibuckets) of the Fluid Hopper")
|
||||||
|
|
||||||
var fhPickupWorldFluids: Boolean by ConfigBool("fluidHopper", "fhPickupWorldFluids", true, "If the Fluid Hopper should pickup fluids placed in the world directly above it.")
|
var fhPickupWorldFluids: Boolean by ConfigBool("fluidHopper", "pickupWorldFluids", true, "If the Fluid Hopper should pickup fluids placed in the world directly above it.")
|
||||||
|
|
||||||
var fhPlaceFluidsInWorld: Boolean by ConfigBool("fluidHopper", "fhPlaceFluidsInWorld", true, "If the Fluid Hopper should place fluids in the world directly in front of it.")
|
var fhPlaceFluidsInWorld: Boolean by ConfigBool("fluidHopper", "placeFluidsInWorld", true, "If the Fluid Hopper should place fluids in the world directly in front of it.")
|
||||||
|
|
||||||
|
var wfhMaxTemperature: Int by ConfigInt("woodenFluidHopper", "maxTemperature", 400, 0, Integer.MAX_VALUE, "The maximum temperature (in Kelvin) of the fluid that can be help by the Wooden Fluid Hopper.")
|
||||||
|
|
||||||
fun init(configDir: File) {
|
fun init(configDir: File) {
|
||||||
config = Configuration(File(configDir, "shadowfacts/ExtraHoppers.cfg"))
|
config = Configuration(File(configDir, "shadowfacts/ExtraHoppers.cfg"))
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.shadowfacts.extrahoppers
|
package net.shadowfacts.extrahoppers
|
||||||
|
|
||||||
import net.minecraft.item.Item
|
import net.minecraft.item.Item
|
||||||
|
import net.minecraftforge.common.MinecraftForge
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry
|
import net.minecraftforge.fml.client.registry.ClientRegistry
|
||||||
import net.minecraftforge.fml.common.Mod
|
import net.minecraftforge.fml.common.Mod
|
||||||
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent
|
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent
|
||||||
|
@ -12,6 +13,8 @@ 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.TileEntityFluidHopper
|
||||||
import net.shadowfacts.extrahoppers.block.fluid.TESRFluidHopper
|
import net.shadowfacts.extrahoppers.block.fluid.TESRFluidHopper
|
||||||
|
import net.shadowfacts.extrahoppers.block.wooden_fluid.TileEntityWoodenFluidHopper
|
||||||
|
import net.shadowfacts.extrahoppers.event.ClientEventHandler
|
||||||
import net.shadowfacts.extrahoppers.gui.GUIHandler
|
import net.shadowfacts.extrahoppers.gui.GUIHandler
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +42,9 @@ object ExtraHoppers {
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
fun preInitClient(event: FMLPreInitializationEvent) {
|
fun preInitClient(event: FMLPreInitializationEvent) {
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFluidHopper::class.java, TESRFluidHopper)
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFluidHopper::class.java, TESRFluidHopper)
|
||||||
|
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWoodenFluidHopper::class.java, TESRFluidHopper)
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.register(ClientEventHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.shadowfacts.extrahoppers.block
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
import net.shadowfacts.extrahoppers.block.fluid.BlockFluidHopper
|
import net.shadowfacts.extrahoppers.block.fluid.BlockFluidHopper
|
||||||
import net.shadowfacts.extrahoppers.block.wooden.BlockWoodenHopper
|
import net.shadowfacts.extrahoppers.block.wooden.BlockWoodenHopper
|
||||||
|
import net.shadowfacts.extrahoppers.block.wooden_fluid.BlockWoodenFluidHopper
|
||||||
import net.shadowfacts.shadowmc.block.ModBlocks
|
import net.shadowfacts.shadowmc.block.ModBlocks
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,10 +13,12 @@ object ModBlocks: ModBlocks() {
|
||||||
|
|
||||||
val fluidHopper = BlockFluidHopper()
|
val fluidHopper = BlockFluidHopper()
|
||||||
val woodenHopper = BlockWoodenHopper()
|
val woodenHopper = BlockWoodenHopper()
|
||||||
|
val woodenFluidHopper = BlockWoodenFluidHopper()
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
register(fluidHopper)
|
register(fluidHopper)
|
||||||
register(woodenHopper)
|
register(woodenHopper)
|
||||||
|
register(woodenFluidHopper)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun <T: Block> register(block: T): T {
|
override fun <T: Block> register(block: T): T {
|
||||||
|
|
|
@ -11,7 +11,7 @@ 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.fluids.FluidUtil
|
import net.minecraftforge.fluids.FluidUtil
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler
|
import net.minecraftforge.fluids.capability.CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry
|
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
|
||||||
|
@ -20,7 +20,7 @@ import net.shadowfacts.extrahoppers.gui.GUIHandler
|
||||||
/**
|
/**
|
||||||
* @author shadowfacts
|
* @author shadowfacts
|
||||||
*/
|
*/
|
||||||
class BlockFluidHopper: BlockHopperBase<TileEntityFluidHopper>("fluid_hopper", material = Material.IRON) {
|
open class BlockFluidHopper(name: String = "fluid_hopper", material: Material = Material.IRON): BlockHopperBase<TileEntityFluidHopper>(name, material = material) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setHardness(3.5f)
|
setHardness(3.5f)
|
||||||
|
@ -34,15 +34,14 @@ class BlockFluidHopper: BlockHopperBase<TileEntityFluidHopper>("fluid_hopper", m
|
||||||
} else {
|
} else {
|
||||||
val te = getTileEntity(world, pos)
|
val te = getTileEntity(world, pos)
|
||||||
val stack = player.getHeldItem(hand)
|
val stack = player.getHeldItem(hand)
|
||||||
val result = FluidUtil.interactWithFluidHandler(stack, te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.NORTH), player)
|
val result = FluidUtil.interactWithFluidHandler(stack, te.getCapability(FLUID_HANDLER_CAPABILITY, EnumFacing.NORTH), player)
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
player.setHeldItem(hand, result.getResult())
|
player.setHeldItem(hand, result.getResult())
|
||||||
te.save()
|
te.save()
|
||||||
|
}
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
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("$unlocalizedName.tooltip"))
|
||||||
|
|
|
@ -4,7 +4,11 @@ import net.minecraft.block.BlockLiquid
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
import net.minecraft.util.ITickable
|
import net.minecraft.util.ITickable
|
||||||
|
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.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.fluids.capability.IFluidHandler
|
||||||
import net.minecraftforge.fml.common.network.NetworkRegistry
|
import net.minecraftforge.fml.common.network.NetworkRegistry
|
||||||
|
@ -13,24 +17,26 @@ import net.shadowfacts.extrahoppers.EHConfig
|
||||||
import net.shadowfacts.extrahoppers.block.base.TileEntityHopperBase
|
import net.shadowfacts.extrahoppers.block.base.TileEntityHopperBase
|
||||||
import net.shadowfacts.shadowmc.ShadowMC
|
import net.shadowfacts.shadowmc.ShadowMC
|
||||||
import net.shadowfacts.shadowmc.capability.CapHolder
|
import net.shadowfacts.shadowmc.capability.CapHolder
|
||||||
import net.shadowfacts.shadowmc.fluid.FluidTank
|
|
||||||
import net.shadowfacts.shadowmc.nbt.AutoSerializeNBT
|
|
||||||
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
|
||||||
*/
|
*/
|
||||||
class TileEntityFluidHopper: TileEntityHopperBase(), ITickable {
|
open class TileEntityFluidHopper: TileEntityHopperBase(), ITickable {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val HANDLER_COOLDOWN = 8
|
val HANDLER_COOLDOWN = 8
|
||||||
val WORLD_COOLDOWN = 40
|
val WORLD_COOLDOWN = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
@AutoSerializeNBT
|
internal var tank = object: FluidTank(EHConfig.fhSize) {
|
||||||
@CapHolder(capabilities = arrayOf(IFluidHandler::class))
|
override fun canFillFluidType(fluid: FluidStack): Boolean {
|
||||||
internal var tank = FluidTank(EHConfig.fhSize)
|
return fluidValiator(fluid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected open val fluidValiator: (FluidStack) -> Boolean = { true }
|
||||||
|
|
||||||
private var handlerCooldown: Int = HANDLER_COOLDOWN
|
private var handlerCooldown: Int = HANDLER_COOLDOWN
|
||||||
private var worldCooldown: Int = WORLD_COOLDOWN
|
private var worldCooldown: Int = WORLD_COOLDOWN
|
||||||
|
@ -112,7 +118,7 @@ class TileEntityFluidHopper: TileEntityHopperBase(), ITickable {
|
||||||
if (EHConfig.fhPickupWorldFluids && tank.fluidAmount <= tank.capacity - BUCKET_VOLUME) {
|
if (EHConfig.fhPickupWorldFluids && tank.fluidAmount <= tank.capacity - BUCKET_VOLUME) {
|
||||||
if (FluidUtils.isFluidBlock(world, pos.up())) {
|
if (FluidUtils.isFluidBlock(world, pos.up())) {
|
||||||
val toDrain = FluidUtils.drainFluidBlock(world, pos.up(), false)!!
|
val toDrain = FluidUtils.drainFluidBlock(world, pos.up(), false)!!
|
||||||
if (toDrain.amount <= tank.capacity - tank.fluidAmount) {
|
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, pos.up(), true), true)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -153,4 +159,14 @@ class TileEntityFluidHopper: TileEntityHopperBase(), ITickable {
|
||||||
super.readFromNBT(tag)
|
super.readFromNBT(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun hasCapability(capability: Capability<*>, facing: EnumFacing?): Boolean {
|
||||||
|
if (capability == FLUID_HANDLER_CAPABILITY) return true
|
||||||
|
else return super.hasCapability(capability, facing)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun <T: Any?> getCapability(capability: Capability<T>, facing: EnumFacing?): T? {
|
||||||
|
if (capability == FLUID_HANDLER_CAPABILITY) return tank as T
|
||||||
|
else return super.getCapability(capability, facing)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package net.shadowfacts.extrahoppers.block.wooden_fluid
|
||||||
|
|
||||||
|
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.item.ItemStack
|
||||||
|
import net.minecraft.util.EnumFacing
|
||||||
|
import net.minecraft.util.EnumHand
|
||||||
|
import net.minecraft.util.math.BlockPos
|
||||||
|
import net.minecraft.world.World
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry
|
||||||
|
import net.shadowfacts.extrahoppers.ExtraHoppers
|
||||||
|
import net.shadowfacts.extrahoppers.block.fluid.BlockFluidHopper
|
||||||
|
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
|
||||||
|
import net.shadowfacts.extrahoppers.gui.GUIHandler
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author shadowfacts
|
||||||
|
*/
|
||||||
|
class BlockWoodenFluidHopper: BlockFluidHopper(name = "wooden_fluid_hopper", material = Material.WOOD) {
|
||||||
|
|
||||||
|
init {
|
||||||
|
setHardness(1.5f)
|
||||||
|
setResistance(4f)
|
||||||
|
soundType = SoundType.WOOD
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBlockActivated(world: World, pos: BlockPos, state: IBlockState, player: EntityPlayer, hand: EnumHand, side: EnumFacing, hitX: Float, hitY: Float, hitZ: Float): Boolean {
|
||||||
|
if (player.isSneaking) {
|
||||||
|
GUIHandler.woodenFluidHopperOpen = true
|
||||||
|
player.openGui(ExtraHoppers, GUIHandler.WOODEN_FLUID_HOPPER, world, pos.x, pos.y, pos.z)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return super.onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun registerTileEntity() {
|
||||||
|
GameRegistry.registerTileEntity(TileEntityWoodenFluidHopper::class.java, registryName.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun addInformation(stack: ItemStack, player: EntityPlayer, tooltip: MutableList<String>, advanced: Boolean) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createTileEntity(world: World, state: IBlockState): TileEntityFluidHopper {
|
||||||
|
return TileEntityWoodenFluidHopper()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package net.shadowfacts.extrahoppers.block.wooden_fluid
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer
|
||||||
|
import net.minecraft.inventory.Container
|
||||||
|
import net.minecraft.util.ResourceLocation
|
||||||
|
import net.shadowfacts.extrahoppers.MOD_ID
|
||||||
|
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
|
||||||
|
import net.shadowfacts.extrahoppers.gui.GUIHandler
|
||||||
|
import net.shadowfacts.extrahoppers.gui.element.UIFluidIndicator
|
||||||
|
import net.shadowfacts.shadowmc.ui.dsl.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author shadowfacts
|
||||||
|
*/
|
||||||
|
object GUIWoodenFluidHopper {
|
||||||
|
|
||||||
|
private val BG = ResourceLocation("shadowmc", "textures/gui/blank.png")
|
||||||
|
|
||||||
|
fun create(hopper: TileEntityFluidHopper, container: Container): GuiContainer {
|
||||||
|
return container(container) {
|
||||||
|
fixed {
|
||||||
|
id = "root"
|
||||||
|
width = 176
|
||||||
|
height = 166
|
||||||
|
|
||||||
|
image {
|
||||||
|
id = "bg"
|
||||||
|
width = 176
|
||||||
|
height = 166
|
||||||
|
texture = BG
|
||||||
|
}
|
||||||
|
|
||||||
|
fixed {
|
||||||
|
id = "top"
|
||||||
|
width = 176
|
||||||
|
height = 166 / 2
|
||||||
|
|
||||||
|
add(UIFluidIndicator(hopper.tank, "fluidIndicator"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
style("$MOD_ID:fluid_hopper")
|
||||||
|
updateHandler {
|
||||||
|
GUIHandler.woodenFluidHopperOpen = true
|
||||||
|
}
|
||||||
|
closeHandler {
|
||||||
|
GUIHandler.woodenFluidHopperOpen = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package net.shadowfacts.extrahoppers.block.wooden_fluid
|
||||||
|
|
||||||
|
import net.minecraftforge.fluids.FluidStack
|
||||||
|
import net.shadowfacts.extrahoppers.EHConfig
|
||||||
|
import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author shadowfacts
|
||||||
|
*/
|
||||||
|
class TileEntityWoodenFluidHopper: TileEntityFluidHopper() {
|
||||||
|
|
||||||
|
override val fluidValiator: (FluidStack) -> Boolean = { it.fluid.temperature <= EHConfig.wfhMaxTemperature }
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package net.shadowfacts.extrahoppers.event
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.I18n
|
||||||
|
import net.minecraft.util.text.TextFormatting
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent
|
||||||
|
import net.minecraftforge.fluids.capability.CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||||
|
import net.shadowfacts.extrahoppers.EHConfig
|
||||||
|
import net.shadowfacts.extrahoppers.gui.GUIHandler
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author shadowfacts
|
||||||
|
*/
|
||||||
|
object ClientEventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
fun itemTooltip(event: ItemTooltipEvent) {
|
||||||
|
if (GUIHandler.woodenFluidHopperOpen) {
|
||||||
|
val stack = event.itemStack
|
||||||
|
if (stack.hasCapability(FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
||||||
|
val handler = stack.getCapability(FLUID_HANDLER_ITEM_CAPABILITY, null)!!
|
||||||
|
val props = handler.tankProperties
|
||||||
|
val fluid = props[0].contents
|
||||||
|
if (fluid != null) {
|
||||||
|
val color = if (fluid.fluid.temperature <= EHConfig.wfhMaxTemperature) TextFormatting.GREEN else TextFormatting.RED
|
||||||
|
event.toolTip.add(I18n.format("extrahoppers.wooden_fluid_hopper.temperature", color, fluid.fluid.temperature))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ import net.shadowfacts.extrahoppers.block.fluid.TileEntityFluidHopper
|
||||||
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
|
||||||
|
import net.shadowfacts.extrahoppers.block.wooden_fluid.GUIWoodenFluidHopper
|
||||||
import net.shadowfacts.shadowmc.inventory.ContainerPlayerInv
|
import net.shadowfacts.shadowmc.inventory.ContainerPlayerInv
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,12 +20,16 @@ object GUIHandler: IGuiHandler {
|
||||||
|
|
||||||
val FLUID_HOPPER = 0
|
val FLUID_HOPPER = 0
|
||||||
val WOODEN_HOPPER = 1
|
val WOODEN_HOPPER = 1
|
||||||
|
val WOODEN_FLUID_HOPPER = 2
|
||||||
|
|
||||||
|
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) {
|
||||||
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)!!)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +37,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) {
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"forge_marker": 1,
|
||||||
|
"defaults": {
|
||||||
|
"textures": {
|
||||||
|
"particle": "blocks/planks_oak",
|
||||||
|
"top": "blocks/planks_oak",
|
||||||
|
"side": "blocks/planks_oak",
|
||||||
|
"inside": "blocks/planks_oak"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variants": {
|
||||||
|
"inventory": {
|
||||||
|
"model": "hopper_down",
|
||||||
|
"transform": "forge:default-block"
|
||||||
|
},
|
||||||
|
"facing": {
|
||||||
|
"down": {
|
||||||
|
"model": "hopper_down"
|
||||||
|
},
|
||||||
|
"north": {
|
||||||
|
"model": "hopper_side"
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"model": "hopper_side",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"model": "hopper_side",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"model": "hopper_side",
|
||||||
|
"y": 90
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
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:wooden_hopper.name=Wooden Hopper
|
tile.extrahoppers:wooden_hopper.name=Wooden Hopper
|
||||||
|
tile.extrahoppers:wooden_fluid_hopper.name=Wooden Fluid Hopper
|
||||||
|
|
||||||
|
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.general=General
|
Loading…
Reference in New Issue