mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-28 07:56:01 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -4,35 +4,34 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.*;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
|
||||
public class SmelteryDamageSource extends DamageSource
|
||||
{
|
||||
public SmelteryDamageSource()
|
||||
{
|
||||
public class SmelteryDamageSource extends DamageSource {
|
||||
public SmelteryDamageSource() {
|
||||
super("smeltery");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent func_151519_b (EntityLivingBase par1EntityLiving)
|
||||
{
|
||||
public IChatComponent func_151519_b(EntityLivingBase par1EntityLiving) {
|
||||
String type = "";
|
||||
switch (AbilityHelper.random.nextInt(4))
|
||||
{
|
||||
case 0:
|
||||
type = "one.";
|
||||
break;
|
||||
case 1:
|
||||
type = "two.";
|
||||
break;
|
||||
case 2:
|
||||
type = "three.";
|
||||
break;
|
||||
case 3:
|
||||
type = "four.";
|
||||
break;
|
||||
switch (AbilityHelper.random.nextInt(4)) {
|
||||
case 0:
|
||||
type = "one.";
|
||||
break;
|
||||
case 1:
|
||||
type = "two.";
|
||||
break;
|
||||
case 2:
|
||||
type = "three.";
|
||||
break;
|
||||
case 3:
|
||||
type = "four.";
|
||||
break;
|
||||
}
|
||||
EntityLivingBase entityliving1 = par1EntityLiving.func_94060_bK();
|
||||
String s = "death." + type + this.damageType;
|
||||
String s1 = s + ".player";
|
||||
return entityliving1 != null && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] { par1EntityLiving.func_145748_c_(), entityliving1.func_145748_c_() }) : new ChatComponentTranslation(s, new Object[] { par1EntityLiving.func_145748_c_() });
|
||||
return entityliving1 != null && StatCollector.canTranslate(s1)
|
||||
? new ChatComponentTranslation(
|
||||
s1, new Object[] {par1EntityLiving.func_145748_c_(), entityliving1.func_145748_c_()})
|
||||
: new ChatComponentTranslation(s, new Object[] {par1EntityLiving.func_145748_c_()});
|
||||
}
|
||||
}
|
||||
@@ -21,13 +21,10 @@ import tconstruct.smeltery.gui.*;
|
||||
import tconstruct.smeltery.logic.*;
|
||||
import tconstruct.smeltery.model.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
{
|
||||
public class SmelteryProxyClient extends SmelteryProxyCommon {
|
||||
@Override
|
||||
public void initialize ()
|
||||
{
|
||||
public void initialize() {
|
||||
registerRenderer();
|
||||
registerGuiHandler();
|
||||
registerManualIcons();
|
||||
@@ -35,8 +32,7 @@ public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
void registerRenderer ()
|
||||
{
|
||||
void registerRenderer() {
|
||||
RenderingRegistry.registerBlockHandler(new TankRender());
|
||||
RenderingRegistry.registerBlockHandler(new CastingBlockRender());
|
||||
RenderingRegistry.registerBlockHandler(new DryingRackRender());
|
||||
@@ -47,7 +43,8 @@ public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
|
||||
IItemRenderer tankItemRenderer = new TankItemRenderer();
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(TinkerSmeltery.lavaTank), tankItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(TinkerSmeltery.lavaTankNether), tankItemRenderer);
|
||||
MinecraftForgeClient.registerItemRenderer(
|
||||
Item.getItemFromBlock(TinkerSmeltery.lavaTankNether), tankItemRenderer);
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new SmelteryRender());
|
||||
|
||||
@@ -56,8 +53,7 @@ public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(DryingRackLogic.class, new DryingRackSpecialRender());
|
||||
}
|
||||
|
||||
void registerManualIcons ()
|
||||
{
|
||||
void registerManualIcons() {
|
||||
MantleClientRegistry.registerManualIcon("smelterybook", new ItemStack(TinkerTools.manualBook, 1, 2));
|
||||
MantleClientRegistry.registerManualIcon("smeltery", new ItemStack(TinkerSmeltery.smeltery));
|
||||
MantleClientRegistry.registerManualIcon("blankcast", new ItemStack(TinkerTools.blankPattern, 1, 1));
|
||||
@@ -79,8 +75,7 @@ public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
MProxyClient.registerManualPage("blockcast", BlockCastPage.class);
|
||||
}
|
||||
|
||||
void registerManualRecipes ()
|
||||
{
|
||||
void registerManualRecipes() {
|
||||
ItemStack sand = new ItemStack(Blocks.sand, 1, 0);
|
||||
ItemStack gravel = new ItemStack(Blocks.gravel, 1, 0);
|
||||
ItemStack clay = new ItemStack(Items.clay_ball, 1, 0);
|
||||
@@ -93,34 +88,147 @@ public class SmelteryProxyClient extends SmelteryProxyCommon
|
||||
|
||||
MantleClientRegistry.registerManualSmallRecipe("grout", grout, sand, gravel, null, clay);
|
||||
MantleClientRegistry.registerManualFurnaceRecipe("searedbrick", searedbrick, grout);
|
||||
MantleClientRegistry.registerManualSmallRecipe("searedbricks", new ItemStack(TinkerSmeltery.smeltery, 1, 2), searedbrick, searedbrick, searedbrick, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe("smelterycontroller", new ItemStack(TinkerSmeltery.smeltery, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, null, searedbrick, searedbrick, searedbrick, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe("dryingrack", new ItemStack(TinkerArmor.dryingRack, 1, 0), null, null, null, plankSlab, plankSlab, plankSlab, null, null, null);
|
||||
MantleClientRegistry.registerManualSmallRecipe(
|
||||
"searedbricks",
|
||||
new ItemStack(TinkerSmeltery.smeltery, 1, 2),
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"smelterycontroller",
|
||||
new ItemStack(TinkerSmeltery.smeltery, 1, 0),
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"dryingrack",
|
||||
new ItemStack(TinkerArmor.dryingRack, 1, 0),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
plankSlab,
|
||||
plankSlab,
|
||||
plankSlab,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
|
||||
MantleClientRegistry.registerManualLargeRecipe("smelterydrain", new ItemStack(TinkerSmeltery.smeltery, 1, 1), searedbrick, null, searedbrick, searedbrick, null, searedbrick, searedbrick, null, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"smelterydrain",
|
||||
new ItemStack(TinkerSmeltery.smeltery, 1, 1),
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick);
|
||||
|
||||
MantleClientRegistry.registerManualLargeRecipe("smelterytank1", new ItemStack(TinkerSmeltery.lavaTank, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, glass, searedbrick, searedbrick, searedbrick, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe("smelterytank2", new ItemStack(TinkerSmeltery.lavaTank, 1, 1), searedbrick, glass, searedbrick, glass, glass, glass, searedbrick, glass, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe("smelterytank3", new ItemStack(TinkerSmeltery.lavaTank, 1, 2), searedbrick, glass, searedbrick, searedbrick, glass, searedbrick, searedbrick, glass, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"smelterytank1",
|
||||
new ItemStack(TinkerSmeltery.lavaTank, 1, 0),
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
glass,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"smelterytank2",
|
||||
new ItemStack(TinkerSmeltery.lavaTank, 1, 1),
|
||||
searedbrick,
|
||||
glass,
|
||||
searedbrick,
|
||||
glass,
|
||||
glass,
|
||||
glass,
|
||||
searedbrick,
|
||||
glass,
|
||||
searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"smelterytank3",
|
||||
new ItemStack(TinkerSmeltery.lavaTank, 1, 2),
|
||||
searedbrick,
|
||||
glass,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
glass,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
glass,
|
||||
searedbrick);
|
||||
|
||||
MantleClientRegistry.registerManualLargeRecipe("smelterytable", new ItemStack(TinkerSmeltery.searedBlock, 1, 0), searedbrick, searedbrick, searedbrick, searedbrick, null, searedbrick, searedbrick, null, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe("smelteryfaucet", new ItemStack(TinkerSmeltery.searedBlock, 1, 1), searedbrick, null, searedbrick, null, searedbrick, null, null, null, null);
|
||||
MantleClientRegistry.registerManualLargeRecipe("castingchannel", new ItemStack(TinkerSmeltery.castingChannel), null, null, null, searedbrick, null, searedbrick, searedbrick, searedbrick, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe("smelterybasin", new ItemStack(TinkerSmeltery.searedBlock, 1, 2), searedbrick, null, searedbrick, searedbrick, null, searedbrick, searedbrick, searedbrick, searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"smelterytable",
|
||||
new ItemStack(TinkerSmeltery.searedBlock, 1, 0),
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"smelteryfaucet",
|
||||
new ItemStack(TinkerSmeltery.searedBlock, 1, 1),
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"castingchannel",
|
||||
new ItemStack(TinkerSmeltery.castingChannel),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick);
|
||||
MantleClientRegistry.registerManualLargeRecipe(
|
||||
"smelterybasin",
|
||||
new ItemStack(TinkerSmeltery.searedBlock, 1, 2),
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
null,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick,
|
||||
searedbrick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerGuiHandler ()
|
||||
{
|
||||
protected void registerGuiHandler() {
|
||||
TProxyCommon.registerClientGuiHandler(smelteryGuiID, this);
|
||||
TProxyCommon.registerServerGuiHandler(smelteryGuiID, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
if (ID == SmelteryProxyCommon.smelteryGuiID)
|
||||
{
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == SmelteryProxyCommon.smelteryGuiID) {
|
||||
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getTileEntity(x, y, z), world, x, y, z);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -7,26 +7,21 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
|
||||
public class SmelteryProxyCommon implements IGuiHandler
|
||||
{
|
||||
public class SmelteryProxyCommon implements IGuiHandler {
|
||||
public static final int smelteryGuiID = 7;
|
||||
|
||||
public void initialize ()
|
||||
{
|
||||
public void initialize() {
|
||||
registerGuiHandler();
|
||||
}
|
||||
|
||||
protected void registerGuiHandler ()
|
||||
{
|
||||
protected void registerGuiHandler() {
|
||||
TProxyCommon.registerServerGuiHandler(smelteryGuiID, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof InventoryLogic)
|
||||
{
|
||||
if (tile != null && tile instanceof InventoryLogic) {
|
||||
return ((InventoryLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
|
||||
}
|
||||
|
||||
@@ -34,10 +29,8 @@ public class SmelteryProxyCommon implements IGuiHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,7 +1,7 @@
|
||||
package tconstruct.smeltery;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.*;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
import mantle.world.WorldHelper;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -9,31 +9,25 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraftforge.event.entity.player.*;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.smeltery.blocks.*;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class TinkerSmelteryEvents
|
||||
{
|
||||
public class TinkerSmelteryEvents {
|
||||
@SubscribeEvent
|
||||
public void onCrafting (ItemCraftedEvent event)
|
||||
{
|
||||
if (!PHConstruct.beginnerBook)
|
||||
{
|
||||
public void onCrafting(ItemCraftedEvent event) {
|
||||
if (!PHConstruct.beginnerBook) {
|
||||
return;
|
||||
}
|
||||
|
||||
Item item = event.crafting.getItem();
|
||||
if (!event.player.worldObj.isRemote)
|
||||
{
|
||||
if (item == Item.getItemFromBlock(TinkerSmeltery.smeltery) || item == Item.getItemFromBlock(TinkerSmeltery.lavaTank))
|
||||
{
|
||||
if (!event.player.worldObj.isRemote) {
|
||||
if (item == Item.getItemFromBlock(TinkerSmeltery.smeltery)
|
||||
|| item == Item.getItemFromBlock(TinkerSmeltery.lavaTank)) {
|
||||
TPlayerStats stats = TPlayerStats.get(event.player);
|
||||
if (!stats.smelteryManual)
|
||||
{
|
||||
if (!stats.smelteryManual) {
|
||||
stats.smelteryManual = true;
|
||||
AbilityHelper.spawnItemAtPlayer(event.player, new ItemStack(TinkerTools.manualBook, 1, 2));
|
||||
}
|
||||
@@ -42,36 +36,26 @@ public class TinkerSmelteryEvents
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void bucketFill (FillBucketEvent evt)
|
||||
{
|
||||
if (evt.current.getItem() == Items.bucket && evt.target.typeOfHit == MovingObjectType.BLOCK)
|
||||
{
|
||||
public void bucketFill(FillBucketEvent evt) {
|
||||
if (evt.current.getItem() == Items.bucket && evt.target.typeOfHit == MovingObjectType.BLOCK) {
|
||||
int hitX = evt.target.blockX;
|
||||
int hitY = evt.target.blockY;
|
||||
int hitZ = evt.target.blockZ;
|
||||
|
||||
if (evt.entityPlayer != null && !evt.entityPlayer.canPlayerEdit(hitX, hitY, hitZ, evt.target.sideHit, evt.current))
|
||||
{
|
||||
if (evt.entityPlayer != null
|
||||
&& !evt.entityPlayer.canPlayerEdit(hitX, hitY, hitZ, evt.target.sideHit, evt.current)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block bID = evt.world.getBlock(hitX, hitY, hitZ);
|
||||
for (int id = 0; id < TinkerSmeltery.fluidBlocks.length; id++)
|
||||
{
|
||||
if (bID == TinkerSmeltery.fluidBlocks[id])
|
||||
{
|
||||
if (evt.entityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
for (int id = 0; id < TinkerSmeltery.fluidBlocks.length; id++) {
|
||||
if (bID == TinkerSmeltery.fluidBlocks[id]) {
|
||||
if (evt.entityPlayer.capabilities.isCreativeMode) {
|
||||
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TinkerSmeltery.fluidBlocks[id] instanceof LiquidMetalFinite)
|
||||
{
|
||||
} else {
|
||||
if (TinkerSmeltery.fluidBlocks[id] instanceof LiquidMetalFinite) {
|
||||
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
WorldHelper.setBlockToAir(evt.world, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,19 +6,15 @@ import net.minecraft.potion.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class BloodBlock extends TConstructFluid
|
||||
{
|
||||
public class BloodBlock extends TConstructFluid {
|
||||
|
||||
public BloodBlock(Fluid fluid, Material material, String texture)
|
||||
{
|
||||
public BloodBlock(Fluid fluid, Material material, String texture) {
|
||||
super(fluid, material, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.field_76434_w.id, 20 * 15, 0));
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 20 * 5, 1));
|
||||
}
|
||||
|
||||
@@ -15,12 +15,9 @@ import tconstruct.smeltery.model.BlockRenderCastingChannel;
|
||||
/**
|
||||
* @author BluSunrize
|
||||
*/
|
||||
public class CastingChannelBlock extends BlockContainer {
|
||||
|
||||
public class CastingChannelBlock extends BlockContainer
|
||||
{
|
||||
|
||||
public CastingChannelBlock()
|
||||
{
|
||||
public CastingChannelBlock() {
|
||||
super(Material.rock);
|
||||
this.setHardness(1F);
|
||||
this.setResistance(10);
|
||||
@@ -29,23 +26,20 @@ public class CastingChannelBlock extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z);
|
||||
|
||||
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerSmeltery.castingChannel))
|
||||
return false;
|
||||
else
|
||||
{
|
||||
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerSmeltery.castingChannel)) return false;
|
||||
else {
|
||||
tile.changeOutputs(player, side, hitX, hitY, hitZ);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z);
|
||||
float minX = 0.3125F;
|
||||
float maxX = 0.6875F;
|
||||
@@ -59,38 +53,31 @@ public class CastingChannelBlock extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return BlockRenderCastingChannel.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon("tinker:searedstone");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World var1, int var2)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new CastingChannelLogic();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,71 +9,62 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.*;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
|
||||
public class GlassBlock extends TConstructBlock
|
||||
{
|
||||
static String blockTextures[] = { "glass_clear", "soulglass", "soulglass_clear" };
|
||||
public class GlassBlock extends TConstructBlock {
|
||||
static String blockTextures[] = {"glass_clear", "soulglass", "soulglass_clear"};
|
||||
|
||||
public GlassBlock()
|
||||
{
|
||||
public GlassBlock() {
|
||||
super(Material.glass, 3f, blockTextures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
Block i1 = par1IBlockAccess.getBlock(par2, par3, par4);
|
||||
return i1 == (Block) this ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness (World world, int x, int y, int z)
|
||||
{
|
||||
public float getBlockHardness(World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return 0.3F;
|
||||
case 1:
|
||||
return 50.0F;
|
||||
case 2:
|
||||
return 50.0F;
|
||||
default:
|
||||
return blockHardness;
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return 0.3F;
|
||||
case 1:
|
||||
return 50.0F;
|
||||
case 2:
|
||||
return 50.0F;
|
||||
default:
|
||||
return blockHardness;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExplosionResistance (Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
|
||||
{
|
||||
public float getExplosionResistance(
|
||||
Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
switch (meta)
|
||||
{
|
||||
case 0:
|
||||
return 1.5F;
|
||||
case 1:
|
||||
return 2000F;
|
||||
case 2:
|
||||
return 2000F;
|
||||
default:
|
||||
return getExplosionResistance(entity);
|
||||
switch (meta) {
|
||||
case 0:
|
||||
return 1.5F;
|
||||
case 1:
|
||||
return 2000F;
|
||||
case 2:
|
||||
return 2000F;
|
||||
default:
|
||||
return getExplosionResistance(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:glass/" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -12,17 +12,14 @@ import tconstruct.util.config.PHConstruct;
|
||||
|
||||
/**
|
||||
* @author fuj1n
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
public class GlassBlockConnectedMeta extends GlassBlockConnected
|
||||
{
|
||||
public class GlassBlockConnectedMeta extends GlassBlockConnected {
|
||||
public String[] textures;
|
||||
public IIcon[][] icons;
|
||||
boolean ignoreMetaForConnectedGlass = PHConstruct.connectedTexturesMode == 2;
|
||||
|
||||
public GlassBlockConnectedMeta(String location, boolean hasAlpha, String... textures)
|
||||
{
|
||||
public GlassBlockConnectedMeta(String location, boolean hasAlpha, String... textures) {
|
||||
super(location, hasAlpha);
|
||||
this.textures = textures;
|
||||
this.icons = new IIcon[textures.length][16];
|
||||
@@ -30,46 +27,38 @@ public class GlassBlockConnectedMeta extends GlassBlockConnected
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
public IIcon getIcon(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
int meta = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
|
||||
if (meta < icons.length)
|
||||
{
|
||||
if (meta < icons.length) {
|
||||
return getConnectedBlockTexture(par1IBlockAccess, par2, par3, par4, par5, icons[meta]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return getConnectedBlockTexture(par1IBlockAccess, par2, par3, par4, par5, icons[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldConnectToBlock (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, Block par5, int par6)
|
||||
{
|
||||
return par5 == this && (par6 == par1IBlockAccess.getBlockMetadata(par2, par3, par4) || ignoreMetaForConnectedGlass);
|
||||
public boolean shouldConnectToBlock(
|
||||
IBlockAccess par1IBlockAccess, int par2, int par3, int par4, Block par5, int par6) {
|
||||
return par5 == this
|
||||
&& (par6 == par1IBlockAccess.getBlockMetadata(par2, par3, par4) || ignoreMetaForConnectedGlass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int par1, int par2)
|
||||
{
|
||||
public IIcon getIcon(int par1, int par2) {
|
||||
return icons[par2][0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < textures.length; i++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int i = 0; i < textures.length; i++) {
|
||||
par3List.add(new ItemStack(b, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
for (int i = 0; i < textures.length; i++)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
for (int i = 0; i < textures.length; i++) {
|
||||
icons[i][0] = par1IconRegister.registerIcon("tinker:glass/" + folder + "/" + textures[i] + "/glass");
|
||||
icons[i][1] = par1IconRegister.registerIcon("tinker:glass/" + folder + "/" + textures[i] + "/glass_1_d");
|
||||
icons[i][2] = par1IconRegister.registerIcon("tinker:glass/" + folder + "/" + textures[i] + "/glass_1_u");
|
||||
@@ -90,15 +79,12 @@ public class GlassBlockConnectedMeta extends GlassBlockConnected
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int par1)
|
||||
{
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceTorchOnTop (World world, int x, int y, int z)
|
||||
{
|
||||
public boolean canPlaceTorchOnTop(World world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,45 +8,55 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
|
||||
public class GlassBlockStained extends TConstructBlock
|
||||
{
|
||||
static String blockTextures[] = { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black" };
|
||||
public class GlassBlockStained extends TConstructBlock {
|
||||
static String blockTextures[] = {
|
||||
"white",
|
||||
"orange",
|
||||
"magenta",
|
||||
"lightblue",
|
||||
"yellow",
|
||||
"lime",
|
||||
"pink",
|
||||
"gray",
|
||||
"lightgray",
|
||||
"cyan",
|
||||
"purple",
|
||||
"blue",
|
||||
"brown",
|
||||
"green",
|
||||
"red",
|
||||
"black"
|
||||
};
|
||||
String textureName;
|
||||
|
||||
public GlassBlockStained(String tex)
|
||||
{
|
||||
public GlassBlockStained(String tex) {
|
||||
super(Material.glass, 3f, blockTextures);
|
||||
this.textureName = tex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return block == this ? false : super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:glass/" + textureName + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,10 @@ package tconstruct.smeltery.blocks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class GlassPane extends PaneBase
|
||||
{
|
||||
static String blockTextures[] = { "glass_clear", "soulglass", "soulglass_clear" };
|
||||
public class GlassPane extends PaneBase {
|
||||
static String blockTextures[] = {"glass_clear", "soulglass", "soulglass_clear"};
|
||||
|
||||
public GlassPane()
|
||||
{
|
||||
public GlassPane() {
|
||||
super(Material.glass, "glass/", blockTextures);
|
||||
this.setHardness(0.3F);
|
||||
this.stepSound = soundTypeGlass;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,12 +3,27 @@ package tconstruct.smeltery.blocks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class GlassPaneStained extends PaneBase
|
||||
{
|
||||
static String blockTextures[] = { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black" };
|
||||
public class GlassPaneStained extends PaneBase {
|
||||
static String blockTextures[] = {
|
||||
"white",
|
||||
"orange",
|
||||
"magenta",
|
||||
"lightblue",
|
||||
"yellow",
|
||||
"lime",
|
||||
"pink",
|
||||
"gray",
|
||||
"lightgray",
|
||||
"cyan",
|
||||
"purple",
|
||||
"blue",
|
||||
"brown",
|
||||
"green",
|
||||
"red",
|
||||
"black"
|
||||
};
|
||||
|
||||
public GlassPaneStained()
|
||||
{
|
||||
public GlassPaneStained() {
|
||||
super(Material.glass, "glass/", assembleBlockTextures());
|
||||
// TODO setHardness
|
||||
this.setHardness(0.3F);
|
||||
@@ -17,25 +32,21 @@ public class GlassPaneStained extends PaneBase
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
private static String[] assembleBlockTextures ()
|
||||
{
|
||||
private static String[] assembleBlockTextures() {
|
||||
String[] textures = new String[blockTextures.length];
|
||||
for (int i = 0; i < blockTextures.length; i++)
|
||||
{
|
||||
for (int i = 0; i < blockTextures.length; i++) {
|
||||
textures[i] = "stainedglass_" + blockTextures[i];
|
||||
}
|
||||
return textures;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int par1)
|
||||
{
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
}
|
||||
}
|
||||
@@ -8,22 +8,18 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
|
||||
public class GlueBlock extends TConstructBlock
|
||||
{
|
||||
public class GlueBlock extends TConstructBlock {
|
||||
|
||||
public GlueBlock()
|
||||
{
|
||||
super(Material.ground, 4.0f, new String[] { "glue" });
|
||||
public GlueBlock() {
|
||||
super(Material.ground, 4.0f, new String[] {"glue"});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
entity.motionX *= 0.1;
|
||||
entity.motionZ *= 0.1;
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
// Well you'd feel ill too standing on glue...
|
||||
living.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 20, 4));
|
||||
@@ -34,9 +30,7 @@ public class GlueBlock extends TConstructBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return Blocks.soul_sand.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,47 +9,39 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class GlueFluid extends BlockFluidFinite
|
||||
{
|
||||
public class GlueFluid extends BlockFluidFinite {
|
||||
|
||||
IIcon stillIcon;
|
||||
IIcon flowIcon;
|
||||
|
||||
boolean overwriteFluidIcons = true;
|
||||
|
||||
public GlueFluid(Fluid fluid, Material material)
|
||||
{
|
||||
public GlueFluid(Fluid fluid, Material material) {
|
||||
super(fluid, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
stillIcon = iconRegister.registerIcon("tinker:liquid_glue");
|
||||
flowIcon = iconRegister.registerIcon("tinker:liquid_glue_flow");
|
||||
|
||||
if (this.overwriteFluidIcons)
|
||||
this.getFluid().setIcons(stillIcon, flowIcon);
|
||||
if (this.overwriteFluidIcons) this.getFluid().setIcons(stillIcon, flowIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
return stillIcon;
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 0 || side == 1) return stillIcon;
|
||||
return flowIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
entity.motionX *= 0.1;
|
||||
entity.motionZ *= 0.1;
|
||||
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
EntityLivingBase living = (EntityLivingBase) entity;
|
||||
// Well you'd feel ill too standing in glue...
|
||||
living.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 20, 4));
|
||||
@@ -59,8 +51,7 @@ public class GlueFluid extends BlockFluidFinite
|
||||
}
|
||||
}
|
||||
|
||||
public void suppressOverwritingFluidIcons ()
|
||||
{
|
||||
public void suppressOverwritingFluidIcons() {
|
||||
this.overwriteFluidIcons = false;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package tconstruct.smeltery.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import mantle.blocks.iface.IServantLogic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
@@ -26,15 +27,11 @@ import tconstruct.smeltery.itemblocks.LavaTankItemBlock;
|
||||
import tconstruct.smeltery.logic.LavaTankLogic;
|
||||
import tconstruct.smeltery.model.TankRender;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LavaTankBlock extends BlockContainer
|
||||
{
|
||||
public class LavaTankBlock extends BlockContainer {
|
||||
public IIcon[] icons;
|
||||
String texturePrefix = "";
|
||||
|
||||
public LavaTankBlock()
|
||||
{
|
||||
public LavaTankBlock() {
|
||||
super(Material.rock);
|
||||
setHardness(3F);
|
||||
setResistance(20F);
|
||||
@@ -43,73 +40,70 @@ public class LavaTankBlock extends BlockContainer
|
||||
setStepSound(Block.soundTypeGrass);
|
||||
}
|
||||
|
||||
public LavaTankBlock(String prefix)
|
||||
{
|
||||
public LavaTankBlock(String prefix) {
|
||||
this();
|
||||
texturePrefix = prefix;
|
||||
}
|
||||
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "lavatank_side", "lavatank_top", "searedgague_top", "searedgague_side", "searedgague_bottom", "searedwindow_top", "searedwindow_side", "searedwindow_bottom" };
|
||||
public String[] getTextureNames() {
|
||||
String[] textureNames = {
|
||||
"lavatank_side",
|
||||
"lavatank_top",
|
||||
"searedgague_top",
|
||||
"searedgague_side",
|
||||
"searedgague_bottom",
|
||||
"searedwindow_top",
|
||||
"searedwindow_side",
|
||||
"searedwindow_bottom"
|
||||
};
|
||||
|
||||
if (!texturePrefix.equals(""))
|
||||
for (int i = 0; i < textureNames.length; i++)
|
||||
textureNames[i] = texturePrefix + "_" + textureNames[i];
|
||||
for (int i = 0; i < textureNames.length; i++) textureNames[i] = texturePrefix + "_" + textureNames[i];
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister IIconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister IIconRegister) {
|
||||
String[] textureNames = getTextureNames();
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = IIconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block bID = world.getBlock(x, y, z);
|
||||
return bID == this ? false : super.shouldSideBeRendered(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInPass (int pass)
|
||||
{
|
||||
public boolean canRenderInPass(int pass) {
|
||||
TankRender.renderPass = pass;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
if (logic != null && logic instanceof LavaTankLogic)
|
||||
return ((LavaTankLogic) logic).getBrightness();
|
||||
if (logic != null && logic instanceof LavaTankLogic) return ((LavaTankLogic) logic).getBrightness();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -118,89 +112,78 @@ public class LavaTankBlock extends BlockContainer
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return TankRender.tankModelID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (meta >= 3)
|
||||
meta = 0;
|
||||
if (meta == 0)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (meta >= 3) meta = 0;
|
||||
if (meta == 0) {
|
||||
if (side == 0 || side == 1) {
|
||||
return icons[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return icons[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return icons[meta * 3 + getTextureIndex(side) - 1];
|
||||
}
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new LavaTankLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
|
||||
ItemStack current = entityplayer.inventory.getCurrentItem();
|
||||
if (current != null)
|
||||
{
|
||||
if (current != null) {
|
||||
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(current);
|
||||
LavaTankLogic logic = (LavaTankLogic) world.getTileEntity(i, j, k);
|
||||
// putting liquid into the tank
|
||||
if (liquid != null && !world.isRemote)
|
||||
{
|
||||
if (liquid != null && !world.isRemote) {
|
||||
int amount = logic.fill(ForgeDirection.UNKNOWN, liquid, false);
|
||||
if (amount == liquid.amount)
|
||||
{
|
||||
if (amount == liquid.amount) {
|
||||
logic.fill(ForgeDirection.UNKNOWN, liquid, true);
|
||||
if (!entityplayer.capabilities.isCreativeMode)
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(
|
||||
entityplayer.inventory.currentItem, consumeItem(current));
|
||||
|
||||
// update
|
||||
entityplayer.inventoryContainer.detectAndSendChanges();
|
||||
world.markBlockForUpdate(i,j,k);
|
||||
world.markBlockForUpdate(i, j, k);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// taking liquit out of the tank
|
||||
else if (FluidContainerRegistry.isBucket(current))
|
||||
{
|
||||
else if (FluidContainerRegistry.isBucket(current)) {
|
||||
FluidTankInfo[] tanks = logic.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
FluidStack fillFluid = tanks[0].fluid;// getFluid();
|
||||
if(!world.isRemote) {
|
||||
FluidStack fillFluid = tanks[0].fluid; // getFluid();
|
||||
if (!world.isRemote) {
|
||||
ItemStack fillStack = FluidContainerRegistry.fillFluidContainer(fillFluid, current);
|
||||
if (fillStack != null) {
|
||||
logic.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.getFluidForFilledItem(fillStack).amount, true);
|
||||
logic.drain(
|
||||
ForgeDirection.UNKNOWN,
|
||||
FluidContainerRegistry.getFluidForFilledItem(fillStack).amount,
|
||||
true);
|
||||
if (!entityplayer.capabilities.isCreativeMode && !world.isRemote) {
|
||||
if (current.stackSize == 1) {
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, fillStack);
|
||||
entityplayer.inventory.setInventorySlotContents(
|
||||
entityplayer.inventory.currentItem, fillStack);
|
||||
} else {
|
||||
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, consumeItem(current));
|
||||
entityplayer.inventory.setInventorySlotContents(
|
||||
entityplayer.inventory.currentItem, consumeItem(current));
|
||||
|
||||
if (!entityplayer.inventory.addItemStackToInventory(fillStack)) {
|
||||
entityplayer.dropPlayerItemWithRandomChoice(fillStack, false);
|
||||
@@ -222,17 +205,11 @@ public class LavaTankBlock extends BlockContainer
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ItemStack consumeItem (ItemStack stack)
|
||||
{
|
||||
if (stack.stackSize == 1)
|
||||
{
|
||||
if (stack.getItem().hasContainerItem())
|
||||
return stack.getItem().getContainerItem(stack);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
public static ItemStack consumeItem(ItemStack stack) {
|
||||
if (stack.stackSize == 1) {
|
||||
if (stack.getItem().hasContainerItem()) return stack.getItem().getContainerItem(stack);
|
||||
else return null;
|
||||
} else {
|
||||
stack.splitStack(1);
|
||||
|
||||
return stack;
|
||||
@@ -240,60 +217,49 @@ public class LavaTankBlock extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int test)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int test) {
|
||||
return createTileEntity(world, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 3; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 3; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
/* Data */
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
/* Updates */
|
||||
public void onNeighborBlockChange (World world, int x, int y, int z, Block nBlockID)
|
||||
{
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block nBlockID) {
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
if (logic instanceof IServantLogic)
|
||||
{
|
||||
if (logic instanceof IServantLogic) {
|
||||
((IServantLogic) logic).notifyMasterOfChange();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer (World world, EntityPlayer player, int x, int y, int z)
|
||||
{
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
player.addExhaustion(0.025F);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
ItemStack stack = new ItemStack(this, 1, meta);
|
||||
LavaTankLogic logic = (LavaTankLogic) world.getTileEntity(x, y, z);
|
||||
FluidStack liquid = logic.tank.getFluid();
|
||||
if (liquid != null)
|
||||
{
|
||||
if (liquid != null) {
|
||||
LavaTankItemBlock lavaTankItemBlock = (LavaTankItemBlock) stack.getItem();
|
||||
lavaTankItemBlock.setFluid(stack, liquid);
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode || player.isSneaking())
|
||||
dropTankBlock(world, x, y, z, stack);
|
||||
if (!player.capabilities.isCreativeMode || player.isSneaking()) dropTankBlock(world, x, y, z, stack);
|
||||
|
||||
return world.setBlockToAir(x, y, z);
|
||||
}
|
||||
|
||||
protected void dropTankBlock (World world, int x, int y, int z, ItemStack stack)
|
||||
{
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops"))
|
||||
{
|
||||
protected void dropTankBlock(World world, int x, int y, int z, ItemStack stack) {
|
||||
if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
|
||||
float f = 0.7F;
|
||||
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
|
||||
@@ -305,14 +271,10 @@ public class LavaTankBlock extends BlockContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock (World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
|
||||
}
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase living, ItemStack stack)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) {
|
||||
LavaTankItemBlock lavaTankItemBlock = (LavaTankItemBlock) stack.getItem();
|
||||
FluidStack liquid = lavaTankItemBlock.getFluid(stack);
|
||||
if (liquid != null) {
|
||||
@@ -321,22 +283,19 @@ public class LavaTankBlock extends BlockContainer
|
||||
}
|
||||
}
|
||||
|
||||
//Comparator
|
||||
// Comparator
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride ()
|
||||
{
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride (World world, int x, int y, int z, int comparatorSide)
|
||||
{
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int comparatorSide) {
|
||||
return getTankLogic(world, x, y, z).comparatorStrength();
|
||||
}
|
||||
|
||||
public static LavaTankLogic getTankLogic (IBlockAccess blockAccess, int par1, int par2, int par3)
|
||||
{
|
||||
public static LavaTankLogic getTankLogic(IBlockAccess blockAccess, int par1, int par2, int par3) {
|
||||
return (LavaTankLogic) blockAccess.getTileEntity(par1, par2, par3);
|
||||
}
|
||||
}
|
||||
@@ -10,53 +10,44 @@ import net.minecraftforge.fluids.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
|
||||
public class LiquidMetalFinite extends BlockFluidFinite
|
||||
{
|
||||
public class LiquidMetalFinite extends BlockFluidFinite {
|
||||
String texture;
|
||||
public IIcon stillIcon;
|
||||
public IIcon flowIcon;
|
||||
|
||||
public LiquidMetalFinite(Fluid fluid, String texture)
|
||||
{
|
||||
public LiquidMetalFinite(Fluid fluid, String texture) {
|
||||
super(fluid, TinkerSmeltery.liquidMetal);
|
||||
this.texture = texture;
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
public int getRenderBlockPass() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
stillIcon = iconRegister.registerIcon("tinker:" + texture);
|
||||
flowIcon = iconRegister.registerIcon("tinker:" + texture + "_flow");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
return stillIcon;
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 0 || side == 1) return stillIcon;
|
||||
return flowIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World par1World, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World par1World, int x, int y, int z, Entity entity) {
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
entity.motionX *= 0.4D;
|
||||
entity.motionZ *= 0.4D;
|
||||
}
|
||||
if (!(entity instanceof EntityItem) && !entity.isImmuneToFire())
|
||||
{
|
||||
if (!(entity instanceof EntityItem) && !entity.isImmuneToFire()) {
|
||||
entity.attackEntityFrom(DamageSource.lava, 4.0F);
|
||||
entity.setFire(15);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,29 +7,22 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
|
||||
public class MetalOre extends TConstructBlock
|
||||
{
|
||||
public MetalOre(Material material, float hardness, String[] tex)
|
||||
{
|
||||
public class MetalOre extends TConstructBlock {
|
||||
public MetalOre(Material material, float hardness, String[] tex) {
|
||||
super(material, hardness, tex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBlockHardness (World world, int x, int y, int z)
|
||||
{
|
||||
public float getBlockHardness(World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta <= 2)
|
||||
return 10f;
|
||||
else
|
||||
return 3f;
|
||||
if (meta <= 2) return 10f;
|
||||
else return 3f;
|
||||
// return this.blockHardness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 1; iter < 6; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
|
||||
for (int iter = 1; iter < 6; iter++) {
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,15 +10,13 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.smeltery.model.PaneRender;
|
||||
|
||||
public class PaneBase extends BlockStainedGlassPane
|
||||
{
|
||||
public class PaneBase extends BlockStainedGlassPane {
|
||||
public String[] textureNames;
|
||||
public String folder;
|
||||
public IIcon[] icons;
|
||||
public IIcon[] sideIcons;
|
||||
|
||||
public PaneBase(Material material, String folder, String[] blockTextures)
|
||||
{
|
||||
public PaneBase(Material material, String folder, String[] blockTextures) {
|
||||
super();
|
||||
textureNames = blockTextures;
|
||||
this.folder = folder;
|
||||
@@ -26,13 +24,11 @@ public class PaneBase extends BlockStainedGlassPane
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
this.sideIcons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
this.sideIcons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i] + "_side");
|
||||
}
|
||||
@@ -40,49 +36,41 @@ public class PaneBase extends BlockStainedGlassPane
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon func_149735_b (int p_149735_1_, int p_149735_2_)
|
||||
{
|
||||
public IIcon func_149735_b(int p_149735_1_, int p_149735_2_) {
|
||||
return icons[p_149735_2_];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon func_150104_b (int p_150104_1_)
|
||||
{
|
||||
public IIcon func_150104_b(int p_150104_1_) {
|
||||
return sideIcons[p_150104_1_];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon (int p_149691_1_, int p_149691_2_)
|
||||
{
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
||||
return icons[p_149691_2_];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < textureNames.length; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < textureNames.length; iter++) {
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return PaneRender.model;
|
||||
}
|
||||
}
|
||||
@@ -6,31 +6,25 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class PigIronMoltenBlock extends TConstructFluid
|
||||
{
|
||||
public class PigIronMoltenBlock extends TConstructFluid {
|
||||
|
||||
public PigIronMoltenBlock(Fluid fluid, Material material, String texture)
|
||||
{
|
||||
public PigIronMoltenBlock(Fluid fluid, Material material, String texture) {
|
||||
super(fluid, material, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.stillIcon = iconRegister.registerIcon("tinker:" + texture);
|
||||
this.flowIcon = iconRegister.registerIcon("tinker:" + texture);
|
||||
|
||||
if (this.overwriteFluidIcons)
|
||||
this.getFluid().setIcons(stillIcon, flowIcon);
|
||||
if (this.overwriteFluidIcons) this.getFluid().setIcons(stillIcon, flowIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (!world.isRemote && entity != null && !entity.isWet())
|
||||
entity.setFire(40);
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (!world.isRemote && entity != null && !entity.isWet()) entity.setFire(40);
|
||||
if (!entity.isWet() || world.rand.nextInt(100) > 73)
|
||||
world.playSoundAtEntity(entity, "random.fizz", 0.7F, 1.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.4F);
|
||||
world.playSoundAtEntity(
|
||||
entity, "random.fizz", 0.7F, 1.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.4F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,19 +11,14 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.event.SmelteryEvent;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.smeltery.logic.*;
|
||||
import tconstruct.smeltery.model.CastingBlockRender;
|
||||
|
||||
public class SearedBlock extends InventoryBlock
|
||||
{
|
||||
public class SearedBlock extends InventoryBlock {
|
||||
|
||||
public SearedBlock()
|
||||
{
|
||||
public SearedBlock() {
|
||||
super(Material.rock);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
setHardness(3F);
|
||||
@@ -31,75 +26,63 @@ public class SearedBlock extends InventoryBlock
|
||||
setStepSound(soundTypeMetal);
|
||||
}
|
||||
|
||||
public SearedBlock(String texture)
|
||||
{
|
||||
public SearedBlock(String texture) {
|
||||
this();
|
||||
this.texturePrefix = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return new CastingTableLogic();
|
||||
case 1:
|
||||
return new FaucetLogic();
|
||||
case 2:
|
||||
return new CastingBasinLogic();
|
||||
default:
|
||||
return null;
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
return new CastingTableLogic();
|
||||
case 1:
|
||||
return new FaucetLogic();
|
||||
case 2:
|
||||
return new CastingBasinLogic();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
public int getRenderBlockPass() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
/* Activation */
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) {
|
||||
int md = world.getBlockMetadata(x, y, z);
|
||||
// casting table or basin
|
||||
if (md == 0 || md == 2)
|
||||
{
|
||||
if (md == 0 || md == 2) {
|
||||
return activateCastingBlock(world, x, y, z, player);
|
||||
}
|
||||
// faucet
|
||||
else if (md == 1)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
return false;
|
||||
else if (md == 1) {
|
||||
if (player.isSneaking()) return false;
|
||||
|
||||
if(!world.isRemote) {
|
||||
if (!world.isRemote) {
|
||||
FaucetLogic logic = (FaucetLogic) world.getTileEntity(x, y, z);
|
||||
logic.setActive(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return super.onBlockActivated(world, x, y, z, player, side, clickX, clickY, clickZ);
|
||||
} else return super.onBlockActivated(world, x, y, z, player, side, clickX, clickY, clickZ);
|
||||
}
|
||||
|
||||
boolean activateCastingBlock (World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if(!world.isRemote) {
|
||||
boolean activateCastingBlock(World world, int x, int y, int z, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
CastingBlockLogic logic = (CastingBlockLogic) world.getTileEntity(x, y, z);
|
||||
logic.interact(player);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
@@ -109,118 +92,104 @@ public class SearedBlock extends InventoryBlock
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return CastingBlockRender.searedModel;
|
||||
}
|
||||
|
||||
String texturePrefix = "";
|
||||
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "castingtable_top", "castingtable_side", "castingtable_bottom", "faucet", "blockcast_top", "blockcast_side", "blockcast_bottom" };
|
||||
public String[] getTextureNames() {
|
||||
String[] textureNames = {
|
||||
"castingtable_top",
|
||||
"castingtable_side",
|
||||
"castingtable_bottom",
|
||||
"faucet",
|
||||
"blockcast_top",
|
||||
"blockcast_side",
|
||||
"blockcast_bottom"
|
||||
};
|
||||
|
||||
if (!texturePrefix.equals(""))
|
||||
for (int i = 0; i < textureNames.length; i++)
|
||||
textureNames[i] = texturePrefix + "_" + textureNames[i];
|
||||
for (int i = 0; i < textureNames.length; i++) textureNames[i] = texturePrefix + "_" + textureNames[i];
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
// TODO getIcon
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (meta == 0)
|
||||
return icons[getTextureIndex(side)];
|
||||
else if (meta == 2)
|
||||
return icons[getTextureIndex(side) + 4];
|
||||
else
|
||||
return icons[3];
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (meta == 0) return icons[getTextureIndex(side)];
|
||||
else if (meta == 2) return icons[getTextureIndex(side) + 4];
|
||||
else return icons[3];
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 3; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 3; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 1)
|
||||
{
|
||||
if (meta != 1) {
|
||||
this.setBlockBounds(0, 0, 0, 1, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
float xMin = 0.25F;
|
||||
float xMax = 0.75F;
|
||||
float zMin = 0.25F;
|
||||
float zMax = 0.75F;
|
||||
|
||||
if (te instanceof FaucetLogic)
|
||||
{
|
||||
if (te instanceof FaucetLogic) {
|
||||
FaucetLogic logic = (FaucetLogic) te;
|
||||
switch (logic.getRenderDirection())
|
||||
{
|
||||
case 2:
|
||||
zMin = 0.625F;
|
||||
zMax = 1.0F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.375F;
|
||||
zMin = 0F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.625F;
|
||||
xMax = 1.0F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.375F;
|
||||
xMin = 0F;
|
||||
break;
|
||||
switch (logic.getRenderDirection()) {
|
||||
case 2:
|
||||
zMin = 0.625F;
|
||||
zMax = 1.0F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.375F;
|
||||
zMin = 0F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.625F;
|
||||
xMax = 1.0F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.375F;
|
||||
xMin = 0F;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,45 +198,45 @@ public class SearedBlock extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta != 1)
|
||||
{
|
||||
if (meta != 1) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof FaucetLogic)
|
||||
{
|
||||
if (tile != null && tile instanceof FaucetLogic) {
|
||||
FaucetLogic logic = (FaucetLogic) tile;
|
||||
float xMin = 0.25F;
|
||||
float xMax = 0.75F;
|
||||
float zMin = 0.25F;
|
||||
float zMax = 0.75F;
|
||||
|
||||
switch (logic.getRenderDirection())
|
||||
{
|
||||
case 2:
|
||||
zMin = 0.625F;
|
||||
zMax = 1.0F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.375F;
|
||||
zMin = 0F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.625F;
|
||||
xMax = 1.0F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.375F;
|
||||
xMin = 0F;
|
||||
break;
|
||||
switch (logic.getRenderDirection()) {
|
||||
case 2:
|
||||
zMin = 0.625F;
|
||||
zMax = 1.0F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.375F;
|
||||
zMin = 0F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.625F;
|
||||
xMax = 1.0F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.375F;
|
||||
xMin = 0F;
|
||||
break;
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getBoundingBox((double) ((float) x + xMin), (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x + xMax), (double) y + 0.625, (double) ((float) z + zMax));
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(double) ((float) x + xMin),
|
||||
(double) y + 0.25,
|
||||
(double) ((float) z + zMin),
|
||||
(double) ((float) x + xMax),
|
||||
(double) y + 0.625,
|
||||
(double) ((float) z + zMax));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,23 +245,19 @@ public class SearedBlock extends InventoryBlock
|
||||
|
||||
/* Redstone */
|
||||
@Override
|
||||
public boolean canConnectRedstone (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return world.getBlockMetadata(x, y, z) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange (World world, int x, int y, int z, Block neighborBlockID)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) == 1)
|
||||
{
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighborBlockID) {
|
||||
if (world.getBlockMetadata(x, y, z) == 1) {
|
||||
boolean isPowered = world.isBlockIndirectlyGettingPowered(x, y, z);
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(!(te instanceof FaucetLogic))
|
||||
return;
|
||||
if (!(te instanceof FaucetLogic)) return;
|
||||
FaucetLogic logic = (FaucetLogic) te;
|
||||
// was it a low->high pulse
|
||||
if(!logic.hasRedstonePower && isPowered) {
|
||||
if (!logic.hasRedstonePower && isPowered) {
|
||||
logic.hasRedstonePower = true;
|
||||
logic.setActive(true);
|
||||
}
|
||||
@@ -303,18 +268,16 @@ public class SearedBlock extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return new CastingTableLogic();
|
||||
case 1:
|
||||
return new FaucetLogic();
|
||||
case 2:
|
||||
return new CastingBasinLogic();
|
||||
default:
|
||||
return null;
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
return new CastingTableLogic();
|
||||
case 1:
|
||||
return new FaucetLogic();
|
||||
case 2:
|
||||
return new CastingBasinLogic();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,8 @@ import tconstruct.blocks.SlabBase;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
|
||||
public class SearedSlab extends SlabBase
|
||||
{
|
||||
public SearedSlab()
|
||||
{
|
||||
public class SearedSlab extends SlabBase {
|
||||
public SearedSlab() {
|
||||
super(Material.rock);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
setHardness(12F);
|
||||
@@ -22,29 +20,22 @@ public class SearedSlab extends SlabBase
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = meta % 8;
|
||||
if (meta == 0)
|
||||
return TinkerSmeltery.smeltery.getIcon(side, 2);
|
||||
if (meta <= 3)
|
||||
return TinkerSmeltery.smeltery.getIcon(side, meta + 3);
|
||||
if (meta == 0) return TinkerSmeltery.smeltery.getIcon(side, 2);
|
||||
if (meta <= 3) return TinkerSmeltery.smeltery.getIcon(side, meta + 3);
|
||||
|
||||
return TinkerSmeltery.smeltery.getIcon(side, meta + 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 8; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 8; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,15 +19,12 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.smeltery.SmelteryProxyCommon;
|
||||
import tconstruct.smeltery.logic.*;
|
||||
import tconstruct.smeltery.model.SmelteryRender;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class SmelteryBlock extends InventoryBlock
|
||||
{
|
||||
public class SmelteryBlock extends InventoryBlock {
|
||||
Random rand;
|
||||
String texturePrefix = "";
|
||||
|
||||
public SmelteryBlock()
|
||||
{
|
||||
public SmelteryBlock() {
|
||||
super(Material.rock);
|
||||
setHardness(3F);
|
||||
setResistance(20F);
|
||||
@@ -37,8 +34,7 @@ public class SmelteryBlock extends InventoryBlock
|
||||
this.setBlockName("tconstruct.Smeltery");
|
||||
}
|
||||
|
||||
public SmelteryBlock(String prefix)
|
||||
{
|
||||
public SmelteryBlock(String prefix) {
|
||||
this();
|
||||
texturePrefix = prefix;
|
||||
}
|
||||
@@ -46,46 +42,51 @@ public class SmelteryBlock extends InventoryBlock
|
||||
/* Rendering */
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return SmelteryRender.smelteryModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "smeltery_side", "smeltery_inactive", "smeltery_active", "drain_side", "drain_out", "drain_basin", "searedbrick", "searedstone", "searedcobble", "searedpaver", "searedbrickcracked", "searedroad", "searedbrickfancy", "searedbricksquare", "searedcreeper" };
|
||||
public String[] getTextureNames() {
|
||||
String[] textureNames = {
|
||||
"smeltery_side",
|
||||
"smeltery_inactive",
|
||||
"smeltery_active",
|
||||
"drain_side",
|
||||
"drain_out",
|
||||
"drain_basin",
|
||||
"searedbrick",
|
||||
"searedstone",
|
||||
"searedcobble",
|
||||
"searedpaver",
|
||||
"searedbrickcracked",
|
||||
"searedroad",
|
||||
"searedbrickfancy",
|
||||
"searedbricksquare",
|
||||
"searedcreeper"
|
||||
};
|
||||
|
||||
if (!texturePrefix.equals(""))
|
||||
for (int i = 0; i < textureNames.length; i++)
|
||||
textureNames[i] = texturePrefix + "_" + textureNames[i];
|
||||
for (int i = 0; i < textureNames.length; i++) textureNames[i] = texturePrefix + "_" + textureNames[i];
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (meta < 2)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (meta < 2) {
|
||||
int sideTex = side == 3 ? 1 : 0;
|
||||
return icons[sideTex + meta * 3];
|
||||
}
|
||||
else if (meta == 2)
|
||||
{
|
||||
} else if (meta == 2) {
|
||||
return icons[6];
|
||||
}
|
||||
else if (meta == 11)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
return icons[9];
|
||||
} else if (meta == 11) {
|
||||
if (side == 0 || side == 1) return icons[9];
|
||||
}
|
||||
|
||||
return icons[3 + meta];
|
||||
@@ -93,160 +94,128 @@ public class SmelteryBlock extends InventoryBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getRenderDirection() : 0;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0) // Smeltery
|
||||
{
|
||||
if (side == direction)
|
||||
{
|
||||
if (isActive(world, x, y, z))
|
||||
{
|
||||
if (side == direction) {
|
||||
if (isActive(world, x, y, z)) {
|
||||
return icons[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return icons[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return icons[0];
|
||||
}
|
||||
}
|
||||
if (meta == 1) // Drain
|
||||
{
|
||||
if (side == direction)
|
||||
return icons[5];
|
||||
else if (side / 2 == direction / 2)
|
||||
return icons[4];
|
||||
else
|
||||
return icons[3];
|
||||
}
|
||||
else if (meta == 2)
|
||||
{
|
||||
if (side == direction) return icons[5];
|
||||
else if (side / 2 == direction / 2) return icons[4];
|
||||
else return icons[3];
|
||||
} else if (meta == 2) {
|
||||
return icons[6];
|
||||
}
|
||||
else if (meta == 11)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
return icons[9];
|
||||
} else if (meta == 11) {
|
||||
if (side == 0 || side == 1) return icons[9];
|
||||
}
|
||||
return icons[3 + meta];
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @Override public int getRenderBlockPass() { return 1; }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped (Random random)
|
||||
{
|
||||
public int quantityDropped(Random random) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
// return -1;
|
||||
return SmelteryProxyCommon.smelteryGuiID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (isActive(world, x, y, z))
|
||||
{
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||
if (isActive(world, x, y, z)) {
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
byte face = 0;
|
||||
if (logic instanceof IFacingLogic)
|
||||
face = ((IFacingLogic) logic).getRenderDirection();
|
||||
if (logic instanceof IFacingLogic) face = ((IFacingLogic) logic).getRenderDirection();
|
||||
float f = (float) x + 0.5F;
|
||||
float f1 = (float) y + 0.5F + (random.nextFloat() * 6F) / 16F;
|
||||
float f2 = (float) z + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = random.nextFloat() * 0.6F - 0.3F;
|
||||
switch (face)
|
||||
{
|
||||
case 4:
|
||||
world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
switch (face) {
|
||||
case 4:
|
||||
world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
case 5:
|
||||
world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
case 2:
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
case 3:
|
||||
world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||
return !isActive(world, x, y, z) ? 0 : 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) != 0)
|
||||
return false;
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) {
|
||||
if (world.getBlockMetadata(x, y, z) != 0) return false;
|
||||
|
||||
return super.onBlockActivated(world, x,y,z, player, side, clickX, clickY, clickZ);
|
||||
return super.onBlockActivated(world, x, y, z, player, side, clickX, clickY, clickZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
return new SmelteryLogic();
|
||||
case 1:
|
||||
return new SmelteryDrainLogic();
|
||||
case 3:
|
||||
return null; // Furnace
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
return new SmelteryLogic();
|
||||
case 1:
|
||||
return new SmelteryDrainLogic();
|
||||
case 3:
|
||||
return null; // Furnace
|
||||
}
|
||||
return new MultiServantLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, x, y, z, entityliving, stack);
|
||||
if (world.getBlockMetadata(x, y, z) == 0)
|
||||
onBlockPlacedElsewhere(world, x, y, z, entityliving);
|
||||
if (world.getBlockMetadata(x, y, z) == 0) onBlockPlacedElsewhere(world, x, y, z, entityliving);
|
||||
}
|
||||
|
||||
public void onBlockPlacedElsewhere (World world, int x, int y, int z, EntityLivingBase entityliving)
|
||||
{
|
||||
public void onBlockPlacedElsewhere(World world, int x, int y, int z, EntityLivingBase entityliving) {
|
||||
SmelteryLogic logic = (SmelteryLogic) world.getTileEntity(x, y, z);
|
||||
logic.checkValidPlacement();
|
||||
}
|
||||
@@ -258,62 +227,49 @@ public class SmelteryBlock extends InventoryBlock
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 12; iter++)
|
||||
{
|
||||
if (iter != 3)
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 12; iter++) {
|
||||
if (iter != 3) list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
/* Updating */
|
||||
@Override
|
||||
public void onNeighborBlockChange (World world, int x, int y, int z, Block block)
|
||||
{
|
||||
//System.out.println("Neighbor changed");
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||
// System.out.println("Neighbor changed");
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
if (logic instanceof IServantLogic)
|
||||
{
|
||||
if (logic instanceof IServantLogic) {
|
||||
((IServantLogic) logic).notifyMasterOfChange();
|
||||
}
|
||||
else if (logic instanceof IMasterLogic)
|
||||
{
|
||||
} else if (logic instanceof IMasterLogic) {
|
||||
((IMasterLogic) logic).notifyChange(null, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock (World world, int x, int y, int z, Block blockID, int meta)
|
||||
{
|
||||
public void breakBlock(World world, int x, int y, int z, Block blockID, int meta) {
|
||||
// TE is not valid anymore at this point. :/
|
||||
|
||||
TileEntity logic = world.getTileEntity(x, y, z);
|
||||
if (logic instanceof IServantLogic)
|
||||
{
|
||||
if (logic instanceof IServantLogic) {
|
||||
((IServantLogic) logic).notifyMasterOfChange();
|
||||
}
|
||||
super.breakBlock(world, x, y, z, blockID, meta);
|
||||
}
|
||||
|
||||
//Comparator
|
||||
// Comparator
|
||||
|
||||
public boolean hasComparatorInputOverride ()
|
||||
{
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getComparatorInputOverride (World world, int x, int y, int z, int comparatorSide)
|
||||
{
|
||||
public int getComparatorInputOverride(World world, int x, int y, int z, int comparatorSide) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0)
|
||||
{
|
||||
if (meta == 0) {
|
||||
return Container.calcRedstoneFromInventory(((SmelteryLogic) world.getTileEntity(x, y, z)));
|
||||
}
|
||||
if (meta == 1)
|
||||
{
|
||||
if (meta == 1) {
|
||||
return ((SmelteryDrainLogic) world.getTileEntity(x, y, z)).comparatorStrength();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,48 +9,47 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
|
||||
public class SpeedBlock extends TConstructBlock
|
||||
{
|
||||
public static String[] textureNames = new String[] { "brownstone_rough", "brownstone_rough_road", "brownstone_smooth", "brownstone_smooth_brick", "brownstone_smooth_road", "brownstone_smooth_fancy", "brownstone_smooth_chiseled" };
|
||||
public class SpeedBlock extends TConstructBlock {
|
||||
public static String[] textureNames = new String[] {
|
||||
"brownstone_rough",
|
||||
"brownstone_rough_road",
|
||||
"brownstone_smooth",
|
||||
"brownstone_smooth_brick",
|
||||
"brownstone_smooth_road",
|
||||
"brownstone_smooth_fancy",
|
||||
"brownstone_smooth_chiseled"
|
||||
};
|
||||
|
||||
public SpeedBlock()
|
||||
{
|
||||
public SpeedBlock() {
|
||||
super(Material.rock, 3.0f, textureNames);
|
||||
// this.setBlockBounds(0f, 0f, 0f, 1.0f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalking (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
|
||||
double boost = 2.2D;
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 1 || metadata == 4)
|
||||
boost = 2.7D;
|
||||
if (metadata == 1 || metadata == 4) boost = 2.7D;
|
||||
|
||||
double mX = Math.abs(entity.motionX);
|
||||
double mZ = Math.abs(entity.motionZ);
|
||||
if (mX < 0.5D)
|
||||
{
|
||||
if (mX < 0.5D) {
|
||||
entity.motionX *= boost;
|
||||
}
|
||||
if (mZ < 0.5D)
|
||||
{
|
||||
if (mZ < 0.5D) {
|
||||
entity.motionZ *= boost;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < textureNames.length; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < textureNames.length; iter++) {
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,8 @@ import tconstruct.blocks.SlabBase;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
|
||||
public class SpeedSlab extends SlabBase
|
||||
{
|
||||
public SpeedSlab()
|
||||
{
|
||||
public class SpeedSlab extends SlabBase {
|
||||
public SpeedSlab() {
|
||||
super(Material.rock);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
setHardness(3F);
|
||||
@@ -24,43 +22,34 @@ public class SpeedSlab extends SlabBase
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = meta % 8;
|
||||
return TinkerSmeltery.speedBlock.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 7; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 7; iter++) {
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalking (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
public void onEntityWalking(World world, int x, int y, int z, Entity entity) {
|
||||
double boost = 2.2D;
|
||||
int metadata = world.getBlockMetadata(x, y, z) % 8;
|
||||
if (metadata == 1 || metadata == 4)
|
||||
boost = 2.7D;
|
||||
if (metadata == 1 || metadata == 4) boost = 2.7D;
|
||||
|
||||
double mX = Math.abs(entity.motionX);
|
||||
double mZ = Math.abs(entity.motionZ);
|
||||
if (mX < 0.5D)
|
||||
{
|
||||
if (mX < 0.5D) {
|
||||
entity.motionX *= boost;
|
||||
}
|
||||
if (mZ < 0.5D)
|
||||
{
|
||||
if (mZ < 0.5D) {
|
||||
entity.motionZ *= boost;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class TConstructFluid extends BlockFluidClassic
|
||||
{
|
||||
public class TConstructFluid extends BlockFluidClassic {
|
||||
String texture;
|
||||
boolean alpha;
|
||||
public IIcon stillIcon;
|
||||
@@ -16,53 +15,44 @@ public class TConstructFluid extends BlockFluidClassic
|
||||
boolean overwriteFluidIcons = true;
|
||||
private Fluid fluid = null;
|
||||
|
||||
public TConstructFluid(Fluid fluid, Material material, String texture)
|
||||
{
|
||||
public TConstructFluid(Fluid fluid, Material material, String texture) {
|
||||
super(fluid, material);
|
||||
this.texture = texture;
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
public TConstructFluid(Fluid fluid, Material material, String texture, boolean alpha)
|
||||
{
|
||||
public TConstructFluid(Fluid fluid, Material material, String texture, boolean alpha) {
|
||||
this(fluid, material, texture);
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
public int getRenderBlockPass() {
|
||||
return alpha ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
stillIcon = iconRegister.registerIcon("tinker:" + texture);
|
||||
flowIcon = iconRegister.registerIcon("tinker:" + texture + "_flow");
|
||||
|
||||
if (overwriteFluidIcons)
|
||||
this.getFluid().setIcons(stillIcon, flowIcon);
|
||||
if (overwriteFluidIcons) this.getFluid().setIcons(stillIcon, flowIcon);
|
||||
|
||||
if(this.getFluid().getBlock() != this && fluid != null)
|
||||
fluid.setIcons(stillIcon, flowIcon);
|
||||
if (this.getFluid().getBlock() != this && fluid != null) fluid.setIcons(stillIcon, flowIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
return stillIcon;
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 0 || side == 1) return stillIcon;
|
||||
return flowIcon;
|
||||
}
|
||||
|
||||
public void suppressOverwritingFluidIcons ()
|
||||
{
|
||||
public void suppressOverwritingFluidIcons() {
|
||||
overwriteFluidIcons = false;
|
||||
}
|
||||
|
||||
public void setFluid(Fluid fluid) {
|
||||
this.fluid = fluid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,31 +5,24 @@ import net.minecraft.inventory.Slot;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.smeltery.inventory.ActiveSlot;
|
||||
|
||||
public abstract class ActiveContainerGui extends GuiContainer
|
||||
{
|
||||
public abstract class ActiveContainerGui extends GuiContainer {
|
||||
|
||||
public ActiveContainerGui(ActiveContainer p_i1072_1_)
|
||||
{
|
||||
public ActiveContainerGui(ActiveContainer p_i1072_1_) {
|
||||
super(p_i1072_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a (Slot slot)
|
||||
{
|
||||
if (!(slot instanceof ActiveSlot) || ((ActiveSlot) slot).getActive())
|
||||
{
|
||||
public void func_146977_a(Slot slot) {
|
||||
if (!(slot instanceof ActiveSlot) || ((ActiveSlot) slot).getActive()) {
|
||||
super.func_146977_a(slot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOverSlot (Slot slot, int mouseX, int mouseY)
|
||||
{
|
||||
if (!(slot instanceof ActiveSlot) || ((ActiveSlot) slot).getActive())
|
||||
{
|
||||
public boolean isMouseOverSlot(Slot slot, int mouseX, int mouseY) {
|
||||
if (!(slot instanceof ActiveSlot) || ((ActiveSlot) slot).getActive()) {
|
||||
return super.isMouseOverSlot(slot, mouseX, mouseY);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package tconstruct.smeltery.gui;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -9,17 +8,14 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.inventory.*;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import tconstruct.util.network.SmelteryPacket;
|
||||
|
||||
public class SmelteryGui extends ActiveContainerGui
|
||||
{
|
||||
public class SmelteryGui extends ActiveContainerGui {
|
||||
public SmelteryLogic logic;
|
||||
private boolean isScrolling = false;
|
||||
private boolean wasClicking;
|
||||
@@ -31,8 +27,7 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
private final int smelterySize;
|
||||
public static final int maxRows = 8;
|
||||
|
||||
public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, World world, int x, int y, int z)
|
||||
{
|
||||
public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, World world, int x, int y, int z) {
|
||||
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
logic = smeltery;
|
||||
smelterySize = smeltery.getBlockCapacity();
|
||||
@@ -43,20 +38,17 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
if (logic != null)
|
||||
logic.updateFuelDisplay();
|
||||
if (logic != null) logic.updateFuelDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
// the smeltery changed. we close the screen because updating the changes in all containers would be way too complicated.
|
||||
if(logic.getBlockCapacity() != smelterySize)
|
||||
{
|
||||
public void drawScreen(int mouseX, int mouseY, float par3) {
|
||||
// the smeltery changed. we close the screen because updating the changes in all containers would be way too
|
||||
// complicated.
|
||||
if (logic.getBlockCapacity() != smelterySize) {
|
||||
mc.thePlayer.closeScreen();
|
||||
return;
|
||||
}
|
||||
@@ -65,10 +57,8 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
updateScrollbar(mouseX, mouseY, par3);
|
||||
}
|
||||
|
||||
protected void updateScrollbar (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
if (smelterySize > columns * maxRows)
|
||||
{
|
||||
protected void updateScrollbar(int mouseX, int mouseY, float par3) {
|
||||
if (smelterySize > columns * maxRows) {
|
||||
boolean mouseDown = Mouse.isButtonDown(0);
|
||||
int lefto = this.guiLeft;
|
||||
int topo = this.guiTop;
|
||||
@@ -77,88 +67,82 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
int scrollWidth = xScroll + 14;
|
||||
int scrollHeight = yScroll + 144;
|
||||
|
||||
if (!this.wasClicking && mouseDown && mouseX >= xScroll && mouseY >= yScroll && mouseX < scrollWidth && mouseY < scrollHeight)
|
||||
{
|
||||
if (!this.wasClicking
|
||||
&& mouseDown
|
||||
&& mouseX >= xScroll
|
||||
&& mouseY >= yScroll
|
||||
&& mouseX < scrollWidth
|
||||
&& mouseY < scrollHeight) {
|
||||
this.isScrolling = true;
|
||||
}
|
||||
|
||||
if (!mouseDown)
|
||||
{
|
||||
if (!mouseDown) {
|
||||
this.isScrolling = false;
|
||||
}
|
||||
|
||||
if (wasClicking && !isScrolling && slotPos != prevSlotPos)
|
||||
{
|
||||
if (wasClicking && !isScrolling && slotPos != prevSlotPos) {
|
||||
prevSlotPos = slotPos;
|
||||
}
|
||||
|
||||
this.wasClicking = mouseDown;
|
||||
|
||||
if (this.isScrolling)
|
||||
{
|
||||
if (this.isScrolling) {
|
||||
this.currentScroll = (mouseY - yScroll - 7.5F) / (scrollHeight - yScroll - 15.0F);
|
||||
|
||||
if (this.currentScroll < 0.0F)
|
||||
{
|
||||
if (this.currentScroll < 0.0F) {
|
||||
this.currentScroll = 0.0F;
|
||||
}
|
||||
|
||||
if (this.currentScroll > 1.0F)
|
||||
{
|
||||
if (this.currentScroll > 1.0F) {
|
||||
this.currentScroll = 1.0F;
|
||||
}
|
||||
|
||||
int s = ((SmelteryContainer) this.inventorySlots).scrollTo(this.currentScroll);
|
||||
if (s != -1)
|
||||
slotPos = s;
|
||||
if (s != -1) slotPos = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
int baseX = 86 + (columns - 3) * 22;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Smeltery"), baseX, 5, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), baseX + 4, (ySize - 96) + 2, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"), baseX + 4, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
int cornerX = (width - xSize) / 2 + 36 + (columns - 3) * 22;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
int[] fluidHeights = calcLiquidHeights();
|
||||
int base = 0;
|
||||
for (int i = 0; i < fluidHeights.length; i++)
|
||||
{
|
||||
for (int i = 0; i < fluidHeights.length; i++) {
|
||||
int leftX = cornerX + 54;
|
||||
int topY = (cornerY + 68) - fluidHeights[i] - base;
|
||||
|
||||
if (mouseX >= leftX && mouseX <= leftX + 52 && mouseY >= topY && mouseY < topY + fluidHeights[i])
|
||||
{
|
||||
if (mouseX >= leftX && mouseX <= leftX + 52 && mouseY >= topY && mouseY < topY + fluidHeights[i]) {
|
||||
drawFluidStackTooltip(logic.moltenMetal.get(i), mouseX - cornerX + 36, mouseY - cornerY, false);
|
||||
}
|
||||
base += fluidHeights[i];
|
||||
}
|
||||
|
||||
// lava/fuel
|
||||
if (logic.fuelGague > 0)
|
||||
{
|
||||
if (logic.fuelGague > 0) {
|
||||
int leftX = cornerX + 117;
|
||||
int topY = (cornerY + 68) - logic.getScaledFuelGague(52);
|
||||
int sizeX = 12;
|
||||
int sizeY = logic.getScaledFuelGague(52);
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY) {
|
||||
drawFluidStackTooltip(logic.getFuel(), mouseX - cornerX + 36, mouseY - cornerY, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/smeltery.png");
|
||||
private static final ResourceLocation backgroundSide = new ResourceLocation("tinker", "textures/gui/smelteryside.png");
|
||||
private static final ResourceLocation backgroundSide =
|
||||
new ResourceLocation("tinker", "textures/gui/smelteryside.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY)
|
||||
{
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2 + 36 + (columns - 3) * 22;
|
||||
@@ -167,44 +151,43 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
|
||||
// Fuel - Lava
|
||||
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
if (logic.fuelGague > 0)
|
||||
{
|
||||
if (logic.fuelGague > 0) {
|
||||
FluidStack fuelStack = logic.getFuel();
|
||||
IIcon lavaIcon = fuelStack.getFluid().getStillIcon();
|
||||
if(lavaIcon == null)
|
||||
lavaIcon = Blocks.lava.getIcon(0, 0);
|
||||
if (lavaIcon == null) lavaIcon = Blocks.lava.getIcon(0, 0);
|
||||
int fuel = logic.getScaledFuelGague(52);
|
||||
int count = 0;
|
||||
while (fuel > 0)
|
||||
{
|
||||
while (fuel > 0) {
|
||||
int size = fuel >= 16 ? 16 : fuel;
|
||||
fuel -= size;
|
||||
drawLiquidRect(cornerX + 117, (cornerY + 68) - size - 16 * count, lavaIcon, 12, size, fuelStack.getFluid().getColor(fuelStack));
|
||||
drawLiquidRect(
|
||||
cornerX + 117,
|
||||
(cornerY + 68) - size - 16 * count,
|
||||
lavaIcon,
|
||||
12,
|
||||
size,
|
||||
fuelStack.getFluid().getColor(fuelStack));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (logic.getCapacity() > 0)
|
||||
{
|
||||
if (logic.getCapacity() > 0) {
|
||||
// Liquids - molten metal
|
||||
int base = 0;
|
||||
int[] fluidHeights = calcLiquidHeights();
|
||||
|
||||
// render the fluids
|
||||
int basePos = 54;
|
||||
for (int i = 0; i < logic.moltenMetal.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < logic.moltenMetal.size(); i++) {
|
||||
FluidStack liquid = logic.moltenMetal.get(i);
|
||||
IIcon icon = liquid.getFluid().getStillIcon();
|
||||
int color = liquid.getFluid().getColor(liquid);
|
||||
|
||||
if (icon == null)
|
||||
continue;
|
||||
if (icon == null) continue;
|
||||
|
||||
int height = fluidHeights[i];
|
||||
int h = height;
|
||||
while (h > 0)
|
||||
{
|
||||
while (h > 0) {
|
||||
int v = Math.min(16, h);
|
||||
// we render in 16x16 squares so the texture doesn't get distorted
|
||||
drawLiquidRect(cornerX + basePos + 00, (cornerY + 68) - h - base, icon, 16, v, color);
|
||||
@@ -227,15 +210,12 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
int xleft = 46;
|
||||
xleft += 22 * (columns - 3); // we have to shift the whole thing to the left if we have more than 3 columns
|
||||
int h = smelterySize / columns;
|
||||
if (smelterySize % columns != 0)
|
||||
h++;
|
||||
if (smelterySize % columns != 0) h++;
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(backgroundSide);
|
||||
if (smelterySize > 0)
|
||||
{
|
||||
if (h >= 8)
|
||||
{
|
||||
if (smelterySize > 0) {
|
||||
if (h >= 8) {
|
||||
// standard 3 slots
|
||||
drawTexturedModalRect(cornerX - xleft, cornerY, 0, 0, 72, ySize - 8);
|
||||
// additional slots
|
||||
@@ -250,11 +230,8 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
if (isScrolling || (mouseX >= sx && mouseX <= sx + 12 && mouseY >= sy && mouseY <= sy + 15))
|
||||
drawTexturedModalRect(sx, sy, 122, 0, 12, 15);
|
||||
// scroll bar
|
||||
else
|
||||
drawTexturedModalRect(sx, sy, 98, 0, 12, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
else drawTexturedModalRect(sx, sy, 98, 0, 12, 15);
|
||||
} else {
|
||||
int yd = 43 + 18 * (h - 3);
|
||||
// slots
|
||||
// standard 3 slots
|
||||
@@ -279,36 +256,41 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
xleft -= 8;
|
||||
// Temperature
|
||||
int slotSize = smelterySize;
|
||||
if (slotSize > columns * maxRows)
|
||||
slotSize = columns * maxRows;
|
||||
if (slotSize > columns * maxRows) slotSize = columns * maxRows;
|
||||
int iter;
|
||||
for (iter = 0; iter < slotSize && iter + slotPos * columns < smelterySize; iter++)
|
||||
{
|
||||
for (iter = 0; iter < slotSize && iter + slotPos * columns < smelterySize; iter++) {
|
||||
int slotTemp = logic.getTempForSlot(iter + slotPos * columns) - 20;
|
||||
int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * columns) - 20;
|
||||
if (slotTemp > 0 && maxTemp > 0)
|
||||
{
|
||||
if (slotTemp > 0 && maxTemp > 0) {
|
||||
int size = 16 * slotTemp / maxTemp + 1;
|
||||
drawTexturedModalRect(cornerX - xleft + (iter % columns * 22), cornerY + 8 + (iter / columns * 18) + 16 - size, 98, 15 + 16 - size, 5, size);
|
||||
drawTexturedModalRect(
|
||||
cornerX - xleft + (iter % columns * 22),
|
||||
cornerY + 8 + (iter / columns * 18) + 16 - size,
|
||||
98,
|
||||
15 + 16 - size,
|
||||
5,
|
||||
size);
|
||||
}
|
||||
}
|
||||
|
||||
// hide nonexistant slots
|
||||
int maxSlots = Math.min(maxRows, h) * columns;
|
||||
for (; iter < maxSlots; iter++)
|
||||
{
|
||||
drawTexturedModalRect(cornerX - xleft + (iter % columns * 22) - 1, cornerY + 8 + (iter / columns * 18) - 1, 98, 47, 22, 18);
|
||||
for (; iter < maxSlots; iter++) {
|
||||
drawTexturedModalRect(
|
||||
cornerX - xleft + (iter % columns * 22) - 1,
|
||||
cornerY + 8 + (iter / columns * 18) - 1,
|
||||
98,
|
||||
47,
|
||||
22,
|
||||
18);
|
||||
}
|
||||
}
|
||||
|
||||
protected int[] calcLiquidHeights ()
|
||||
{
|
||||
protected int[] calcLiquidHeights() {
|
||||
int fluidHeights[] = new int[logic.moltenMetal.size()];
|
||||
int cap = logic.getCapacity();
|
||||
if (logic.getTotalLiquid() > cap)
|
||||
cap = logic.getTotalLiquid();
|
||||
for (int i = 0; i < logic.moltenMetal.size(); i++)
|
||||
{
|
||||
if (logic.getTotalLiquid() > cap) cap = logic.getTotalLiquid();
|
||||
for (int i = 0; i < logic.moltenMetal.size(); i++) {
|
||||
FluidStack liquid = logic.moltenMetal.get(i);
|
||||
|
||||
float h = (float) liquid.amount / (float) cap;
|
||||
@@ -317,36 +299,30 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
|
||||
// check if we have enough height to render everything
|
||||
int sum = 0;
|
||||
do
|
||||
{
|
||||
do {
|
||||
sum = 0;
|
||||
int biggest = -1;
|
||||
int m = 0;
|
||||
for (int i = 0; i < fluidHeights.length; i++)
|
||||
{
|
||||
for (int i = 0; i < fluidHeights.length; i++) {
|
||||
sum += fluidHeights[i];
|
||||
if (logic.moltenMetal.get(i).amount > biggest)
|
||||
{
|
||||
if (logic.moltenMetal.get(i).amount > biggest) {
|
||||
biggest = logic.moltenMetal.get(i).amount;
|
||||
m = i;
|
||||
}
|
||||
}
|
||||
|
||||
// remove a pixel from the biggest one
|
||||
if (sum > 52)
|
||||
fluidHeights[m]--;
|
||||
if (sum > 52) fluidHeights[m]--;
|
||||
} while (sum > 52);
|
||||
|
||||
return fluidHeights;
|
||||
}
|
||||
|
||||
protected void drawFluidStackTooltip (FluidStack par1ItemStack, int par2, int par3, boolean fuel)
|
||||
{
|
||||
protected void drawFluidStackTooltip(FluidStack par1ItemStack, int par2, int par3, boolean fuel) {
|
||||
this.zLevel = 100;
|
||||
List list = getLiquidTooltip(par1ItemStack, this.mc.gameSettings.advancedItemTooltips, fuel);
|
||||
|
||||
for (int k = 0; k < list.size(); ++k)
|
||||
{
|
||||
for (int k = 0; k < list.size(); ++k) {
|
||||
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||
}
|
||||
|
||||
@@ -354,83 +330,56 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
this.zLevel = 0;
|
||||
}
|
||||
|
||||
public List getLiquidTooltip (FluidStack liquid, boolean advanced, boolean fuel)
|
||||
{
|
||||
public List getLiquidTooltip(FluidStack liquid, boolean advanced, boolean fuel) {
|
||||
ArrayList list = new ArrayList();
|
||||
if (fuel)
|
||||
{
|
||||
if (fuel) {
|
||||
list.add("\u00A7f" + StatCollector.translateToLocal("gui.smeltery.fuel"));
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
String name = liquid.getFluid().getLocalizedName(liquid);
|
||||
list.add("\u00A7f" + name);
|
||||
if (name.equals(StatCollector.translateToLocal("fluid.emerald.liquid")))
|
||||
{
|
||||
if (name.equals(StatCollector.translateToLocal("fluid.emerald.liquid"))) {
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.emerald") + liquid.amount / 640f);
|
||||
}
|
||||
else if (name.equals(StatCollector.translateToLocal("fluid.quartz.molten")))
|
||||
{
|
||||
} else if (name.equals(StatCollector.translateToLocal("fluid.quartz.molten"))) {
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.quartz") + liquid.amount / 250f);
|
||||
}
|
||||
else if (name.equals(StatCollector.translateToLocal("fluid.glass.molten")))
|
||||
{
|
||||
} else if (name.equals(StatCollector.translateToLocal("fluid.glass.molten"))) {
|
||||
int blocks = liquid.amount / 1000;
|
||||
if (blocks > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + blocks);
|
||||
if (blocks > 0) list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + blocks);
|
||||
int panels = (liquid.amount % 1000) / 250;
|
||||
if (panels > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.glass.pannel") + panels);
|
||||
if (panels > 0) list.add(StatCollector.translateToLocal("gui.smeltery.glass.pannel") + panels);
|
||||
int mB = (liquid.amount % 1000) % 250;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else if (name.equals(StatCollector.translateToLocal("fluid.stone.seared")))
|
||||
{
|
||||
if (mB > 0) list.add("mB: " + mB);
|
||||
} else if (name.equals(StatCollector.translateToLocal("fluid.stone.seared"))) {
|
||||
int blocks = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (blocks > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + blocks);
|
||||
int ingots = (liquid.amount % TConstruct.ingotLiquidValue) / (TConstruct.ingotLiquidValue/4);
|
||||
if (ingots > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.metal.ingot") + ingots);
|
||||
int mB = (liquid.amount % TConstruct.ingotLiquidValue) % (TConstruct.ingotLiquidValue/4);
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else if (isMolten(name))
|
||||
{
|
||||
if (blocks > 0) list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + blocks);
|
||||
int ingots = (liquid.amount % TConstruct.ingotLiquidValue) / (TConstruct.ingotLiquidValue / 4);
|
||||
if (ingots > 0) list.add(StatCollector.translateToLocal("gui.smeltery.metal.ingot") + ingots);
|
||||
int mB = (liquid.amount % TConstruct.ingotLiquidValue) % (TConstruct.ingotLiquidValue / 4);
|
||||
if (mB > 0) list.add("mB: " + mB);
|
||||
} else if (isMolten(name)) {
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.metal.ingot") + ingots);
|
||||
if (ingots > 0) list.add(StatCollector.translateToLocal("gui.smeltery.metal.ingot") + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
{
|
||||
if (mB > 0) {
|
||||
int nuggets = mB / TConstruct.nuggetLiquidValue;
|
||||
int junk = (mB % TConstruct.nuggetLiquidValue);
|
||||
if (nuggets > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.metal.nugget") + nuggets);
|
||||
if (junk > 0)
|
||||
list.add("mB: " + junk);
|
||||
if (nuggets > 0) list.add(StatCollector.translateToLocal("gui.smeltery.metal.nugget") + nuggets);
|
||||
if (junk > 0) list.add("mB: " + junk);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private boolean isMolten (String fluidName)
|
||||
{
|
||||
private boolean isMolten(String fluidName) {
|
||||
boolean molten = false;
|
||||
String[] moltenNames = StatCollector.translateToLocal("gui.smeltery.molten.check").split(",");
|
||||
String[] moltenNames =
|
||||
StatCollector.translateToLocal("gui.smeltery.molten.check").split(",");
|
||||
|
||||
for (int i = 0; i < moltenNames.length; i++)
|
||||
{
|
||||
if (fluidName.contains(moltenNames[i].trim()))
|
||||
{
|
||||
for (int i = 0; i < moltenNames.length; i++) {
|
||||
if (fluidName.contains(moltenNames[i].trim())) {
|
||||
molten = true;
|
||||
break;
|
||||
}
|
||||
@@ -439,10 +388,8 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
return molten;
|
||||
}
|
||||
|
||||
protected void drawToolTip (List par1List, int par2, int par3)
|
||||
{
|
||||
if (!par1List.isEmpty())
|
||||
{
|
||||
protected void drawToolTip(List par1List, int par2, int par3) {
|
||||
if (!par1List.isEmpty()) {
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
@@ -450,13 +397,11 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
int k = 0;
|
||||
Iterator iterator = par1List.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
while (iterator.hasNext()) {
|
||||
String s = (String) iterator.next();
|
||||
int l = this.fontRendererObj.getStringWidth(s);
|
||||
|
||||
if (l > k)
|
||||
{
|
||||
if (l > k) {
|
||||
k = l;
|
||||
}
|
||||
}
|
||||
@@ -465,18 +410,15 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
int j1 = par3 - 12;
|
||||
int k1 = 8;
|
||||
|
||||
if (par1List.size() > 1)
|
||||
{
|
||||
if (par1List.size() > 1) {
|
||||
k1 += 2 + (par1List.size() - 1) * 10;
|
||||
}
|
||||
|
||||
if (i1 + k > this.width)
|
||||
{
|
||||
if (i1 + k > this.width) {
|
||||
i1 -= 28 + k;
|
||||
}
|
||||
|
||||
if (j1 + k1 + 6 > this.height)
|
||||
{
|
||||
if (j1 + k1 + 6 > this.height) {
|
||||
j1 = this.height - k1 - 6;
|
||||
}
|
||||
|
||||
@@ -495,13 +437,11 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
|
||||
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
|
||||
|
||||
for (int k2 = 0; k2 < par1List.size(); ++k2)
|
||||
{
|
||||
for (int k2 = 0; k2 < par1List.size(); ++k2) {
|
||||
String s1 = (String) par1List.get(k2);
|
||||
this.fontRendererObj.drawStringWithShadow(s1, i1, j1, -1);
|
||||
|
||||
if (k2 == 0)
|
||||
{
|
||||
if (k2 == 0) {
|
||||
j1 += 2;
|
||||
}
|
||||
|
||||
@@ -514,8 +454,7 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLiquidRect (int startU, int startV, IIcon icon, int endU, int endV, int color)
|
||||
{
|
||||
public void drawLiquidRect(int startU, int startV, IIcon icon, int endU, int endV, int color) {
|
||||
float top = icon.getInterpolatedV(16 - endV);
|
||||
float bottom = icon.getMaxV();
|
||||
float left = icon.getMinU();
|
||||
@@ -523,16 +462,15 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_I(color);
|
||||
tessellator.addVertexWithUV(startU + 0, startV + endV, this.zLevel, left, bottom);//Bottom left
|
||||
tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, right, bottom);//Bottom right
|
||||
tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, right, top);//Top right
|
||||
tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, left, top); //Top left
|
||||
tessellator.addVertexWithUV(startU + 0, startV + endV, this.zLevel, left, bottom); // Bottom left
|
||||
tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, right, bottom); // Bottom right
|
||||
tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, right, top); // Top right
|
||||
tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, left, top); // Top left
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked (int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
int cornerX = (width - xSize) / 2 + 36 + (columns - 3) * 22;
|
||||
@@ -541,16 +479,20 @@ public class SmelteryGui extends ActiveContainerGui
|
||||
|
||||
int[] fluidHeights = calcLiquidHeights();
|
||||
int base = 0;
|
||||
for(int i = 0; i < fluidHeights.length; i++)
|
||||
{
|
||||
for (int i = 0; i < fluidHeights.length; i++) {
|
||||
int leftX = cornerX + 54;
|
||||
int topY = (cornerY + 68) - fluidHeights[i] - base;
|
||||
|
||||
if (mouseX >= leftX && mouseX <= leftX + 52 && mouseY >= topY && mouseY < topY + fluidHeights[i])
|
||||
{
|
||||
if (mouseX >= leftX && mouseX <= leftX + 52 && mouseY >= topY && mouseY < topY + fluidHeights[i]) {
|
||||
fluidToBeBroughtUp = logic.moltenMetal.get(i).getFluidID();
|
||||
|
||||
TConstruct.packetPipeline.sendToServer(new SmelteryPacket(logic.getWorldObj().provider.dimensionId, logic.xCoord, logic.yCoord, logic.zCoord, this.isShiftKeyDown(), fluidToBeBroughtUp));
|
||||
TConstruct.packetPipeline.sendToServer(new SmelteryPacket(
|
||||
logic.getWorldObj().provider.dimensionId,
|
||||
logic.xCoord,
|
||||
logic.yCoord,
|
||||
logic.zCoord,
|
||||
this.isShiftKeyDown(),
|
||||
fluidToBeBroughtUp));
|
||||
}
|
||||
base += fluidHeights[i];
|
||||
}
|
||||
|
||||
@@ -4,22 +4,18 @@ import java.util.*;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
public class ActiveContainer extends Container
|
||||
{
|
||||
public class ActiveContainer extends Container {
|
||||
public List<ActiveSlot> activeInventorySlots = new ArrayList<ActiveSlot>();
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected ActiveSlot addDualSlotToContainer (ActiveSlot slot)
|
||||
{
|
||||
protected ActiveSlot addDualSlotToContainer(ActiveSlot slot) {
|
||||
slot.activeSlotNumber = this.activeInventorySlots.size();
|
||||
this.activeInventorySlots.add(slot);
|
||||
this.addSlotToContainer(slot);
|
||||
return slot;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,24 +2,20 @@ package tconstruct.smeltery.inventory;
|
||||
|
||||
import net.minecraft.inventory.*;
|
||||
|
||||
public class ActiveSlot extends Slot
|
||||
{
|
||||
public class ActiveSlot extends Slot {
|
||||
protected boolean active;
|
||||
public int activeSlotNumber;
|
||||
|
||||
public ActiveSlot(IInventory iinventory, int par2, int par3, int par4, boolean flag)
|
||||
{
|
||||
public ActiveSlot(IInventory iinventory, int par2, int par3, int par4, boolean flag) {
|
||||
super(iinventory, par2, par3, par4);
|
||||
active = flag;
|
||||
}
|
||||
|
||||
public void setActive (boolean flag)
|
||||
{
|
||||
public void setActive(boolean flag) {
|
||||
active = flag;
|
||||
}
|
||||
|
||||
public boolean getActive ()
|
||||
{
|
||||
public boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.gui.SmelteryGui;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
|
||||
public class SmelteryContainer extends ActiveContainer
|
||||
{
|
||||
public class SmelteryContainer extends ActiveContainer {
|
||||
public SmelteryLogic logic;
|
||||
public InventoryPlayer playerInv;
|
||||
public int fuel = 0;
|
||||
@@ -17,8 +16,7 @@ public class SmelteryContainer extends ActiveContainer
|
||||
public int columns;
|
||||
public final int smelterySize;
|
||||
|
||||
public SmelteryContainer(InventoryPlayer inventoryplayer, SmelteryLogic smeltery)
|
||||
{
|
||||
public SmelteryContainer(InventoryPlayer inventoryplayer, SmelteryLogic smeltery) {
|
||||
logic = smeltery;
|
||||
playerInv = inventoryplayer;
|
||||
slotRow = 0;
|
||||
@@ -31,47 +29,38 @@ public class SmelteryContainer extends ActiveContainer
|
||||
int totalSlots = smeltery.getBlockCapacity();
|
||||
int y = 0;
|
||||
|
||||
for (int i = 0; i < totalSlots; i++)
|
||||
{
|
||||
for (int i = 0; i < totalSlots; i++) {
|
||||
int x = i % columns;
|
||||
this.addDualSlotToContainer(new ActiveSlot(smeltery, x + y * columns, 2 + x * 22, 8 + y * 18, y < 8));
|
||||
if (x == columns - 1)
|
||||
y++;
|
||||
if (x == columns - 1) y++;
|
||||
}
|
||||
|
||||
|
||||
int baseX = 90 + (columns - 3) * 22;
|
||||
|
||||
/* Player inventory */
|
||||
for (int row = 0; row < 3; row++)
|
||||
{
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column + row * 9 + 9, baseX + column * 18, 84 + row * 18));
|
||||
for (int row = 0; row < 3; row++) {
|
||||
for (int column = 0; column < 9; column++) {
|
||||
this.addSlotToContainer(
|
||||
new Slot(inventoryplayer, column + row * 9 + 9, baseX + column * 18, 84 + row * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
for (int column = 0; column < 9; column++) {
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, baseX + column * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
public int updateRows (int invRow)
|
||||
{
|
||||
if (invRow != slotRow)
|
||||
{
|
||||
public int updateRows(int invRow) {
|
||||
if (invRow != slotRow) {
|
||||
slotRow = invRow;
|
||||
// TConstruct.logger.info(invRow);
|
||||
int basePos = invRow * columns;
|
||||
for (int iter = 0; iter < activeInventorySlots.size(); iter++)
|
||||
{
|
||||
for (int iter = 0; iter < activeInventorySlots.size(); iter++) {
|
||||
ActiveSlot slot = (ActiveSlot) activeInventorySlots.get(iter);
|
||||
if (slot.activeSlotNumber >= basePos && slot.activeSlotNumber < basePos + columns * SmelteryGui.maxRows)
|
||||
{
|
||||
if (slot.activeSlotNumber >= basePos
|
||||
&& slot.activeSlotNumber < basePos + columns * SmelteryGui.maxRows) {
|
||||
slot.setActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
slot.setActive(false);
|
||||
}
|
||||
|
||||
@@ -85,22 +74,20 @@ public class SmelteryContainer extends ActiveContainer
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int scrollTo (float scrollPos)
|
||||
{
|
||||
public int scrollTo(float scrollPos) {
|
||||
int slots = SmelteryGui.maxRows * columns;
|
||||
float total = (logic.getSizeInventory() - slots) / columns;
|
||||
if ((logic.getSizeInventory() - slots) % columns != 0)
|
||||
total++;
|
||||
if ((logic.getSizeInventory() - slots) % columns != 0) total++;
|
||||
int rowPos = Math.round(total * scrollPos);
|
||||
return updateRows(rowPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges () // TODO: Sync with this
|
||||
{
|
||||
// we only update if the size is the same, since the screen is getting closed on sizechange and would cause a crash otherwise
|
||||
if(smelterySize == this.inventorySlots.size())
|
||||
super.detectAndSendChanges();
|
||||
public void detectAndSendChanges() // TODO: Sync with this
|
||||
{
|
||||
// we only update if the size is the same, since the screen is getting closed on sizechange and would cause a
|
||||
// crash otherwise
|
||||
if (smelterySize == this.inventorySlots.size()) super.detectAndSendChanges();
|
||||
/*
|
||||
* for (int i = 0; i < crafters.size(); i++) { ICrafting icrafting =
|
||||
* (ICrafting)crafters.get(i); if (progress != logic.progress) {
|
||||
@@ -108,17 +95,15 @@ public class SmelteryContainer extends ActiveContainer
|
||||
* != logic.fuel) { icrafting.sendProgressBarUpdate(this, 1,
|
||||
* logic.fuel); } if (fuelGague != logic.fuelGague) {
|
||||
* icrafting.sendProgressBarUpdate(this, 2, logic.fuelGague); } }
|
||||
*
|
||||
*
|
||||
* progress = logic.progress; fuel = logic.fuel; fuelGague =
|
||||
* logic.fuelGague;
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar (int id, int value)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
public void updateProgressBar(int id, int value) {
|
||||
if (id == 0) {
|
||||
logic.fuelGague = value;
|
||||
}
|
||||
/*
|
||||
@@ -130,43 +115,32 @@ public class SmelteryContainer extends ActiveContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
Block block = logic.getWorldObj().getBlock(logic.xCoord, logic.yCoord, logic.zCoord);
|
||||
if (block != TinkerSmeltery.smeltery && block != TinkerSmeltery.smelteryNether)
|
||||
return false;
|
||||
if (block != TinkerSmeltery.smeltery && block != TinkerSmeltery.smelteryNether) return false;
|
||||
return logic.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < smelterySize)
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
if (slotID < smelterySize) {
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, smelterySize, false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(slotStack, 0, smelterySize, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
if (slotStack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
@@ -175,14 +149,12 @@ public class SmelteryContainer extends ActiveContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean mergeItemStack (ItemStack inputStack, int startSlot, int endSlot, boolean flag)
|
||||
{
|
||||
protected boolean mergeItemStack(ItemStack inputStack, int startSlot, int endSlot, boolean flag) {
|
||||
// TConstruct.logger.info("Merge");
|
||||
boolean merged = false;
|
||||
int slotPos = startSlot;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
slotPos = endSlot - 1;
|
||||
}
|
||||
|
||||
@@ -195,11 +167,11 @@ public class SmelteryContainer extends ActiveContainer
|
||||
* (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag &&
|
||||
* slotPos >= startSlot)) { slot = (Slot)
|
||||
* this.inventorySlots.get(slotPos); slotStack = slot.getStack();
|
||||
*
|
||||
*
|
||||
* if (slotStack != null && ItemStack.areItemStacksEqual(inputStack,
|
||||
* slotStack) && !inputStack.getHasSubtypes()) { int totalSize =
|
||||
* slotStack.stackSize + inputStack.stackSize;
|
||||
*
|
||||
*
|
||||
* if (totalSize <= inputStack.getMaxStackSize()) { inputStack.stackSize
|
||||
* = 0; slotStack.stackSize = totalSize; slot.onSlotChanged(); merged =
|
||||
* true; } else if (slotStack.stackSize < inputStack.getMaxStackSize())
|
||||
@@ -207,30 +179,26 @@ public class SmelteryContainer extends ActiveContainer
|
||||
* slotStack.stackSize; slotStack.stackSize =
|
||||
* inputStack.getMaxStackSize(); slot.onSlotChanged(); merged = true; }
|
||||
* }
|
||||
*
|
||||
*
|
||||
* if (flag) { --slotPos; } else { ++slotPos; } } }
|
||||
*/
|
||||
|
||||
if (inputStack.isStackable() && startSlot >= logic.getSizeInventory())
|
||||
{
|
||||
while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot))
|
||||
{
|
||||
if (inputStack.isStackable() && startSlot >= logic.getSizeInventory()) {
|
||||
while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot)) {
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack != null && slotStack.isItemEqual(inputStack) && ItemStack.areItemStackTagsEqual(slotStack, inputStack))
|
||||
{
|
||||
if (slotStack != null
|
||||
&& slotStack.isItemEqual(inputStack)
|
||||
&& ItemStack.areItemStackTagsEqual(slotStack, inputStack)) {
|
||||
int l = slotStack.stackSize + inputStack.stackSize;
|
||||
|
||||
if (l <= inputStack.getMaxStackSize())
|
||||
{
|
||||
if (l <= inputStack.getMaxStackSize()) {
|
||||
inputStack.stackSize = 0;
|
||||
slotStack.stackSize = l;
|
||||
slot.onSlotChanged();
|
||||
merged = true;
|
||||
}
|
||||
else if (slotStack.stackSize < inputStack.getMaxStackSize())
|
||||
{
|
||||
} else if (slotStack.stackSize < inputStack.getMaxStackSize()) {
|
||||
inputStack.stackSize -= inputStack.getMaxStackSize() - slotStack.stackSize;
|
||||
slotStack.stackSize = inputStack.getMaxStackSize();
|
||||
slot.onSlotChanged();
|
||||
@@ -238,35 +206,26 @@ public class SmelteryContainer extends ActiveContainer
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
--slotPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
++slotPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inputStack.stackSize > 0)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
if (inputStack.stackSize > 0) {
|
||||
if (flag) {
|
||||
slotPos = endSlot - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
slotPos = startSlot;
|
||||
}
|
||||
|
||||
while (!flag && slotPos < endSlot || flag && slotPos >= startSlot)
|
||||
{
|
||||
while (!flag && slotPos < endSlot || flag && slotPos >= startSlot) {
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack == null)
|
||||
{
|
||||
if (slotStack == null) {
|
||||
slot.putStack(inputStack.copy());
|
||||
slot.onSlotChanged();
|
||||
inputStack.stackSize -= 1;
|
||||
@@ -274,12 +233,9 @@ public class SmelteryContainer extends ActiveContainer
|
||||
break;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
--slotPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
++slotPos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,12 @@ package tconstruct.smeltery.itemblocks;
|
||||
import mantle.blocks.abstracts.MultiItemBlock;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class CastingChannelItem extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "Channel" };
|
||||
public class CastingChannelItem extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {"Channel"};
|
||||
|
||||
public CastingChannelItem(Block b)
|
||||
{
|
||||
public CastingChannelItem(Block b) {
|
||||
super(b, "Smeltery", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,57 +7,44 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class GlassBlockItem extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "pure" };// , "soul",
|
||||
// "soul.pure" };
|
||||
public class GlassBlockItem extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {"pure"}; // , "soul",
|
||||
// "soul.pure" };
|
||||
|
||||
public GlassBlockItem(Block b)
|
||||
{
|
||||
public GlassBlockItem(Block b) {
|
||||
super(b, "block.glass", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.hasTagCompound() && stack.getItemDamage() == 0)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (stack.hasTagCompound() && stack.getItemDamage() == 0) {
|
||||
NBTTagCompound contentTags = stack.getTagCompound().getCompoundTag("Contents");
|
||||
if (contentTags != null)
|
||||
{
|
||||
if (contentTags != null) {
|
||||
ItemStack contents = ItemStack.loadItemStackFromNBT(contentTags);
|
||||
if (contents != null)
|
||||
{
|
||||
if (contents != null) {
|
||||
list.add("Inventory: " + contents.getDisplayName());
|
||||
list.add("Amount: " + contents.stackSize);
|
||||
}
|
||||
}
|
||||
NBTTagCompound camoTag = stack.getTagCompound().getCompoundTag("Camoflauge");
|
||||
if (camoTag != null)
|
||||
{
|
||||
if (camoTag != null) {
|
||||
ItemStack camo = ItemStack.loadItemStackFromNBT(camoTag);
|
||||
if (camo != null)
|
||||
list.add("Camoflauge: " + camo.getDisplayName());
|
||||
if (camo != null) list.add("Camoflauge: " + camo.getDisplayName());
|
||||
}
|
||||
|
||||
if (stack.getTagCompound().hasKey("Placement"))
|
||||
{
|
||||
if (stack.getTagCompound().hasKey("Placement")) {
|
||||
String string = getDirectionString(stack.getTagCompound().getByte("Placement"));
|
||||
list.add("Placement Direction: " + string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String getDirectionString (byte key)
|
||||
{
|
||||
if (key == 0)
|
||||
return ("Up");
|
||||
if (key == 1)
|
||||
return ("Right");
|
||||
if (key == 2)
|
||||
return ("Down");
|
||||
String getDirectionString(byte key) {
|
||||
if (key == 0) return ("Up");
|
||||
if (key == 1) return ("Right");
|
||||
if (key == 2) return ("Down");
|
||||
|
||||
return "Left";
|
||||
}
|
||||
|
||||
@@ -3,15 +3,12 @@ package tconstruct.smeltery.itemblocks;
|
||||
import mantle.blocks.abstracts.MultiItemBlock;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class GlassPaneItem extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "pure", "soul", "soul.pure" };
|
||||
public class GlassPaneItem extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {"pure", "soul", "soul.pure"};
|
||||
|
||||
public GlassPaneItem(Block b)
|
||||
{
|
||||
public GlassPaneItem(Block b) {
|
||||
super(b, "block.glass", "pane", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package tconstruct.smeltery.itemblocks;
|
||||
|
||||
import java.util.List;
|
||||
import mantle.blocks.abstracts.MultiItemBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -10,33 +11,25 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import tconstruct.smeltery.logic.LavaTankLogic;
|
||||
|
||||
import java.util.List;
|
||||
public class LavaTankItemBlock extends MultiItemBlock implements IFluidContainerItem {
|
||||
public static final String blockTypes[] = {"Tank", "Gague", "Window"};
|
||||
|
||||
public class LavaTankItemBlock extends MultiItemBlock implements IFluidContainerItem
|
||||
{
|
||||
public static final String blockTypes[] = { "Tank", "Gague", "Window" };
|
||||
|
||||
public LavaTankItemBlock(Block b)
|
||||
{
|
||||
public LavaTankItemBlock(Block b) {
|
||||
super(b, "LavaTank", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound liquidTag = stack.getTagCompound().getCompoundTag("Fluid");
|
||||
if (liquidTag != null)
|
||||
{
|
||||
list.add(StatCollector.translateToLocal("searedtank1.tooltip") + " " + StatCollector.translateToLocal(liquidTag.getString("FluidName")));
|
||||
if (liquidTag != null) {
|
||||
list.add(StatCollector.translateToLocal("searedtank1.tooltip") + " "
|
||||
+ StatCollector.translateToLocal(liquidTag.getString("FluidName")));
|
||||
list.add(liquidTag.getInteger("Amount") + " mB");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
list.add(StatCollector.translateToLocal("searedtank3.tooltip"));
|
||||
list.add(StatCollector.translateToLocal("searedtank2.tooltip"));
|
||||
}
|
||||
@@ -79,7 +72,6 @@ public class LavaTankItemBlock extends MultiItemBlock implements IFluidContainer
|
||||
container.setTagCompound(nbt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param container
|
||||
* ItemStack which is the fluid container.
|
||||
|
||||
@@ -7,20 +7,19 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class MetalItemBlock extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze", "Tin", "Aluminum", "AlBrass", "Alumite", "Steel", "Ender" };
|
||||
public class MetalItemBlock extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {
|
||||
"Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze", "Tin", "Aluminum", "AlBrass", "Alumite", "Steel", "Ender"
|
||||
};
|
||||
|
||||
public MetalItemBlock(Block b)
|
||||
{
|
||||
public MetalItemBlock(Block b) {
|
||||
super(b, "StorageMetals", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
list.add(StatCollector.translateToLocal("metalblock.tooltip"));
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,13 @@ package tconstruct.smeltery.itemblocks;
|
||||
import mantle.blocks.abstracts.MultiItemBlock;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class SearedSlabItem extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "brick", "stone", "cobble", "paver", "road", "fancy", "square", "creeper" };
|
||||
public class SearedSlabItem extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {"brick", "stone", "cobble", "paver", "road", "fancy", "square", "creeper"
|
||||
};
|
||||
|
||||
public SearedSlabItem(Block b)
|
||||
{
|
||||
public SearedSlabItem(Block b) {
|
||||
super(b, "block.searedstone.slab", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +1,16 @@
|
||||
package tconstruct.smeltery.itemblocks;
|
||||
|
||||
import java.util.List;
|
||||
import mantle.blocks.abstracts.MultiItemBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import java.util.List;
|
||||
public class SearedTableItemBlock extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {"Table", "Faucet", "Basin"};
|
||||
|
||||
public class SearedTableItemBlock extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "Table", "Faucet", "Basin" };
|
||||
|
||||
public SearedTableItemBlock(Block b)
|
||||
{
|
||||
public SearedTableItemBlock(Block b) {
|
||||
super(b, "SearedBlock", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
@@ -34,7 +31,6 @@ public class SearedTableItemBlock extends MultiItemBlock
|
||||
break;
|
||||
}
|
||||
|
||||
if(StatCollector.canTranslate(tooltip))
|
||||
p_77624_3_.add(StatCollector.translateToLocal(tooltip));
|
||||
if (StatCollector.canTranslate(tooltip)) p_77624_3_.add(StatCollector.translateToLocal(tooltip));
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,22 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.achievements.TAchievements;
|
||||
|
||||
public class SmelteryItemBlock extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "Controller", "Drain", "Brick", "Furnace", "Stone", "Cobblestone", "Paver", "Brick.Cracked", "Road", "Brick.Fancy", "Brick.Square" };
|
||||
public class SmelteryItemBlock extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {
|
||||
"Controller",
|
||||
"Drain",
|
||||
"Brick",
|
||||
"Furnace",
|
||||
"Stone",
|
||||
"Cobblestone",
|
||||
"Paver",
|
||||
"Brick.Cracked",
|
||||
"Road",
|
||||
"Brick.Fancy",
|
||||
"Brick.Square"
|
||||
};
|
||||
|
||||
public SmelteryItemBlock(Block b)
|
||||
{
|
||||
public SmelteryItemBlock(Block b) {
|
||||
super(b, "Smeltery", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
@@ -23,30 +33,27 @@ public class SmelteryItemBlock extends MultiItemBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add(StatCollector.translateToLocal("smeltery.controller.tooltip"));
|
||||
break;
|
||||
case 1:
|
||||
list.add(StatCollector.translateToLocal("smeltery.drain.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("smeltery.drain.tooltip2"));
|
||||
break;
|
||||
case 3:
|
||||
list.add(StatCollector.translateToLocal("smeltery.furnace.tooltip"));
|
||||
break;
|
||||
default:
|
||||
list.add(StatCollector.translateToLocal("smeltery.brick.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("smeltery.brick.tooltip2"));
|
||||
break;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case 0:
|
||||
list.add(StatCollector.translateToLocal("smeltery.controller.tooltip"));
|
||||
break;
|
||||
case 1:
|
||||
list.add(StatCollector.translateToLocal("smeltery.drain.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("smeltery.drain.tooltip2"));
|
||||
break;
|
||||
case 3:
|
||||
list.add(StatCollector.translateToLocal("smeltery.furnace.tooltip"));
|
||||
break;
|
||||
default:
|
||||
list.add(StatCollector.translateToLocal("smeltery.brick.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("smeltery.brick.tooltip2"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated (ItemStack item, World world, EntityPlayer player)
|
||||
{
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer player) {
|
||||
TAchievements.triggerAchievement(player, "tconstruct.smelteryMaker");
|
||||
}
|
||||
}
|
||||
@@ -7,24 +7,27 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class SpeedBlockItem extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "brownstone.rough", "brownstone.rough.road", "brownstone.smooth", "brownstone.smooth.brick", "brownstone.smooth.road", "brownstone.smooth.fancy", "brownstone.smooth.chiseled" };
|
||||
public class SpeedBlockItem extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {
|
||||
"brownstone.rough",
|
||||
"brownstone.rough.road",
|
||||
"brownstone.smooth",
|
||||
"brownstone.smooth.brick",
|
||||
"brownstone.smooth.road",
|
||||
"brownstone.smooth.fancy",
|
||||
"brownstone.smooth.chiseled"
|
||||
};
|
||||
|
||||
public SpeedBlockItem(Block b)
|
||||
{
|
||||
public SpeedBlockItem(Block b) {
|
||||
super(b, "block", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
int metadata = stack.getItemDamage();
|
||||
if (metadata == 1 || metadata == 4)
|
||||
list.add(StatCollector.translateToLocal("speedblock1.tooltip"));
|
||||
else
|
||||
list.add(StatCollector.translateToLocal("speedblock2.tooltip"));
|
||||
if (metadata == 1 || metadata == 4) list.add(StatCollector.translateToLocal("speedblock1.tooltip"));
|
||||
else list.add(StatCollector.translateToLocal("speedblock2.tooltip"));
|
||||
}
|
||||
}
|
||||
@@ -7,24 +7,27 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class SpeedSlabItem extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "brownstone.rough", "brownstone.rough.road", "brownstone.smooth", "brownstone.smooth.brick", "brownstone.smooth.road", "brownstone.smooth.fancy", "brownstone.smooth.chiseled" };
|
||||
public class SpeedSlabItem extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {
|
||||
"brownstone.rough",
|
||||
"brownstone.rough.road",
|
||||
"brownstone.smooth",
|
||||
"brownstone.smooth.brick",
|
||||
"brownstone.smooth.road",
|
||||
"brownstone.smooth.fancy",
|
||||
"brownstone.smooth.chiseled"
|
||||
};
|
||||
|
||||
public SpeedSlabItem(Block b)
|
||||
{
|
||||
public SpeedSlabItem(Block b) {
|
||||
super(b, "block", "slab", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
int metadata = stack.getItemDamage() % 8;
|
||||
if (metadata == 1 || metadata == 4)
|
||||
list.add(StatCollector.translateToLocal("speedblock1.tooltip"));
|
||||
else
|
||||
list.add(StatCollector.translateToLocal("speedblock2.tooltip"));
|
||||
if (metadata == 1 || metadata == 4) list.add(StatCollector.translateToLocal("speedblock1.tooltip"));
|
||||
else list.add(StatCollector.translateToLocal("speedblock2.tooltip"));
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,29 @@ package tconstruct.smeltery.itemblocks;
|
||||
import mantle.blocks.abstracts.MultiItemBlock;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class StainedGlassClearItem extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black" };
|
||||
public class StainedGlassClearItem extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {
|
||||
"white",
|
||||
"orange",
|
||||
"magenta",
|
||||
"lightblue",
|
||||
"yellow",
|
||||
"lime",
|
||||
"pink",
|
||||
"gray",
|
||||
"lightgray",
|
||||
"cyan",
|
||||
"purple",
|
||||
"blue",
|
||||
"brown",
|
||||
"green",
|
||||
"red",
|
||||
"black"
|
||||
};
|
||||
|
||||
public StainedGlassClearItem(Block b)
|
||||
{
|
||||
public StainedGlassClearItem(Block b) {
|
||||
super(b, "block.stainedglass", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,15 +3,29 @@ package tconstruct.smeltery.itemblocks;
|
||||
import mantle.blocks.abstracts.MultiItemBlock;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class StainedGlassClearPaneItem extends MultiItemBlock
|
||||
{
|
||||
public static final String blockTypes[] = { "white", "orange", "magenta", "lightblue", "yellow", "lime", "pink", "gray", "lightgray", "cyan", "purple", "blue", "brown", "green", "red", "black" };
|
||||
public class StainedGlassClearPaneItem extends MultiItemBlock {
|
||||
public static final String blockTypes[] = {
|
||||
"white",
|
||||
"orange",
|
||||
"magenta",
|
||||
"lightblue",
|
||||
"yellow",
|
||||
"lime",
|
||||
"pink",
|
||||
"gray",
|
||||
"lightgray",
|
||||
"cyan",
|
||||
"purple",
|
||||
"blue",
|
||||
"brown",
|
||||
"green",
|
||||
"red",
|
||||
"black"
|
||||
};
|
||||
|
||||
public StainedGlassClearPaneItem(Block b)
|
||||
{
|
||||
public StainedGlassClearPaneItem(Block b) {
|
||||
super(b, "block.stainedglass", "pane", blockTypes);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,32 +5,54 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.*;
|
||||
import tconstruct.tools.items.Pattern;
|
||||
|
||||
public class ClayPattern extends Pattern
|
||||
{
|
||||
public class ClayPattern extends Pattern {
|
||||
|
||||
public ClayPattern(String patternType, String folder)
|
||||
{
|
||||
public ClayPattern(String patternType, String folder) {
|
||||
super(patternName, getPatternNames(patternType), folder);
|
||||
}
|
||||
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
protected static String[] getPatternNames(String partType) {
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
if (!(patternName[i].equals("")))
|
||||
names[i] = partType + patternName[i];
|
||||
else
|
||||
names[i] = "";
|
||||
if (!(patternName[i].equals(""))) names[i] = partType + patternName[i];
|
||||
else names[i] = "";
|
||||
return names;
|
||||
}
|
||||
|
||||
private static final String[] patternName = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel", "", "", "", "", "", "", "", "", "fullguard", "", "", "arrowhead", "gem", "nugget" };
|
||||
private static final String[] patternName = new String[] {
|
||||
"ingot",
|
||||
"rod",
|
||||
"pickaxe",
|
||||
"shovel",
|
||||
"axe",
|
||||
"swordblade",
|
||||
"largeguard",
|
||||
"mediumguard",
|
||||
"crossbar",
|
||||
"binding",
|
||||
"frypan",
|
||||
"sign",
|
||||
"knifeblade",
|
||||
"chisel",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"fullguard",
|
||||
"",
|
||||
"",
|
||||
"arrowhead",
|
||||
"gem",
|
||||
"nugget"
|
||||
};
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_)
|
||||
{
|
||||
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_) {
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
if (!(patternName[i].equals("")))
|
||||
p_150895_3_.add(new ItemStack(p_150895_1_, 1, i));
|
||||
if (!(patternName[i].equals(""))) p_150895_3_.add(new ItemStack(p_150895_1_, 1, i));
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,9 @@ import net.minecraftforge.fluids.BlockFluidFinite;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
|
||||
public class FilledBucket extends ItemBucket
|
||||
{
|
||||
public class FilledBucket extends ItemBucket {
|
||||
|
||||
public FilledBucket(Block b)
|
||||
{
|
||||
public FilledBucket(Block b) {
|
||||
super(b);
|
||||
// setTextureFile(TRepo.craftingTexture);
|
||||
// setIconIndex(224);
|
||||
@@ -29,85 +27,73 @@ public class FilledBucket extends ItemBucket
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
float var4 = 1.0F;
|
||||
double trueX = player.prevPosX + (player.posX - player.prevPosX) * (double) var4;
|
||||
double trueY = player.prevPosY + (player.posY - player.prevPosY) * (double) var4 + 1.62D - (double) player.yOffset;
|
||||
double trueY =
|
||||
player.prevPosY + (player.posY - player.prevPosY) * (double) var4 + 1.62D - (double) player.yOffset;
|
||||
double trueZ = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) var4;
|
||||
boolean wannabeFull = false;
|
||||
MovingObjectPosition position = this.getMovingObjectPositionFromPlayer(world, player, wannabeFull);
|
||||
|
||||
if (position == null)
|
||||
{
|
||||
if (position == null) {
|
||||
return stack;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/*
|
||||
* FillBucketEvent event = new FillBucketEvent(player, stack, world,
|
||||
* position); if (MinecraftForge.EVENT_BUS.post(event)) { return
|
||||
* stack; }
|
||||
*
|
||||
*
|
||||
* if (event.getResult() == Event.Result.ALLOW) { if
|
||||
* (player.capabilities.isCreativeMode) { return stack; }
|
||||
*
|
||||
*
|
||||
* if (--stack.stackSize <= 0) { return event.result; }
|
||||
*
|
||||
*
|
||||
* if (!player.inventory.addItemStackToInventory(event.result)) {
|
||||
* player.dropPlayerItem(event.result); }
|
||||
*
|
||||
*
|
||||
* return stack; }
|
||||
*/
|
||||
|
||||
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int clickX = position.blockX;
|
||||
int clickY = position.blockY;
|
||||
int clickZ = position.blockZ;
|
||||
|
||||
if (!world.canMineBlock(player, clickX, clickY, clickZ))
|
||||
{
|
||||
if (!world.canMineBlock(player, clickX, clickY, clickZ)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (position.sideHit == 0)
|
||||
{
|
||||
if (position.sideHit == 0) {
|
||||
--clickY;
|
||||
}
|
||||
|
||||
if (position.sideHit == 1)
|
||||
{
|
||||
if (position.sideHit == 1) {
|
||||
++clickY;
|
||||
}
|
||||
|
||||
if (position.sideHit == 2)
|
||||
{
|
||||
if (position.sideHit == 2) {
|
||||
--clickZ;
|
||||
}
|
||||
|
||||
if (position.sideHit == 3)
|
||||
{
|
||||
if (position.sideHit == 3) {
|
||||
++clickZ;
|
||||
}
|
||||
|
||||
if (position.sideHit == 4)
|
||||
{
|
||||
if (position.sideHit == 4) {
|
||||
--clickX;
|
||||
}
|
||||
|
||||
if (position.sideHit == 5)
|
||||
{
|
||||
if (position.sideHit == 5) {
|
||||
++clickX;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(clickX, clickY, clickZ, position.sideHit, stack))
|
||||
{
|
||||
if (!player.canPlayerEdit(clickX, clickY, clickZ, position.sideHit, stack)) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if (this.tryPlaceContainedLiquid(world, clickX, clickY, clickZ, stack.getItemDamage()) && !player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (this.tryPlaceContainedLiquid(world, clickX, clickY, clickZ, stack.getItemDamage())
|
||||
&& !player.capabilities.isCreativeMode) {
|
||||
return new ItemStack(Items.bucket);
|
||||
}
|
||||
}
|
||||
@@ -116,27 +102,20 @@ public class FilledBucket extends ItemBucket
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryPlaceContainedLiquid (World world, int clickX, int clickY, int clickZ, int type)
|
||||
{
|
||||
if (!WorldHelper.isAirBlock(world, clickX, clickY, clickZ) && world.getBlock(clickX, clickY, clickZ).getMaterial().isSolid())
|
||||
{
|
||||
public boolean tryPlaceContainedLiquid(World world, int clickX, int clickY, int clickZ, int type) {
|
||||
if (!WorldHelper.isAirBlock(world, clickX, clickY, clickZ)
|
||||
&& world.getBlock(clickX, clickY, clickZ).getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if (TinkerSmeltery.fluidBlocks[type] == null)
|
||||
return false;
|
||||
} else {
|
||||
try {
|
||||
if (TinkerSmeltery.fluidBlocks[type] == null) return false;
|
||||
|
||||
int metadata = 0;
|
||||
if (TinkerSmeltery.fluidBlocks[type] instanceof BlockFluidFinite)
|
||||
metadata = 7;
|
||||
if (TinkerSmeltery.fluidBlocks[type] instanceof BlockFluidFinite) metadata = 7;
|
||||
|
||||
world.setBlock(clickX, clickY, clickZ, TinkerSmeltery.fluidBlocks[type], metadata, 3); // TODO: Merge liquids
|
||||
}
|
||||
catch (ArrayIndexOutOfBoundsException ex)
|
||||
{
|
||||
world.setBlock(
|
||||
clickX, clickY, clickZ, TinkerSmeltery.fluidBlocks[type], metadata, 3); // TODO: Merge liquids
|
||||
} catch (ArrayIndexOutOfBoundsException ex) {
|
||||
TConstruct.logger.warn("AIOBE occured when placing bucket into world; " + ex);
|
||||
return false;
|
||||
}
|
||||
@@ -146,41 +125,101 @@ public class FilledBucket extends ItemBucket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < icons.length; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
public void getSubItems(Item b, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < icons.length; i++) list.add(new ItemStack(b, 1, i));
|
||||
}
|
||||
|
||||
public IIcon[] icons;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:materials/bucket_" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, materialNames.length);
|
||||
return getUnlocalizedName() + "." + materialNames[arr];
|
||||
}
|
||||
|
||||
public static final String[] materialNames = new String[] { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Cobalt", "Ardite", "Bronze", "AluBrass", "Manyullyn", "Alumite", "Obsidian", "Steel", "Glass", "Stone", "Villager", "Cow", "Nickel", "Lead", "Silver", "Shiny", "Invar", "Electrum", "Ender", "Slime", "Glue", "PigIron", "Lumium", "Signalum", "Mithril", "Enderium", "Quartz" };
|
||||
public static final String[] materialNames = new String[] {
|
||||
"Iron",
|
||||
"Gold",
|
||||
"Copper",
|
||||
"Tin",
|
||||
"Aluminum",
|
||||
"Cobalt",
|
||||
"Ardite",
|
||||
"Bronze",
|
||||
"AluBrass",
|
||||
"Manyullyn",
|
||||
"Alumite",
|
||||
"Obsidian",
|
||||
"Steel",
|
||||
"Glass",
|
||||
"Stone",
|
||||
"Villager",
|
||||
"Cow",
|
||||
"Nickel",
|
||||
"Lead",
|
||||
"Silver",
|
||||
"Shiny",
|
||||
"Invar",
|
||||
"Electrum",
|
||||
"Ender",
|
||||
"Slime",
|
||||
"Glue",
|
||||
"PigIron",
|
||||
"Lumium",
|
||||
"Signalum",
|
||||
"Mithril",
|
||||
"Enderium",
|
||||
"Quartz"
|
||||
};
|
||||
|
||||
public static final String[] textureNames = new String[] { "iron", "gold", "copper", "tin", "aluminum", "cobalt", "ardite", "bronze", "alubrass", "manyullyn", "alumite", "obsidian", "steel", "glass", "stone", "emerald", "blood", "nickel", "lead", "silver", "shiny", "invar", "electrum", "ender", "slime", "glue", "pigiron", "lumium", "signalum", "mithril", "enderium", "quartz" };
|
||||
public static final String[] textureNames = new String[] {
|
||||
"iron",
|
||||
"gold",
|
||||
"copper",
|
||||
"tin",
|
||||
"aluminum",
|
||||
"cobalt",
|
||||
"ardite",
|
||||
"bronze",
|
||||
"alubrass",
|
||||
"manyullyn",
|
||||
"alumite",
|
||||
"obsidian",
|
||||
"steel",
|
||||
"glass",
|
||||
"stone",
|
||||
"emerald",
|
||||
"blood",
|
||||
"nickel",
|
||||
"lead",
|
||||
"silver",
|
||||
"shiny",
|
||||
"invar",
|
||||
"electrum",
|
||||
"ender",
|
||||
"slime",
|
||||
"glue",
|
||||
"pigiron",
|
||||
"lumium",
|
||||
"signalum",
|
||||
"mithril",
|
||||
"enderium",
|
||||
"quartz"
|
||||
};
|
||||
}
|
||||
@@ -5,32 +5,54 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.*;
|
||||
import tconstruct.tools.items.Pattern;
|
||||
|
||||
public class MetalPattern extends Pattern
|
||||
{
|
||||
public class MetalPattern extends Pattern {
|
||||
|
||||
public MetalPattern(String patternType, String folder)
|
||||
{
|
||||
public MetalPattern(String patternType, String folder) {
|
||||
super(patternName, getPatternNames(patternType), folder);
|
||||
}
|
||||
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
protected static String[] getPatternNames(String partType) {
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
if (!(patternName[i].equals("")))
|
||||
names[i] = partType + patternName[i];
|
||||
else
|
||||
names[i] = "";
|
||||
if (!(patternName[i].equals(""))) names[i] = partType + patternName[i];
|
||||
else names[i] = "";
|
||||
return names;
|
||||
}
|
||||
|
||||
private static final String[] patternName = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "", "", "arrowhead", "gem", "nugget" };
|
||||
private static final String[] patternName = new String[] {
|
||||
"ingot",
|
||||
"rod",
|
||||
"pickaxe",
|
||||
"shovel",
|
||||
"axe",
|
||||
"swordblade",
|
||||
"largeguard",
|
||||
"mediumguard",
|
||||
"crossbar",
|
||||
"binding",
|
||||
"frypan",
|
||||
"sign",
|
||||
"knifeblade",
|
||||
"chisel",
|
||||
"largerod",
|
||||
"toughbinding",
|
||||
"largeplate",
|
||||
"broadaxe",
|
||||
"scythe",
|
||||
"excavator",
|
||||
"largeblade",
|
||||
"hammerhead",
|
||||
"fullguard",
|
||||
"",
|
||||
"",
|
||||
"arrowhead",
|
||||
"gem",
|
||||
"nugget"
|
||||
};
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_)
|
||||
{
|
||||
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List p_150895_3_) {
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
if (!(patternName[i].equals("")))
|
||||
p_150895_3_.add(new ItemStack(p_150895_1_, 1, i));
|
||||
if (!(patternName[i].equals(""))) p_150895_3_.add(new ItemStack(p_150895_1_, 1, i));
|
||||
}
|
||||
}
|
||||
@@ -6,22 +6,18 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.CastingRecipe;
|
||||
import tconstruct.library.event.*;
|
||||
|
||||
public class CastingBasinLogic extends CastingBlockLogic
|
||||
{
|
||||
public CastingBasinLogic()
|
||||
{
|
||||
public class CastingBasinLogic extends CastingBlockLogic {
|
||||
public CastingBasinLogic() {
|
||||
super(TConstructRegistry.getBasinCasting());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmelteryCastEvent getCastingEvent (CastingRecipe recipe, FluidStack metal)
|
||||
{
|
||||
public SmelteryCastEvent getCastingEvent(CastingRecipe recipe, FluidStack metal) {
|
||||
return new SmelteryCastEvent.CastingBasin(recipe, metal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmelteryCastedEvent getCastedEvent (CastingRecipe recipe, ItemStack result)
|
||||
{
|
||||
public SmelteryCastedEvent getCastedEvent(CastingRecipe recipe, ItemStack result) {
|
||||
return new SmelteryCastedEvent.CastingBasin(recipe, result);
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,7 @@ import tconstruct.library.event.*;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.util.IPattern;
|
||||
|
||||
public abstract class CastingBlockLogic extends InventoryLogic implements IFluidTank, IFluidHandler, ISidedInventory
|
||||
{
|
||||
public abstract class CastingBlockLogic extends InventoryLogic implements IFluidTank, IFluidHandler, ISidedInventory {
|
||||
public FluidStack liquid;
|
||||
protected int maxCastingDelay = 0;
|
||||
protected int castingDelay = 0;
|
||||
@@ -31,49 +30,39 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
protected int tick;
|
||||
protected final LiquidCasting liquidCasting;
|
||||
|
||||
public CastingBlockLogic(LiquidCasting casting)
|
||||
{
|
||||
public CastingBlockLogic(LiquidCasting casting) {
|
||||
// input slot and output slot, 1 item in it max
|
||||
super(2, 1);
|
||||
this.liquidCasting = casting;
|
||||
}
|
||||
|
||||
public int updateCapacity () // Only used to initialize
|
||||
{
|
||||
public int updateCapacity() // Only used to initialize
|
||||
{
|
||||
ItemStack inv = inventory[0];
|
||||
int ret = TConstruct.ingotLiquidValue;
|
||||
int rec = liquidCasting.getCastingAmount(this.liquid, inv);
|
||||
|
||||
if (rec > 0)
|
||||
ret = rec;
|
||||
else
|
||||
{
|
||||
if (inv != null && inv.getItem() instanceof IPattern)
|
||||
{
|
||||
if (rec > 0) ret = rec;
|
||||
else {
|
||||
if (inv != null && inv.getItem() instanceof IPattern) {
|
||||
int cost = ((IPattern) inv.getItem()).getPatternCost(inv);
|
||||
if (cost > 0)
|
||||
ret *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5;
|
||||
if (cost > 0) ret *= ((IPattern) inv.getItem()).getPatternCost(inv) * 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int updateCapacity (int capacity)
|
||||
{
|
||||
public int updateCapacity(int capacity) {
|
||||
int ret = TConstruct.ingotLiquidValue;
|
||||
|
||||
if (capacity > 0)
|
||||
ret = capacity;
|
||||
else
|
||||
{
|
||||
if (capacity > 0) ret = capacity;
|
||||
else {
|
||||
ItemStack inv = inventory[0];
|
||||
|
||||
if (inv != null && inv.getItem() instanceof IPattern)
|
||||
{
|
||||
if (inv != null && inv.getItem() instanceof IPattern) {
|
||||
int cost = ((IPattern) inv.getItem()).getPatternCost(inv);
|
||||
if (cost > 0)
|
||||
ret *= cost * 0.5;
|
||||
if (cost > 0) ret *= cost * 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,121 +71,98 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
|
||||
/* FluidHandler stuff. Mostly delegated to Tank stuff */
|
||||
@Override
|
||||
public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
// only same liquid
|
||||
if (liquid != null && liquid.getFluid() != resource.getFluid())
|
||||
return null;
|
||||
if (liquid != null && liquid.getFluid() != resource.getFluid()) return null;
|
||||
|
||||
return drain(resource.amount, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
return drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if(fluid == null)
|
||||
return false;
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
if (fluid == null) return false;
|
||||
return fill(from, new FluidStack(fluid, 1), false) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if(fluid == null)
|
||||
return false;
|
||||
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
if (fluid == null) return false;
|
||||
|
||||
FluidStack drained = drain(from, new FluidStack(fluid, 1), false);
|
||||
return drained != null && drained.amount > 0;
|
||||
}
|
||||
|
||||
/* Tank stuff */
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo (ForgeDirection from)
|
||||
{
|
||||
return new FluidTankInfo[] { getInfo() };
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return new FluidTankInfo[] {getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluid ()
|
||||
{
|
||||
public FluidStack getFluid() {
|
||||
return liquid == null ? null : liquid.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidAmount ()
|
||||
{
|
||||
public int getFluidAmount() {
|
||||
return liquid != null ? liquid.amount : 0;
|
||||
}
|
||||
|
||||
/** Returns the current amount of the liquid FOR RENDERING */
|
||||
public int getLiquidAmount ()
|
||||
{
|
||||
public int getLiquidAmount() {
|
||||
return liquid.amount - renderOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity ()
|
||||
{
|
||||
public int getCapacity() {
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo getInfo ()
|
||||
{
|
||||
public FluidTankInfo getInfo() {
|
||||
return new FluidTankInfo(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return the casting event here. It'll be fired automatically.
|
||||
*/
|
||||
public abstract SmelteryCastEvent getCastingEvent (CastingRecipe recipe, FluidStack metal);
|
||||
public abstract SmelteryCastEvent getCastingEvent(CastingRecipe recipe, FluidStack metal);
|
||||
|
||||
@Override
|
||||
public int fill (FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null)
|
||||
return 0;
|
||||
public int fill(FluidStack resource, boolean doFill) {
|
||||
if (resource == null) return 0;
|
||||
|
||||
if (this.liquid == null)
|
||||
{
|
||||
if (this.liquid == null) {
|
||||
CastingRecipe recipe = liquidCasting.getCastingRecipe(resource, inventory[0]);
|
||||
if (recipe == null)
|
||||
return 0;
|
||||
if (recipe == null) return 0;
|
||||
|
||||
SmelteryCastEvent event = getCastingEvent(recipe, resource);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
if (event.getResult() == Event.Result.DENY)
|
||||
return 0;
|
||||
if (event.getResult() == Event.Result.DENY) return 0;
|
||||
|
||||
this.capacity = updateCapacity(recipe.castingMetal.amount);
|
||||
|
||||
if (inventory[1] == null)
|
||||
{
|
||||
if (inventory[1] == null) {
|
||||
FluidStack copyLiquid = resource.copy();
|
||||
|
||||
if (copyLiquid.amount > this.capacity)
|
||||
{
|
||||
if (copyLiquid.amount > this.capacity) {
|
||||
copyLiquid.amount = this.capacity;
|
||||
}
|
||||
|
||||
if (doFill)
|
||||
{
|
||||
if (copyLiquid.amount == this.capacity)
|
||||
{
|
||||
maxCastingDelay= castingDelay = recipe.coolTime;
|
||||
if (doFill) {
|
||||
if (copyLiquid.amount == this.capacity) {
|
||||
maxCastingDelay = castingDelay = recipe.coolTime;
|
||||
}
|
||||
renderOffset = copyLiquid.amount;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
@@ -204,19 +170,14 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
needsUpdate = true;
|
||||
}
|
||||
return copyLiquid.amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (resource.isFluidEqual(this.liquid))
|
||||
{
|
||||
} else if (resource.isFluidEqual(this.liquid)) {
|
||||
if (resource.amount + this.liquid.amount >= this.capacity) // Start timer here
|
||||
{
|
||||
int roomInTank = this.capacity - liquid.amount;
|
||||
if (doFill && roomInTank > 0)
|
||||
{
|
||||
if (doFill && roomInTank > 0) {
|
||||
renderOffset = roomInTank;
|
||||
maxCastingDelay = castingDelay = liquidCasting.getCastingDelay(this.liquid, inventory[0]);
|
||||
this.liquid.amount = this.capacity;
|
||||
@@ -224,12 +185,8 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
needsUpdate = true;
|
||||
}
|
||||
return roomInTank;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (doFill)
|
||||
{
|
||||
} else {
|
||||
if (doFill) {
|
||||
renderOffset += resource.amount;
|
||||
this.liquid.amount += resource.amount;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
@@ -237,28 +194,20 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
}
|
||||
return resource.amount;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (liquid == null || liquid.getFluid() == null || liquid.getFluidID() <= 0 || castingDelay > 0)
|
||||
return null;
|
||||
if (liquid.amount <= 0)
|
||||
return null;
|
||||
public FluidStack drain(int maxDrain, boolean doDrain) {
|
||||
if (liquid == null || liquid.getFluid() == null || liquid.getFluidID() <= 0 || castingDelay > 0) return null;
|
||||
if (liquid.amount <= 0) return null;
|
||||
|
||||
int used = maxDrain;
|
||||
if (liquid.amount < used)
|
||||
used = liquid.amount;
|
||||
if (liquid.amount < used) used = liquid.amount;
|
||||
|
||||
if (doDrain)
|
||||
{
|
||||
if (doDrain) {
|
||||
liquid.amount -= used;
|
||||
}
|
||||
|
||||
@@ -268,52 +217,49 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
renderOffset = 0;
|
||||
|
||||
// Reset liquid if emptied
|
||||
if (liquid.amount <= 0)
|
||||
liquid = null;
|
||||
if (liquid.amount <= 0) liquid = null;
|
||||
|
||||
if (doDrain)
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(drained, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this, used));
|
||||
FluidEvent.fireEvent(new FluidEvent.FluidDrainingEvent(
|
||||
drained, this.worldObj, this.xCoord, this.yCoord, this.zCoord, this, used));
|
||||
|
||||
return drained;
|
||||
}
|
||||
|
||||
/* Inventory, inserting/extracting */
|
||||
|
||||
public void interact(EntityPlayer player)
|
||||
{
|
||||
public void interact(EntityPlayer player) {
|
||||
// only server side
|
||||
//if(worldObj.isRemote)
|
||||
//return;
|
||||
// if(worldObj.isRemote)
|
||||
// return;
|
||||
|
||||
// can't interact with liquid inside
|
||||
// todo: maybe let it interact with a bucket or tank!
|
||||
if(liquid != null)
|
||||
return;
|
||||
if (liquid != null) return;
|
||||
|
||||
// put stuff in?
|
||||
if(!isStackInSlot(0) && !isStackInSlot(1))
|
||||
{
|
||||
if (!isStackInSlot(0) && !isStackInSlot(1)) {
|
||||
ItemStack stack = player.inventory.decrStackSize(player.inventory.currentItem, stackSizeLimit);
|
||||
SmelteryEvent.ItemInsertedIntoCasting event = new SmelteryEvent.ItemInsertedIntoCasting(this, xCoord, yCoord, zCoord, stack, player);
|
||||
SmelteryEvent.ItemInsertedIntoCasting event =
|
||||
new SmelteryEvent.ItemInsertedIntoCasting(this, xCoord, yCoord, zCoord, stack, player);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if(!event.isCanceled())
|
||||
setInventorySlotContents(0, event.item);
|
||||
if (!event.isCanceled()) setInventorySlotContents(0, event.item);
|
||||
else
|
||||
player.inventory.addItemStackToInventory(stack); // should never return false, since the itemstack was taken from the inventory
|
||||
player.inventory.addItemStackToInventory(
|
||||
stack); // should never return false, since the itemstack was taken from the inventory
|
||||
}
|
||||
// take stuff out.
|
||||
else
|
||||
{
|
||||
else {
|
||||
int slot = 0;
|
||||
// output-slot has higher priority
|
||||
if(isStackInSlot(1))
|
||||
slot = 1;
|
||||
if (isStackInSlot(1)) slot = 1;
|
||||
|
||||
// Additional Info: Only 1 item can only be put into the casting block usually, however recipes
|
||||
// can have multiple blocks as output (compressed gravel -> brownstone for example)
|
||||
// we therefore spill the whole contents on extraction
|
||||
|
||||
SmelteryEvent.ItemRemovedFromCasting event = new SmelteryEvent.ItemRemovedFromCasting(this, xCoord, yCoord, zCoord, getStackInSlot(slot), player);
|
||||
SmelteryEvent.ItemRemovedFromCasting event = new SmelteryEvent.ItemRemovedFromCasting(
|
||||
this, xCoord, yCoord, zCoord, getStackInSlot(slot), player);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
// try to transfer thes tack to the player inventory
|
||||
@@ -326,137 +272,110 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
public ItemStack decrStackSize(int slot, int quantity) {
|
||||
ItemStack stack = super.decrStackSize(slot, quantity);
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide (int side)
|
||||
{
|
||||
return new int[] { 0, 1 };
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return new int[] {0, 1};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem (int slot, ItemStack itemstack, int side)
|
||||
{
|
||||
public boolean canInsertItem(int slot, ItemStack itemstack, int side) {
|
||||
// can't insert if there's liquid in it
|
||||
if (liquid != null)
|
||||
return false;
|
||||
if (liquid != null) return false;
|
||||
|
||||
// only into input slot
|
||||
return slot == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem (int slot, ItemStack itemstack, int side)
|
||||
{
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, int side) {
|
||||
// only output slot
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
/* We don't have a gui or anything */
|
||||
@Override
|
||||
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
|
||||
{
|
||||
public Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultName ()
|
||||
{
|
||||
protected String getDefaultName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
public String getInventoryName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName ()
|
||||
{
|
||||
public String getInvName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
|
||||
}
|
||||
public void closeInventory() {}
|
||||
|
||||
/* NBT, Updating */
|
||||
@Override
|
||||
public void markDirty () // Isn't actually called?
|
||||
{
|
||||
public void markDirty() // Isn't actually called?
|
||||
{
|
||||
super.markDirty();
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
if (castingDelay > 0)
|
||||
{
|
||||
public void updateEntity() {
|
||||
if (castingDelay > 0) {
|
||||
castingDelay--;
|
||||
if (castingDelay == 0)
|
||||
castLiquid();
|
||||
if (castingDelay == 0) castLiquid();
|
||||
}
|
||||
if (renderOffset > 0)
|
||||
{
|
||||
//renderOffset -= Math.max(renderOffset/3, 6);
|
||||
if (renderOffset > 0) {
|
||||
// renderOffset -= Math.max(renderOffset/3, 6);
|
||||
renderOffset -= 6;
|
||||
if(renderOffset < 0)
|
||||
renderOffset = 0;
|
||||
if (renderOffset < 0) renderOffset = 0;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
tick++;
|
||||
if (tick % 20 == 0)
|
||||
{
|
||||
if (tick % 20 == 0) {
|
||||
tick = 0;
|
||||
if (needsUpdate)
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
if (needsUpdate) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and return the casting event here. It'll be fired automatically.
|
||||
*/
|
||||
public abstract SmelteryCastedEvent getCastedEvent (CastingRecipe recipe, ItemStack result);
|
||||
public abstract SmelteryCastedEvent getCastedEvent(CastingRecipe recipe, ItemStack result);
|
||||
|
||||
public void castLiquid ()
|
||||
{
|
||||
public void castLiquid() {
|
||||
CastingRecipe recipe = liquidCasting.getCastingRecipe(liquid, inventory[0]);
|
||||
if (recipe != null)
|
||||
{
|
||||
if (recipe != null) {
|
||||
SmelteryCastedEvent event = getCastedEvent(recipe, recipe.getResult());
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
maxCastingDelay = 0;
|
||||
|
||||
inventory[1] = event.output;
|
||||
if (event.consumeCast)
|
||||
inventory[0] = null;
|
||||
if (event.consumeCast) inventory[0] = null;
|
||||
|
||||
// if we just created a cast, move it to the first slot so we can use it directly afterwards
|
||||
if (event.output != null && event.output.getItem() instanceof IPattern)
|
||||
{
|
||||
if (event.output != null && event.output.getItem() instanceof IPattern) {
|
||||
inventory[1] = inventory[0];
|
||||
inventory[0] = event.output;
|
||||
}
|
||||
@@ -467,42 +386,32 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
readCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void readCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
if (tags.getBoolean("hasLiquid"))
|
||||
{
|
||||
public void readCustomNBT(NBTTagCompound tags) {
|
||||
if (tags.getBoolean("hasLiquid")) {
|
||||
this.liquid = FluidStack.loadFluidStackFromNBT(tags.getCompoundTag("Fluid"));
|
||||
}
|
||||
else
|
||||
this.liquid = null;
|
||||
} else this.liquid = null;
|
||||
|
||||
if (tags.getBoolean("Initialized"))
|
||||
this.capacity = tags.getInteger("Capacity");
|
||||
else
|
||||
this.capacity = updateCapacity();
|
||||
if (tags.getBoolean("Initialized")) this.capacity = tags.getInteger("Capacity");
|
||||
else this.capacity = updateCapacity();
|
||||
this.castingDelay = tags.getInteger("castingDelay");
|
||||
this.maxCastingDelay = tags.getInteger("maxCastingDelay");
|
||||
this.renderOffset = tags.getInteger("RenderOffset");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
writeCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void writeCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeCustomNBT(NBTTagCompound tags) {
|
||||
tags.setBoolean("hasLiquid", liquid != null);
|
||||
if (liquid != null)
|
||||
{
|
||||
if (liquid != null) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
liquid.writeToNBT(nbt);
|
||||
tags.setTag("Fluid", nbt);
|
||||
@@ -516,25 +425,23 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid
|
||||
|
||||
/* Packets */
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readFromNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
if(castingDelay == 0 || maxCastingDelay == 0) {
|
||||
if (castingDelay == 0 || maxCastingDelay == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int)(( (maxCastingDelay - castingDelay) / (double)maxCastingDelay) * 100);
|
||||
return (int) (((maxCastingDelay - castingDelay) / (double) maxCastingDelay) * 100);
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,9 @@ import tconstruct.TConstruct;
|
||||
/**
|
||||
* @author BluSunrize
|
||||
*/
|
||||
|
||||
public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
{
|
||||
public final static int fillMax = TConstruct.ingotLiquidValue * 3;
|
||||
public final static int outputMax = TConstruct.ingotLiquidValue;
|
||||
public class CastingChannelLogic extends TileEntity implements IFluidHandler {
|
||||
public static final int fillMax = TConstruct.ingotLiquidValue * 3;
|
||||
public static final int outputMax = TConstruct.ingotLiquidValue;
|
||||
FluidTank internalTank = new FluidTank(fillMax);
|
||||
HashMap<ForgeDirection, FluidTank> subTanks = new HashMap();
|
||||
public ForgeDirection lastProvider;
|
||||
@@ -30,8 +28,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
public CastingChannelMode mode = CastingChannelMode.SINGLEDRAIN;
|
||||
*/
|
||||
|
||||
public CastingChannelLogic()
|
||||
{
|
||||
public CastingChannelLogic() {
|
||||
lastProvider = ForgeDirection.UNKNOWN;
|
||||
validOutputs.add(ForgeDirection.DOWN);
|
||||
validOutputs.add(ForgeDirection.NORTH);
|
||||
@@ -46,8 +43,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
public void updateEntity() {
|
||||
ticks++;
|
||||
|
||||
boolean flagActiveFaucet = false;
|
||||
@@ -56,21 +52,18 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
if (possibleFaucet != null && possibleFaucet instanceof FaucetLogic)
|
||||
flagActiveFaucet = ((FaucetLogic) possibleFaucet).active;
|
||||
|
||||
if (ticks == 6)// && !flagActiveFaucet)
|
||||
this.distributeFluids();
|
||||
if (ticks >= 12)// && !flagActiveFaucet)
|
||||
if (ticks == 6) // && !flagActiveFaucet)
|
||||
this.distributeFluids();
|
||||
if (ticks >= 12) // && !flagActiveFaucet)
|
||||
{
|
||||
if (recentlyFilledDelay != 0)
|
||||
recentlyFilledDelay--;
|
||||
if (recentlyFilledDelay == 0 || lastProvider == ForgeDirection.UP)
|
||||
this.outputFluids();
|
||||
if (recentlyFilledDelay != 0) recentlyFilledDelay--;
|
||||
if (recentlyFilledDelay == 0 || lastProvider == ForgeDirection.UP) this.outputFluids();
|
||||
|
||||
ticks = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void changeOutputs (EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public void changeOutputs(EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
/*
|
||||
* UNUSED
|
||||
if(player.isSneaking())
|
||||
@@ -88,104 +81,69 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
*/
|
||||
|
||||
ForgeDirection toggle = ForgeDirection.UNKNOWN;
|
||||
if (side == 0 || side == 1)
|
||||
{
|
||||
if (hitX > 0.3125 && hitX < 0.6875)
|
||||
if (hitZ > 0 && hitZ < 0.3125)
|
||||
toggle = ForgeDirection.NORTH;
|
||||
if (hitX > 0.3125 && hitX < 0.6875)
|
||||
if (hitZ > 0.6875 && hitZ < 1)
|
||||
toggle = ForgeDirection.SOUTH;
|
||||
if (hitZ > 0.3125 && hitZ < 0.6875)
|
||||
if (hitX > 0 && hitX < 0.3125)
|
||||
toggle = ForgeDirection.WEST;
|
||||
if (hitZ > 0.3125 && hitZ < 0.6875)
|
||||
if (hitX > 0.6875 && hitX < 1)
|
||||
toggle = ForgeDirection.EAST;
|
||||
if (side == 0 || side == 1) {
|
||||
if (hitX > 0.3125 && hitX < 0.6875) if (hitZ > 0 && hitZ < 0.3125) toggle = ForgeDirection.NORTH;
|
||||
if (hitX > 0.3125 && hitX < 0.6875) if (hitZ > 0.6875 && hitZ < 1) toggle = ForgeDirection.SOUTH;
|
||||
if (hitZ > 0.3125 && hitZ < 0.6875) if (hitX > 0 && hitX < 0.3125) toggle = ForgeDirection.WEST;
|
||||
if (hitZ > 0.3125 && hitZ < 0.6875) if (hitX > 0.6875 && hitX < 1) toggle = ForgeDirection.EAST;
|
||||
|
||||
if (side == 0)
|
||||
if (hitX > 0.3125 && hitX < 0.6875)
|
||||
if (hitZ > 0.3125 && hitZ < 0.6875)
|
||||
toggle = ForgeDirection.DOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (side == 2)
|
||||
{
|
||||
if (hitX > 0 && hitX < 0.3125)
|
||||
toggle = ForgeDirection.WEST;
|
||||
if (hitX > 0.6875 && hitX < 1)
|
||||
toggle = ForgeDirection.EAST;
|
||||
if (hitX > 0.3125 && hitX < 0.6875) if (hitZ > 0.3125 && hitZ < 0.6875) toggle = ForgeDirection.DOWN;
|
||||
} else {
|
||||
if (side == 2) {
|
||||
if (hitX > 0 && hitX < 0.3125) toggle = ForgeDirection.WEST;
|
||||
if (hitX > 0.6875 && hitX < 1) toggle = ForgeDirection.EAST;
|
||||
}
|
||||
if (side == 3)
|
||||
{
|
||||
if (hitX > 0 && hitX < 0.3125)
|
||||
toggle = ForgeDirection.WEST;
|
||||
if (hitX > 0.6875 && hitX < 1)
|
||||
toggle = ForgeDirection.EAST;
|
||||
if (side == 3) {
|
||||
if (hitX > 0 && hitX < 0.3125) toggle = ForgeDirection.WEST;
|
||||
if (hitX > 0.6875 && hitX < 1) toggle = ForgeDirection.EAST;
|
||||
}
|
||||
if (side == 4)
|
||||
{
|
||||
if (hitZ > 0 && hitZ < 0.3125)
|
||||
toggle = ForgeDirection.NORTH;
|
||||
if (hitZ > 0.6875 && hitZ < 1)
|
||||
toggle = ForgeDirection.SOUTH;
|
||||
if (side == 4) {
|
||||
if (hitZ > 0 && hitZ < 0.3125) toggle = ForgeDirection.NORTH;
|
||||
if (hitZ > 0.6875 && hitZ < 1) toggle = ForgeDirection.SOUTH;
|
||||
}
|
||||
if (side == 5)
|
||||
{
|
||||
if (hitZ > 0 && hitZ < 0.3125)
|
||||
toggle = ForgeDirection.NORTH;
|
||||
if (hitZ > 0.6875 && hitZ < 1)
|
||||
toggle = ForgeDirection.SOUTH;
|
||||
if (side == 5) {
|
||||
if (hitZ > 0 && hitZ < 0.3125) toggle = ForgeDirection.NORTH;
|
||||
if (hitZ > 0.6875 && hitZ < 1) toggle = ForgeDirection.SOUTH;
|
||||
}
|
||||
}
|
||||
|
||||
if (toggle != ForgeDirection.UNKNOWN && toggle != ForgeDirection.UP)
|
||||
{
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord + toggle.offsetX, yCoord + toggle.offsetY, zCoord + toggle.offsetZ);
|
||||
if (toggle != ForgeDirection.UNKNOWN && toggle != ForgeDirection.UP) {
|
||||
TileEntity tile =
|
||||
worldObj.getTileEntity(xCoord + toggle.offsetX, yCoord + toggle.offsetY, zCoord + toggle.offsetZ);
|
||||
if (tile instanceof IFluidHandler)
|
||||
if (validOutputs.contains(toggle))
|
||||
{
|
||||
if (validOutputs.contains(toggle)) {
|
||||
validOutputs.remove(toggle);
|
||||
if (tile instanceof CastingChannelLogic && toggle != ForgeDirection.DOWN)
|
||||
((CastingChannelLogic) tile).validOutputs.remove(toggle.getOpposite());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
validOutputs.add(toggle);
|
||||
if (tile instanceof CastingChannelLogic && toggle != ForgeDirection.DOWN)
|
||||
if (!((CastingChannelLogic) tile).validOutputs.contains(toggle.getOpposite()))
|
||||
((CastingChannelLogic) tile).validOutputs.add(toggle.getOpposite());
|
||||
}
|
||||
|
||||
}
|
||||
markDirtyForRendering();
|
||||
}
|
||||
|
||||
private void distributeFluids ()
|
||||
{
|
||||
private void distributeFluids() {
|
||||
/* DEBUG
|
||||
boolean printDebugLog = false;
|
||||
ArrayList<String> debugLog = new ArrayList();
|
||||
*/
|
||||
//Move Fluid to Output Tanks
|
||||
// Move Fluid to Output Tanks
|
||||
Set<ForgeDirection> connected = this.getOutputs().keySet();
|
||||
|
||||
if (connected.contains(ForgeDirection.DOWN))
|
||||
connected.remove(ForgeDirection.DOWN);
|
||||
if (connected.contains(lastProvider))
|
||||
connected.remove(lastProvider);
|
||||
if (connected.contains(ForgeDirection.DOWN)) connected.remove(ForgeDirection.DOWN);
|
||||
if (connected.contains(lastProvider)) connected.remove(lastProvider);
|
||||
|
||||
int output = Math.min(internalTank.getFluidAmount(), outputMax);
|
||||
int connectedAmount = connected.size();
|
||||
if (connectedAmount < 1)
|
||||
connectedAmount = 1;
|
||||
if (connectedAmount < 1) connectedAmount = 1;
|
||||
int scaledAmount = output / connectedAmount;
|
||||
|
||||
for (ForgeDirection dirOut : connected)
|
||||
{
|
||||
if (this.internalTank.getFluid() == null)
|
||||
break;
|
||||
for (ForgeDirection dirOut : connected) {
|
||||
if (this.internalTank.getFluid() == null) break;
|
||||
|
||||
/* DEBUG
|
||||
debugLog.add("Moving to "+dirOut+"ern SubTank");
|
||||
@@ -195,8 +153,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
/* DEBUG
|
||||
debugLog.add("SubTank will accept "+fit+"mb");
|
||||
*/
|
||||
if (fit > 0)
|
||||
fit = internalTank.drain(fit, true).amount;
|
||||
if (fit > 0) fit = internalTank.drain(fit, true).amount;
|
||||
/* DEBUG
|
||||
debugLog.add("Internal Tank was drained by "+fit+"mb");
|
||||
*/
|
||||
@@ -221,20 +178,20 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
printDebugLog = false;
|
||||
*/
|
||||
|
||||
//Get Fluid from most recent InputTank
|
||||
// Get Fluid from most recent InputTank
|
||||
FluidTank inputTank = subTanks.get(lastProvider);
|
||||
if (inputTank != null && inputTank.getFluid() != null) //Tank can be null if input was received from top
|
||||
if (inputTank != null && inputTank.getFluid() != null) // Tank can be null if input was received from top
|
||||
{
|
||||
/* DEBUG
|
||||
debugLog.add("Importing from "+lastProvider+"ern SubTank");
|
||||
*/
|
||||
FluidStack tempFS = new FluidStack(inputTank.getFluid().getFluid(), Math.min(inputTank.getFluidAmount(), outputMax));
|
||||
FluidStack tempFS =
|
||||
new FluidStack(inputTank.getFluid().getFluid(), Math.min(inputTank.getFluidAmount(), outputMax));
|
||||
int fit = internalTank.fill(tempFS, false);
|
||||
/* DEBUG
|
||||
debugLog.add("Internal Tank will accept "+fit+"mb");
|
||||
*/
|
||||
if (fit > 0)
|
||||
fit = inputTank.drain(fit, true).amount;
|
||||
if (fit > 0) fit = inputTank.drain(fit, true).amount;
|
||||
/* DEBUG
|
||||
debugLog.add("Import Tank was drained by "+fit+"mb");
|
||||
*/
|
||||
@@ -259,44 +216,42 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
*/
|
||||
}
|
||||
|
||||
private void outputFluids ()
|
||||
{
|
||||
private void outputFluids() {
|
||||
/* DEBUG
|
||||
boolean printDebugLog = false;
|
||||
ArrayList<String> debugLog = new ArrayList();
|
||||
*/
|
||||
|
||||
HashMap<ForgeDirection, TileEntity> connected = this.getOutputs();
|
||||
if (connected.containsKey(lastProvider))
|
||||
connected.remove(lastProvider);
|
||||
if (connected.containsKey(ForgeDirection.DOWN) && this.internalTank.getFluid() != null) // Prioritizes FluidHandlers below
|
||||
if (connected.containsKey(lastProvider)) connected.remove(lastProvider);
|
||||
if (connected.containsKey(ForgeDirection.DOWN)
|
||||
&& this.internalTank.getFluid() != null) // Prioritizes FluidHandlers below
|
||||
{
|
||||
int output = Math.min(internalTank.getFluid().amount, outputMax);
|
||||
FluidStack tempFS = new FluidStack(internalTank.getFluid().getFluid(), output);
|
||||
int fittingBelow = ((IFluidHandler) connected.get(ForgeDirection.DOWN)).fill(ForgeDirection.UP, tempFS, false);
|
||||
if (fittingBelow > 0)
|
||||
fittingBelow = this.drain(ForgeDirection.DOWN, fittingBelow, true).amount;
|
||||
int fittingBelow =
|
||||
((IFluidHandler) connected.get(ForgeDirection.DOWN)).fill(ForgeDirection.UP, tempFS, false);
|
||||
if (fittingBelow > 0) fittingBelow = this.drain(ForgeDirection.DOWN, fittingBelow, true).amount;
|
||||
tempFS.amount = fittingBelow;
|
||||
fittingBelow = ((IFluidHandler) connected.get(ForgeDirection.DOWN)).fill(ForgeDirection.UP, tempFS, true);
|
||||
|
||||
connected.remove(ForgeDirection.DOWN);
|
||||
}
|
||||
if (connected.size() != 0)
|
||||
{
|
||||
for (ForgeDirection dir : connected.keySet()) //Iterates to connected FluidHandlers
|
||||
if (connected.size() != 0) {
|
||||
for (ForgeDirection dir : connected.keySet()) // Iterates to connected FluidHandlers
|
||||
{
|
||||
if (subTanks.get(dir) != null && subTanks.get(dir).getFluid() != null)
|
||||
{
|
||||
if (subTanks.get(dir) != null && subTanks.get(dir).getFluid() != null) {
|
||||
/* DEBUG
|
||||
debugLog.add("Exporting from "+dir+"ern SubTank");
|
||||
*/
|
||||
FluidStack tempFS = new FluidStack(subTanks.get(dir).getFluid().getFluid(), Math.min(subTanks.get(dir).getFluidAmount(), outputMax));
|
||||
FluidStack tempFS = new FluidStack(
|
||||
subTanks.get(dir).getFluid().getFluid(),
|
||||
Math.min(subTanks.get(dir).getFluidAmount(), outputMax));
|
||||
int fit = ((IFluidHandler) connected.get(dir)).fill(dir.getOpposite(), tempFS, false);
|
||||
/* DEBUG
|
||||
debugLog.add("New Channel will accept "+fit+"mb");
|
||||
*/
|
||||
if (fit > 0)
|
||||
fit = this.drain(dir, fit, true).amount;
|
||||
if (fit > 0) fit = this.drain(dir, fit, true).amount;
|
||||
/* DEBUG
|
||||
debugLog.add("OldSubTank was drained by "+fit+"mb");
|
||||
*/
|
||||
@@ -320,92 +275,77 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float tankBelow ()
|
||||
{
|
||||
public float tankBelow() {
|
||||
TileEntity te = this.worldObj.getTileEntity(this.xCoord, this.yCoord - 1, this.zCoord);
|
||||
if (te instanceof CastingChannelLogic)
|
||||
return -0.5f;
|
||||
if (te instanceof LavaTankLogic)
|
||||
return -1.0f;
|
||||
if (te instanceof CastingBasinLogic)
|
||||
return -0.75f;
|
||||
if (te instanceof CastingTableLogic)
|
||||
return -0.125f;
|
||||
if (te instanceof IFluidHandler)
|
||||
return 0f;
|
||||
if (te instanceof CastingChannelLogic) return -0.5f;
|
||||
if (te instanceof LavaTankLogic) return -1.0f;
|
||||
if (te instanceof CastingBasinLogic) return -0.75f;
|
||||
if (te instanceof CastingTableLogic) return -0.125f;
|
||||
if (te instanceof IFluidHandler) return 0f;
|
||||
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
private void markDirtyForRendering ()
|
||||
{
|
||||
private void markDirtyForRendering() {
|
||||
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public HashMap<ForgeDirection, TileEntity> getOutputs ()
|
||||
{
|
||||
public HashMap<ForgeDirection, TileEntity> getOutputs() {
|
||||
HashMap<ForgeDirection, TileEntity> map = new HashMap();
|
||||
for (ForgeDirection fd : this.validOutputs)
|
||||
{
|
||||
for (ForgeDirection fd : this.validOutputs) {
|
||||
int tX = this.xCoord + fd.offsetX;
|
||||
int tY = this.yCoord + fd.offsetY;
|
||||
int tZ = this.zCoord + fd.offsetZ;
|
||||
TileEntity tile = this.worldObj.getTileEntity(tX, tY, tZ);
|
||||
|
||||
if (tile != null && tile instanceof IFluidHandler)
|
||||
map.put(fd, tile);
|
||||
if (tile != null && tile instanceof IFluidHandler) map.put(fd, tile);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (doFill)
|
||||
{
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
if (doFill) {
|
||||
markDirtyForRendering();
|
||||
this.lastProvider = from;
|
||||
//if (this.internalTank.getFluid() == null)
|
||||
//this.recentlyFilledDelay = 2;
|
||||
// if (this.internalTank.getFluid() == null)
|
||||
// this.recentlyFilledDelay = 2;
|
||||
}
|
||||
|
||||
if (from == ForgeDirection.UP)
|
||||
{
|
||||
if (from == ForgeDirection.UP) {
|
||||
return this.internalTank.fill(resource, doFill);
|
||||
}
|
||||
else if (from == ForgeDirection.NORTH || from == ForgeDirection.SOUTH || from == ForgeDirection.WEST || from == ForgeDirection.EAST)
|
||||
{
|
||||
} else if (from == ForgeDirection.NORTH
|
||||
|| from == ForgeDirection.SOUTH
|
||||
|| from == ForgeDirection.WEST
|
||||
|| from == ForgeDirection.EAST) {
|
||||
return this.subTanks.get(from).fill(resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack fluidStack = null;
|
||||
if (from == ForgeDirection.DOWN)
|
||||
if(this.internalTank.getFluid() != null)
|
||||
fluidStack = this.internalTank.getFluid();
|
||||
else if(validOutputs.contains(from))
|
||||
if (this.internalTank.getFluid() != null) fluidStack = this.internalTank.getFluid();
|
||||
else if (validOutputs.contains(from))
|
||||
fluidStack = this.subTanks.get(from).getFluid();
|
||||
|
||||
// wrong fluid
|
||||
if(fluidStack != null && fluidStack.getFluid() != resource.getFluid())
|
||||
return null;
|
||||
if (fluidStack != null && fluidStack.getFluid() != resource.getFluid()) return null;
|
||||
|
||||
return drain(from, resource.amount, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
//if(doDrain)
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
// if(doDrain)
|
||||
// this.worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
if (from == ForgeDirection.DOWN)
|
||||
return this.internalTank.drain(maxDrain, doDrain);
|
||||
else if (from == ForgeDirection.NORTH || from == ForgeDirection.SOUTH || from == ForgeDirection.WEST || from == ForgeDirection.EAST)
|
||||
{
|
||||
if (from == ForgeDirection.DOWN) return this.internalTank.drain(maxDrain, doDrain);
|
||||
else if (from == ForgeDirection.NORTH
|
||||
|| from == ForgeDirection.SOUTH
|
||||
|| from == ForgeDirection.WEST
|
||||
|| from == ForgeDirection.EAST) {
|
||||
return this.subTanks.get(from).drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@@ -413,59 +353,45 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if (from == ForgeDirection.DOWN)
|
||||
return false;
|
||||
if (from == ForgeDirection.UP)
|
||||
return true;
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
if (from == ForgeDirection.DOWN) return false;
|
||||
if (from == ForgeDirection.UP) return true;
|
||||
return validOutputs.contains(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
if (from == ForgeDirection.UP)
|
||||
return false;
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
if (from == ForgeDirection.UP) return false;
|
||||
return validOutputs.contains(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo (ForgeDirection from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
if (from == null || from == ForgeDirection.UP || from == ForgeDirection.DOWN || from == ForgeDirection.UNKNOWN)
|
||||
return new FluidTankInfo[] { new FluidTankInfo(internalTank) };
|
||||
else
|
||||
return new FluidTankInfo[] { new FluidTankInfo(subTanks.get(from)) };
|
||||
return new FluidTankInfo[] {new FluidTankInfo(internalTank)};
|
||||
else return new FluidTankInfo[] {new FluidTankInfo(subTanks.get(from))};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
readCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void readCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readCustomNBT(NBTTagCompound tags) {
|
||||
|
||||
NBTTagCompound nbtTank = tags.getCompoundTag("internalTank");
|
||||
if (nbtTank != null)
|
||||
internalTank.readFromNBT(nbtTank);
|
||||
if (nbtTank != null) internalTank.readFromNBT(nbtTank);
|
||||
|
||||
for (ForgeDirection fdSub : subTanks.keySet())
|
||||
{
|
||||
for (ForgeDirection fdSub : subTanks.keySet()) {
|
||||
NBTTagCompound nbtSubTank = tags.getCompoundTag("subTank_" + fdSub.name());
|
||||
if (nbtSubTank != null)
|
||||
subTanks.get(fdSub).readFromNBT(nbtSubTank);
|
||||
if (nbtSubTank != null) subTanks.get(fdSub).readFromNBT(nbtSubTank);
|
||||
}
|
||||
|
||||
int[] validFDs = tags.getIntArray("validOutputs");
|
||||
if (validFDs != null)
|
||||
{
|
||||
if (validFDs != null) {
|
||||
validOutputs = new ArrayList();
|
||||
for (int i : validFDs)
|
||||
validOutputs.add(convertIntToFD(i));
|
||||
for (int i : validFDs) validOutputs.add(convertIntToFD(i));
|
||||
}
|
||||
/* UNUSED
|
||||
this.mode = CastingChannelMode.readFromNBT(tags);
|
||||
@@ -474,19 +400,16 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
writeCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void writeCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeCustomNBT(NBTTagCompound tags) {
|
||||
NBTTagCompound nbtTank = new NBTTagCompound();
|
||||
internalTank.writeToNBT(nbtTank);
|
||||
tags.setTag("internalTank", nbtTank);
|
||||
for (ForgeDirection fdSub : subTanks.keySet())
|
||||
{
|
||||
for (ForgeDirection fdSub : subTanks.keySet()) {
|
||||
NBTTagCompound nbtSubTank = new NBTTagCompound();
|
||||
subTanks.get(fdSub).writeToNBT(nbtSubTank);
|
||||
tags.setTag("subTank_" + fdSub.name(), nbtSubTank);
|
||||
@@ -494,10 +417,8 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
|
||||
int[] validFDs = new int[validOutputs.size()];
|
||||
int it = 0;
|
||||
for (ForgeDirection fd : validOutputs)
|
||||
{
|
||||
if (fd != null)
|
||||
validFDs[it] = convertFDToInt(fd);
|
||||
for (ForgeDirection fd : validOutputs) {
|
||||
if (fd != null) validFDs[it] = convertFDToInt(fd);
|
||||
it++;
|
||||
}
|
||||
tags.setIntArray("validOutputs", validFDs);
|
||||
@@ -508,59 +429,53 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeCustomNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
this.worldObj.func_147479_m(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
public int convertFDToInt (ForgeDirection dir)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
case DOWN:
|
||||
return 0;
|
||||
case UP:
|
||||
return 1;
|
||||
case NORTH:
|
||||
return 2;
|
||||
case SOUTH:
|
||||
return 3;
|
||||
case WEST:
|
||||
return 4;
|
||||
case EAST:
|
||||
return 5;
|
||||
default:
|
||||
return -1;
|
||||
public int convertFDToInt(ForgeDirection dir) {
|
||||
switch (dir) {
|
||||
case DOWN:
|
||||
return 0;
|
||||
case UP:
|
||||
return 1;
|
||||
case NORTH:
|
||||
return 2;
|
||||
case SOUTH:
|
||||
return 3;
|
||||
case WEST:
|
||||
return 4;
|
||||
case EAST:
|
||||
return 5;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public ForgeDirection convertIntToFD (int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return ForgeDirection.DOWN;
|
||||
case 1:
|
||||
return ForgeDirection.UP;
|
||||
case 2:
|
||||
return ForgeDirection.NORTH;
|
||||
case 3:
|
||||
return ForgeDirection.SOUTH;
|
||||
case 4:
|
||||
return ForgeDirection.WEST;
|
||||
case 5:
|
||||
return ForgeDirection.EAST;
|
||||
default:
|
||||
return ForgeDirection.UNKNOWN;
|
||||
public ForgeDirection convertIntToFD(int i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
return ForgeDirection.DOWN;
|
||||
case 1:
|
||||
return ForgeDirection.UP;
|
||||
case 2:
|
||||
return ForgeDirection.NORTH;
|
||||
case 3:
|
||||
return ForgeDirection.SOUTH;
|
||||
case 4:
|
||||
return ForgeDirection.WEST;
|
||||
case 5:
|
||||
return ForgeDirection.EAST;
|
||||
default:
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
}
|
||||
/* UNUSED
|
||||
|
||||
@@ -6,22 +6,18 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.CastingRecipe;
|
||||
import tconstruct.library.event.*;
|
||||
|
||||
public class CastingTableLogic extends CastingBlockLogic
|
||||
{
|
||||
public CastingTableLogic()
|
||||
{
|
||||
public class CastingTableLogic extends CastingBlockLogic {
|
||||
public CastingTableLogic() {
|
||||
super(TConstructRegistry.getTableCasting());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmelteryCastEvent getCastingEvent (CastingRecipe recipe, FluidStack metal)
|
||||
{
|
||||
public SmelteryCastEvent getCastingEvent(CastingRecipe recipe, FluidStack metal) {
|
||||
return new SmelteryCastEvent.CastingTable(recipe, metal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmelteryCastedEvent getCastedEvent (CastingRecipe recipe, ItemStack result)
|
||||
{
|
||||
public SmelteryCastedEvent getCastedEvent(CastingRecipe recipe, ItemStack result) {
|
||||
return new SmelteryCastedEvent.CastingTable(recipe, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,55 +10,49 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogic, IFluidHandler
|
||||
{
|
||||
public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogic, IFluidHandler {
|
||||
byte direction;
|
||||
boolean active;
|
||||
public FluidStack liquid;
|
||||
public boolean hasRedstonePower = false;
|
||||
|
||||
public boolean activateFaucet ()
|
||||
{
|
||||
if (liquid == null && active)
|
||||
{
|
||||
public boolean activateFaucet() {
|
||||
if (liquid == null && active) {
|
||||
int x = xCoord, z = zCoord;
|
||||
switch (getRenderDirection())
|
||||
{
|
||||
case 2:
|
||||
z++;
|
||||
break;
|
||||
case 3:
|
||||
z--;
|
||||
break;
|
||||
case 4:
|
||||
x++;
|
||||
break;
|
||||
case 5:
|
||||
x--;
|
||||
break;
|
||||
switch (getRenderDirection()) {
|
||||
case 2:
|
||||
z++;
|
||||
break;
|
||||
case 3:
|
||||
z--;
|
||||
break;
|
||||
case 4:
|
||||
x++;
|
||||
break;
|
||||
case 5:
|
||||
x--;
|
||||
break;
|
||||
}
|
||||
|
||||
TileEntity drainte = worldObj.getTileEntity(x, yCoord, z);
|
||||
TileEntity tankte = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord);
|
||||
|
||||
if (drainte != null && drainte instanceof IFluidHandler && tankte != null && tankte instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack templiquid = ((IFluidHandler) drainte).drain(getForgeDirection(), TConstruct.ingotLiquidValue, false);
|
||||
if (templiquid != null)
|
||||
{
|
||||
if (drainte != null
|
||||
&& drainte instanceof IFluidHandler
|
||||
&& tankte != null
|
||||
&& tankte instanceof IFluidHandler) {
|
||||
FluidStack templiquid =
|
||||
((IFluidHandler) drainte).drain(getForgeDirection(), TConstruct.ingotLiquidValue, false);
|
||||
if (templiquid != null) {
|
||||
int drained = ((IFluidHandler) tankte).fill(ForgeDirection.UP, templiquid, false);
|
||||
if (drained > 0)
|
||||
{
|
||||
if (drained > 0) {
|
||||
liquid = ((IFluidHandler) drainte).drain(getForgeDirection(), drained, true);
|
||||
((IFluidHandler) tankte).fill(ForgeDirection.UP, liquid, true);
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,16 +60,12 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
if (liquid != null)
|
||||
{
|
||||
public void updateEntity() {
|
||||
if (liquid != null) {
|
||||
liquid.amount -= TConstruct.liquidUpdateAmount;
|
||||
if (liquid.amount <= 0)
|
||||
{
|
||||
if (liquid.amount <= 0) {
|
||||
liquid = null;
|
||||
if (!activateFaucet())
|
||||
{
|
||||
if (!activateFaucet()) {
|
||||
active = false;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
@@ -84,33 +74,26 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getRenderDirection ()
|
||||
{
|
||||
public byte getRenderDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForgeDirection ()
|
||||
{
|
||||
public ForgeDirection getForgeDirection() {
|
||||
return ForgeDirection.VALID_DIRECTIONS[direction];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (int side)
|
||||
{
|
||||
if (side != 0 && side != 1)
|
||||
{
|
||||
public void setDirection(int side) {
|
||||
if (side != 0 && side != 1) {
|
||||
direction = (byte) side;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
direction = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (float yaw, float pitch, EntityLivingBase player)
|
||||
{
|
||||
public void setDirection(float yaw, float pitch, EntityLivingBase player) {
|
||||
/*int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3;
|
||||
switch (facing)
|
||||
{
|
||||
@@ -133,36 +116,28 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
readCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void readCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readCustomNBT(NBTTagCompound tags) {
|
||||
direction = tags.getByte("Direction");
|
||||
if (tags.getBoolean("hasLiquid"))
|
||||
{
|
||||
if (tags.getBoolean("hasLiquid")) {
|
||||
this.liquid = FluidStack.loadFluidStackFromNBT(tags.getCompoundTag("Fluid"));
|
||||
}
|
||||
else
|
||||
this.liquid = null;
|
||||
} else this.liquid = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
writeCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void writeCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeCustomNBT(NBTTagCompound tags) {
|
||||
tags.setByte("Direction", direction);
|
||||
tags.setBoolean("hasLiquid", liquid != null);
|
||||
if (liquid != null)
|
||||
{
|
||||
if (liquid != null) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
liquid.writeToNBT(nbt);
|
||||
tags.setTag("Fluid", nbt);
|
||||
@@ -171,79 +146,65 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi
|
||||
|
||||
/* Packets */
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeCustomNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getActive ()
|
||||
{
|
||||
public boolean getActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive (boolean flag)
|
||||
{
|
||||
if (!active)
|
||||
{
|
||||
public void setActive(boolean flag) {
|
||||
if (!active) {
|
||||
active = true;
|
||||
if (!activateFaucet())
|
||||
active = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!activateFaucet()) active = false;
|
||||
} else {
|
||||
active = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo (ForgeDirection from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -7,23 +7,19 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class LavaTankLogic extends MultiServantLogic implements IFluidHandler
|
||||
{
|
||||
public class LavaTankLogic extends MultiServantLogic implements IFluidHandler {
|
||||
public FluidTank tank;
|
||||
public int renderOffset;
|
||||
public final static int tankCapacity = FluidContainerRegistry.BUCKET_VOLUME * 4;
|
||||
public static final int tankCapacity = FluidContainerRegistry.BUCKET_VOLUME * 4;
|
||||
|
||||
public LavaTankLogic()
|
||||
{
|
||||
public LavaTankLogic() {
|
||||
tank = new FluidTank(tankCapacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
int amount = tank.fill(resource, doFill);
|
||||
if (amount > 0 && doFill)
|
||||
{
|
||||
if (amount > 0 && doFill) {
|
||||
renderOffset += resource.amount;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, this.getBlockType());
|
||||
@@ -33,11 +29,9 @@ public class LavaTankLogic extends MultiServantLogic implements IFluidHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
FluidStack amount = tank.drain(maxDrain, doDrain);
|
||||
if (amount != null && doDrain)
|
||||
{
|
||||
if (amount != null && doDrain) {
|
||||
renderOffset = -maxDrain;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, this.getBlockType());
|
||||
@@ -46,36 +40,30 @@ public class LavaTankLogic extends MultiServantLogic implements IFluidHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if (tank.getFluidAmount() == 0)
|
||||
return null;
|
||||
if (tank.getFluid().getFluid() != resource.getFluid())
|
||||
return null;
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
if (tank.getFluidAmount() == 0) return null;
|
||||
if (tank.getFluid().getFluid() != resource.getFluid()) return null;
|
||||
|
||||
// same fluid, k
|
||||
return this.drain(from, resource.amount, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return tank.getFluidAmount() == 0 || (tank.getFluid().getFluid() == fluid && tank.getFluidAmount() < tank.getCapacity());
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
return tank.getFluidAmount() == 0
|
||||
|| (tank.getFluid().getFluid() == fluid && tank.getFluidAmount() < tank.getCapacity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return tank.getFluidAmount() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo (ForgeDirection from)
|
||||
{
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
FluidStack fluid = null;
|
||||
if (tank.getFluid() != null)
|
||||
fluid = tank.getFluid().copy();
|
||||
return new FluidTankInfo[] { new FluidTankInfo(fluid, tank.getCapacity()) };
|
||||
if (tank.getFluid() != null) fluid = tank.getFluid().copy();
|
||||
return new FluidTankInfo[] {new FluidTankInfo(fluid, tank.getCapacity())};
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -86,68 +74,52 @@ public class LavaTankLogic extends MultiServantLogic implements IFluidHandler
|
||||
* type) { return tank; }
|
||||
*/
|
||||
|
||||
public float getFluidAmountScaled ()
|
||||
{
|
||||
public float getFluidAmountScaled() {
|
||||
return (float) (tank.getFluid().amount - renderOffset) / (float) (tank.getCapacity() * 1.01F);
|
||||
}
|
||||
|
||||
public boolean containsFluid ()
|
||||
{
|
||||
public boolean containsFluid() {
|
||||
return tank.getFluid() != null;
|
||||
}
|
||||
|
||||
public int getBrightness ()
|
||||
{
|
||||
if (containsFluid())
|
||||
{
|
||||
public int getBrightness() {
|
||||
if (containsFluid()) {
|
||||
return (tank.getFluid().getFluid().getLuminosity() * tank.getFluidAmount()) / tank.getCapacity();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
readCustomNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
writeCustomNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
if (tags.getBoolean("hasFluid"))
|
||||
{
|
||||
public void readCustomNBT(NBTTagCompound tags) {
|
||||
if (tags.getBoolean("hasFluid")) {
|
||||
// TODO: Removed in future Versions, backward compat.
|
||||
if (tags.getInteger("itemID") != 0)
|
||||
{
|
||||
if (tags.getInteger("itemID") != 0) {
|
||||
tank.setFluid(new FluidStack(tags.getInteger("itemID"), tags.getInteger("amount")));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
tank.setFluid(FluidRegistry.getFluidStack(tags.getString("fluidName"), tags.getInteger("amount")));
|
||||
}
|
||||
}
|
||||
else
|
||||
tank.setFluid(null);
|
||||
} else tank.setFluid(null);
|
||||
|
||||
if(tags.hasKey("renderOffset"))
|
||||
renderOffset = tags.getInteger("renderOffset");
|
||||
if (tags.hasKey("renderOffset")) renderOffset = tags.getInteger("renderOffset");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeCustomNBT(NBTTagCompound tags) {
|
||||
FluidStack liquid = tank.getFluid();
|
||||
tags.setBoolean("hasFluid", liquid != null);
|
||||
if (liquid != null)
|
||||
{
|
||||
if (liquid != null) {
|
||||
tags.setString("fluidName", liquid.getFluid().getName());
|
||||
tags.setInteger("amount", liquid.amount);
|
||||
}
|
||||
@@ -156,42 +128,35 @@ public class LavaTankLogic extends MultiServantLogic implements IFluidHandler
|
||||
|
||||
/* Packets */
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeCustomNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/* Updating */
|
||||
@Override
|
||||
public boolean canUpdate ()
|
||||
{
|
||||
public boolean canUpdate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
if (renderOffset != 0)
|
||||
{
|
||||
renderOffset -= renderOffset/12 + 1; // has to be at least 1
|
||||
public void updateEntity() {
|
||||
if (renderOffset != 0) {
|
||||
renderOffset -= renderOffset / 12 + 1; // has to be at least 1
|
||||
|
||||
if(renderOffset < 0)
|
||||
renderOffset = 0;
|
||||
if (renderOffset < 0) renderOffset = 0;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public int comparatorStrength ()
|
||||
{
|
||||
public int comparatorStrength() {
|
||||
return 15 * tank.getFluidAmount() / tank.getCapacity();
|
||||
}
|
||||
}
|
||||
@@ -5,63 +5,53 @@ import net.minecraft.network.*;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class LiquidTextureLogic extends TileEntity
|
||||
{
|
||||
public class LiquidTextureLogic extends TileEntity {
|
||||
int texturePos;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate ()
|
||||
{
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setLiquidType (int tex)
|
||||
{
|
||||
public void setLiquidType(int tex) {
|
||||
texturePos = tex;
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public int getLiquidType ()
|
||||
{
|
||||
public int getLiquidType() {
|
||||
return texturePos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
readCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void readCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readCustomNBT(NBTTagCompound tags) {
|
||||
texturePos = tags.getInteger("Texture");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
writeCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void writeCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeCustomNBT(NBTTagCompound tags) {
|
||||
tags.setInteger("Texture", texturePos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeCustomNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,49 +11,41 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandler, IFacingLogic
|
||||
{
|
||||
public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandler, IFacingLogic {
|
||||
byte direction;
|
||||
|
||||
@Override
|
||||
public boolean canUpdate ()
|
||||
{
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill (ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
if (hasValidMaster() && resource != null && canFill(from, resource.getFluid()))
|
||||
{
|
||||
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
if (hasValidMaster() && resource != null && canFill(from, resource.getFluid())) {
|
||||
SmelteryLogic smeltery = (SmelteryLogic)
|
||||
worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
return smeltery.fill(resource, doFill);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (hasValidMaster() && canDrain(from, null))
|
||||
{
|
||||
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
if (hasValidMaster() && canDrain(from, null)) {
|
||||
SmelteryLogic smeltery = (SmelteryLogic)
|
||||
worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
return smeltery.drain(maxDrain, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if (hasValidMaster() && canDrain(from, resource.getFluid()))
|
||||
{
|
||||
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
if (resource.getFluid() == smeltery.getFluid().getFluid())
|
||||
{
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
if (hasValidMaster() && canDrain(from, resource.getFluid())) {
|
||||
SmelteryLogic smeltery = (SmelteryLogic)
|
||||
worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
if (resource.getFluid() == smeltery.getFluid().getFluid()) {
|
||||
return smeltery.drain(resource.amount, doDrain);
|
||||
}
|
||||
}
|
||||
@@ -61,28 +53,23 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
// return from == getForgeDirection();//.getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain (ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
// Check that the drain is coming from the from the front of the block
|
||||
// and that the fluid to be drained is in the smeltery.
|
||||
if(!hasValidMaster())
|
||||
return false;
|
||||
|
||||
if (!hasValidMaster()) return false;
|
||||
|
||||
boolean containsFluid = fluid == null;
|
||||
if (fluid != null)
|
||||
{
|
||||
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
for (FluidStack fstack : smeltery.moltenMetal)
|
||||
{
|
||||
if (fstack.getFluidID() == fluid.getID())
|
||||
{
|
||||
if (fluid != null) {
|
||||
SmelteryLogic smeltery = (SmelteryLogic)
|
||||
worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
for (FluidStack fstack : smeltery.moltenMetal) {
|
||||
if (fstack.getFluidID() == fluid.getID()) {
|
||||
containsFluid = true;
|
||||
break;
|
||||
}
|
||||
@@ -93,11 +80,13 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo (ForgeDirection from)
|
||||
{
|
||||
if (hasValidMaster() && (from == getForgeDirection() || from == getForgeDirection().getOpposite() || from == ForgeDirection.UNKNOWN))
|
||||
{
|
||||
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
if (hasValidMaster()
|
||||
&& (from == getForgeDirection()
|
||||
|| from == getForgeDirection().getOpposite()
|
||||
|| from == ForgeDirection.UNKNOWN)) {
|
||||
SmelteryLogic smeltery = (SmelteryLogic)
|
||||
worldObj.getTileEntity(getMasterPosition().x, getMasterPosition().y, getMasterPosition().z);
|
||||
return smeltery.getMultiTankInfo();
|
||||
// return new FluidTankInfo[] { smeltery.getInfo() };
|
||||
}
|
||||
@@ -105,98 +94,81 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getRenderDirection ()
|
||||
{
|
||||
public byte getRenderDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getForgeDirection ()
|
||||
{
|
||||
public ForgeDirection getForgeDirection() {
|
||||
return ForgeDirection.VALID_DIRECTIONS[direction];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection (int side)
|
||||
{
|
||||
|
||||
}
|
||||
public void setDirection(int side) {}
|
||||
|
||||
@Override
|
||||
public void setDirection (float yaw, float pitch, EntityLivingBase player)
|
||||
{
|
||||
if (pitch > 45)
|
||||
direction = 1;
|
||||
else if (pitch < -45)
|
||||
direction = 0;
|
||||
else
|
||||
{
|
||||
public void setDirection(float yaw, float pitch, EntityLivingBase player) {
|
||||
if (pitch > 45) direction = 1;
|
||||
else if (pitch < -45) direction = 0;
|
||||
else {
|
||||
int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3;
|
||||
switch (facing)
|
||||
{
|
||||
case 0:
|
||||
direction = 2;
|
||||
break;
|
||||
switch (facing) {
|
||||
case 0:
|
||||
direction = 2;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
direction = 5;
|
||||
break;
|
||||
case 1:
|
||||
direction = 5;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
direction = 3;
|
||||
break;
|
||||
case 2:
|
||||
direction = 3;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
direction = 4;
|
||||
break;
|
||||
case 3:
|
||||
direction = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
direction = tags.getByte("Direction");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
tags.setByte("Direction", direction);
|
||||
}
|
||||
|
||||
/* Packets */
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readFromNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public int comparatorStrength ()
|
||||
{
|
||||
public int comparatorStrength() {
|
||||
CoordTuple master = this.getMasterPosition();
|
||||
// invalid smeltery
|
||||
if(master == null)
|
||||
return 0;
|
||||
if (master == null) return 0;
|
||||
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(master.x, master.y, master.z);
|
||||
|
||||
// this can happen when the comparator checks its strength before the drain is getting updated on a broken master (smeltery controller)
|
||||
if(smeltery == null)
|
||||
return 0;
|
||||
// this can happen when the comparator checks its strength before the drain is getting updated on a broken
|
||||
// master (smeltery controller)
|
||||
if (smeltery == null) return 0;
|
||||
|
||||
if(smeltery.maxLiquid == 0)
|
||||
return 0;
|
||||
if (smeltery.maxLiquid == 0) return 0;
|
||||
return 15 * smeltery.currentLiquid / smeltery.maxLiquid;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -14,55 +14,50 @@ import tconstruct.smeltery.logic.CastingChannelLogic;
|
||||
/**
|
||||
* @author BluSunrize
|
||||
*/
|
||||
|
||||
public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler {
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
//Floor
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
// Floor
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Channel Z-
|
||||
// Channel Z-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0D, 0.375D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Channel Z+
|
||||
// Channel Z+
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.6875D, 0.375D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Wall X-
|
||||
// Wall X-
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
//Wall X+
|
||||
// Wall X+
|
||||
renderer.setRenderBounds(0.625D, 0.375D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
this.renderStandardBlock(block, metadata, renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == renderID)
|
||||
{
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == renderID) {
|
||||
CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z);
|
||||
|
||||
Set<ForgeDirection> outputs = tile.getOutputs().keySet();
|
||||
|
||||
if (!outputs.contains(ForgeDirection.DOWN))//CentrePiece, floor is removed if tank below is found
|
||||
if (!outputs.contains(ForgeDirection.DOWN)) // CentrePiece, floor is removed if tank below is found
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//"Guiding Borders" when tank below is found
|
||||
} else
|
||||
// "Guiding Borders" when tank below is found
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.125D, 0.3125D, 0.625D, 0.5D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -73,7 +68,7 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
renderer.setRenderBounds(0.625D, 0.125D, 0.3125D, 0.6875D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
if (outputs.contains(ForgeDirection.NORTH))//Channel to Z-
|
||||
if (outputs.contains(ForgeDirection.NORTH)) // Channel to Z-
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0D, 0.6875D, 0.5D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -81,15 +76,14 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0D, 0.6875D, 0.625D, 0.3125D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to Z-
|
||||
} else
|
||||
// Wall to Z-
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.3125D, 0.625D, 0.625D, 0.375D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (outputs.contains(ForgeDirection.SOUTH))//Channel to Z+
|
||||
if (outputs.contains(ForgeDirection.SOUTH)) // Channel to Z+
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.375D, 0.6875D, 0.6875D, 0.5D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -97,15 +91,14 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.6875D, 0.6875D, 0.625D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to Z+
|
||||
} else
|
||||
// Wall to Z+
|
||||
{
|
||||
renderer.setRenderBounds(0.375D, 0.5D, 0.625D, 0.625D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (outputs.contains(ForgeDirection.WEST))//Channel to X-
|
||||
if (outputs.contains(ForgeDirection.WEST)) // Channel to X-
|
||||
{
|
||||
renderer.setRenderBounds(0D, 0.375D, 0.3125D, 0.3125D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -113,15 +106,14 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0D, 0.5D, 0.625D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to X-
|
||||
} else
|
||||
// Wall to X-
|
||||
{
|
||||
renderer.setRenderBounds(0.3125D, 0.5D, 0.3125D, 0.375D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (outputs.contains(ForgeDirection.EAST))//Channel to X+
|
||||
if (outputs.contains(ForgeDirection.EAST)) // Channel to X+
|
||||
{
|
||||
renderer.setRenderBounds(0.6875D, 0.375D, 0.3125D, 1D, 0.5D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -129,29 +121,24 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.625D, 1D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
//Wall to X+
|
||||
} else
|
||||
// Wall to X+
|
||||
{
|
||||
renderer.setRenderBounds(0.625D, 0.5D, 0.3125D, 0.6875D, 0.625D, 0.6875D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
FluidTankInfo tankMain = tile.getTankInfo(null)[0];
|
||||
if (tankMain.fluid != null)
|
||||
{
|
||||
if (tankMain.fluid != null) {
|
||||
float liquidAmount = (float) tankMain.fluid.amount / (float) tankMain.capacity * 0.125f;
|
||||
double startY = tile.tankBelow();
|
||||
renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.51 + liquidAmount, 0.625D); //Center
|
||||
renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.51 + liquidAmount, 0.625D); // Center
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tankMain.fluid, false);
|
||||
}
|
||||
for (ForgeDirection dir : outputs)
|
||||
{
|
||||
for (ForgeDirection dir : outputs) {
|
||||
double[] bounds = getRenderboundsForLiquid(dir);
|
||||
if (bounds == null)
|
||||
break;
|
||||
if (bounds == null) break;
|
||||
FluidTankInfo tankSub = tile.getTankInfo(dir)[0];
|
||||
if (tankSub == null || tankSub.fluid == null)
|
||||
break;
|
||||
if (tankSub == null || tankSub.fluid == null) break;
|
||||
float liquidAmount = (float) tankSub.fluid.amount / (float) tankSub.capacity * 0.125f / 2;
|
||||
renderer.setRenderBounds(bounds[0], 0.51, bounds[1], bounds[2], 0.5 + liquidAmount, bounds[3]);
|
||||
renderLiquidPart(world, x, y, z, block, renderer, tankSub.fluid, false);
|
||||
@@ -161,25 +148,30 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
private double[] getRenderboundsForLiquid (ForgeDirection dir)
|
||||
{
|
||||
switch (dir)
|
||||
{
|
||||
case NORTH:
|
||||
return new double[] { 0.375, 0, 0.625, 0.375 };
|
||||
case SOUTH:
|
||||
return new double[] { 0.375, 0.625, 0.625, 1 };
|
||||
case WEST:
|
||||
return new double[] { 0, 0.375, 0.375, 0.625 };
|
||||
case EAST:
|
||||
return new double[] { 0.625, 0.375, 1, 0.625 };
|
||||
default:
|
||||
return null;
|
||||
private double[] getRenderboundsForLiquid(ForgeDirection dir) {
|
||||
switch (dir) {
|
||||
case NORTH:
|
||||
return new double[] {0.375, 0, 0.625, 0.375};
|
||||
case SOUTH:
|
||||
return new double[] {0.375, 0.625, 0.625, 1};
|
||||
case WEST:
|
||||
return new double[] {0, 0.375, 0.375, 0.625};
|
||||
case EAST:
|
||||
return new double[] {0.625, 0.375, 1, 0.625};
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void renderLiquidPart (IBlockAccess world, int x, int y, int z, Block block, RenderBlocks renderer, FluidStack fluidStack, boolean useFlowingTexture)
|
||||
{
|
||||
private void renderLiquidPart(
|
||||
IBlockAccess world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
Block block,
|
||||
RenderBlocks renderer,
|
||||
FluidStack fluidStack,
|
||||
boolean useFlowingTexture) {
|
||||
int color = block.colorMultiplier(world, x, y, z);
|
||||
float red = (color >> 16 & 0xFF) / 255.0F;
|
||||
float green = (color >> 8 & 0xFF) / 255.0F;
|
||||
@@ -188,13 +180,30 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
if (fluid.canBePlacedInWorld() && !useFlowingTexture)
|
||||
BlockSkinRenderHelper.renderMetadataBlock(fluid.getBlock(), 0, x, y, z, renderer, world);
|
||||
else if (useFlowingTexture)
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getFlowingIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world, false, fluid.getColor(fluidStack));
|
||||
BlockSkinRenderHelper.renderLiquidBlock(
|
||||
fluid.getFlowingIcon(),
|
||||
fluid.getFlowingIcon(),
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
renderer,
|
||||
world,
|
||||
false,
|
||||
fluid.getColor(fluidStack));
|
||||
else
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world, false, fluid.getColor(fluidStack));
|
||||
BlockSkinRenderHelper.renderLiquidBlock(
|
||||
fluid.getStillIcon(),
|
||||
fluid.getFlowingIcon(),
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
renderer,
|
||||
world,
|
||||
false,
|
||||
fluid.getColor(fluidStack));
|
||||
}
|
||||
|
||||
private void renderStandardBlock (Block block, int meta, RenderBlocks renderer)
|
||||
{
|
||||
private void renderStandardBlock(Block block, int meta, RenderBlocks renderer) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
@@ -225,14 +234,12 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
public int getRenderId() {
|
||||
return renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelId)
|
||||
{
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,16 +13,13 @@ import tconstruct.tools.entity.FancyEntityItem;
|
||||
/* Special renderer, only used for drawing tools */
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CastingBasinSpecialRender extends TileEntitySpecialRenderer
|
||||
{
|
||||
public class CastingBasinSpecialRender extends TileEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
public void renderTileEntityAt(TileEntity logic, double var2, double var4, double var6, float var8) {
|
||||
this.render((CastingBasinLogic) logic, var2, var4, var6, var8);
|
||||
}
|
||||
|
||||
public void render (CastingBasinLogic logic, double posX, double posY, double posZ, float var8)
|
||||
{
|
||||
public void render(CastingBasinLogic logic, double posX, double posY, double posZ, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
float var10 = (float) (posX - 0.5F);
|
||||
float var11 = (float) (posY - 0.5F);
|
||||
@@ -30,18 +27,15 @@ public class CastingBasinSpecialRender extends TileEntitySpecialRenderer
|
||||
GL11.glTranslatef(var10, var11, var12);
|
||||
|
||||
ItemStack stack = logic.getStackInSlot(0);
|
||||
if (stack != null)
|
||||
renderItem(logic, stack);
|
||||
if (stack != null) renderItem(logic, stack);
|
||||
|
||||
stack = logic.getStackInSlot(1);
|
||||
if (stack != null)
|
||||
renderItem(logic, stack);
|
||||
if (stack != null) renderItem(logic, stack);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
void renderItem (CastingBasinLogic logic, ItemStack stack)
|
||||
{
|
||||
void renderItem(CastingBasinLogic logic, ItemStack stack) {
|
||||
FancyEntityItem entityitem = new FancyEntityItem(logic.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
@@ -49,13 +43,10 @@ public class CastingBasinSpecialRender extends TileEntitySpecialRenderer
|
||||
GL11.glTranslatef(1F, 0.675F, 1.0F);
|
||||
// GL11.glRotatef(90F, 1, 0F, 0F);
|
||||
GL11.glScalef(1.75F, 1.75F, 1.75F);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (stack.getItem() instanceof ItemBlock) {
|
||||
GL11.glScalef(1.6F, 1.6F, 1.6F);
|
||||
GL11.glTranslatef(0F, 0.045F, 0.0f);
|
||||
}
|
||||
else if (!(stack.getItem() instanceof ItemBlocklike))
|
||||
{
|
||||
} else if (!(stack.getItem() instanceof ItemBlocklike)) {
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glRotatef(90F, 0F, 0F, 1F);
|
||||
GL11.glScalef(0.75F, 0.75F, 0.75F);
|
||||
@@ -68,5 +59,4 @@ public class CastingBasinSpecialRender extends TileEntitySpecialRenderer
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,17 +13,13 @@ import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.logic.*;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public class CastingBlockRender implements ISimpleBlockRenderingHandler {
|
||||
public static int searedModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == searedModel)
|
||||
{
|
||||
if (metadata == 0)
|
||||
{
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == searedModel) {
|
||||
if (metadata == 0) {
|
||||
// Top
|
||||
renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
@@ -47,9 +43,7 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
else if (metadata == 1)
|
||||
{
|
||||
} else if (metadata == 1) {
|
||||
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.375, 0.625, 1);
|
||||
@@ -57,9 +51,7 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
renderer.setRenderBounds(0.625, 0.25, 0.625, 0.75, 0.625, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
|
||||
}
|
||||
else if (metadata == 2)
|
||||
{
|
||||
} else if (metadata == 2) {
|
||||
renderer.setRenderBounds(0.125F, 0.125f, 0.125F, 0.875F, 0.25F, 0.875F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
|
||||
@@ -119,9 +111,7 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
renderer.setRenderBounds(0.125f, 0.125, 0.875f, 0.875f, 1.0F, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
@@ -129,13 +119,11 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == searedModel)
|
||||
{
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == searedModel) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 0)
|
||||
{
|
||||
if (metadata == 0) {
|
||||
// Top
|
||||
renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -160,11 +148,9 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
if (world.getTileEntity(x, y, z) instanceof CastingTableLogic)
|
||||
{
|
||||
if (world.getTileEntity(x, y, z) instanceof CastingTableLogic) {
|
||||
CastingTableLogic logic = (CastingTableLogic) world.getTileEntity(x, y, z);
|
||||
if (logic.liquid != null)
|
||||
{
|
||||
if (logic.liquid != null) {
|
||||
float minHeight = 0.9375F;
|
||||
float maxHeight = 1F;
|
||||
|
||||
@@ -174,11 +160,9 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
float maxZ = 0.9375F;
|
||||
|
||||
ItemStack it = logic.getStackInSlot(0);
|
||||
if (it != null)
|
||||
{
|
||||
if (it != null) {
|
||||
CastingRecipe rec = TConstruct.tableCasting.getCastingRecipe(logic.liquid, it);
|
||||
if (rec != null && rec.fluidRenderProperties != null)
|
||||
{
|
||||
if (rec != null && rec.fluidRenderProperties != null) {
|
||||
minHeight = rec.fluidRenderProperties.minHeight;
|
||||
maxHeight = rec.fluidRenderProperties.maxHeight;
|
||||
|
||||
@@ -196,115 +180,129 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
renderer.setRenderBounds(minX, minHeight, minZ, maxX, minHeight + height, maxZ);
|
||||
|
||||
Fluid fluid = logic.liquid.getFluid();
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world, false, fluid.getColor(logic.liquid));
|
||||
BlockSkinRenderHelper.renderLiquidBlock(
|
||||
fluid.getStillIcon(),
|
||||
fluid.getFlowingIcon(),
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
renderer,
|
||||
world,
|
||||
false,
|
||||
fluid.getColor(logic.liquid));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (metadata == 1)
|
||||
{
|
||||
if (world.getTileEntity(x, y, z) instanceof FaucetLogic)
|
||||
{
|
||||
} else if (metadata == 1) {
|
||||
if (world.getTileEntity(x, y, z) instanceof FaucetLogic) {
|
||||
FaucetLogic logic = (FaucetLogic) world.getTileEntity(x, y, z);
|
||||
float xMin = 0.375F, zMin = 0.375F, xMax = 0.625F, zMax = 0.625F;
|
||||
switch (logic.getRenderDirection())
|
||||
{
|
||||
case 2:
|
||||
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.25, 0.375, 0.625, 0.375, 0.625, 1);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0.625, 0.75, 0.625, 1);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
|
||||
zMin = 0.5F;
|
||||
// zMin = 0.625F;
|
||||
break;
|
||||
case 3:
|
||||
renderer.setRenderBounds(0.25, 0.25, 0, 0.75, 0.375, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.25, 0.375, 0, 0.375, 0.625, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0, 0.75, 0.625, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.375, 0.375, 0, 0.625, 0.625, 0.375);
|
||||
zMax = 0.5F;
|
||||
break;
|
||||
case 4:
|
||||
renderer.setRenderBounds(0.625, 0.25, 0.25, 1, 0.375, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0.25, 1, 0.625, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0.625, 1, 0.625, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0.375, 1, 0.625, 0.625);
|
||||
xMin = 0.5F;
|
||||
break;
|
||||
case 5:
|
||||
renderer.setRenderBounds(0, 0.25, 0.25, 0.375, 0.375, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0.375, 0.25, 0.375, 0.625, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0.375, 0.625, 0.375, 0.625, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0.375, 0.375, 0.375, 0.625, 0.625);
|
||||
xMax = 0.5F;
|
||||
break;
|
||||
switch (logic.getRenderDirection()) {
|
||||
case 2:
|
||||
renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.25, 0.375, 0.625, 0.375, 0.625, 1);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0.625, 0.75, 0.625, 1);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
|
||||
zMin = 0.5F;
|
||||
// zMin = 0.625F;
|
||||
break;
|
||||
case 3:
|
||||
renderer.setRenderBounds(0.25, 0.25, 0, 0.75, 0.375, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.25, 0.375, 0, 0.375, 0.625, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0, 0.75, 0.625, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.375, 0.375, 0, 0.625, 0.625, 0.375);
|
||||
zMax = 0.5F;
|
||||
break;
|
||||
case 4:
|
||||
renderer.setRenderBounds(0.625, 0.25, 0.25, 1, 0.375, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0.25, 1, 0.625, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0.625, 1, 0.625, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.625, 0.375, 0.375, 1, 0.625, 0.625);
|
||||
xMin = 0.5F;
|
||||
break;
|
||||
case 5:
|
||||
renderer.setRenderBounds(0, 0.25, 0.25, 0.375, 0.375, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0.375, 0.25, 0.375, 0.625, 0.375);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0.375, 0.625, 0.375, 0.625, 0.75);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0, 0.375, 0.375, 0.375, 0.625, 0.625);
|
||||
xMax = 0.5F;
|
||||
break;
|
||||
}
|
||||
|
||||
float yMin = 0F;
|
||||
Block uBlock = world.getBlock(x, y - 1, z);
|
||||
int uMeta = world.getBlockMetadata(x, y - 1, z);
|
||||
if ((uBlock == TinkerSmeltery.searedBlock || uBlock == TinkerSmeltery.searedBlockNether) && uMeta == 0)
|
||||
{
|
||||
if ((uBlock == TinkerSmeltery.searedBlock || uBlock == TinkerSmeltery.searedBlockNether)
|
||||
&& uMeta == 0) {
|
||||
yMin = -0.125F;
|
||||
}
|
||||
else if ((uBlock == TinkerSmeltery.searedBlock || uBlock == TinkerSmeltery.searedBlockNether) && uMeta == 2)
|
||||
{
|
||||
} else if ((uBlock == TinkerSmeltery.searedBlock || uBlock == TinkerSmeltery.searedBlockNether)
|
||||
&& uMeta == 2) {
|
||||
yMin = -0.75F;
|
||||
}
|
||||
else if (uBlock == TinkerSmeltery.lavaTank || uBlock == TinkerSmeltery.lavaTankNether)
|
||||
{
|
||||
} else if (uBlock == TinkerSmeltery.lavaTank || uBlock == TinkerSmeltery.lavaTankNether) {
|
||||
yMin = -1F;
|
||||
}
|
||||
else if (uBlock == TinkerSmeltery.castingChannel)
|
||||
{
|
||||
} else if (uBlock == TinkerSmeltery.castingChannel) {
|
||||
yMin = -0.5F;
|
||||
}
|
||||
|
||||
if (logic.liquid != null)
|
||||
{
|
||||
if (logic.liquid != null) {
|
||||
Fluid fluid = logic.liquid.getFluid();
|
||||
renderer.setRenderBounds(xMin, yMin, zMin, xMax, 0.625, zMax);
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world, false, fluid.getColor(logic.liquid));
|
||||
BlockSkinRenderHelper.renderLiquidBlock(
|
||||
fluid.getStillIcon(),
|
||||
fluid.getFlowingIcon(),
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
renderer,
|
||||
world,
|
||||
false,
|
||||
fluid.getColor(logic.liquid));
|
||||
|
||||
// float xMin = 0.375F, zMin = 0.375F, xMax = 0.625F,
|
||||
// zMax = 0.625F;
|
||||
switch (logic.getRenderDirection())
|
||||
{
|
||||
case 3:
|
||||
zMin = 0.0F;
|
||||
zMax = 0.375F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.625F;
|
||||
zMax = 1.0F;
|
||||
break;
|
||||
case 5:
|
||||
xMin = 0.0F;
|
||||
xMax = 0.375F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.625F;
|
||||
xMax = 1.0F;
|
||||
break;
|
||||
switch (logic.getRenderDirection()) {
|
||||
case 3:
|
||||
zMin = 0.0F;
|
||||
zMax = 0.375F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.625F;
|
||||
zMax = 1.0F;
|
||||
break;
|
||||
case 5:
|
||||
xMin = 0.0F;
|
||||
xMax = 0.375F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.625F;
|
||||
xMax = 1.0F;
|
||||
break;
|
||||
}
|
||||
renderer.setRenderBounds(xMin, 0.5F, zMin, xMax, 0.625F, zMax);
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world, false, fluid.getColor(logic.liquid));
|
||||
BlockSkinRenderHelper.renderLiquidBlock(
|
||||
fluid.getStillIcon(),
|
||||
fluid.getFlowingIcon(),
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
renderer,
|
||||
world,
|
||||
false,
|
||||
fluid.getColor(logic.liquid));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (metadata == 2)
|
||||
{
|
||||
} else if (metadata == 2) {
|
||||
renderer.setRenderBounds(0.125F, 0.125f, 0.125F, 0.875F, 0.25F, 0.875F);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
@@ -367,11 +365,9 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
// Liquids
|
||||
if (world.getTileEntity(x, y, z) instanceof CastingBasinLogic)
|
||||
{
|
||||
if (world.getTileEntity(x, y, z) instanceof CastingBasinLogic) {
|
||||
CastingBasinLogic logic = (CastingBasinLogic) world.getTileEntity(x, y, z);
|
||||
if (logic.liquid != null)
|
||||
{
|
||||
if (logic.liquid != null) {
|
||||
float minHeight = 0.25F;
|
||||
float maxHeight = 0.95F;
|
||||
|
||||
@@ -381,11 +377,9 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
float maxZ = 0.9375F;
|
||||
|
||||
ItemStack it = logic.getStackInSlot(0);
|
||||
if (it != null)
|
||||
{
|
||||
if (it != null) {
|
||||
CastingRecipe rec = TConstruct.basinCasting.getCastingRecipe(logic.liquid, it);
|
||||
if (rec != null && rec.fluidRenderProperties != null)
|
||||
{
|
||||
if (rec != null && rec.fluidRenderProperties != null) {
|
||||
minHeight = rec.fluidRenderProperties.minHeight;
|
||||
maxHeight = rec.fluidRenderProperties.maxHeight;
|
||||
|
||||
@@ -403,12 +397,19 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
renderer.setRenderBounds(minX, minHeight, minZ, maxX, minHeight + height, maxZ);
|
||||
|
||||
Fluid fluid = logic.liquid.getFluid();
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), x, y, z, renderer, world, false, fluid.getColor(logic.liquid));
|
||||
BlockSkinRenderHelper.renderLiquidBlock(
|
||||
fluid.getStillIcon(),
|
||||
fluid.getFlowingIcon(),
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
renderer,
|
||||
world,
|
||||
false,
|
||||
fluid.getColor(logic.liquid));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
|
||||
@@ -426,14 +427,12 @@ public class CastingBlockRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelid)
|
||||
{
|
||||
public boolean shouldRender3DInInventory(int modelid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
public int getRenderId() {
|
||||
return searedModel;
|
||||
}
|
||||
}
|
||||
@@ -5,9 +5,7 @@ import net.minecraft.client.renderer.entity.*;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.ItemBlocklike;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.logic.CastingTableLogic;
|
||||
@@ -16,17 +14,14 @@ import tconstruct.tools.entity.FancyEntityItem;
|
||||
/* Special renderer, only used for drawing tools */
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer
|
||||
{
|
||||
public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer {
|
||||
@Override
|
||||
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
public void renderTileEntityAt(TileEntity logic, double var2, double var4, double var6, float var8) {
|
||||
// TConstruct.logger.info("Render!!!");
|
||||
this.render((CastingTableLogic) logic, var2, var4, var6, var8);
|
||||
}
|
||||
|
||||
public void render (CastingTableLogic logic, double posX, double posY, double posZ, float var8)
|
||||
{
|
||||
public void render(CastingTableLogic logic, double posX, double posY, double posZ, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
float var10 = (float) (posX - 0.5F);
|
||||
float var11 = (float) (posY - 0.5F);
|
||||
@@ -36,21 +31,17 @@ public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void func_82402_b (CastingTableLogic logic)
|
||||
{
|
||||
private void func_82402_b(CastingTableLogic logic) {
|
||||
ItemStack stack = logic.getStackInSlot(0);
|
||||
|
||||
if (stack != null)
|
||||
renderItem(logic, stack);
|
||||
if (stack != null) renderItem(logic, stack);
|
||||
|
||||
stack = logic.getStackInSlot(1);
|
||||
|
||||
if (stack != null)
|
||||
renderItem(logic, stack);
|
||||
if (stack != null) renderItem(logic, stack);
|
||||
}
|
||||
|
||||
void renderItem (CastingTableLogic logic, ItemStack stack)
|
||||
{
|
||||
void renderItem(CastingTableLogic logic, ItemStack stack) {
|
||||
FancyEntityItem entityitem = new FancyEntityItem(logic.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
@@ -58,17 +49,15 @@ public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer
|
||||
GL11.glTranslatef(1F, 1.48F, 0.55F);
|
||||
GL11.glRotatef(90F, 1, 0F, 0F);
|
||||
GL11.glScalef(2F, 2F, 2F);
|
||||
if (stack.getItem() instanceof ItemBlock || stack.getItem() instanceof ItemBlocklike)
|
||||
{
|
||||
if (stack.getItem() instanceof ItemBlock || stack.getItem() instanceof ItemBlocklike) {
|
||||
GL11.glRotatef(90F, -1, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -0.1F, 0.2275F);
|
||||
}
|
||||
|
||||
if (stack.isItemEqual(new ItemStack(TinkerSmeltery.glassPane)))
|
||||
{
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -0.194F, -0.1F);
|
||||
GL11.glScalef(0.85F, 0.85F, 0.85F);
|
||||
if (stack.isItemEqual(new ItemStack(TinkerSmeltery.glassPane))) {
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glTranslatef(0F, -0.194F, -0.1F);
|
||||
GL11.glScalef(0.85F, 0.85F, 0.85F);
|
||||
}
|
||||
|
||||
RenderItem.renderInFrame = true;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.smeltery.model;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
import cpw.mods.fml.client.registry.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -7,22 +9,16 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import tconstruct.smeltery.blocks.GlassPaneConnected;
|
||||
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
public class PaneConnectedRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public class PaneConnectedRender implements ISimpleBlockRenderingHandler {
|
||||
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
|
||||
}
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
||||
{
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
boolean temp = renderer.renderAllFaces;
|
||||
renderer.renderAllFaces = true;
|
||||
|
||||
@@ -35,41 +31,34 @@ public class PaneConnectedRender implements ISimpleBlockRenderingHandler
|
||||
|
||||
IIcon sideTexture = pane.getSideTextureIndex();
|
||||
|
||||
if (!flag && !flag1 && !flag2 && !flag3)
|
||||
{
|
||||
if (!flag && !flag1 && !flag2 && !flag3) {
|
||||
renderer.setRenderBounds(0D, 0D, 0.45D, 1D, 1D, 0.55D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 0.55D);
|
||||
// renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
// renderer.setOverrideBlockTexture(sideTexture);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
renderer.setRenderBounds(0.45D, 0D, 0.45D, 1D, 1D, 0.55D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
renderer.setRenderBounds(0D, 0D, 0.45D, 0.45D, 1D, 0.55D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (flag2)
|
||||
{
|
||||
if (flag2) {
|
||||
renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
if (flag3)
|
||||
{
|
||||
if (flag3) {
|
||||
renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 0.45D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
@@ -81,15 +70,12 @@ public class PaneConnectedRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelID)
|
||||
{
|
||||
public boolean shouldRender3DInInventory(int modelID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
public int getRenderId() {
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,45 +6,36 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
public class PaneRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public class PaneRender implements ISimpleBlockRenderingHandler {
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
//renderer.setOverrideBlockTexture(((PaneBase)block).getIcon(0, world.getBlockMetadata(x,y,z)));
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
// renderer.setOverrideBlockTexture(((PaneBase)block).getIcon(0, world.getBlockMetadata(x,y,z)));
|
||||
return renderer.renderBlockStainedGlassPane(block, x, y, z);
|
||||
//return renderPaneInWorld(renderer, world, x, y, z, (PaneBase) block);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// return renderPaneInWorld(renderer, world, x, y, z, (PaneBase) block);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelID)
|
||||
{
|
||||
public boolean shouldRender3DInInventory(int modelID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
public int getRenderId() {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
@@ -13,59 +13,48 @@ import tconstruct.library.crafting.Smeltery;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
public class SmelteryRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public class SmelteryRender implements ISimpleBlockRenderingHandler {
|
||||
public static int smelteryModel = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == smelteryModel)
|
||||
{
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == smelteryModel) {
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == smelteryModel)
|
||||
{
|
||||
if (world.getBlockMetadata(x, y, z) == 0)
|
||||
return renderSmeltery(world, x, y, z, block, modelID, renderer);
|
||||
else
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == smelteryModel) {
|
||||
if (world.getBlockMetadata(x, y, z) == 0) return renderSmeltery(world, x, y, z, block, modelID, renderer);
|
||||
else renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean renderSmeltery (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
public boolean renderSmeltery(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
|
||||
boolean ret = renderer.renderStandardBlock(block, x, y, z);
|
||||
SmelteryLogic logic = (SmelteryLogic) world.getTileEntity(x, y, z);
|
||||
if (logic.validStructure)
|
||||
{
|
||||
if (logic.validStructure) {
|
||||
CoordTuple from = logic.minPos;
|
||||
CoordTuple to = logic.maxPos;
|
||||
|
||||
//Melting
|
||||
if (logic.getSizeInventory() > 0)
|
||||
{
|
||||
for (int i = 0; i < logic.layers; i++)
|
||||
{
|
||||
// Melting
|
||||
if (logic.getSizeInventory() > 0) {
|
||||
for (int i = 0; i < logic.layers; i++) {
|
||||
renderLayer(logic, i * logic.getBlocksPerLayer(), from, to, from.y + i, renderer, world);
|
||||
}
|
||||
}
|
||||
|
||||
//Liquids
|
||||
// Liquids
|
||||
float base = 0F;
|
||||
int yBase = 0;
|
||||
int liquidBase = 0;
|
||||
for (FluidStack liquid : logic.moltenMetal)
|
||||
{
|
||||
for (FluidStack liquid : logic.moltenMetal) {
|
||||
int liquidSize = liquid.amount;
|
||||
while (liquidSize > 0)
|
||||
{
|
||||
while (liquidSize > 0) {
|
||||
int cap = logic.getCapacityPerLayer();
|
||||
int room = cap - liquidBase;
|
||||
int countSize = liquidSize > room ? room : liquidSize;
|
||||
@@ -77,27 +66,34 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler
|
||||
base += height;
|
||||
liquidBase += countSize;
|
||||
|
||||
if(renderHeight < 0.01)
|
||||
renderHeight = 0.01f;
|
||||
if (renderHeight < 0.01) renderHeight = 0.01f;
|
||||
|
||||
renderer.setRenderBounds(0, renderBase, 0, 1, renderHeight, 1);
|
||||
Fluid fluid = liquid.getFluid();
|
||||
for (int xi = from.x; xi <= to.x; xi++)
|
||||
for (int zi = from.z; zi <= to.z; zi++)
|
||||
{
|
||||
for (int zi = from.z; zi <= to.z; zi++) {
|
||||
float minX = xi == from.x ? -0.001F : 0F;
|
||||
float minZ = zi == from.z ? -0.001F : 0F;
|
||||
float maxX = xi == to.x ? 1.001F : 1F;
|
||||
float maxZ = zi == to.z ? 1.001F : 1F;
|
||||
renderer.setRenderBounds(minX, renderBase, minZ, maxX, renderHeight, maxZ);
|
||||
if (fluid.canBePlacedInWorld())
|
||||
BlockSkinRenderHelper.renderMetadataBlock(fluid.getBlock(), 0, xi, from.y + yBase, zi, renderer, world);
|
||||
BlockSkinRenderHelper.renderMetadataBlock(
|
||||
fluid.getBlock(), 0, xi, from.y + yBase, zi, renderer, world);
|
||||
else
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getFlowingIcon(), xi, from.y + yBase, zi, renderer, world, false, fluid.getColor(liquid));
|
||||
BlockSkinRenderHelper.renderLiquidBlock(
|
||||
fluid.getStillIcon(),
|
||||
fluid.getFlowingIcon(),
|
||||
xi,
|
||||
from.y + yBase,
|
||||
zi,
|
||||
renderer,
|
||||
world,
|
||||
false,
|
||||
fluid.getColor(liquid));
|
||||
}
|
||||
|
||||
if (countSize == room)
|
||||
{
|
||||
if (countSize == room) {
|
||||
base = 0F;
|
||||
yBase++;
|
||||
liquidBase = 0;
|
||||
@@ -109,27 +105,31 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler
|
||||
return ret;
|
||||
}
|
||||
|
||||
void renderLayer (SmelteryLogic logic, int start, CoordTuple from, CoordTuple to, int posY, RenderBlocks renderer, IBlockAccess world)
|
||||
{
|
||||
void renderLayer(
|
||||
SmelteryLogic logic,
|
||||
int start,
|
||||
CoordTuple from,
|
||||
CoordTuple to,
|
||||
int posY,
|
||||
RenderBlocks renderer,
|
||||
IBlockAccess world) {
|
||||
renderer.setRenderBounds(-0.001F, -0.001F, -0.001F, 1.001F, 1.001F, 1.001F);
|
||||
int i = start;
|
||||
for (int x = from.x; x <= to.x; x++)
|
||||
for (int z = from.z; z <= to.z; z++)
|
||||
{
|
||||
for (int z = from.z; z <= to.z; z++) {
|
||||
// safety because of changes.
|
||||
if(i > logic.getSizeInventory())
|
||||
return;
|
||||
if (i > logic.getSizeInventory()) return;
|
||||
ItemStack input = logic.getStackInSlot(i);
|
||||
if (input != null && logic.getTempForSlot(i) > 20)
|
||||
{
|
||||
if (input != null && logic.getTempForSlot(i) > 20) {
|
||||
ItemStack blockToRender = Smeltery.getRenderIndex(input);
|
||||
if (blockToRender != null)
|
||||
{
|
||||
if (blockToRender != null) {
|
||||
float blockHeight = input.stackSize / (float) blockToRender.stackSize;
|
||||
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, MathHelper.clamp_float(blockHeight, 0.01F, 1.0F), 1.0F);
|
||||
renderer.setRenderBounds(
|
||||
0.0F, 0.0F, 0.0F, 1.0F, MathHelper.clamp_float(blockHeight, 0.01F, 1.0F), 1.0F);
|
||||
|
||||
Block liquidBlock = Block.getBlockFromItem(blockToRender.getItem());
|
||||
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), x, posY, z, renderer, world);
|
||||
BlockSkinRenderHelper.renderMetadataBlock(
|
||||
liquidBlock, blockToRender.getItemDamage(), x, posY, z, renderer, world);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
@@ -137,14 +137,12 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelId)
|
||||
{
|
||||
public boolean shouldRender3DInInventory(int modelId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
public int getRenderId() {
|
||||
return smelteryModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,22 +28,22 @@ public class TankItemRenderer implements IItemRenderer {
|
||||
Block block = Block.getBlockFromItem(item.getItem());
|
||||
int meta = item.getItemDamage();
|
||||
|
||||
if(item.hasTagCompound() && item.getTagCompound().hasKey("Fluid"))
|
||||
{
|
||||
FluidStack liquid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("Fluid"));
|
||||
if(liquid != null && liquid.getFluid().getBlock() != null)
|
||||
{
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("Fluid")) {
|
||||
FluidStack liquid =
|
||||
FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("Fluid"));
|
||||
if (liquid != null && liquid.getFluid().getBlock() != null) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
float height = (float)liquid.amount / 4000f - 0.01f;
|
||||
float height = (float) liquid.amount / 4000f - 0.01f;
|
||||
renderblocks.setRenderBounds(0.01, 0.01, 0.01, 0.99, height, 0.99);
|
||||
ItemHelper.renderStandardInvBlock(renderblocks, liquid.getFluid().getBlock(), 0);
|
||||
ItemHelper.renderStandardInvBlock(
|
||||
renderblocks, liquid.getFluid().getBlock(), 0);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
renderblocks.setRenderBounds(0, 0, 0, 1, 1, 1);
|
||||
//ItemHelper.renderStandardInvBlock(renderblocks, block, meta);
|
||||
// ItemHelper.renderStandardInvBlock(renderblocks, block, meta);
|
||||
RenderingRegistry.instance().renderInventoryBlock(renderblocks, block, meta, TankRender.tankModelID);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
@@ -11,20 +11,16 @@ import tconstruct.client.BlockSkinRenderHelper;
|
||||
import tconstruct.smeltery.logic.LavaTankLogic;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
public class TankRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public class TankRender implements ISimpleBlockRenderingHandler {
|
||||
public static int tankModelID = RenderingRegistry.getNextAvailableRenderId();
|
||||
public static int renderPass = 0;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == tankModelID)
|
||||
{
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == tankModelID) {
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
// the thingie on top of lava tanks
|
||||
if (metadata == 0)
|
||||
{
|
||||
if (metadata == 0) {
|
||||
renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
|
||||
renderDoRe(renderer, block, metadata);
|
||||
}
|
||||
@@ -32,31 +28,35 @@ public class TankRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == tankModelID)
|
||||
{
|
||||
//Liquid
|
||||
if (renderPass == 0)
|
||||
{
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == tankModelID) {
|
||||
// Liquid
|
||||
if (renderPass == 0) {
|
||||
LavaTankLogic logic = (LavaTankLogic) world.getTileEntity(x, y, z);
|
||||
if (logic.containsFluid())
|
||||
{
|
||||
if (logic.containsFluid()) {
|
||||
FluidStack liquid = logic.tank.getFluid();
|
||||
renderer.setRenderBounds(0.001, 0.001, 0.001, 0.999, logic.getFluidAmountScaled(), 0.999);
|
||||
Fluid fluid = liquid.getFluid();
|
||||
BlockSkinRenderHelper.renderLiquidBlock(fluid.getStillIcon(), fluid.getStillIcon(), x, y, z, renderer, world, false, fluid.getColor(liquid));
|
||||
BlockSkinRenderHelper.renderLiquidBlock(
|
||||
fluid.getStillIcon(),
|
||||
fluid.getStillIcon(),
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
renderer,
|
||||
world,
|
||||
false,
|
||||
fluid.getColor(liquid));
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//Block
|
||||
else
|
||||
{
|
||||
// Block
|
||||
else {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0 && world.getBlock(x, y + 1, z) == Blocks.air)
|
||||
{
|
||||
if (meta == 0 && world.getBlock(x, y + 1, z) == Blocks.air) {
|
||||
renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
|
||||
renderer.renderStandardBlock(block, x, y + 1, z);
|
||||
}
|
||||
@@ -68,19 +68,16 @@ public class TankRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelID)
|
||||
{
|
||||
public boolean shouldRender3DInInventory(int modelID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
public int getRenderId() {
|
||||
return tankModelID;
|
||||
}
|
||||
|
||||
private void renderDoRe (RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
private void renderDoRe(RenderBlocks renderblocks, Block block, int meta) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, 0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
@@ -109,4 +106,4 @@ public class TankRender implements ISimpleBlockRenderingHandler
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user