Format cleanup

This commit is contained in:
mDiyo committed 2013-11-10 13:57:35 -08:00
1 parent c6ef343106
commit fdcb651ef4
130 files changed
+4066 -3266

No files matched your search

+1 -1
View File
@@ -98,7 +98,7 @@ public class TConstruct
proxy.addNames();
proxy.readManuals();
proxy.registerKeys();
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
GameRegistry.registerWorldGenerator(new TBaseWorldGenerator());
+15 -14
View File
@@ -521,36 +521,37 @@ public class BlockLandmine extends BlockContainer
return par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) ? 1 : 0;
}
protected AxisAlignedBB getSensitiveAABB(World par1World, int par2, int par3, int par4){
protected AxisAlignedBB getSensitiveAABB (World par1World, int par2, int par3, int par4)
{
float f = 0.125F;
// return AxisAlignedBB.getAABBPool().getAABB((double)((float)par1 + f), (double)par2, (double)((float)par3 + f), (double)((float)(par1 + 1) - f), (double)par2 + 0.25D, (double)((float)(par3 + 1) - f));
// return AxisAlignedBB.getAABBPool().getAABB((double)((float)par1 + f), (double)par2, (double)((float)par3 + f), (double)((float)(par1 + 1) - f), (double)par2 + 0.25D, (double)((float)(par3 + 1) - f));
int l = par1World.getBlockMetadata(par2, par3, par4);
int i1 = l & 7;
boolean flag = (l & 8) > 0;
float minX = par2 + f, minY = par3, minZ = par4 + f, maxX = par2 + 1 - f, maxY = par3 + 0.25F, maxZ = par4 + 1 - f;
ForgeDirection dir = Helper.convertMetaToForgeOrientation(i1);
switch (dir)
{
case DOWN:
break;
case UP:
minY = par3 + 0.75F;
maxY = par3 + 1;
minY = par3 + 0.75F;
maxY = par3 + 1;
break;
default:
minX = par2;
minY = par3;
minZ = par4;
maxX = par2 + 1;
maxY = par3 + 1;
maxZ = par4 + 1;
minX = par2;
minY = par3;
minZ = par4;
maxX = par2 + 1;
maxY = par3 + 1;
maxZ = par4 + 1;
}
return AxisAlignedBB.getAABBPool().getAABB(minX, minY, minZ, maxX, maxY, maxZ);
return AxisAlignedBB.getAABBPool().getAABB(minX, minY, minZ, maxX, maxY, maxZ);
}
public Entity getMineTriggerer (World par1World, int par2, int par3, int par4)
{
@@ -42,7 +42,7 @@ public class CastingChannelBlock extends BlockContainer
{
//int amount = 0;
//if (tile.getFluid() != null)
//amount = tile.getLiquidAmount();
//amount = tile.getLiquidAmount();
//player.addChatMessage("LiquidAmount: " + amount);
tile.setActive(true);
}
+18 -18
View File
@@ -25,26 +25,26 @@ public class ConveyorBase extends Block
this.setCreativeTab(TConstructRegistry.blockTab);
setBlockBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
}
public boolean isBlockReplaceable(World world, int x, int y, int z)
public boolean isBlockReplaceable (World world, int x, int y, int z)
{
return false;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
return null;
}
@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)
{
if (!world.isBlockIndirectlyGettingPowered(x, y, z))
{
double moveX = 0;
double moveZ = 0;
double speed = 0.01;
int meta = world.getBlockMetadata(x, y, z);
@@ -56,7 +56,7 @@ public class ConveyorBase extends Block
case 7:
moveX += speed;
moveZ += speed;
break;
break;
case 0:
moveZ += speed;
break;
@@ -82,22 +82,22 @@ public class ConveyorBase extends Block
entity.addVelocity(moveX, 0, moveZ);
}
if (entity instanceof EntityItem)
{
((EntityItem)entity).age = 0;
((EntityItem) entity).age = 0;
}
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
{
int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D) + (entity.isSneaking() ? 4 : 0) & 7;
int meta = world.getBlockMetadata(x, y, z) & 8;
world.setBlockMetadataWithNotify(x, y, z, face | meta, 2);
}
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)
{
if (side == 1)
return false;
@@ -108,31 +108,31 @@ public class ConveyorBase extends Block
/* Rendering */
@Override
public boolean renderAsNormalBlock()
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderBlockPass()
public int getRenderBlockPass ()
{
return 1;
}
@Override
public int getRenderType()
public int getRenderType ()
{
return SlimeChannelRender.model;
}
@Override
public void registerIcons(IconRegister iconRegister)
public void registerIcons (IconRegister iconRegister)
{
String[] textureNames = new String[] { "greencurrent", "greencurrent_flow" };
this.icons = new Icon[textureNames.length];
@@ -145,7 +145,7 @@ public class ConveyorBase extends Block
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
public Icon getIcon (int side, int meta)
{
if (meta >= 8)
return icons[0];
+3 -2
View File
@@ -123,7 +123,8 @@ public class EquipBlock extends InventoryBlock
}
@Override
public void breakBlock (World par1World, int x, int y, int z, int par5, int meta){
public void breakBlock (World par1World, int x, int y, int z, int par5, int meta)
{
TileEntity te = par1World.getBlockTileEntity(x, y, z);
if (te != null && te instanceof EquipLogic)
@@ -169,7 +170,7 @@ public class EquipBlock extends InventoryBlock
super.breakBlock(par1World, x, y, z, par5, meta);
}
public int getLightValue (IBlockAccess world, int x, int y, int z)
{
return !isActive(world, x, y, z) ? 0 : 9;
@@ -29,10 +29,11 @@ public class GlassBlockConnected extends Block
setHardness(0.3F);
this.setCreativeTab(TConstructRegistry.blockTab);
}
//For FMP support
public Icon[] getIcons(){
return icons;
public Icon[] getIcons ()
{
return icons;
}
@Override
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -182,7 +182,7 @@ public class MeatBlock extends Block
{
return true;
}
public boolean isBeaconBase (World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ)
{
return true;
+1 -1
View File
@@ -206,7 +206,7 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable
return true;
world.setBlock(x, y, z, blockID, meta - 4, 3);
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.oreBerries, random.nextInt(3)+1, meta % 4 + itemMeat));
AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.oreBerries, random.nextInt(3) + 1, meta % 4 + itemMeat));
return true;
}
+1 -1
View File
@@ -272,7 +272,7 @@ public class RedstoneMachine extends InventoryBlock
{
if (direction == i)
continue;
CoordTuple coord = directions.get(i);
if (this.getIndirectPowerLevelTo(world, x + coord.x, y + coord.y, z + coord.z, i) > 0 || activeRedstone(world, coord.x, y + coord.y, z + coord.z))
{
+103 -141
View File
@@ -53,68 +53,74 @@ import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
public class SignalBus extends Block implements ITileEntityProvider {
public static class Geometry {
public class SignalBus extends Block implements ITileEntityProvider
{
public static class Geometry
{
public static double cable_width_min = 0.375D;
public static double cable_width_max = 1 - cable_width_min;
public static double cable_low_height = 0.2D;
public static double cable_low_offset = 0.0D;
public static double cable_high_height = 1.0D;
public static double cable_high_offset = 1 - cable_low_height;
public static double cable_extend_min = 0.0D;
public static double cable_extend_max = 1.0D;
public static double cable_corner_min = cable_high_offset - 1;
public static double cable_corner_max = cable_low_height + 1;
public static double zfight = 0.00001D;
}
public static int HITBOXES = 6;
public Icon[] icons;
public String[] textureNames = new String[] { "signalbus" };
public SignalBus(int par1) {
super(par1, Material.circuits);
public SignalBus(int par1)
{
super(par1, Material.circuits);
this.setHardness(0.1F);
this.setResistance(1);
this.setStepSound(soundMetalFootstep);
setCreativeTab(TConstructRegistry.blockTab);
}
}
@Override
public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ) {
TileEntity te = world.getBlockTileEntity(tileX, tileY, tileZ);
if (te instanceof SignalBusLogic) {
if (((SignalBusLogic)te).getMultiblockMaster() != null) {
((SignalBusLogic)te).getMultiblockMaster().detachBlock((IMultiblockMember)te, false);
}
}
}
@Override
public void onNeighborTileChange (World world, int x, int y, int z, int tileX, int tileY, int tileZ)
{
TileEntity te = world.getBlockTileEntity(tileX, tileY, tileZ);
if (te instanceof SignalBusLogic)
{
if (((SignalBusLogic) te).getMultiblockMaster() != null)
{
((SignalBusLogic) te).getMultiblockMaster().detachBlock((IMultiblockMember) te, false);
}
}
}
@Override
@Override
public void onNeighborBlockChange (World world, int x, int y, int z, int blockID)
{
if (blockID == this.blockID)
{
return;
}
super.onNeighborBlockChange(world, x, y, z, blockID);
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof SignalBusLogic)
{
ItemStack tempStack;
float jumpX, jumpY, jumpZ;
Random rand = new Random();
int dropBus = ((SignalBusLogic)te).checkUnsupportedSides();
if (blockID == this.blockID)
{
return;
}
super.onNeighborBlockChange(world, x, y, z, blockID);
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof SignalBusLogic)
{
ItemStack tempStack;
float jumpX, jumpY, jumpZ;
Random rand = new Random();
int dropBus = ((SignalBusLogic) te).checkUnsupportedSides();
if (dropBus > 0)
{
if (((SignalBusLogic)te).checkShouldDestroy())
if (((SignalBusLogic) te).checkShouldDestroy())
{
world.setBlockToAir(x, y, z);
}
@@ -131,19 +137,21 @@ public class SignalBus extends Block implements ITileEntityProvider {
entityitem.motionY = (double) ((float) rand.nextGaussian() * offset + 0.2F);
entityitem.motionZ = (double) ((float) rand.nextGaussian() * offset);
world.spawnEntityInWorld(entityitem);
world.markBlockForUpdate(x, y, z);
}
}
}
}
@Override
public void onBlockAdded(World world, int x, int y, int z) {
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te != null && te instanceof SignalBusLogic) {
((SignalBusLogic)te).onBlockAdded(world, x, y, z);
}
}
public void onBlockAdded (World world, int x, int y, int z)
{
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te != null && te instanceof SignalBusLogic)
{
((SignalBusLogic) te).onBlockAdded(world, x, y, z);
}
}
@Override
@SideOnly(Side.CLIENT)
@@ -181,7 +189,7 @@ public class SignalBus extends Block implements ITileEntityProvider {
{
return SignalBusRender.renderID;
}
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB collisionTest, List collisionBoxList, Entity entity)
{
TileEntity te = world.getBlockTileEntity(x, y, z);
@@ -213,7 +221,7 @@ public class SignalBus extends Block implements ITileEntityProvider {
super.addCollisionBoxesToList(world, x, y, z, collisionTest, collisionBoxList, entity);
}
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered (IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5)
@@ -228,8 +236,8 @@ public class SignalBus extends Block implements ITileEntityProvider {
if (te instanceof SignalBusLogic)
{
MovingObjectPosition closest = null;
AxisAlignedBB[] boxes = getBoxes((SignalBusLogic)te);
AxisAlignedBB[] boxes = getBoxes((SignalBusLogic) te);
double closestCalc = Double.MAX_VALUE;
double hitDistance = 0D;
@@ -239,7 +247,7 @@ public class SignalBus extends Block implements ITileEntityProvider {
{
continue;
}
this.setBlockBounds((float)boxes[i].minX, (float)boxes[i].minY, (float)boxes[i].minZ, (float)boxes[i].maxX, (float)boxes[i].maxY, (float)boxes[i].maxZ);
this.setBlockBounds((float) boxes[i].minX, (float) boxes[i].minY, (float) boxes[i].minZ, (float) boxes[i].maxX, (float) boxes[i].maxY, (float) boxes[i].maxZ);
MovingObjectPosition hit = super.collisionRayTrace(world, x, y, z, start, end);
if (hit != null)
{
@@ -253,10 +261,10 @@ public class SignalBus extends Block implements ITileEntityProvider {
}
return closest;
}
return null;
}
private static AxisAlignedBB[] getBoxes (SignalBusLogic logic)
{
boolean placed[] = logic.placedSides();
@@ -273,26 +281,20 @@ public class SignalBus extends Block implements ITileEntityProvider {
double maxY;
double maxZ;
boolean didRender = false;
if (placed[ForgeDirection.DOWN.ordinal()])
{
connected = logic.connectedSides(ForgeDirection.DOWN);
corners = logic.getRenderCorners(ForgeDirection.DOWN);
renderDir = new boolean[] {
(connected[0] || placed[0] || corners[0]),
(connected[1] || placed[1] || corners[1]),
(connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]),
(connected[4] || placed[4] || corners[4]),
(connected[5] || placed[5] || corners[5])
};
renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) };
minX = (renderDir[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
minY = Geometry.cable_low_offset;
minZ = (renderDir[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxY = Geometry.cable_low_height;
maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
parts[0] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
didRender = true;
}
@@ -300,21 +302,15 @@ public class SignalBus extends Block implements ITileEntityProvider {
{
connected = logic.connectedSides(ForgeDirection.UP);
corners = logic.getRenderCorners(ForgeDirection.UP);
renderDir = new boolean[] {
(connected[0] || placed[0] || corners[0]),
(connected[1] || placed[1] || corners[1]),
(connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]),
(connected[4] || placed[4] || corners[4]),
(connected[5] || placed[5] || corners[5])
};
renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) };
minX = (renderDir[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
minY = Geometry.cable_high_offset;
minZ = (renderDir[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxY = Geometry.cable_high_height;
maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
parts[1] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
didRender = true;
}
@@ -322,22 +318,15 @@ public class SignalBus extends Block implements ITileEntityProvider {
{
connected = logic.connectedSides(ForgeDirection.NORTH);
corners = logic.getRenderCorners(ForgeDirection.NORTH);
renderDir = new boolean[] {
(connected[0] || placed[0] || corners[0]),
(connected[1] || placed[1] || corners[1]),
(connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]),
(connected[4] || placed[4] || corners[4]),
(connected[5] || placed[5] || corners[5])
};
renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) };
minX = (renderDir[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
minY = (renderDir[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
minZ = Geometry.cable_low_offset;
maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxZ = Geometry.cable_low_height;
parts[2] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
didRender = true;
}
@@ -345,14 +334,8 @@ public class SignalBus extends Block implements ITileEntityProvider {
{
connected = logic.connectedSides(ForgeDirection.SOUTH);
corners = logic.getRenderCorners(ForgeDirection.SOUTH);
renderDir = new boolean[] {
(connected[0] || placed[0] || corners[0]),
(connected[1] || placed[1] || corners[1]),
(connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]),
(connected[4] || placed[4] || corners[4]),
(connected[5] || placed[5] || corners[5])
};
renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) };
minX = (renderDir[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
minY = (renderDir[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
minZ = Geometry.cable_high_offset;
@@ -367,14 +350,8 @@ public class SignalBus extends Block implements ITileEntityProvider {
{
connected = logic.connectedSides(ForgeDirection.WEST);
corners = logic.getRenderCorners(ForgeDirection.WEST);
renderDir = new boolean[] {
(connected[0] || placed[0] || corners[0]),
(connected[1] || placed[1] || corners[1]),
(connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]),
(connected[4] || placed[4] || corners[4]),
(connected[5] || placed[5] || corners[5])
};
renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) };
minX = Geometry.cable_low_offset;
minY = (renderDir[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
minZ = (renderDir[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
@@ -389,21 +366,15 @@ public class SignalBus extends Block implements ITileEntityProvider {
{
connected = logic.connectedSides(ForgeDirection.EAST);
corners = logic.getRenderCorners(ForgeDirection.EAST);
renderDir = new boolean[] {
(connected[0] || placed[0] || corners[0]),
(connected[1] || placed[1] || corners[1]),
(connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]),
(connected[4] || placed[4] || corners[4]),
(connected[5] || placed[5] || corners[5])
};
renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]),
(connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) };
minX = Geometry.cable_high_offset;
minY = (renderDir[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
minZ = (renderDir[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min;
maxX = Geometry.cable_high_height;
maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
parts[5] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
didRender = true;
}
@@ -415,7 +386,7 @@ public class SignalBus extends Block implements ITileEntityProvider {
maxX = Geometry.cable_width_max;
maxY = Geometry.cable_low_height;
maxZ = Geometry.cable_width_max;
parts[0] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
}
@@ -457,7 +428,7 @@ public class SignalBus extends Block implements ITileEntityProvider {
/**
* Draws lines for the edges of the bounding box.
*/
private static void drawOutlinedBoundingBox(AxisAlignedBB par1AxisAlignedBB)
private static void drawOutlinedBoundingBox (AxisAlignedBB par1AxisAlignedBB)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawing(3);
@@ -485,21 +456,23 @@ public class SignalBus extends Block implements ITileEntityProvider {
tessellator.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ);
tessellator.draw();
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new SignalBusLogic();
}
@Override
public TileEntity createNewTileEntity(World world) {
return new SignalBusLogic();
}
@Override
@Override
public TileEntity createTileEntity (World world, int metadata)
{
return new SignalBusLogic();
}
@Override
public TileEntity createNewTileEntity (World world)
{
return new SignalBusLogic();
}
@Override
public ArrayList<ItemStack> getBlockDropped (World world, int x, int y, int z, int metadata, int fortune)
{
return new ArrayList<ItemStack>();
return new ArrayList<ItemStack>();
}
@Override
@@ -524,7 +497,7 @@ public class SignalBus extends Block implements ITileEntityProvider {
float jumpX, jumpY, jumpZ;
ItemStack tempStack;
Random rand = new Random();
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof SignalBusLogic)
{
@@ -565,45 +538,34 @@ public class SignalBus extends Block implements ITileEntityProvider {
super.breakBlock(world, x, y, z, id, meta);
}
/**
* checks to see if you can place this block can be placed on that side of a block: BlockLever overrides
*/
@Override
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
public boolean canPlaceBlockOnSide (World par1World, int par2, int par3, int par4, int par5)
{
ForgeDirection dir = ForgeDirection.getOrientation(par5);
return (dir == DOWN && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN )) ||
(dir == UP && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP )) ||
(dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ||
(dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
(dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST )) ||
(dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ));
return (dir == DOWN && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN)) || (dir == UP && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP))
|| (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) || (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
|| (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) || (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST));
}
/**
* Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z
*/
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
public boolean canPlaceBlockAt (World par1World, int par2, int par3, int par4)
{
return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) ||
par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP ) ||
par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN );
return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) || par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) || par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)
|| par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) || par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) || par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN);
}
@Override
public boolean canBlockStay (World par1World, int par2, int par3, int par4)
{
return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) ||
par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP ) ||
par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN );
return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) || par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) || par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)
|| par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) || par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) || par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN);
}
}
+2 -4
View File
@@ -477,8 +477,6 @@ public class SignalTerminal extends Block implements ITileEntityProvider
((SignalTerminalLogic) te).connectPending();
}
}
@Override
public ArrayList<ItemStack> getBlockDropped (World world, int x, int y, int z, int metadata, int fortune)
@@ -493,13 +491,13 @@ public class SignalTerminal extends Block implements ITileEntityProvider
float jumpX, jumpY, jumpZ;
ItemStack tempStack;
Random rand = new Random();
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof SignalTerminalLogic)
{
dropTerm = ((SignalTerminalLogic) te).getDroppedTerminals();
dropWire = ((SignalTerminalLogic) te).getDroppedWire();
if (dropTerm > 0)
{
tempStack = new ItemStack(TConstruct.instance.content.signalTerminal.blockID, dropTerm, 0);
+20 -18
View File
@@ -26,21 +26,21 @@ public class SlimePad extends Block
setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.625F, 0.875F);
this.setCreativeTab(TConstructRegistry.blockTab);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
return null;
}
@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)
{
if (!world.isBlockIndirectlyGettingPowered(x, y, z))
{
double moveX = 0;
double moveZ = 0;
double speed = 0.25;
int meta = world.getBlockMetadata(x, y, z);
@@ -52,7 +52,7 @@ public class SlimePad extends Block
case 7:
moveX += speed;
moveZ += speed;
break;
break;
case 0:
moveZ += speed;
break;
@@ -80,64 +80,66 @@ public class SlimePad extends Block
{
entity.posY += 1;
}
entity.addVelocity(moveX, speed*2, moveZ);
entity.addVelocity(moveX, speed * 2, moveZ);
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, this.stepSound.getStepSound(), (this.stepSound.getVolume()) / 2.0F, this.stepSound.getPitch() * 0.65F);
}
}
public boolean isBlockReplaceable(World world, int x, int y, int z)
public boolean isBlockReplaceable (World world, int x, int y, int z)
{
return false;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack)
{
int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D) + (entity.isSneaking() ? 4 : 0) & 7;
int meta = world.getBlockMetadata(x, y, z) & 8;
world.setBlockMetadataWithNotify(x, y, z, face | meta, 2);
}
@Override
public boolean renderAsNormalBlock()
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderBlockPass()
public int getRenderBlockPass ()
{
return 1;
}
@Override
public int getRenderType()
public int getRenderType ()
{
return SlimePadRender.model;
}
@Override
public void registerIcons(IconRegister iconRegister) {}
public void registerIcons (IconRegister iconRegister)
{
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
public Icon getIcon (int side, int meta)
{
return TContent.slimeGel.getIcon(side, 1);
}
public Icon getFluidIcon(int meta)
public Icon getFluidIcon (int meta)
{
return TContent.slimeChannel.getIcon(2, 0);
}
public Icon getNubIcon(int meta)
public Icon getNubIcon (int meta)
{
return TContent.slimeGel.getIcon(0, 0);
}
+2 -2
View File
@@ -64,8 +64,8 @@ public class SoilBlock extends TConstructBlock
return Block.dirt.blockHardness;
return this.blockHardness;
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
return Block.slowSand.getCollisionBoundingBoxFromPool(world, x, y, z);
}
+4 -3
View File
@@ -6,7 +6,8 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.Icon;
public class StoneLadder extends BlockLadder {
public class StoneLadder extends BlockLadder
{
// Override ladder material
public final Material blockMaterial = Material.rock;
@@ -22,13 +23,13 @@ public class StoneLadder extends BlockLadder {
}
@Override
public void registerIcons(IconRegister register)
public void registerIcons (IconRegister register)
{
icon = register.registerIcon("tinker:ladder_stone");
}
@Override
public Icon getIcon(int meta, int side)
public Icon getIcon (int meta, int side)
{
return icon;
}
+1 -1
View File
@@ -50,7 +50,7 @@ public class TConstructBlock extends Block
{
return meta < icons.length ? icons[meta] : icons[0];
}
@SideOnly(Side.CLIENT)
public int getSideTextureIndex (int side)
{
+6 -6
View File
@@ -66,8 +66,8 @@ public class TankAirBlock extends BlockContainer
return null;
}
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 par5Vec3, Vec3 par6Vec3)
public MovingObjectPosition collisionRayTrace (World world, int x, int y, int z, Vec3 par5Vec3, Vec3 par6Vec3)
{
TankAirLogic tank = (TankAirLogic) world.getBlockTileEntity(x, y, z);
if (tank.hasItem())
@@ -89,17 +89,17 @@ public class TankAirBlock extends BlockContainer
}
@Override
public boolean canHarvestBlock(EntityPlayer player, int meta)
public boolean canHarvestBlock (EntityPlayer player, int meta)
{
return false;
}
@Override
public boolean isAirBlock(World world, int x, int y, int z)
public boolean isAirBlock (World world, int x, int y, int z)
{
return false;
}
@Override
public void getSubBlocks (int id, CreativeTabs tab, List list)
{
+5 -7
View File
@@ -21,37 +21,35 @@ public class WoodRail extends BlockRailBase
}
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getIcon(int par1, int par2)
public Icon getIcon (int par1, int par2)
{
return par2 >= 6 ? this.theIcon : this.blockIcon;
}
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons(IconRegister par1IconRegister)
public void registerIcons (IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("tinker:woodrail");
this.theIcon = par1IconRegister.registerIcon("tinker:woodrail_turn");
}
protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, int par7)
protected void func_94358_a (World par1World, int par2, int par3, int par4, int par5, int par6, int par7)
{
if (par7 > 0 && Block.blocksList[par7].canProvidePower() && (new BlockBaseRailLogic(this, par1World, par2, par3, par4)).getNumberOfAdjacentTracks() == 3)
{
this.refreshTrackShape(par1World, par2, par3, par4, false);
}
}
@Override
public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z)
public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, int z)
{
return 0.3f;
}
@@ -123,7 +123,6 @@ public class SignalBusMasterLogic extends MultiblockMasterBaseLogic
((SignalBusMasterLogic) newMaster).forceUpdate();
}
@Override
@@ -258,7 +258,7 @@ public class SmelteryComponent extends LogicComponent
ret = 1;
return ret;
}
/* NBT */
public void readNetworkNBT (NBTTagCompound tags)
{
@@ -7,13 +7,16 @@ import tconstruct.library.component.MultiFluidTank;
public class TankAirComponent extends MultiFluidTank
{
public TankAirComponent() {}
public TankAirComponent()
{
}
public TankAirComponent(int i)
{
super(i);
}
public void overrideFluids(ArrayList<FluidStack> fluids)
public void overrideFluids (ArrayList<FluidStack> fluids)
{
fluidlist = fluids;
}
@@ -29,7 +29,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
@Override
public boolean setPotentialMaster (IMasterLogic master, World world, int x, int y, int z)
{
// TConstruct.logger.info("Master: "+master);
// TConstruct.logger.info("Master: "+master);
return (master instanceof AdaptiveSmelteryLogic || master instanceof AdaptiveDrainLogic) && !hasMaster;
}
@@ -47,11 +47,11 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl
@Override
public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
{
// TConstruct.logger.info("Attempting drain " + hasValidMaster());
// TConstruct.logger.info("Attempting drain " + hasValidMaster());
if (hasValidMaster() && canDrain(from, null))
{
AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
// TConstruct.logger.info("Found master");
// TConstruct.logger.info("Found master");
return smeltery.drain(from, maxDrain, doDrain);
}
return null;
@@ -82,7 +82,7 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc
updateAir();
updateAir = false;
}
if (recheckStructure)
{
structure.recheckStructure();
File diff suppressed because it is too large. Load diff
@@ -36,18 +36,21 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
return true;
}
@Override
public int[] getAccessibleSlotsFromSide(int var1) {
return new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
}
@Override
public int[] getAccessibleSlotsFromSide (int var1)
{
return new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
}
@Override
public boolean canInsertItem(int i, ItemStack itemstack, int j) {
return i != 0;
}
@Override
public boolean canInsertItem (int i, ItemStack itemstack, int j)
{
return i != 0;
}
@Override
public boolean canExtractItem(int i, ItemStack itemstack, int j) {
return i != 0;
}
@Override
public boolean canExtractItem (int i, ItemStack itemstack, int j)
{
return i != 0;
}
}
@@ -30,14 +30,14 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
byte direction;
byte placementDirection = 4;
FakePlayerLogic fakePlayer;
ItemStack bufferStack = null;
public DrawbridgeLogic()
{
super(2);
}
@Override
public void setWorldObj (World par1World)
{
@@ -260,7 +260,7 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
bufferStack = inventory[0].copy();
bufferStack.stackSize = 1;
switch (direction)
{
case 0:
@@ -354,10 +354,13 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
{
worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "tile.piston.in", 0.25F, worldObj.rand.nextFloat() * 0.15F + 0.6F);
if (worldObj.setBlock(xPos, yPos, zPos, 0))
if(inventory[0] == null){
inventory[0] = bufferStack.copy();
}else{
inventory[0].stackSize++;
if (inventory[0] == null)
{
inventory[0] = bufferStack.copy();
}
else
{
inventory[0].stackSize++;
}
}
else
@@ -455,15 +458,17 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
active = tags.getBoolean("Active");
working = tags.getBoolean("Working");
extension = tags.getByte("Extension");
NBTTagCompound bufferInv = (NBTTagCompound) tags.getTag("BufferInv");
if(bufferInv != null){
bufferStack = ItemStack.loadItemStackFromNBT(bufferInv);
if (bufferInv != null)
{
bufferStack = ItemStack.loadItemStackFromNBT(bufferInv);
}
if(bufferStack == null && inventory[0] != null){
bufferStack = inventory[0];
if (bufferStack == null && inventory[0] != null)
{
bufferStack = inventory[0];
}
readCustomNBT(tags);
}
@@ -474,13 +479,14 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
tags.setBoolean("Active", active);
tags.setBoolean("Working", working);
tags.setByte("Extension", extension);
if(bufferStack != null){
NBTTagCompound bufferInv = new NBTTagCompound();
bufferStack.writeToNBT(bufferInv);
tags.setTag("BufferInv", bufferInv);
if (bufferStack != null)
{
NBTTagCompound bufferInv = new NBTTagCompound();
bufferStack.writeToNBT(bufferInv);
tags.setTag("BufferInv", bufferInv);
}
writeCustomNBT(tags);
}
@@ -521,9 +527,10 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc
public void onInventoryChanged ()
{
super.onInventoryChanged();
if(getStackInSlot(0) != null){
bufferStack = getStackInSlot(0).copy();
bufferStack.stackSize = 1;
if (getStackInSlot(0) != null)
{
bufferStack = getStackInSlot(0).copy();
bufferStack.stackSize = 1;
}
this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
+15 -11
View File
@@ -33,22 +33,26 @@ public abstract class EquipLogic extends InventoryLogic
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack){
if(slot == 0){
return;
}else{
super.setInventorySlotContents(slot, stack);
}
public void setInventorySlotContents (int slot, ItemStack stack)
{
if (slot == 0)
{
return;
}
else
{
super.setInventorySlotContents(slot, stack);
}
}
@Override
public ItemStack getStackInSlot(int slot)
public ItemStack getStackInSlot (int slot)
{
return slot != 0 ? inventory[slot] : null;
}
public boolean isStackInSlot(int slot)
public boolean isStackInSlot (int slot)
{
return slot != 0 ? inventory[slot] != null : false;
return slot != 0 ? inventory[slot] != null : false;
}
}
+17 -9
View File
@@ -215,7 +215,7 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin
{
return 150;
}
if (block == Block.wood)
{
return 1200;
@@ -232,14 +232,22 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin
}
}
if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) return 200;
if (i == Item.stick.itemID) return 100;
if (i == Item.coal.itemID) return 1600;
if (i == Item.bucketLava.itemID) return 20000;
if (i == Block.sapling.blockID) return 100;
if (i == Item.blazeRod.itemID) return 2400;
if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD"))
return 200;
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD"))
return 200;
if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD"))
return 200;
if (i == Item.stick.itemID)
return 100;
if (i == Item.coal.itemID)
return 1600;
if (i == Item.bucketLava.itemID)
return 20000;
if (i == Block.sapling.blockID)
return 100;
if (i == Item.blazeRod.itemID)
return 2400;
return GameRegistry.getFuelValue(stack);
}
}
@@ -17,111 +17,141 @@ import net.minecraft.world.World;
* @author fuj1n
*
*/
public class LandmineExplodeLogic {
public class LandmineExplodeLogic
{
private final World worldObj;
private final Entity triggerer;
private final TileEntityLandmine tileEntity;
private final int x, y, z;
private final World worldObj;
private final Entity triggerer;
private final TileEntityLandmine tileEntity;
private final int x, y, z;
public LandmineExplodeLogic(World par1World, int par2, int par3, int par4, Entity entity) {
worldObj = par1World;
this.tileEntity = (TileEntityLandmine) par1World.getBlockTileEntity(par2, par3, par4);
this.x = par2;
this.y = par3;
this.z = par4;
this.triggerer = entity;
}
public LandmineExplodeLogic(World par1World, int par2, int par3, int par4, Entity entity)
{
worldObj = par1World;
this.tileEntity = (TileEntityLandmine) par1World.getBlockTileEntity(par2, par3, par4);
this.x = par2;
this.y = par3;
this.z = par4;
this.triggerer = entity;
}
public void explode() {
if (triggerer == null) {
return;
}
public void explode ()
{
if (triggerer == null)
{
return;
}
boolean preventExplode = false;
boolean isOffensive = true;
boolean cancelDefault = false;
boolean preventExplode = false;
boolean isOffensive = true;
boolean cancelDefault = false;
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
boolean hasExploded = false;
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
boolean hasExploded = false;
if (tileEntity == null) {
return;
}
if (tileEntity == null)
{
return;
}
tileEntity.isExploding = true;
tileEntity.isExploding = true;
for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++) {
ItemStack currentStack = tileEntity.getStackInSlot(i);
Behavior b = Behavior.getBehaviorFromStack(currentStack);
if (b != null) {
for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++)
{
ItemStack currentStack = tileEntity.getStackInSlot(i);
Behavior b = Behavior.getBehaviorFromStack(currentStack);
if (b != null)
{
if (b.doesBehaviorPreventRemovalOfBlock(currentStack)) {
preventExplode = true;
}
if (b.doesBehaviorPreventRemovalOfBlock(currentStack))
{
preventExplode = true;
}
if (!b.isBehaviorExchangableWithOffensive(currentStack)) {
isOffensive = false;
}
if (!b.isBehaviorExchangableWithOffensive(currentStack))
{
isOffensive = false;
}
if (b.overridesDefault()) {
cancelDefault = true;
}
if (b.overridesDefault())
{
cancelDefault = true;
}
if (!stacks.isEmpty() && Behavior.arrayContainsEqualStack(stacks, currentStack) && b.effectStacks()) {
stacks.get(Behavior.arrayIndexOfStack(stacks, currentStack)).stackSize += currentStack.stackSize;
} else {
stacks.add(currentStack.copy());
}
}
}
if (!stacks.isEmpty() && Behavior.arrayContainsEqualStack(stacks, currentStack) && b.effectStacks())
{
stacks.get(Behavior.arrayIndexOfStack(stacks, currentStack)).stackSize += currentStack.stackSize;
}
else
{
stacks.add(currentStack.copy());
}
}
}
LandmineSpecialStackLogic specialStacks = new LandmineSpecialStackLogic(worldObj, x, y, z, triggerer, isOffensive, stacks);
specialStacks.handleSpecialStacks();
LandmineSpecialStackLogic specialStacks = new LandmineSpecialStackLogic(worldObj, x, y, z, triggerer, isOffensive, stacks);
specialStacks.handleSpecialStacks();
Iterator<ItemStack> i1 = stacks.iterator();
while (i1.hasNext()) {
ItemStack currentStack = i1.next();
Behavior b = Behavior.getBehaviorFromStack(currentStack);
if (b != null) {
if (isOffensive || !b.isOffensive(currentStack)) {
b.executeLogic(worldObj, x, y, z, currentStack, triggerer, !preventExplode);
if (b.shouldItemBeRemoved(currentStack, !preventExplode)) {
if (b.effectStacks()) {
for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++) {
if (tileEntity.getStackInSlot(i) != null) {
if (tileEntity.getStackInSlot(i).isItemEqual(currentStack)) {
tileEntity.setInventorySlotContents(i, null);
}
}
}
} else {
boolean hasRemoved = false;
Iterator<ItemStack> i1 = stacks.iterator();
while (i1.hasNext())
{
ItemStack currentStack = i1.next();
Behavior b = Behavior.getBehaviorFromStack(currentStack);
if (b != null)
{
if (isOffensive || !b.isOffensive(currentStack))
{
b.executeLogic(worldObj, x, y, z, currentStack, triggerer, !preventExplode);
if (b.shouldItemBeRemoved(currentStack, !preventExplode))
{
if (b.effectStacks())
{
for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++)
{
if (tileEntity.getStackInSlot(i) != null)
{
if (tileEntity.getStackInSlot(i).isItemEqual(currentStack))
{
tileEntity.setInventorySlotContents(i, null);
}
}
}
}
else
{
boolean hasRemoved = false;
for (int i = 0; i < tileEntity.getSizeTriggerInventory() && !hasRemoved; i++) {
if (tileEntity.getStackInSlot(i) != null) {
if (tileEntity.getStackInSlot(i).isItemEqual(currentStack)) {
tileEntity.setInventorySlotContents(i, null);
hasRemoved = true;
}
}
}
}
}
}
}
}
for (int i = 0; i < tileEntity.getSizeTriggerInventory() && !hasRemoved; i++)
{
if (tileEntity.getStackInSlot(i) != null)
{
if (tileEntity.getStackInSlot(i).isItemEqual(currentStack))
{
tileEntity.setInventorySlotContents(i, null);
hasRemoved = true;
}
}
}
}
}
}
}
}
Behavior defBeh = Behavior.getDefaulBehavior();
if (defBeh != null && isOffensive && !cancelDefault) {
defBeh.executeLogic(worldObj, x, y, z, null, triggerer, !preventExplode);
}
Behavior defBeh = Behavior.getDefaulBehavior();
if (defBeh != null && isOffensive && !cancelDefault)
{
defBeh.executeLogic(worldObj, x, y, z, null, triggerer, !preventExplode);
}
if (hasExploded || defBeh != null && !preventExplode) {
worldObj.removeBlockTileEntity(x, y, z);
worldObj.setBlockToAir(x, y, z);
} else {
tileEntity.isExploding = false;
}
}
if (hasExploded || defBeh != null && !preventExplode)
{
worldObj.removeBlockTileEntity(x, y, z);
worldObj.setBlockToAir(x, y, z);
}
else
{
tileEntity.isExploding = false;
}
}
}
@@ -29,7 +29,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic
if (worldObj.getBlockId(master.x, master.y, master.z) == masterID && worldObj.getBlockMetadata(master.x, master.y, master.z) == masterMeat)
return true;
else
{
hasMaster = false;
+14 -14
View File
@@ -144,7 +144,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
{
return;
}
if (forceCheck)
{
int connectableCount = this.getNeighboringMembers().length;
@@ -153,7 +153,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
{
cachedConnectableCount = connectableCount;
super.onBlockAdded(worldObj, xCoord, yCoord, zCoord);
// this.getMultiblockMaster().revisitBlocks();
// this.getMultiblockMaster().revisitBlocks();
}
}
@@ -286,8 +286,8 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
transceivers.put(coords, signals);
northboundSignalsChanged = true;
updateLocalSignals(((SignalBusMasterLogic)getMultiblockMaster()).getSignals());
updateLocalSignals(((SignalBusMasterLogic) getMultiblockMaster()).getSignals());
((ISignalTransceiver) te).receiveSignalUpdate(cachedReceivedSignals);
return true;
}
@@ -311,8 +311,8 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
if (transceivers != null || !transceivers.isEmpty())
{
northboundSignalsChanged = true;
updateLocalSignals(((SignalBusMasterLogic)getMultiblockMaster()).getSignals());
updateLocalSignals(((SignalBusMasterLogic) getMultiblockMaster()).getSignals());
}
}
@@ -566,14 +566,14 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
int i, j;
ForgeDirection iDir, jDir;
TileEntity te;
for (i = 0; i < 6; ++i)
{
iDir = ForgeDirection.VALID_DIRECTIONS[i];
if (!placedSides[i])
{
continue;
}
}
for (j = 0; j < 6; ++j)
{
@@ -585,7 +585,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
if (xCoord + jDir.offsetX == coord.x && yCoord + jDir.offsetY == coord.y && zCoord + jDir.offsetZ == coord.z)
{
te = worldObj.getBlockTileEntity(xCoord + jDir.offsetX, yCoord + jDir.offsetY, zCoord + jDir.offsetZ);
if (te instanceof ISignalBusConnectable && ((ISignalBusConnectable)te).connectableOnFace(iDir))
if (te instanceof ISignalBusConnectable && ((ISignalBusConnectable) te).connectableOnFace(iDir))
{
return true;
}
@@ -597,7 +597,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
if (xCoord + iDir.offsetX + jDir.offsetX == coord.x && yCoord + iDir.offsetY + jDir.offsetY == coord.y && zCoord + iDir.offsetZ + jDir.offsetZ == coord.z)
{
te = worldObj.getBlockTileEntity(xCoord + iDir.offsetX + jDir.offsetX, yCoord + iDir.offsetY + jDir.offsetY, zCoord + iDir.offsetZ + jDir.offsetZ);
if (te instanceof ISignalBusConnectable && ((ISignalBusConnectable)te).connectableOnCorner(iDir.getOpposite(), jDir.getOpposite()))
if (te instanceof ISignalBusConnectable && ((ISignalBusConnectable) te).connectableOnCorner(iDir.getOpposite(), jDir.getOpposite()))
{
return true;
}
@@ -658,7 +658,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
++calc;
}
}
return calc;
}
@@ -674,10 +674,10 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
calc += ((ISignalTransceiver) te).getDroppedWire();
}
}
return calc;
}
public void notifyBreak ()
{
CoordTuple[] scan = new CoordTuple[transceivers.keySet().size()];
@@ -732,7 +732,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic,
++dropCount;
}
}
return dropCount;
}
@@ -77,7 +77,7 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive
if (isRegistered)
{
doUpdate = true;
}
else
{
@@ -162,7 +162,7 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive
pendingSide = -1;
forceUpdateSide = true;
}
if (worldObj.isRemote)
{
return;
@@ -552,7 +552,8 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive
{
continue;
}
temp = worldObj.getIndirectPowerLevelTo(xCoord + offset[0] + Facing.offsetsXForSide[j], yCoord + offset[1] + Facing.offsetsYForSide[j], zCoord + offset[2] + Facing.offsetsZForSide[j], j);
temp = worldObj.getIndirectPowerLevelTo(xCoord + offset[0] + Facing.offsetsXForSide[j], yCoord + offset[1] + Facing.offsetsYForSide[j], zCoord + offset[2]
+ Facing.offsetsZForSide[j], j);
if (temp > power)
{
@@ -578,8 +579,8 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive
}
else
{
tempStrength = worldObj.getIndirectPowerLevelTo(xCoord + offset[0], yCoord + offset[1], zCoord + offset[2], oSide);
// tempStrength = worldObj.getStrongestIndirectPower(xCoord + offset[0], yCoord + offset[1], zCoord + offset[2]);
tempStrength = worldObj.getIndirectPowerLevelTo(xCoord + offset[0], yCoord + offset[1], zCoord + offset[2], oSide);
// tempStrength = worldObj.getStrongestIndirectPower(xCoord + offset[0], yCoord + offset[1], zCoord + offset[2]);
}
// if (tempStrength > 0 && tempStrength < receivingSides[i]){
@@ -617,20 +618,19 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive
public int doUnregister (boolean reHoming)
{
int dropWire = 0;
if (signalBus != null)
{
TileEntity te = worldObj.getBlockTileEntity(signalBus.x, signalBus.y, signalBus.z);
dropWire = Math.abs(xCoord - signalBus.x) + Math.abs(yCoord - signalBus.y) + Math.abs(zCoord - signalBus.z);
if (te instanceof SignalBusLogic)
{
((SignalBusLogic)te).unregisterTerminal(worldObj, xCoord, yCoord, zCoord);
((SignalBusLogic) te).unregisterTerminal(worldObj, xCoord, yCoord, zCoord);
}
}
// Remove signalBus coords
signalBus = null;
// Calculate new local received signals and provide them to local connections
receiveSignalUpdate(getReceivedSignals());
@@ -654,10 +654,10 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive
++count;
}
}
return count;
}
public int getDroppedWire ()
{
int calcWire = 0;
@@ -666,7 +666,7 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive
calcWire += Math.abs(signalBus.x - xCoord);
calcWire += Math.abs(signalBus.y - yCoord);
calcWire += Math.abs(signalBus.z - zCoord);
return calcWire;
}
return 0;
+13 -13
View File
@@ -30,19 +30,19 @@ public class TankAirLogic extends InventoryLogic implements IServantLogic, ISide
{
super(1);
}
public void overrideFluids(ArrayList<FluidStack> fluids)
public void overrideFluids (ArrayList<FluidStack> fluids)
{
/*multitank.overrideFluids(fluids);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);*/
}
public boolean hasItem()
public boolean hasItem ()
{
return inventory[0] != null;
}
public boolean hasFluids()
public boolean hasFluids ()
{
return multitank.fluidlist.size() > 0;
}
@@ -51,7 +51,7 @@ public class TankAirLogic extends InventoryLogic implements IServantLogic, ISide
{
return multitank.fluidlist;
}
@Override
public void setInventorySlotContents (int slot, ItemStack itemstack)
{
@@ -127,27 +127,27 @@ public class TankAirLogic extends InventoryLogic implements IServantLogic, ISide
{
return false;
}
/*@Override
public boolean canUpdate()
{
return false;
}*/
//DELETE
public void updateEntity ()
{
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
}
//Keep TE regardless of metadata
public boolean shouldRefresh(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z)
public boolean shouldRefresh (int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z)
{
return oldID != newID;
}
/* NBT */
@Override
public void readFromNBT (NBTTagCompound tags)
{
+2 -2
View File
@@ -82,9 +82,9 @@ public class SlimeLeaves extends BlockLeaves
list.add(new ItemStack(id, 1, iter));
}
}
@Override
public boolean isLeaves(World world, int x, int y, int z)
public boolean isLeaves (World world, int x, int y, int z)
{
return true;
}
@@ -34,85 +34,85 @@ public class SignalTetherWorldOverlayRenderer
{
GL11.glPushMatrix();
Entity entity = event.context.mc.renderViewEntity;
double posX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * event.partialTicks;
double posY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * event.partialTicks;
double posZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * event.partialTicks;
GL11.glTranslated(-posX, -posY, -posZ);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glLineWidth(2.5F);
GL11.glBegin(GL11.GL_LINES);
GL11.glColor4f(1, 0, 0, 1);
World world = entity.worldObj;
int x1 = (int) entity.posX;
int z1 = (int) entity.posZ;
int y1 = (int) ((entity.posY > world.getHeight()-16) ? world.getHeight()-16 : ((entity.posY < 16) ? 16 : entity.posY));
int y1 = (int) ((entity.posY > world.getHeight() - 16) ? world.getHeight() - 16 : ((entity.posY < 16) ? 16 : entity.posY));
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
GL11.glColor4f(1, 0, 0, 1);
Chunk chunks[] = new Chunk[9];
chunks[4] = world.getChunkFromBlockCoords(x1, z1);
int cX = chunks[4].xPosition;
int cZ = chunks[4].zPosition;
chunks[0] = world.getChunkFromChunkCoords(cX - 1, cZ - 1);
chunks[1] = world.getChunkFromChunkCoords(cX , cZ - 1);
chunks[1] = world.getChunkFromChunkCoords(cX, cZ - 1);
chunks[2] = world.getChunkFromChunkCoords(cX + 1, cZ - 1);
chunks[3] = world.getChunkFromChunkCoords(cX - 1, cZ );
chunks[5] = world.getChunkFromChunkCoords(cX + 1, cZ );
chunks[3] = world.getChunkFromChunkCoords(cX - 1, cZ);
chunks[5] = world.getChunkFromChunkCoords(cX + 1, cZ);
chunks[6] = world.getChunkFromChunkCoords(cX - 1, cZ + 1);
chunks[7] = world.getChunkFromChunkCoords(cX , cZ + 1);
chunks[7] = world.getChunkFromChunkCoords(cX, cZ + 1);
chunks[8] = world.getChunkFromChunkCoords(cX + 1, cZ + 1);
Queue<CoordTuplePair> transceivers = new LinkedList<CoordTuplePair>();
CoordTuple src;
CoordTuple dst;
for (int c = 0; c < 9; ++c)
{
for(Object obj : chunks[c].chunkTileEntityMap.values())
for (Object obj : chunks[c].chunkTileEntityMap.values())
{
if (obj instanceof ISignalTransceiver && obj instanceof TileEntity)
{
dst = ((ISignalTransceiver) obj).getBusCoords();
if (dst != null)
{
src = new CoordTuple(((TileEntity)obj).xCoord, ((TileEntity)obj).yCoord, ((TileEntity)obj).zCoord);
transceivers.add(new CoordTuplePair(src,dst));
src = new CoordTuple(((TileEntity) obj).xCoord, ((TileEntity) obj).yCoord, ((TileEntity) obj).zCoord);
transceivers.add(new CoordTuplePair(src, dst));
}
}
}
}
CoordTuplePair renderPair;
while (transceivers.size() > 0)
{
renderPair = transceivers.remove();
GL11.glVertex3d(renderPair.a.x + 0.5, renderPair.a.y + 0.5, renderPair.a.z + 0.5);
GL11.glVertex3d(renderPair.b.x + 0.5, renderPair.b.y, renderPair.b.z + 0.5);
}
// GL11.glVertex3d(x, y+0.004, z);
// GL11.glVertex3d(x+1, y+0.004, z+1);
// GL11.glVertex3d(x+1, y+0.004, z);
// GL11.glVertex3d(x, y+0.004, z+1);
// GL11.glVertex3d(x, y+0.004, z);
// GL11.glVertex3d(x+1, y+0.004, z+1);
// GL11.glVertex3d(x+1, y+0.004, z);
// GL11.glVertex3d(x, y+0.004, z+1);
GL11.glEnd();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
+1 -1
View File
@@ -62,7 +62,7 @@ public class TClientEvents
{
TContent.fluids[i].setIcons(TContent.fluidBlocks[i].getIcon(0, 0), TContent.fluidBlocks[i].getIcon(2, 0));
}
Fluid lava = FluidRegistry.getFluid("lava");
lava.setIcons(Block.lavaStill.getIcon(0, 0), Block.lavaStill.getIcon(2, 0));
Fluid lavawater = FluidRegistry.getFluid("water");
@@ -26,7 +26,6 @@ public class TClientTickHandler implements ITickHandler
TContent.oreBerry.setGraphicsLevel(Block.leaves.graphicsLevel);
TContent.oreBerrySecond.setGraphicsLevel(Block.leaves.graphicsLevel);
TContent.slimeLeaves.setGraphicsLevel(Block.leaves.graphicsLevel);
/*if (PHConstruct.alphaHunger)
{
+209 -194
View File
@@ -15,217 +15,232 @@ import net.minecraft.util.Icon;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.common.ForgeDirection;
public class RenderArmorCast implements IItemRenderer {
public class RenderArmorCast implements IItemRenderer
{
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
return type != ItemRenderType.FIRST_PERSON_MAP;
}
@Override
public boolean handleRenderType (ItemStack item, ItemRenderType type)
{
return type != ItemRenderType.FIRST_PERSON_MAP;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
switch (helper) {
case BLOCK_3D:
return true;
case ENTITY_BOBBING:
return true;
case ENTITY_ROTATION:
return true;
case EQUIPPED_BLOCK:
return true;
case INVENTORY_BLOCK:
return true;
default:
return false;
}
}
@Override
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
switch (helper)
{
case BLOCK_3D:
return true;
case ENTITY_BOBBING:
return true;
case ENTITY_ROTATION:
return true;
case EQUIPPED_BLOCK:
return true;
case INVENTORY_BLOCK:
return true;
default:
return false;
}
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
RenderBlocks renderer = Minecraft.getMinecraft().renderGlobal.globalRenderBlocks;
Tessellator tessellator = Tessellator.instance;
Icon baseIcon = item.getItem() instanceof ArmorPattern ? ((ArmorPattern) item.getItem()).getBaseIcon() : item.getIconIndex();
GL11.glPushMatrix();
switch (type) {
case ENTITY:
GL11.glScalef(0.8F, 0.33F, 0.8F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
break;
case INVENTORY:
GL11.glScalef(1F, 0.6F, 1F);
GL11.glTranslatef(0F, -0.1F, 0F);
break;
case EQUIPPED:
GL11.glScalef(1F, 0.6F, 1F);
break;
case EQUIPPED_FIRST_PERSON:
GL11.glScalef(1F, 0.6F, 1F);
break;
default:
break;
}
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F);
renderCube(tessellator, renderer, baseIcon);
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 1.0F, 0.9F);
ArrayList<ForgeDirection> sides = new ArrayList<ForgeDirection>();
sides.add(ForgeDirection.NORTH);
sides.add(ForgeDirection.SOUTH);
sides.add(ForgeDirection.EAST);
sides.add(ForgeDirection.WEST);
renderSelectedCube(tessellator, renderer, baseIcon, sides);
renderCastTop(item, type);
@Override
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
{
RenderBlocks renderer = Minecraft.getMinecraft().renderGlobal.globalRenderBlocks;
Tessellator tessellator = Tessellator.instance;
Icon baseIcon = item.getItem() instanceof ArmorPattern ? ((ArmorPattern) item.getItem()).getBaseIcon() : item.getIconIndex();
GL11.glPushMatrix();
switch (type)
{
case ENTITY:
GL11.glScalef(0.8F, 0.33F, 0.8F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
break;
case INVENTORY:
GL11.glScalef(1F, 0.6F, 1F);
GL11.glTranslatef(0F, -0.1F, 0F);
break;
case EQUIPPED:
GL11.glScalef(1F, 0.6F, 1F);
break;
case EQUIPPED_FIRST_PERSON:
GL11.glScalef(1F, 0.6F, 1F);
break;
default:
break;
}
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F);
renderCube(tessellator, renderer, baseIcon);
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 1.0F, 0.9F);
ArrayList<ForgeDirection> sides = new ArrayList<ForgeDirection>();
sides.add(ForgeDirection.NORTH);
sides.add(ForgeDirection.SOUTH);
sides.add(ForgeDirection.EAST);
sides.add(ForgeDirection.WEST);
renderSelectedCube(tessellator, renderer, baseIcon, sides);
renderCastTop(item, type);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
public void renderCube(Tessellator tessellator, RenderBlocks renderer, Icon icon) {
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0F, 0F);
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(1F, 0F, 0F);
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, -1F, 0F);
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 1F, 0F);
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, -1F);
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, 1F);
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
tessellator.draw();
}
public void renderCube (Tessellator tessellator, RenderBlocks renderer, Icon icon)
{
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0F, 0F);
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(1F, 0F, 0F);
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, -1F, 0F);
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 1F, 0F);
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, -1F);
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, 1F);
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
tessellator.draw();
}
public void renderSelectedCube(Tessellator tessellator, RenderBlocks renderer, Icon icon, List<ForgeDirection> sidesToRender) {
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0F, 0F);
if (sidesToRender.contains(ForgeDirection.WEST))
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(1F, 0F, 0F);
if (sidesToRender.contains(ForgeDirection.EAST))
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, -1F, 0F);
if (sidesToRender.contains(ForgeDirection.DOWN))
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 1F, 0F);
if (sidesToRender.contains(ForgeDirection.UP))
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, -1F);
if (sidesToRender.contains(ForgeDirection.SOUTH))
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, 1F);
if (sidesToRender.contains(ForgeDirection.NORTH))
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
tessellator.draw();
}
public void renderSelectedCube (Tessellator tessellator, RenderBlocks renderer, Icon icon, List<ForgeDirection> sidesToRender)
{
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0F, 0F);
if (sidesToRender.contains(ForgeDirection.WEST))
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(1F, 0F, 0F);
if (sidesToRender.contains(ForgeDirection.EAST))
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, -1F, 0F);
if (sidesToRender.contains(ForgeDirection.DOWN))
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 1F, 0F);
if (sidesToRender.contains(ForgeDirection.UP))
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, -1F);
if (sidesToRender.contains(ForgeDirection.SOUTH))
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, 1F);
if (sidesToRender.contains(ForgeDirection.NORTH))
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
tessellator.draw();
}
public void renderCastTop(ItemStack par1ItemStack, ItemRenderType type) {
GL11.glPushMatrix();
Icon icon = par1ItemStack.getIconIndex();
public void renderCastTop (ItemStack par1ItemStack, ItemRenderType type)
{
GL11.glPushMatrix();
Icon icon = par1ItemStack.getIconIndex();
if (icon == null) {
GL11.glPopMatrix();
return;
}
TextureManager texturemanager = Minecraft.getMinecraft().renderEngine;
texturemanager.bindTexture(texturemanager.getResourceLocation(par1ItemStack.getItemSpriteNumber()));
Tessellator tessellator = Tessellator.instance;
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float f4 = 0.0F;
float f5 = 0.3F;
GL11.glTranslatef(-f4, -f5, 0.0F);
float f6 = 1.5F;
GL11.glRotatef(90F, 90F, 0F, 0F);
GL11.glScalef(0.9F, 0.9F, 2F);
GL11.glTranslatef(0.05F, 0.05F, -0.6F);
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
GL11.glScalef(0.8F, 0.8F, 0.9F);
GL11.glTranslatef(0.125F, 0.125F, 0.05F);
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
GL11.glScalef(0.6F, 0.6F, 0.6F);
GL11.glTranslatef(0.335F, 0.335F, 0.05F);
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
if (icon == null)
{
GL11.glPopMatrix();
return;
}
TextureManager texturemanager = Minecraft.getMinecraft().renderEngine;
texturemanager.bindTexture(texturemanager.getResourceLocation(par1ItemStack.getItemSpriteNumber()));
Tessellator tessellator = Tessellator.instance;
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float f4 = 0.0F;
float f5 = 0.3F;
GL11.glTranslatef(-f4, -f5, 0.0F);
float f6 = 1.5F;
GL11.glRotatef(90F, 90F, 0F, 0F);
GL11.glScalef(0.9F, 0.9F, 2F);
GL11.glTranslatef(0.05F, 0.05F, -0.6F);
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
GL11.glScalef(0.8F, 0.8F, 0.9F);
GL11.glTranslatef(0.125F, 0.125F, 0.05F);
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
GL11.glScalef(0.6F, 0.6F, 0.6F);
GL11.glTranslatef(0.335F, 0.335F, 0.05F);
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
public static void renderItemIn2D(Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5, float par6, float par7) {
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 0.0F, 1.0F);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4);
par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) par3, (double) par4);
par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) par3, (double) par2);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) par1, (double) par2);
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 0.0F, -1.0F);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double) (0.0F - par7), (double) par1, (double) par2);
par0Tessellator.addVertexWithUV(1.0D, 1.0D, (double) (0.0F - par7), (double) par3, (double) par2);
par0Tessellator.addVertexWithUV(1.0D, 0.0D, (double) (0.0F - par7), (double) par3, (double) par4);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double) (0.0F - par7), (double) par1, (double) par4);
par0Tessellator.draw();
float f5 = 0.5F * (par1 - par3) / (float) par5;
float f6 = 0.5F * (par4 - par2) / (float) par6;
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F);
int k;
float f7;
float f8;
public static void renderItemIn2D (Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5, float par6, float par7)
{
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 0.0F, 1.0F);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4);
par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) par3, (double) par4);
par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) par3, (double) par2);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) par1, (double) par2);
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 0.0F, -1.0F);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double) (0.0F - par7), (double) par1, (double) par2);
par0Tessellator.addVertexWithUV(1.0D, 1.0D, (double) (0.0F - par7), (double) par3, (double) par2);
par0Tessellator.addVertexWithUV(1.0D, 0.0D, (double) (0.0F - par7), (double) par3, (double) par4);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double) (0.0F - par7), (double) par1, (double) par4);
par0Tessellator.draw();
float f5 = 0.5F * (par1 - par3) / (float) par5;
float f6 = 0.5F * (par4 - par2) / (float) par6;
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F);
int k;
float f7;
float f8;
for (k = 0; k < par5; ++k) {
f7 = (float) k / (float) par5;
f8 = par1 + (par3 - par1) * f7 - f5;
par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f7, 0.0D, 0.0D, (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f7, 1.0D, 0.0D, (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f7, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
}
for (k = 0; k < par5; ++k)
{
f7 = (float) k / (float) par5;
f8 = par1 + (par3 - par1) * f7 - f5;
par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f7, 0.0D, 0.0D, (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f7, 1.0D, 0.0D, (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f7, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
}
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(1.0F, 0.0F, 0.0F);
float f9;
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(1.0F, 0.0F, 0.0F);
float f9;
for (k = 0; k < par5; ++k) {
f7 = (float) k / (float) par5;
f8 = par1 + (par3 - par1) * f7 - f5;
f9 = f7 + 1.0F / (float) par5;
par0Tessellator.addVertexWithUV((double) f9, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f9, 1.0D, 0.0D, (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f9, 0.0D, 0.0D, (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f9, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
}
for (k = 0; k < par5; ++k)
{
f7 = (float) k / (float) par5;
f8 = par1 + (par3 - par1) * f7 - f5;
f9 = f7 + 1.0F / (float) par5;
par0Tessellator.addVertexWithUV((double) f9, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f9, 1.0D, 0.0D, (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f9, 0.0D, 0.0D, (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f9, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
}
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 1.0F, 0.0F);
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 1.0F, 0.0F);
for (k = 0; k < par6; ++k) {
f7 = (float) k / (float) par6;
f8 = par4 + (par2 - par4) * f7 - f6;
f9 = f7 + 1.0F / (float) par6;
par0Tessellator.addVertexWithUV(0.0D, (double) f9, 0.0D, (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f9, 0.0D, (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f9, (double) (0.0F - par7), (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f9, (double) (0.0F - par7), (double) par1, (double) f8);
}
for (k = 0; k < par6; ++k)
{
f7 = (float) k / (float) par6;
f8 = par4 + (par2 - par4) * f7 - f6;
f9 = f7 + 1.0F / (float) par6;
par0Tessellator.addVertexWithUV(0.0D, (double) f9, 0.0D, (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f9, 0.0D, (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f9, (double) (0.0F - par7), (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f9, (double) (0.0F - par7), (double) par1, (double) f8);
}
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, -1.0F, 0.0F);
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, -1.0F, 0.0F);
for (k = 0; k < par6; ++k) {
f7 = (float) k / (float) par6;
f8 = par4 + (par2 - par4) * f7 - f6;
par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f7, 0.0D, (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f7, (double) (0.0F - par7), (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f7, (double) (0.0F - par7), (double) par3, (double) f8);
}
for (k = 0; k < par6; ++k)
{
f7 = (float) k / (float) par6;
f8 = par4 + (par2 - par4) * f7 - f6;
par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f7, 0.0D, (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f7, (double) (0.0F - par7), (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f7, (double) (0.0F - par7), (double) par3, (double) f8);
}
par0Tessellator.draw();
}
par0Tessellator.draw();
}
}
@@ -53,12 +53,14 @@ public class CastingBasinSpecialRender extends TileEntitySpecialRenderer
{
GL11.glScalef(1.6F, 1.6F, 1.6F);
GL11.glTranslatef(0F, 0.045F, 0.0f);
} 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);
GL11.glTranslatef(0F, -0.235F, -0.36F);
}
}
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);
GL11.glTranslatef(0F, -0.235F, -0.36F);
}
RenderItem.renderInFrame = true;
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
@@ -14,77 +14,87 @@ import tconstruct.blocks.GlassPaneConnected;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class PaneConnectedRender implements ISimpleBlockRenderingHandler {
public class PaneConnectedRender implements ISimpleBlockRenderingHandler
{
public static int model = RenderingRegistry.getNextAvailableRenderId();
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
@Override
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) {
boolean temp = renderer.renderAllFaces;
renderer.renderAllFaces = true;
GlassPaneConnected pane = (GlassPaneConnected)block;
boolean flag = pane.canPaneConnectTo(world, x, y, z, EAST);
boolean flag1 = pane.canPaneConnectTo(world, x, y, z, WEST);
boolean flag2 = pane.canPaneConnectTo(world, x, y, z, SOUTH);
boolean flag3 = pane.canPaneConnectTo(world, x, y, z, NORTH);
Icon sideTexture = pane.getSideTextureIndex();
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{
// renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 0.55D);
// renderer.renderStandardBlock(block, x, y, z);
}
// renderer.setOverrideBlockTexture(sideTexture);
if(flag){
renderer.setRenderBounds(0.45D, 0D, 0.45D, 1D, 1D, 0.55D);
renderer.renderStandardBlock(block, x, y, z);
}
if(flag1){
renderer.setRenderBounds(0D, 0D, 0.45D, 0.45D, 1D, 0.55D);
renderer.renderStandardBlock(block, x, y, z);
}
if(flag2){
renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 1D);
renderer.renderStandardBlock(block, x, y, z);
}
if(flag3){
renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 0.45D);
renderer.renderStandardBlock(block, x, y, z);
}
renderer.clearOverrideBlockTexture();
renderer.renderAllFaces = false;
return true;
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
boolean temp = renderer.renderAllFaces;
renderer.renderAllFaces = true;
@Override
public boolean shouldRender3DInInventory() {
return false;
}
GlassPaneConnected pane = (GlassPaneConnected) block;
@Override
public int getRenderId() {
return model;
}
boolean flag = pane.canPaneConnectTo(world, x, y, z, EAST);
boolean flag1 = pane.canPaneConnectTo(world, x, y, z, WEST);
boolean flag2 = pane.canPaneConnectTo(world, x, y, z, SOUTH);
boolean flag3 = pane.canPaneConnectTo(world, x, y, z, NORTH);
Icon sideTexture = pane.getSideTextureIndex();
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
{
// renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 0.55D);
// renderer.renderStandardBlock(block, x, y, z);
}
// renderer.setOverrideBlockTexture(sideTexture);
if (flag)
{
renderer.setRenderBounds(0.45D, 0D, 0.45D, 1D, 1D, 0.55D);
renderer.renderStandardBlock(block, x, y, z);
}
if (flag1)
{
renderer.setRenderBounds(0D, 0D, 0.45D, 0.45D, 1D, 0.55D);
renderer.renderStandardBlock(block, x, y, z);
}
if (flag2)
{
renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 1D);
renderer.renderStandardBlock(block, x, y, z);
}
if (flag3)
{
renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 0.45D);
renderer.renderStandardBlock(block, x, y, z);
}
renderer.clearOverrideBlockTexture();
renderer.renderAllFaces = false;
return true;
}
@Override
public boolean shouldRender3DInInventory ()
{
return false;
}
@Override
public int getRenderId ()
{
return model;
}
}
@@ -46,13 +46,14 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
for (int i = 0; i < 6; ++i)
{
if (!placedSides[i]){
if (!placedSides[i])
{
continue;
}
didRender = true;
connectedSides = tile.connectedSides(ForgeDirection.getOrientation(i));
corners = tile.getRenderCorners(ForgeDirection.getOrientation(i));
renderFaceWithConnections(renderer, block, x, y, z, i, placedSides, connectedSides, corners);
}
if (!didRender)
@@ -63,7 +64,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
double maxX = Geometry.cable_width_max;
double maxY = Geometry.cable_low_height;
double maxZ = Geometry.cable_width_max;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -80,16 +81,10 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
double maxX = 1D;
double maxY = 1D;
double maxZ = 1D;
boolean[] renderDir = {
(connectedSides[0] || placed[0] || corners[0]),
(connectedSides[1] || placed[1] || corners[1]),
(connectedSides[2] || placed[2] || corners[2]),
(connectedSides[3] || placed[3] || corners[3]),
(connectedSides[4] || placed[4] || corners[4]),
(connectedSides[5] || placed[5] || corners[5])
};
boolean[] renderDir = { (connectedSides[0] || placed[0] || corners[0]), (connectedSides[1] || placed[1] || corners[1]), (connectedSides[2] || placed[2] || corners[2]),
(connectedSides[3] || placed[3] || corners[3]), (connectedSides[4] || placed[4] || corners[4]), (connectedSides[5] || placed[5] || corners[5]) };
switch (side)
{
case 0: // DOWN
@@ -102,15 +97,15 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxY = Geometry.cable_low_height;
maxZ = Geometry.cable_width_max;
maxY += Geometry.zfight;
minX = (corners[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_corner_min : minX;
maxX = (corners[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_corner_max : maxX;
renderer.setRenderBounds(minX, minY, minZ, Geometry.cable_width_min, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(Geometry.cable_width_max, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -123,13 +118,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_width_max;
maxY = Geometry.cable_low_height;
maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
minZ = (corners[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_corner_min : minZ;
maxZ = (corners[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_corner_max : maxZ;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, Geometry.cable_width_min);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(minX, minY, Geometry.cable_width_max, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -140,7 +135,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_width_max;
maxY = Geometry.cable_low_height;
maxZ = Geometry.cable_width_max;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
@@ -155,15 +150,15 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxY = Geometry.cable_high_height;
maxZ = Geometry.cable_width_max;
minY -= Geometry.zfight;
minX = (corners[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_corner_min : minX;
maxX = (corners[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_corner_max : maxX;
renderer.setRenderBounds(minX, minY, minZ, Geometry.cable_width_min, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(Geometry.cable_width_max, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -176,13 +171,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_width_max;
maxY = Geometry.cable_high_height;
maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
minZ = (corners[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_corner_min : minZ;
maxZ = (corners[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_corner_max : maxZ;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, Geometry.cable_width_min);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(minX, minY, Geometry.cable_width_max, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -193,10 +188,10 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_width_max;
maxY = Geometry.cable_high_height;
maxZ = Geometry.cable_width_max;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
break;
case 2: // NORTH
// Render East/West
@@ -208,13 +203,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxY = Geometry.cable_width_max;
maxZ = Geometry.cable_low_height;
minX = (corners[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_corner_min : minX;
maxX = (corners[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_corner_max : maxX;
renderer.setRenderBounds(minX, minY, minZ, Geometry.cable_width_min, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(Geometry.cable_width_max, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -227,13 +222,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_width_max;
maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxZ = Geometry.cable_low_height;
minY += (placed[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_low_height : 0;
maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0;
maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0;
renderer.setRenderBounds(minX, Geometry.cable_width_max, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(minX, minY, minZ, maxX, Geometry.cable_width_min, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -244,7 +239,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_width_max;
maxY = Geometry.cable_width_max;
maxZ = Geometry.cable_low_height;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
@@ -259,13 +254,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxY = Geometry.cable_width_max;
maxZ = Geometry.cable_high_height;
minX = (corners[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_corner_min : minX;
maxX = (corners[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_corner_max : maxX;
renderer.setRenderBounds(minX, minY, minZ, Geometry.cable_width_min, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(Geometry.cable_width_max, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -278,13 +273,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_width_max;
maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxZ = Geometry.cable_high_height;
minY += (placed[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_low_height : 0;
maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0;
maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0;
renderer.setRenderBounds(minX, Geometry.cable_width_max, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(minX, minY, minZ, maxX, Geometry.cable_width_min, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -295,7 +290,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_width_max;
maxY = Geometry.cable_width_max;
maxZ = Geometry.cable_high_height;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
@@ -310,13 +305,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_low_height;
maxY = Geometry.cable_width_max;
maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
minZ += (placed[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_low_height : 0;
maxZ -= (placed[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_low_height : 0;
maxZ -= (placed[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_low_height : 0;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, Geometry.cable_width_min);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(minX, minY, Geometry.cable_width_max, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -329,13 +324,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_low_height;
maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxZ = Geometry.cable_width_max;
minY += (placed[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_low_height : 0;
maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0;
maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0;
renderer.setRenderBounds(minX, Geometry.cable_width_max, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(minX, minY, minZ, maxX, Geometry.cable_width_min, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -346,7 +341,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_low_height;
maxY = Geometry.cable_width_max;
maxZ = Geometry.cable_width_max;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
@@ -361,13 +356,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_high_height;
maxY = Geometry.cable_width_max;
maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
minZ += (placed[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_low_height : 0;
maxZ -= (placed[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_low_height : 0;
maxZ -= (placed[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_low_height : 0;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, Geometry.cable_width_min);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(minX, minY, Geometry.cable_width_max, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -380,13 +375,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_high_height;
maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max;
maxZ = Geometry.cable_width_max;
minY += (placed[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_low_height : 0;
maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0;
maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0;
renderer.setRenderBounds(minX, Geometry.cable_width_max, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(minX, minY, minZ, maxX, Geometry.cable_width_min, maxZ);
renderer.renderStandardBlock(block, x, y, z);
}
@@ -397,7 +392,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler
maxX = Geometry.cable_high_height;
maxY = Geometry.cable_width_max;
maxZ = Geometry.cable_width_max;
renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ);
renderer.renderStandardBlock(block, x, y, z);
@@ -17,7 +17,7 @@ public class SlimeChannelRender 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)
{
if (modelID == model)
{
@@ -26,7 +26,7 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
}
@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)
{
if (modelID == model)
{
@@ -35,20 +35,20 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
}
return true;
}
static final float LIGHT_Y_NEG = 0.5F;
static final float LIGHT_Y_POS = 1.0F;
static final float LIGHT_XZ_NEG = 0.8F;
static final float LIGHT_XZ_POS = 0.6F;
public boolean renderRotatedBlock(Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer)
public boolean renderRotatedBlock (Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer)
{
if (true)
{
Tessellator tessellator = Tessellator.instance;
int bMeta = world.getBlockMetadata(x, y, z);
Icon iconStill = block.getIcon(1, bMeta);
float flowDir = (float) (bMeta / 8f * 2*Math.PI); //Tau, radians
float flowDir = (float) (bMeta / 8f * 2 * Math.PI); //Tau, radians
double u1, u2, u3, u4, v1, v2, v3, v4;
@@ -106,13 +106,13 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler
}
@Override
public boolean shouldRender3DInInventory()
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId()
public int getRenderId ()
{
return model;
}
+22 -14
View File
@@ -14,7 +14,7 @@ public class SlimePadRender 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)
{
if (modelID == model)
{
@@ -23,7 +23,7 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler
}
@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)
{
if (modelID == model)
{
@@ -39,31 +39,39 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler
return true;
}
float[] size(int meta)
float[] size (int meta)
{
//xMin, zMin, xMax, zMax
switch (meta)
{
case 0: return new float[] {0.375f, 0.6875f, 0.625f, 0.9375f};
case 1: return new float[] {0.0625f, 0.6875f, 0.3125f, 0.9375f};
case 2: return new float[] {0.0625f, 0.375f, 0.3125f, 0.625f};
case 3: return new float[] {0.0625f, 0.0625f, 0.3125f, 0.3125f};
case 4: return new float[] {0.375f, 0.0625f, 0.625f, 0.3125f};
case 5: return new float[] {0.6875f, 0.0625f, 0.9375f, 0.3125f};
case 6: return new float[] {0.6875f, 0.375f, 0.9375f, 0.625f};
case 7: return new float[] {0.6875f, 0.6875f, 0.9375f, 0.9375f};
case 0:
return new float[] { 0.375f, 0.6875f, 0.625f, 0.9375f };
case 1:
return new float[] { 0.0625f, 0.6875f, 0.3125f, 0.9375f };
case 2:
return new float[] { 0.0625f, 0.375f, 0.3125f, 0.625f };
case 3:
return new float[] { 0.0625f, 0.0625f, 0.3125f, 0.3125f };
case 4:
return new float[] { 0.375f, 0.0625f, 0.625f, 0.3125f };
case 5:
return new float[] { 0.6875f, 0.0625f, 0.9375f, 0.3125f };
case 6:
return new float[] { 0.6875f, 0.375f, 0.9375f, 0.625f };
case 7:
return new float[] { 0.6875f, 0.6875f, 0.9375f, 0.9375f };
}
return new float[] { 0.375f, 0.375f, 0.625f, 0.625f};
return new float[] { 0.375f, 0.375f, 0.625f, 0.625f };
}
@Override
public boolean shouldRender3DInInventory()
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId()
public int getRenderId ()
{
return model;
}
@@ -25,15 +25,15 @@ public class ExplosiveRender extends Render
this.shadowSize = 0.5F;
}
public void renderPrimedTNT(ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9)
public void renderPrimedTNT (ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
float f2;
if ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F)
if ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F)
{
f2 = 1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F;
f2 = 1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F;
if (f2 < 0.0F)
{
@@ -51,7 +51,7 @@ public class ExplosiveRender extends Render
GL11.glScalef(f3, f3, f3);
}
f2 = (1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F;
f2 = (1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F;
this.bindEntityTexture(par1EntityTNTPrimed);
this.blockRenderer.renderBlockAsItem(TContent.slimeExplosive, 0, par1EntityTNTPrimed.getBrightness(par9));
@@ -72,7 +72,7 @@ public class ExplosiveRender extends Render
GL11.glPopMatrix();
}
protected ResourceLocation func_110808_a(ExplosivePrimed par1EntityTNTPrimed)
protected ResourceLocation func_110808_a (ExplosivePrimed par1EntityTNTPrimed)
{
return TextureMap.locationBlocksTexture;
}
@@ -80,9 +80,9 @@ public class ExplosiveRender extends Render
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
protected ResourceLocation getEntityTexture (Entity par1Entity)
{
return this.func_110808_a((ExplosivePrimed)par1Entity);
return this.func_110808_a((ExplosivePrimed) par1Entity);
}
/**
@@ -91,8 +91,8 @@ public class ExplosiveRender extends Render
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderPrimedTNT((ExplosivePrimed)par1Entity, par2, par4, par6, par8, par9);
this.renderPrimedTNT((ExplosivePrimed) par1Entity, par2, par4, par6, par8, par9);
}
}
@@ -50,7 +50,7 @@ public class ArrowRender extends Render
/**
* Renders the item
*/
public void doRenderItem(ArrowEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
public void doRenderItem (ArrowEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
{
this.bindEntityTexture(par1ArrowEntity);
this.random.setSeed(187L);
@@ -163,7 +163,7 @@ public class ArrowRender extends Render
}
}
protected ResourceLocation func_110796_a(ArrowEntity par1ArrowEntity)
protected ResourceLocation func_110796_a (ArrowEntity par1ArrowEntity)
{
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
}
@@ -171,12 +171,12 @@ public class ArrowRender extends Render
/**
* Renders a dropped item
*/
private void renderDroppedItem(ArrowEntity par1ArrowEntity, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
private void renderDroppedItem (ArrowEntity par1ArrowEntity, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
{
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
}
private void renderDroppedItem(ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
private void renderDroppedItem (ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
{
Tessellator tessellator = Tessellator.instance;
@@ -235,7 +235,7 @@ public class ArrowRender extends Render
}
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) par2Icon).getIconWidth(), ((Icon) par2Icon).getIconHeight(), f12);
if (itemstack.hasEffect(pass))
@@ -273,7 +273,7 @@ public class ArrowRender extends Render
GL11.glPopMatrix();
}
protected ResourceLocation getEntityTexture(Entity par1Entity)
protected ResourceLocation getEntityTexture (Entity par1Entity)
{
return this.func_110796_a((ArrowEntity) par1Entity);
}
@@ -284,7 +284,7 @@ public class ArrowRender extends Render
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
}
@@ -293,7 +293,7 @@ public class ArrowRender extends Render
* Items should spread out when rendered in 3d?
* @return
*/
public boolean shouldSpreadItems()
public boolean shouldSpreadItems ()
{
return false;
}
@@ -302,7 +302,7 @@ public class ArrowRender extends Render
* Items should have a bob effect
* @return
*/
public boolean shouldBob()
public boolean shouldBob ()
{
return false;
}
+130 -99
View File
@@ -11,123 +11,154 @@ import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.event.ForgeSubscribe;
public class EventCloakRender {
public class EventCloakRender
{
private final String serverLocation = "https://raw.github.com/SlimeKnights/TinkersConstruct/master/capes.txt";
private final int timeout = 1000;
private final String serverLocation = "https://raw.github.com/SlimeKnights/TinkersConstruct/master/capes.txt";
private final int timeout = 1000;
private static final Graphics TEST_GRAPHICS = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB).getGraphics();
private HashMap<String, String> cloaks = new HashMap<String, String>();
private ArrayList<AbstractClientPlayer> capePlayers = new ArrayList<AbstractClientPlayer>();
private static final Graphics TEST_GRAPHICS = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB).getGraphics();
private HashMap<String, String> cloaks = new HashMap<String, String>();
private ArrayList<AbstractClientPlayer> capePlayers = new ArrayList<AbstractClientPlayer>();
public static EventCloakRender instance;
public static EventCloakRender instance;
public EventCloakRender() {
buildCloakURLDatabase();
instance = this;
}
public EventCloakRender()
{
buildCloakURLDatabase();
instance = this;
}
@ForgeSubscribe
public void onPreRenderSpecials(RenderPlayerEvent.Specials.Pre event) {
if (Loader.isModLoaded("shadersmod")) {
return;
}
if (event.entityPlayer instanceof AbstractClientPlayer) {
AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer;
@ForgeSubscribe
public void onPreRenderSpecials (RenderPlayerEvent.Specials.Pre event)
{
if (Loader.isModLoaded("shadersmod"))
{
return;
}
if (event.entityPlayer instanceof AbstractClientPlayer)
{
AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer;
if (!capePlayers.contains(abstractClientPlayer)) {
String cloakURL = cloaks.get(event.entityPlayer.username);
if (!capePlayers.contains(abstractClientPlayer))
{
String cloakURL = cloaks.get(event.entityPlayer.username);
if (cloakURL == null) {
return;
}
if (cloakURL == null)
{
return;
}
capePlayers.add(abstractClientPlayer);
capePlayers.add(abstractClientPlayer);
abstractClientPlayer.getTextureCape().textureUploaded = false;
new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start();
event.renderCape = true;
}
}
}
abstractClientPlayer.getTextureCape().textureUploaded = false;
new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start();
event.renderCape = true;
}
}
}
public void buildCloakURLDatabase() {
URL url;
try {
url = new URL(serverLocation);
URLConnection con = url.openConnection();
con.setConnectTimeout(timeout);
con.setReadTimeout(timeout);
InputStream io = con.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(io));
public void buildCloakURLDatabase ()
{
URL url;
try
{
url = new URL(serverLocation);
URLConnection con = url.openConnection();
con.setConnectTimeout(timeout);
con.setReadTimeout(timeout);
InputStream io = con.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(io));
String str;
int linetracker = 1;
while ((str = br.readLine()) != null) {
if (!str.startsWith("--")) {
if (str.contains(":")) {
String nick = str.substring(0, str.indexOf(":"));
String link = str.substring(str.indexOf(":") + 1);
new Thread(new CloakPreload(link)).start();
cloaks.put(nick, link);
} else {
System.err.println("[TinkersConstruct] [skins.txt] Syntax error on line " + linetracker + ": " + str);
}
}
linetracker++;
}
String str;
int linetracker = 1;
while ((str = br.readLine()) != null)
{
if (!str.startsWith("--"))
{
if (str.contains(":"))
{
String nick = str.substring(0, str.indexOf(":"));
String link = str.substring(str.indexOf(":") + 1);
new Thread(new CloakPreload(link)).start();
cloaks.put(nick, link);
}
else
{
System.err.println("[TinkersConstruct] [skins.txt] Syntax error on line " + linetracker + ": " + str);
}
}
linetracker++;
}
br.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
br.close();
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
private class CloakThread implements Runnable {
private class CloakThread implements Runnable
{
AbstractClientPlayer abstractClientPlayer;
String cloakURL;
AbstractClientPlayer abstractClientPlayer;
String cloakURL;
public CloakThread(AbstractClientPlayer player, String cloak) {
abstractClientPlayer = player;
cloakURL = cloak;
}
public CloakThread(AbstractClientPlayer player, String cloak)
{
abstractClientPlayer = player;
cloakURL = cloak;
}
@Override
public void run() {
try {
Image cape = new ImageIcon(new URL(cloakURL)).getImage();
BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB);
bo.getGraphics().drawImage(cape, 0, 0, null);
abstractClientPlayer.getTextureCape().bufferedImage = bo;
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
@Override
public void run ()
{
try
{
Image cape = new ImageIcon(new URL(cloakURL)).getImage();
BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB);
bo.getGraphics().drawImage(cape, 0, 0, null);
abstractClientPlayer.getTextureCape().bufferedImage = bo;
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
}
}
private class CloakPreload implements Runnable {
String cloakURL;
private class CloakPreload implements Runnable
{
String cloakURL;
public CloakPreload(String link) {
cloakURL = link;
}
public CloakPreload(String link)
{
cloakURL = link;
}
@Override
public void run() {
try {
TEST_GRAPHICS.drawImage(new ImageIcon(new URL(cloakURL)).getImage(), 0, 0, null);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
}
@Override
public void run ()
{
try
{
TEST_GRAPHICS.drawImage(new ImageIcon(new URL(cloakURL)).getImage(), 0, 0, null);
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
}
}
public void refreshCapes() {
cloaks.clear();
capePlayers.clear();
buildCloakURLDatabase();
}
public void refreshCapes ()
{
cloaks.clear();
capePlayers.clear();
buildCloakURLDatabase();
}
}
+130 -113
View File
@@ -7,137 +7,154 @@ import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton;
public class AdvDrawbridgeButton extends GuiButton {
protected static final ResourceLocation buttonTextures = new ResourceLocation("tinker:textures/gui/slotButton.png");
public class AdvDrawbridgeButton extends GuiButton
{
protected static final ResourceLocation buttonTextures = new ResourceLocation("tinker:textures/gui/slotButton.png");
/** Button width in pixels */
protected int width;
/** Button width in pixels */
protected int width;
/** Button height in pixels */
protected int height;
/** Button height in pixels */
protected int height;
/** The x position of this control. */
public int xPosition;
/** The x position of this control. */
public int xPosition;
/** The y position of this control. */
public int yPosition;
/** The x position of this control when the GUI is expanded. */
public int xPositionExp;
/** The x position of this control when the GUI is expanded. */
public int yPositionExp;
/** Is the GUI expanded. */
public boolean isGuiExpanded = false;
/** The string displayed on this control. */
public String displayString;
/** The y position of this control. */
public int yPosition;
/** ID for this control. */
public int id;
/** The x position of this control when the GUI is expanded. */
public int xPositionExp;
/** True if this control is enabled, false to disable. */
public boolean enabled;
/** The x position of this control when the GUI is expanded. */
public int yPositionExp;
/** Hides the button completely if false. */
public boolean drawButton;
protected boolean field_82253_i;
/** Is the GUI expanded. */
public boolean isGuiExpanded = false;
public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, String par6Str) {
this(par1, par2, par3, par4, par5, 200, 20, par6Str);
}
/** The string displayed on this control. */
public String displayString;
public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, int par6, int par7, String par8Str) {
super(par1, par2, par3, par6, par7, par8Str);
this.width = 200;
this.height = 20;
this.enabled = true;
this.drawButton = true;
this.id = par1;
this.xPosition = par2;
this.yPosition = par3;
this.xPositionExp = par4;
this.yPositionExp = par5;
this.width = par6;
this.height = par7;
this.displayString = par8Str;
}
/** ID for this control. */
public int id;
/**
* Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over
* this button and 2 if it IS hovering over this button.
*/
protected int getHoverState(boolean par1) {
byte b0 = 1;
/** True if this control is enabled, false to disable. */
public boolean enabled;
if (!this.enabled) {
b0 = 0;
} else if (par1) {
b0 = 2;
}
/** Hides the button completely if false. */
public boolean drawButton;
protected boolean field_82253_i;
return b0;
}
public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, String par6Str)
{
this(par1, par2, par3, par4, par5, 200, 20, par6Str);
}
/**
* Draws this button to the screen.
*/
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
if (this.drawButton) {
FontRenderer fontrenderer = par1Minecraft.fontRenderer;
par1Minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int xPosition = isGuiExpanded ? this.xPositionExp : this.xPosition;
int yPosition = isGuiExpanded ? this.yPositionExp : this.yPosition;
this.field_82253_i = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + this.width && par3 < yPosition + this.height;
int k = this.getHoverState(this.field_82253_i);
this.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 26, this.width / 2, this.height);
this.drawTexturedModalRect(xPosition + this.width / 2, yPosition, 200 - this.width / 2, 46 + k * 26, this.width / 2, this.height);
this.mouseDragged(par1Minecraft, par2, par3);
int l = 14737632;
public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, int par6, int par7, String par8Str)
{
super(par1, par2, par3, par6, par7, par8Str);
this.width = 200;
this.height = 20;
this.enabled = true;
this.drawButton = true;
this.id = par1;
this.xPosition = par2;
this.yPosition = par3;
this.xPositionExp = par4;
this.yPositionExp = par5;
this.width = par6;
this.height = par7;
this.displayString = par8Str;
}
if (!this.enabled) {
l = -6250336;
} else if (this.field_82253_i) {
l = 16777120;
}
/**
* Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over
* this button and 2 if it IS hovering over this button.
*/
protected int getHoverState (boolean par1)
{
byte b0 = 1;
this.drawCenteredString(fontrenderer, this.displayString, xPosition + this.width / 2, yPosition + (this.height - 8) / 2, l);
}
}
if (!this.enabled)
{
b0 = 0;
}
else if (par1)
{
b0 = 2;
}
/**
* Fired when the mouse button is dragged. Equivalent of
* MouseListener.mouseDragged(MouseEvent e).
*/
protected void mouseDragged(Minecraft par1Minecraft, int par2, int par3) {
}
return b0;
}
/**
* Fired when the mouse button is released. Equivalent of
* MouseListener.mouseReleased(MouseEvent e).
*/
public void mouseReleased(int par1, int par2) {
}
/**
* Draws this button to the screen.
*/
public void drawButton (Minecraft par1Minecraft, int par2, int par3)
{
if (this.drawButton)
{
FontRenderer fontrenderer = par1Minecraft.fontRenderer;
par1Minecraft.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
/**
* Returns true if the mouse has been pressed on this control. Equivalent of
* MouseListener.mousePressed(MouseEvent e).
*/
public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3) {
int xPosition = isGuiExpanded ? this.xPositionExp : this.xPosition;
int yPosition = isGuiExpanded ? this.yPositionExp : this.yPosition;
return this.enabled && this.drawButton && par2 >= xPosition && par3 >= yPosition && par2 < xPosition + this.width && par3 < yPosition + this.height;
}
int xPosition = isGuiExpanded ? this.xPositionExp : this.xPosition;
int yPosition = isGuiExpanded ? this.yPositionExp : this.yPosition;
public boolean func_82252_a() {
return this.field_82253_i;
}
this.field_82253_i = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + this.width && par3 < yPosition + this.height;
int k = this.getHoverState(this.field_82253_i);
this.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 26, this.width / 2, this.height);
this.drawTexturedModalRect(xPosition + this.width / 2, yPosition, 200 - this.width / 2, 46 + k * 26, this.width / 2, this.height);
this.mouseDragged(par1Minecraft, par2, par3);
int l = 14737632;
public void func_82251_b(int par1, int par2) {
}
if (!this.enabled)
{
l = -6250336;
}
else if (this.field_82253_i)
{
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, xPosition + this.width / 2, yPosition + (this.height - 8) / 2, l);
}
}
/**
* Fired when the mouse button is dragged. Equivalent of
* MouseListener.mouseDragged(MouseEvent e).
*/
protected void mouseDragged (Minecraft par1Minecraft, int par2, int par3)
{
}
/**
* Fired when the mouse button is released. Equivalent of
* MouseListener.mouseReleased(MouseEvent e).
*/
public void mouseReleased (int par1, int par2)
{
}
/**
* Returns true if the mouse has been pressed on this control. Equivalent of
* MouseListener.mousePressed(MouseEvent e).
*/
public boolean mousePressed (Minecraft par1Minecraft, int par2, int par3)
{
int xPosition = isGuiExpanded ? this.xPositionExp : this.xPosition;
int yPosition = isGuiExpanded ? this.yPositionExp : this.yPosition;
return this.enabled && this.drawButton && par2 >= xPosition && par3 >= yPosition && par2 < xPosition + this.width && par3 < yPosition + this.height;
}
public boolean func_82252_a ()
{
return this.field_82253_i;
}
public void func_82251_b (int par1, int par2)
{
}
}
+51 -38
View File
@@ -16,10 +16,10 @@ import tconstruct.inventory.AdvancedDrawbridgeContainer;
public class AdvDrawbridgeGui extends GuiContainer
{
public AdvancedDrawbridgeLogic logic;
public boolean isGuiExpanded = false;
public boolean containerNeglectMouse = false;
public AdvDrawbridgeGui(EntityPlayer player, AdvancedDrawbridgeLogic frypan, World world, int x, int y, int z)
{
super(frypan.getGuiContainer(player.inventory, world, x, y, z));
@@ -43,18 +43,24 @@ public class AdvDrawbridgeGui extends GuiContainer
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
if(!isGuiExpanded){
drawTexturedModalRect(cornerX + 34, cornerY + 35, 238, 0, 18, 18);
}else{
for(int index = 0; index < 16; index++){
drawTexturedModalRect(index < 8 ? cornerX + 9 + 20 * index : cornerX + 9 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1), 238, 0, 18, 18);
if(index != 15){
drawTexturedModalRect(index < 8 ? cornerX + 26 + 20 * index : cornerX + 26 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1) + 6, 253, 18, 3, 5);
}
}
// drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40);
// drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40);
// drawTexturedModalRect(cornerX + 173, cornerY + 29, 10, 167, 10, 40);
if (!isGuiExpanded)
{
drawTexturedModalRect(cornerX + 34, cornerY + 35, 238, 0, 18, 18);
}
else
{
for (int index = 0; index < 16; index++)
{
drawTexturedModalRect(index < 8 ? cornerX + 9 + 20 * index : cornerX + 9 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1), 238, 0, 18, 18);
if (index != 15)
{
drawTexturedModalRect(index < 8 ? cornerX + 26 + 20 * index : cornerX + 26 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1) + 6, 253, 18,
3, 5);
}
}
// drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40);
// drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40);
// drawTexturedModalRect(cornerX + 173, cornerY + 29, 10, 167, 10, 40);
}
}
@@ -86,32 +92,38 @@ public class AdvDrawbridgeGui extends GuiContainer
if (logic.getPlacementDirection() == 4)
button.enabled = false;
this.buttonList.add(button);
this.buttonList.add(new AdvDrawbridgeButton(5, this.width / 2 - 13, this.height / 2 - 52, this.width / 2 + 58, this.height / 2 - 79, 26, 26, "Inv"));
}
public void setExpanded(boolean flag){
this.isGuiExpanded = flag;
this.containerNeglectMouse = true;
Iterator<GuiButton> i1 = this.buttonList.iterator();
while(i1.hasNext()){
GuiButton b = i1.next();
if(b instanceof AdvDrawbridgeButton){
((AdvDrawbridgeButton)b).isGuiExpanded = flag;
} else {
b.drawButton = !flag;
}
}
((AdvancedDrawbridgeContainer)this.inventorySlots).updateContainerSlots();
public void setExpanded (boolean flag)
{
this.isGuiExpanded = flag;
this.containerNeglectMouse = true;
Iterator<GuiButton> i1 = this.buttonList.iterator();
while (i1.hasNext())
{
GuiButton b = i1.next();
if (b instanceof AdvDrawbridgeButton)
{
((AdvDrawbridgeButton) b).isGuiExpanded = flag;
}
else
{
b.drawButton = !flag;
}
}
((AdvancedDrawbridgeContainer) this.inventorySlots).updateContainerSlots();
}
protected void actionPerformed (GuiButton button)
{
if(button.id == 5){
setExpanded(!isGuiExpanded);
return;
}
if (button.id == 5)
{
setExpanded(!isGuiExpanded);
return;
}
for (Object o : buttonList)
{
GuiButton b = (GuiButton) o;
@@ -148,10 +160,11 @@ public class AdvDrawbridgeGui extends GuiContainer
PacketDispatcher.sendPacketToServer(packet);
}
@Override
public void updateScreen(){
super.updateScreen();
this.containerNeglectMouse = false;
public void updateScreen ()
{
super.updateScreen();
this.containerNeglectMouse = false;
}
}
+2 -2
View File
@@ -27,7 +27,7 @@ public class FurnaceGui extends GuiContainer
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer(int par1, int par2)
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
String s = this.logic.isInvNameLocalized() ? this.logic.getInvName() : I18n.getString(this.logic.getInvName());
this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
@@ -37,7 +37,7 @@ public class FurnaceGui extends GuiContainer
/**
* Draw the background layer for the GuiContainer (everything behind the items)
*/
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
+6 -5
View File
@@ -9,13 +9,14 @@ public class SpoolRepairRecipe implements IRecipe
{
ItemStack spool;
ItemStack wire;
public SpoolRepairRecipe(ItemStack spool, ItemStack wire)
{
this.spool = spool.copy();
this.spool.setItemDamage(256);
this.wire = wire.copy();
}
@Override
public boolean matches (InventoryCrafting inventorycrafting, World world)
{
@@ -35,7 +36,7 @@ public class SpoolRepairRecipe implements IRecipe
return false;
}
foundSpool = true;
}
}
else if (tmpStack.itemID == wire.itemID && tmpStack.getItemDamage() == wire.getItemDamage())
{
++countWire;
@@ -50,7 +51,7 @@ public class SpoolRepairRecipe implements IRecipe
return true;
}
}
return false;
}
@@ -71,7 +72,7 @@ public class SpoolRepairRecipe implements IRecipe
{
newSpool = tmpStack.copy();
foundSpool = true;
}
}
else if (tmpStack.itemID == wire.itemID && tmpStack.getItemDamage() == wire.getItemDamage())
{
++countWire;
@@ -82,7 +83,7 @@ public class SpoolRepairRecipe implements IRecipe
{
newSpool.setItemDamage(newSpool.getItemDamage() - countWire);
}
return newSpool;
}
+11 -12
View File
@@ -342,7 +342,7 @@ public class TContent implements IFuelHandler
craftingSlabWood = new CraftingSlab(PHConstruct.woodCrafterSlab, Material.wood).setUnlocalizedName("CraftingSlab");
GameRegistry.registerBlock(craftingSlabWood, CraftingSlabItemBlock.class, "CraftingSlab");
furnaceSlab = new FurnaceSlab(PHConstruct.furnaceSlab, Material.rock).setUnlocalizedName("FurnaceSlab");
GameRegistry.registerBlock(furnaceSlab, "FurnaceSlab");
GameRegistry.registerTileEntity(FurnaceLogic.class, "TConstruct.Furnace");
@@ -798,7 +798,7 @@ public class TContent implements IFuelHandler
essenceExtractor = new EssenceExtractor(PHConstruct.essenceExtractor).setHardness(12f).setUnlocalizedName("extractor.essence");
GameRegistry.registerBlock(essenceExtractor, "extractor.essence");
GameRegistry.registerTileEntity(EssenceExtractorLogic.class, "extractor.essence");
terraformer = new Terraformer(PHConstruct.terraformer).setHardness(50f).setUnlocalizedName("terraformer");
GameRegistry.registerBlock(terraformer, TerraformerItem.class, "terraformer");
GameRegistry.registerTileEntity(TerraformerLogic.class, "TerraFreezer");
@@ -1189,7 +1189,7 @@ public class TContent implements IFuelHandler
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolStationWood, 1, 10), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "plankWood"));
}
GameRegistry.addRecipe(new ItemStack(furnaceSlab, 1, 0), "###", "# #", "###", '#', new ItemStack(Block.stoneSingleSlab, 1, 3));
// Blank Pattern Recipe
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', "stickWood"));
// Manual Book Recipes
@@ -1513,7 +1513,6 @@ public class TContent implements IFuelHandler
modF = new ModFlux();
tb.registerToolMod(modF);
ItemStack redstoneItem = new ItemStack(Item.redstone);
ItemStack redstoneBlock = new ItemStack(Block.blockRedstone);
tb.registerToolMod(new ModRedstone(new ItemStack[] { redstoneItem }, 2, 1));
@@ -2204,18 +2203,18 @@ public class TContent implements IFuelHandler
{
ItemStack ironpick = ToolBuilder.instance.buildTool(new ItemStack(TContent.pickaxeHead, 1, 6), new ItemStack(TContent.toolRod, 1, 2), new ItemStack(TContent.binding, 1, 6), "");
/*TE3 Flux*/
ItemStack batHardened = GameRegistry.findItemStack("ThermalExpansion", "batteryHardened", 1);
ItemStack batHardened = GameRegistry.findItemStack("ThermalExpansion", "batteryHardened", 1);
if (batHardened != null)
{
modF.batteries.add(batHardened);
}
ItemStack basicCell = GameRegistry.findItemStack("ThermalExpansion", "cellBasic", 1);
ItemStack basicCell = GameRegistry.findItemStack("ThermalExpansion", "cellBasic", 1);
if (basicCell != null)
{
modF.batteries.add(basicCell);
}
/* IC2 */
//ItemStack reBattery = ic2.api.item.Items.getItem("reBattery");
Object reBattery = getStaticItem("reBattery", "ic2.core.Ic2Items");
if (reBattery != null)
@@ -2340,7 +2339,7 @@ public class TContent implements IFuelHandler
{
basinCasting.addCastingRecipe(ores.get(0), new FluidStack(moltenElectrumFluid, TConstruct.blockLiquidValue), null, 100);
}
/* Extra Utilities */
ores = OreDictionary.getOres("compressedGravel1x");
if (ores.size() > 0)
@@ -2350,7 +2349,7 @@ public class TContent implements IFuelHandler
ores = OreDictionary.getOres("compressedGravel2x"); //Higher won't save properly
if (ores.size() > 0)
{
basinCasting.addCastingRecipe(new ItemStack(speedBlock, 81), new FluidStack(moltenElectrumFluid, TConstruct.blockLiquidValue*9), ores.get(0), 100);
basinCasting.addCastingRecipe(new ItemStack(speedBlock, 81), new FluidStack(moltenElectrumFluid, TConstruct.blockLiquidValue * 9), ores.get(0), 100);
}
}
@@ -2411,13 +2410,13 @@ public class TContent implements IFuelHandler
registerPatternMaterial("block" + ft.toString(), 18, ft.toString());
}
}
//Compressed materials
for (int i = 1; i <= 8; i++)
{
Smeltery.addDictionaryMelting("compressedCobblestone"+i+"x", FluidType.Stone, 0, TConstruct.ingotLiquidValue / 18 * (9^i));
Smeltery.addDictionaryMelting("compressedCobblestone" + i + "x", FluidType.Stone, 0, TConstruct.ingotLiquidValue / 18 * (9 ^ i));
}
Smeltery.addDictionaryMelting("compressedSand1x", FluidType.Glass, 175, FluidContainerRegistry.BUCKET_VOLUME*9);
Smeltery.addDictionaryMelting("compressedSand1x", FluidType.Glass, 175, FluidContainerRegistry.BUCKET_VOLUME * 9);
registerPatternMaterial("plankWood", 2, "Wood");
registerPatternMaterial("stickWood", 1, "Wood");
+6 -6
View File
@@ -26,7 +26,7 @@ public class TProxyCommon implements IGuiHandler
public static int stencilTableID = 3;
public static int frypanGuiID = 4;
public static int toolForgeID = 5;
public static int smelteryGuiID = 7;
public static int furnaceID = 8;
public static int drawbridgeID = 9;
@@ -37,7 +37,6 @@ public class TProxyCommon implements IGuiHandler
public static int armorGuiID = 101;
public static int knapsackGuiID = 102;
public static int manualGuiID = -1;
@Override
@@ -89,7 +88,7 @@ public class TProxyCommon implements IGuiHandler
public void registerTickHandler ()
{
//TickRegistry.registerTickHandler(new TimeTicker(), Side.SERVER);
TickRegistry.registerScheduledTickHandler(new MultiblockServerTickHandler(), Side.SERVER);
TickRegistry.registerScheduledTickHandler(new MultiblockServerTickHandler(), Side.SERVER);
}
/* Registers any rendering code. Does nothing server-side */
@@ -122,8 +121,9 @@ public class TProxyCommon implements IGuiHandler
public static final String[] patterns = 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", "bowstring", "fletching", "arrowhead" };
public void postInit(){
public void postInit ()
{
}
}
+1 -1
View File
@@ -234,7 +234,7 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
return 4;
if (i == 8)
return 100;
return (float)Math.min(i * i + 8, 49);
return (float) Math.min(i * i + 8, 49);
}
/**
@@ -9,207 +9,238 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityLandmineFirework extends Entity {
/** The age of the firework in ticks. */
private int fireworkAge;
public class EntityLandmineFirework extends Entity
{
/** The age of the firework in ticks. */
private int fireworkAge;
/**
* The lifetime of the firework in ticks. When the age reaches the lifetime the firework explodes.
*/
private int lifetime;
/**
* The lifetime of the firework in ticks. When the age reaches the lifetime the firework explodes.
*/
private int lifetime;
private Entity rider;
private int moveDirection = 0;
public EntityLandmineFirework(World par1World) {
super(par1World);
this.setSize(0.25F, 0.25F);
}
private Entity rider;
protected void entityInit() {
this.dataWatcher.addObjectByDataType(8, 5);
}
public EntityLandmineFirework setRider(Entity entity){
rider = entity;
return this;
}
private int moveDirection = 0;
@SideOnly(Side.CLIENT)
/**
* Checks if the entity is in range to render by using the past in distance and comparing it to its average edge
* length * 64 * renderDistanceWeight Args: distance
*/
public boolean isInRangeToRenderDist(double par1) {
return par1 < 4096.0D;
}
public EntityLandmineFirework(World par1World)
{
super(par1World);
this.setSize(0.25F, 0.25F);
}
public EntityLandmineFirework(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack, int moveDirection) {
super(par1World);
this.fireworkAge = 0;
this.setSize(0.25F, 0.25F);
this.setPosition(par2, par4, par6);
this.yOffset = 0.0F;
int i = 1;
protected void entityInit ()
{
this.dataWatcher.addObjectByDataType(8, 5);
}
if (par8ItemStack != null && par8ItemStack.hasTagCompound()) {
this.dataWatcher.updateObject(8, par8ItemStack);
NBTTagCompound nbttagcompound = par8ItemStack.getTagCompound();
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Fireworks");
public EntityLandmineFirework setRider (Entity entity)
{
rider = entity;
return this;
}
if (nbttagcompound1 != null) {
i += nbttagcompound1.getByte("Flight");
}
}
@SideOnly(Side.CLIENT)
/**
* Checks if the entity is in range to render by using the past in distance and comparing it to its average edge
* length * 64 * renderDistanceWeight Args: distance
*/
public boolean isInRangeToRenderDist (double par1)
{
return par1 < 4096.0D;
}
this.motionX = this.rand.nextGaussian() * 0.001D;
this.motionZ = this.rand.nextGaussian() * 0.001D;
this.motionY = 0.05D;
this.lifetime = 10 * i + this.rand.nextInt(6) + this.rand.nextInt(7);
this.moveDirection = moveDirection;
}
public EntityLandmineFirework(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack, int moveDirection)
{
super(par1World);
this.fireworkAge = 0;
this.setSize(0.25F, 0.25F);
this.setPosition(par2, par4, par6);
this.yOffset = 0.0F;
int i = 1;
@SideOnly(Side.CLIENT)
/**
* Sets the velocity to the args. Args: x, y, z
*/
public void setVelocity(double par1, double par3, double par5) {
this.motionX = par1;
this.motionY = par3;
this.motionZ = par5;
if (par8ItemStack != null && par8ItemStack.hasTagCompound())
{
this.dataWatcher.updateObject(8, par8ItemStack);
NBTTagCompound nbttagcompound = par8ItemStack.getTagCompound();
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Fireworks");
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) * 180.0D / Math.PI);
}
}
if (nbttagcompound1 != null)
{
i += nbttagcompound1.getByte("Flight");
}
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate() {
if(this.riddenByEntity == null && this.rider != null){
this.rider.mountEntity(this);
}
this.lastTickPosX = this.posX;
this.lastTickPosY = this.posY;
this.lastTickPosZ = this.posZ;
super.onUpdate();
this.motionX *= 1.15D;
this.motionZ *= 1.15D;
this.motionY += 0.04D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
this.motionX = this.rand.nextGaussian() * 0.001D;
this.motionZ = this.rand.nextGaussian() * 0.001D;
this.motionY = 0.05D;
this.lifetime = 10 * i + this.rand.nextInt(6) + this.rand.nextInt(7);
this.moveDirection = moveDirection;
}
for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) {
;
}
@SideOnly(Side.CLIENT)
/**
* Sets the velocity to the args. Args: x, y, z
*/
public void setVelocity (double par1, double par3, double par5)
{
this.motionX = par1;
this.motionY = par3;
this.motionZ = par5;
while (this.rotationPitch - this.prevRotationPitch >= 180.0F) {
this.prevRotationPitch += 360.0F;
}
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
{
float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) * 180.0D / Math.PI);
}
}
while (this.rotationYaw - this.prevRotationYaw < -180.0F) {
this.prevRotationYaw -= 360.0F;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate ()
{
if (this.riddenByEntity == null && this.rider != null)
{
this.rider.mountEntity(this);
}
while (this.rotationYaw - this.prevRotationYaw >= 180.0F) {
this.prevRotationYaw += 360.0F;
}
this.lastTickPosX = this.posX;
this.lastTickPosY = this.posY;
this.lastTickPosZ = this.posZ;
super.onUpdate();
this.motionX *= 1.15D;
this.motionZ *= 1.15D;
this.motionY += 0.04D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
{
;
}
if (this.fireworkAge == 0) {
this.worldObj.playSoundAtEntity(this, "fireworks.launch", 3.0F, 1.0F);
}
while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
{
this.prevRotationPitch += 360.0F;
}
++this.fireworkAge;
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
{
this.prevRotationYaw -= 360.0F;
}
if (this.worldObj.isRemote && this.fireworkAge % 2 < 2) {
this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D);
}
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
{
this.prevRotationYaw += 360.0F;
}
if (!this.worldObj.isRemote && this.fireworkAge > this.lifetime) {
this.worldObj.setEntityState(this, (byte) 17);
this.rider.attackEntityFrom(new DamageSourceFireworkExplode("FireworkExplode"), 200F);
this.setDead();
}
}
this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
@SideOnly(Side.CLIENT)
public void handleHealthUpdate(byte par1) {
if (par1 == 17 && this.worldObj.isRemote) {
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
NBTTagCompound nbttagcompound = null;
if (this.fireworkAge == 0)
{
this.worldObj.playSoundAtEntity(this, "fireworks.launch", 3.0F, 1.0F);
}
if (itemstack != null && itemstack.hasTagCompound()) {
nbttagcompound = itemstack.getTagCompound().getCompoundTag("Fireworks");
}
++this.fireworkAge;
this.worldObj.func_92088_a(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound);
}
if (this.worldObj.isRemote && this.fireworkAge % 2 < 2)
{
this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D);
}
super.handleHealthUpdate(par1);
}
if (!this.worldObj.isRemote && this.fireworkAge > this.lifetime)
{
this.worldObj.setEntityState(this, (byte) 17);
this.rider.attackEntityFrom(new DamageSourceFireworkExplode("FireworkExplode"), 200F);
this.setDead();
}
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
par1NBTTagCompound.setInteger("Life", this.fireworkAge);
par1NBTTagCompound.setInteger("LifeTime", this.lifetime);
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
@SideOnly(Side.CLIENT)
public void handleHealthUpdate (byte par1)
{
if (par1 == 17 && this.worldObj.isRemote)
{
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
NBTTagCompound nbttagcompound = null;
if (itemstack != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
itemstack.writeToNBT(nbttagcompound1);
par1NBTTagCompound.setCompoundTag("FireworksItem", nbttagcompound1);
}
}
if (itemstack != null && itemstack.hasTagCompound())
{
nbttagcompound = itemstack.getTagCompound().getCompoundTag("Fireworks");
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
this.fireworkAge = par1NBTTagCompound.getInteger("Life");
this.lifetime = par1NBTTagCompound.getInteger("LifeTime");
NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("FireworksItem");
this.worldObj.func_92088_a(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound);
}
if (nbttagcompound1 != null) {
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound1);
super.handleHealthUpdate(par1);
}
if (itemstack != null) {
this.dataWatcher.updateObject(8, itemstack);
}
}
}
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
{
par1NBTTagCompound.setInteger("Life", this.fireworkAge);
par1NBTTagCompound.setInteger("LifeTime", this.lifetime);
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
@SideOnly(Side.CLIENT)
public float getShadowSize() {
return 0.0F;
}
if (itemstack != null)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
itemstack.writeToNBT(nbttagcompound1);
par1NBTTagCompound.setCompoundTag("FireworksItem", nbttagcompound1);
}
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float par1) {
return super.getBrightness(par1);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
{
this.fireworkAge = par1NBTTagCompound.getInteger("Life");
this.lifetime = par1NBTTagCompound.getInteger("LifeTime");
NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("FireworksItem");
@SideOnly(Side.CLIENT)
public int getBrightnessForRender(float par1) {
return super.getBrightnessForRender(par1);
}
if (nbttagcompound1 != null)
{
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound1);
/**
* If returns false, the item will not inflict any damage against entities.
*/
public boolean canAttackWithItem() {
return false;
}
if (itemstack != null)
{
this.dataWatcher.updateObject(8, itemstack);
}
}
}
@SideOnly(Side.CLIENT)
public float getShadowSize ()
{
return 0.0F;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness (float par1)
{
return super.getBrightness(par1);
}
@SideOnly(Side.CLIENT)
public int getBrightnessForRender (float par1)
{
return super.getBrightnessForRender(par1);
}
/**
* If returns false, the item will not inflict any damage against entities.
*/
public boolean canAttackWithItem ()
{
return false;
}
}
+17 -15
View File
@@ -30,10 +30,10 @@ public class ExplosivePrimed extends Entity
{
this(par1World);
this.setPosition(par2, par4, par6);
float f = (float)(Math.random() * Math.PI * 2.0D);
this.motionX = (double)(-((float)Math.sin((double)f)) * 0.02F);
float f = (float) (Math.random() * Math.PI * 2.0D);
this.motionX = (double) (-((float) Math.sin((double) f)) * 0.02F);
this.motionY = 0.20000000298023224D;
this.motionZ = (double)(-((float)Math.cos((double)f)) * 0.02F);
this.motionZ = (double) (-((float) Math.cos((double) f)) * 0.02F);
this.fuse = 80;
this.prevPosX = par2;
this.prevPosY = par4;
@@ -41,13 +41,15 @@ public class ExplosivePrimed extends Entity
this.tntPlacedBy = par8EntityLivingBase;
}
protected void entityInit() {}
protected void entityInit ()
{
}
/**
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
* prevent them from trampling crops
*/
protected boolean canTriggerWalking()
protected boolean canTriggerWalking ()
{
return false;
}
@@ -55,7 +57,7 @@ public class ExplosivePrimed extends Entity
/**
* Returns true if other Entities should be prevented from moving through this Entity.
*/
public boolean canBeCollidedWith()
public boolean canBeCollidedWith ()
{
return !this.isDead;
}
@@ -63,7 +65,7 @@ public class ExplosivePrimed extends Entity
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
public void onUpdate ()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
@@ -96,13 +98,13 @@ public class ExplosivePrimed extends Entity
}
}
private void explode()
private void explode ()
{
float f = 5.0F;
this.createExplosion(worldObj, this, this.posX, this.posY, this.posZ, f);
}
public void createExplosion(World world, Entity par1Entity, double par2, double par4, double par6, float par8)
public void createExplosion (World world, Entity par1Entity, double par2, double par4, double par6, float par8)
{
Explosion explosion = new MiningExplosion(world, par1Entity, par2, par4, par6, par8);
explosion.isFlaming = false;
@@ -115,21 +117,21 @@ public class ExplosivePrimed extends Entity
/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
protected void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
{
par1NBTTagCompound.setByte("Fuse", (byte)this.fuse);
par1NBTTagCompound.setByte("Fuse", (byte) this.fuse);
}
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
protected void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
{
this.fuse = par1NBTTagCompound.getByte("Fuse");
}
@SideOnly(Side.CLIENT)
public float getShadowSize()
public float getShadowSize ()
{
return 0.0F;
}
@@ -137,7 +139,7 @@ public class ExplosivePrimed extends Entity
/**
* returns null or the entityliving it was placed or ignited by
*/
public EntityLivingBase getTntPlacedBy()
public EntityLivingBase getTntPlacedBy ()
{
return this.tntPlacedBy;
}
@@ -120,27 +120,27 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
{
if (!worldObj.isRemote)
{
int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile);
int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile);
if (j == this.inTile && k == this.inData)
{
++this.ticksInGround;
if (this.ticksInGround == 120000)
if (j == this.inTile && k == this.inData)
{
this.setDead();
++this.ticksInGround;
if (this.ticksInGround == 120000)
{
this.setDead();
}
}
else
{
this.inGround = false;
this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
this.ticksInGround = 0;
this.ticksInAir = 0;
}
}
else
{
this.inGround = false;
this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
this.ticksInGround = 0;
this.ticksInAir = 0;
}
}
}
else
@@ -84,10 +84,10 @@ public class AdaptiveSmelteryContainer extends ActiveContainer
int rowPos = (int) (total * scrollPos);
return updateRows(rowPos);
}
public void updateProgressBar (int id, int value)
{
}
@Override
@@ -9,126 +9,163 @@ import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.AdvancedDrawbridgeLogic;
import tconstruct.client.gui.AdvDrawbridgeGui;
public class AdvancedDrawbridgeContainer extends Container {
public AdvancedDrawbridgeLogic logic;
public int progress = 0;
public int fuel = 0;
public int fuelGague = 0;
public class AdvancedDrawbridgeContainer extends Container
{
public AdvancedDrawbridgeLogic logic;
public int progress = 0;
public int fuel = 0;
public int fuelGague = 0;
private AdvDrawbridgeGui gui = null;
private AdvDrawbridgeGui gui = null;
public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic) {
this.logic = logic;
public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic)
{
this.logic = logic;
addContainerSlots(logic);
bindPlayerInventory(inventoryplayer);
updateContainerSlots();
}
addContainerSlots(logic);
bindPlayerInventory(inventoryplayer);
updateContainerSlots();
}
public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic, AdvDrawbridgeGui gui) {
this.logic = logic;
this.gui = gui;
public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic, AdvDrawbridgeGui gui)
{
this.logic = logic;
this.gui = gui;
addContainerSlots(logic);
bindPlayerInventory(inventoryplayer);
updateContainerSlots();
}
addContainerSlots(logic);
bindPlayerInventory(inventoryplayer);
updateContainerSlots();
}
public void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
for (int column = 0; column < 3; column++) {
for (int row = 0; row < 9; row++) {
this.addSlotToContainer(new Slot(inventoryPlayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
}
}
public void bindPlayerInventory (InventoryPlayer inventoryPlayer)
{
for (int column = 0; column < 3; column++)
{
for (int row = 0; row < 9; row++)
{
this.addSlotToContainer(new Slot(inventoryPlayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
}
}
for (int column = 0; column < 9; column++) {
this.addSlotToContainer(new Slot(inventoryPlayer, column, 8 + column * 18, 142));
}
}
for (int column = 0; column < 9; column++)
{
this.addSlotToContainer(new Slot(inventoryPlayer, column, 8 + column * 18, 142));
}
}
public void addContainerSlots(AdvancedDrawbridgeLogic logic) {
this.addSlotToContainer(new SlotOpaqueBlocksOnly(logic.camoInventory, 0, 35, 36));
public void addContainerSlots (AdvancedDrawbridgeLogic logic)
{
this.addSlotToContainer(new SlotOpaqueBlocksOnly(logic.camoInventory, 0, 35, 36));
for (int i = 0; i < logic.getSizeInventory(); i++) {
int ind = (int) (Math.floor(i / 8) * 8);
int x = i < 8 ? 10 + 20 * i : 10 + 20 * (i - 8);
int y = 35 + (int) Math.floor(i / 8) * 18 + (i < 8 ? 0 : 1);
this.addSlotToContainer(new DrawbridgeSlot(logic, i, x, y, logic));
}
}
for (int i = 0; i < logic.getSizeInventory(); i++)
{
int ind = (int) (Math.floor(i / 8) * 8);
int x = i < 8 ? 10 + 20 * i : 10 + 20 * (i - 8);
int y = 35 + (int) Math.floor(i / 8) * 18 + (i < 8 ? 0 : 1);
this.addSlotToContainer(new DrawbridgeSlot(logic, i, x, y, logic));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return logic.isUseableByPlayer(entityplayer);
}
@Override
public boolean canInteractWith (EntityPlayer entityplayer)
{
return logic.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
ItemStack stack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID);
@Override
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot slot = (Slot) this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack()) {
ItemStack slotStack = slot.getStack();
stack = slotStack.copy();
if (slot != null && slot.getHasStack())
{
ItemStack slotStack = slot.getStack();
stack = slotStack.copy();
if (slotID < logic.getSizeInventory()) {
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) {
return null;
}
} else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false)) {
return null;
}
if (slotID < logic.getSizeInventory())
{
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false))
{
return null;
}
if (slotStack.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
}
if (slotStack.stackSize == 0)
{
slot.putStack((ItemStack) null);
}
else
{
slot.onSlotChanged();
}
}
return stack;
}
return stack;
}
public void updateContainerSlots() {
if (gui == null) {
return;
} else if (gui.isGuiExpanded) {
Iterator<Slot> i1 = inventorySlots.iterator();
int index = 0;
while (i1.hasNext()) {
Slot sl = i1.next();
if (index == 0) {
sl.xDisplayPosition = -1000;
sl.yDisplayPosition = -1000;
} else if (sl instanceof DrawbridgeSlot) {
sl.xDisplayPosition = (index - 1) < 8 ? 10 + 20 * (index - 1) : 10 + 20 * ((index - 1) - 8);
sl.yDisplayPosition = 35 + (int) Math.floor((index - 1) / 8) * 18 + ((index - 1) < 8 ? 0 : 1);
}
index++;
}
} else {
Iterator<Slot> i1 = inventorySlots.iterator();
int index = 0;
while (i1.hasNext()) {
Slot sl = i1.next();
if (index == 0) {
sl.xDisplayPosition = 35;
sl.yDisplayPosition = 36;
} else if (sl instanceof DrawbridgeSlot) {
sl.xDisplayPosition = -1000;
sl.yDisplayPosition = -1000;
}
index++;
}
}
}
@Override
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer){
if(gui != null && gui.containerNeglectMouse){
return null;
}else{
return super.slotClick(par1, par2, par3, par4EntityPlayer);
}
}
public void updateContainerSlots ()
{
if (gui == null)
{
return;
}
else if (gui.isGuiExpanded)
{
Iterator<Slot> i1 = inventorySlots.iterator();
int index = 0;
while (i1.hasNext())
{
Slot sl = i1.next();
if (index == 0)
{
sl.xDisplayPosition = -1000;
sl.yDisplayPosition = -1000;
}
else if (sl instanceof DrawbridgeSlot)
{
sl.xDisplayPosition = (index - 1) < 8 ? 10 + 20 * (index - 1) : 10 + 20 * ((index - 1) - 8);
sl.yDisplayPosition = 35 + (int) Math.floor((index - 1) / 8) * 18 + ((index - 1) < 8 ? 0 : 1);
}
index++;
}
}
else
{
Iterator<Slot> i1 = inventorySlots.iterator();
int index = 0;
while (i1.hasNext())
{
Slot sl = i1.next();
if (index == 0)
{
sl.xDisplayPosition = 35;
sl.yDisplayPosition = 36;
}
else if (sl instanceof DrawbridgeSlot)
{
sl.xDisplayPosition = -1000;
sl.yDisplayPosition = -1000;
}
index++;
}
}
}
@Override
public ItemStack slotClick (int par1, int par2, int par3, EntityPlayer par4EntityPlayer)
{
if (gui != null && gui.containerNeglectMouse)
{
return null;
}
else
{
return super.slotClick(par1, par2, par3, par4EntityPlayer);
}
}
}
@@ -42,7 +42,7 @@ public class FurnaceContainer extends Container
}
}
public void addCraftingToCrafters(ICrafting par1ICrafting)
public void addCraftingToCrafters (ICrafting par1ICrafting)
{
super.addCraftingToCrafters(par1ICrafting);
par1ICrafting.sendProgressBarUpdate(this, 0, this.furnace.progress);
@@ -53,13 +53,13 @@ public class FurnaceContainer extends Container
/**
* Looks for changes made in the container, sends them to every listener.
*/
public void detectAndSendChanges()
public void detectAndSendChanges ()
{
super.detectAndSendChanges();
for (int i = 0; i < this.crafters.size(); ++i)
{
ICrafting icrafting = (ICrafting)this.crafters.get(i);
ICrafting icrafting = (ICrafting) this.crafters.get(i);
if (this.lastCookTime != this.furnace.progress)
{
@@ -83,7 +83,7 @@ public class FurnaceContainer extends Container
}
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2)
public void updateProgressBar (int par1, int par2)
{
if (par1 == 0)
{
@@ -101,7 +101,7 @@ public class FurnaceContainer extends Container
}
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
public boolean canInteractWith (EntityPlayer par1EntityPlayer)
{
return this.furnace.isUseableByPlayer(par1EntityPlayer);
}
@@ -109,10 +109,10 @@ public class FurnaceContainer extends Container
/**
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
*/
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
public ItemStack transferStackInSlot (EntityPlayer par1EntityPlayer, int par2)
{
ItemStack itemstack = null;
Slot slot = (Slot)this.inventorySlots.get(par2);
Slot slot = (Slot) this.inventorySlots.get(par2);
if (slot != null && slot.getHasStack())
{
@@ -163,7 +163,7 @@ public class FurnaceContainer extends Container
if (itemstack1.stackSize == 0)
{
slot.putStack((ItemStack)null);
slot.putStack((ItemStack) null);
}
else
{
+23 -16
View File
@@ -11,40 +11,47 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
public class ArmorPattern extends CraftingItem implements ItemBlocklike{
public class ArmorPattern extends CraftingItem implements ItemBlocklike
{
private Icon baseIcon;
public ArmorPattern(int id, String partType, String patternType, String folder) {
super(id, patternName, getPatternNames(patternType), folder);
private Icon baseIcon;
public ArmorPattern(int id, String partType, String patternType, String folder)
{
super(id, patternName, getPatternNames(patternType), folder);
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setContainerItem(this);
this.setMaxStackSize(1);
}
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++)
names[i] = partType + patternName[i];
return names;
}
public Icon getBaseIcon(){
return baseIcon;
public Icon getBaseIcon ()
{
return baseIcon;
}
@SideOnly(Side.CLIENT)
@Override
public void registerIcons (IconRegister iconRegister){
public void registerIcons (IconRegister iconRegister)
{
super.registerIcons(iconRegister);
baseIcon = iconRegister.registerIcon("tinker:" + folder + "armor_cast");
}
private static final String[] patternName = new String[] { "helmet", "chestplate", "leggings", "boots" };
public void getSubItems (int id, CreativeTabs tab, List list){
for (int i = 0; i < patternName.length; i++){
public void getSubItems (int id, CreativeTabs tab, List list)
{
for (int i = 0; i < patternName.length; i++)
{
list.add(new ItemStack(id, 1, i));
}
}
+1 -2
View File
@@ -23,7 +23,7 @@ public class Jerky extends SpecialFood
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IconRegister iconRegister)
public void registerIcons (IconRegister iconRegister)
{
this.icons = new Icon[iconNames.length];
@@ -33,7 +33,6 @@ public class Jerky extends SpecialFood
}
}
public String getUnlocalizedName (ItemStack stack)
{
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
-2
View File
@@ -19,7 +19,6 @@ public class LengthWire extends Item
public String folder = "logic/";
public Icon[] icons;
public LengthWire(int id)
{
super(id);
@@ -28,7 +27,6 @@ public class LengthWire extends Item
this.setHasSubtypes(false);
}
@SideOnly(Side.CLIENT)
public Icon getIconFromDamage (int meta)
{
+2 -2
View File
@@ -56,7 +56,7 @@ public class SpoolOfWire extends Item
{
return "item." + unlocalizedName;
}
@Override
public boolean onItemUse (ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
{
@@ -87,7 +87,7 @@ public class SpoolOfWire extends Item
int calc = Math.abs(targetX - x) + Math.abs(targetY - y) + Math.abs(targetZ - z);
if ((itemstack.getMaxDamage() - itemstack.getItemDamage()) < calc)
{
{
return false;
}
if (targetDim == world.provider.dimensionId && calc < 16)
+20 -15
View File
@@ -4,22 +4,27 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.item.*;
public class ArmorBasic extends ItemArmor {
public class ArmorBasic extends ItemArmor
{
public String textureName;
public ArmorBasic(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, String textureName) {
super(par1, par2EnumArmorMaterial, 0, par3);
this.textureName = textureName;
}
@Override
public void registerIcons(IconRegister par1IconRegister){
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_" + (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet"));
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer){
public String textureName;
public ArmorBasic(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, String textureName)
{
super(par1, par2EnumArmorMaterial, 0, par3);
this.textureName = textureName;
}
@Override
public void registerIcons (IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_"
+ (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet"));
}
@Override
public String getArmorTexture (ItemStack stack, Entity entity, int slot, int layer)
{
return "tinker:textures/armor/" + textureName + "_" + layer + ".png";
}
+16 -12
View File
@@ -6,20 +6,24 @@ import net.minecraft.item.ItemStack;
import net.minecraft.client.renderer.texture.IconRegister;
import tconstruct.library.armor.*;
public class ArmorStandard extends ArmorCore{
public class ArmorStandard extends ArmorCore
{
public ArmorStandard(int par1, int baseProtection, EnumArmorPart armorPart) {
super(par1, baseProtection, armorPart);
}
public ArmorStandard(int par1, int baseProtection, EnumArmorPart armorPart)
{
super(par1, baseProtection, armorPart);
}
@Override
public void registerIcons(IconRegister par1IconRegister){
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/wood_helmet");
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer){
@Override
public void registerIcons (IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/wood_helmet");
}
@Override
public String getArmorTexture (ItemStack stack, Entity entity, int slot, int layer)
{
return "tinker:textures/armor/wood_" + layer + ".png";
}
}
@@ -38,7 +38,6 @@ public class SignalBusItem extends ItemBlock
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
return (new StringBuilder()).append("tile.").append(blockType[pos]).toString();
}
@Override
@SideOnly(Side.CLIENT)
@@ -93,7 +92,7 @@ public class SignalBusItem extends ItemBlock
tside = side;
break;
}
NBTTagCompound data = new NBTTagCompound();
stack.stackTagCompound = data;
data.setInteger("connectedSide", tside);
@@ -112,13 +111,13 @@ public class SignalBusItem extends ItemBlock
TileEntity te = world.getBlockTileEntity(tmpX, tmpY, tmpZ);
((SignalBusLogic) te).addPlacedSide(tside);
stack.stackTagCompound = null;
--stack.stackSize;
world.markBlockForRenderUpdate(x, y, z);
return true;
}
@@ -178,7 +177,7 @@ public class SignalBusItem extends ItemBlock
return false;
}
return ((SignalBusLogic)te).canPlaceOnSide(ForgeDirection.OPPOSITES[side]);
return ((SignalBusLogic) te).canPlaceOnSide(ForgeDirection.OPPOSITES[side]);
}
return false;
@@ -119,13 +119,13 @@ public class SignalTerminalItem extends ItemBlock
((SignalTerminalLogic) te).addPendingSide(tside);
((SignalTerminalLogic) te).connectPending();
stack.stackTagCompound = null;
--stack.stackSize;
world.markBlockForRenderUpdate(x, y, z);
return true;
}
@@ -12,6 +12,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class TerraformerItem extends ItemBlock
{
static String blockType[] = { "freezer", "fumer", "waver", "leecher", "grower", "nether", "lighter", "crystal" };
//static String[] textureNames = { "crystal_machine_top", "terrafreezer", "terrafumer", "terrawaver", "terraleecher", "terragrower", "terranether", "terralighter", "terracrystal" };
public TerraformerItem(int id)
+18 -15
View File
@@ -300,19 +300,22 @@ public class Battleaxe extends HarvestTool
world.playAuxSFX(2001, x, y, z, woodID + (meta << 12));
return super.onBlockStartBreak(stack, x, y, z, player);
}
@Override
public boolean willAllowOffhandWeapon() {
return false;
}
@Override
public boolean willAllowShield() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean willAllowShield ()
{
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
}
+15 -12
View File
@@ -226,18 +226,21 @@ public class Chisel extends ToolCore
return new String[] { "utility" };
}
@Override
public boolean willAllowOffhandWeapon() {
return false;
}
@Override
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean willAllowShield() {
return false;
}
@Override
public boolean willAllowShield ()
{
return false;
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
}
+20 -16
View File
@@ -162,24 +162,28 @@ public class Cleaver extends Weapon
entity.swingProgressInt /= 2;
return false;
}*/
@Override
public boolean willAllowOffhandWeapon() {
return false;
}
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean willAllowShield() {
return PHConstruct.isCleaverTwoHanded;
}
@Override
public boolean willAllowShield ()
{
return PHConstruct.isCleaverTwoHanded;
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
@Override
public boolean sheatheOnBack() {
return true;
}
@Override
public boolean sheatheOnBack ()
{
return true;
}
}
+20 -16
View File
@@ -293,24 +293,28 @@ public class Excavator extends HarvestTool
}
return super.getStrVsBlock(stack, block, meta);
}
@Override
public boolean willAllowOffhandWeapon() {
return false;
}
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean willAllowShield() {
return false;
}
@Override
public boolean willAllowShield ()
{
return false;
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
@Override
public boolean sheatheOnBack() {
return true;
}
@Override
public boolean sheatheOnBack ()
{
return true;
}
}
+15 -12
View File
@@ -397,19 +397,22 @@ public class Hammer extends HarvestTool
{
return new String[] { "weapon", "harvest", "melee", "bludgeoning" };
}
@Override
public boolean willAllowOffhandWeapon() {
return false;
}
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
@Override
public boolean sheatheOnBack() {
return true;
}
@Override
public boolean sheatheOnBack ()
{
return true;
}
}
+6 -5
View File
@@ -105,9 +105,10 @@ public class Hatchet extends HarvestTool
{
return "axe";
}
@Override
public boolean isOffhandHandDualWeapon() {
return PHConstruct.isHatchetWeapon;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return PHConstruct.isHatchetWeapon;
}
}
+20 -16
View File
@@ -400,24 +400,28 @@ public class LumberAxe extends HarvestTool
{
return 1;
}
@Override
public boolean willAllowOffhandWeapon() {
return false;
}
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean willAllowShield() {
return false;
}
@Override
public boolean willAllowShield ()
{
return false;
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
@Override
public boolean sheatheOnBack() {
return true;
}
@Override
public boolean sheatheOnBack ()
{
return true;
}
}
+6 -5
View File
@@ -68,9 +68,10 @@ public class Pickaxe extends HarvestTool
{
return "pickaxe";
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
}
+19 -15
View File
@@ -219,22 +219,26 @@ public class Scythe extends Weapon
}
@Override
public boolean willAllowOffhandWeapon() {
return false;
}
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean willAllowShield() {
return false;
}
@Override
public boolean willAllowShield ()
{
return false;
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
@Override
public boolean sheatheOnBack() {
return true;
}
@Override
public boolean sheatheOnBack ()
{
return true;
}
}
+20 -16
View File
@@ -190,24 +190,28 @@ public class Shortbow extends BowBase
}
//return TConstructRegistry.getMaterial(type).ability();
}
@Override
public boolean willAllowOffhandWeapon() {
return false;
}
public boolean willAllowOffhandWeapon ()
{
return false;
}
@Override
public boolean willAllowShield() {
return false;
}
@Override
public boolean willAllowShield ()
{
return false;
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
@Override
public boolean sheatheOnBack() {
return true;
}
@Override
public boolean sheatheOnBack ()
{
return true;
}
}
+6 -5
View File
@@ -89,11 +89,12 @@ public class Shovel extends HarvestTool
{
return "shovel";
}
@Override
public boolean isOffhandHandDualWeapon() {
return false;
}
@Override
public boolean isOffhandHandDualWeapon ()
{
return false;
}
/*@Override
public Icon getIcon (ItemStack stack, int renderPass)
+3 -1
View File
@@ -1,3 +1,5 @@
package tconstruct.library;
public interface ItemBlocklike {}
public interface ItemBlocklike
{
}
+261 -209
View File
@@ -15,269 +15,321 @@ import net.minecraftforge.common.ISpecialArmor;
* NBTTags
* Main tag - InfiArmor
*/
public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem, IBoxable, ISpecialArmor {
public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem, IBoxable, ISpecialArmor
{
public static final String SET_NAME = "InfiArmor";
public final EnumArmorPart armorPart;
private static final IBehaviorDispenseItem dispenserBehavior = new BehaviorDispenseArmorCopy();
public final int baseProtection;
public static final String SET_NAME = "InfiArmor";
public final EnumArmorPart armorPart;
private static final IBehaviorDispenseItem dispenserBehavior = new BehaviorDispenseArmorCopy();
public final int baseProtection;
public ArmorCore(int par1, int baseProtection, EnumArmorPart part) {
super(par1, EnumArmorMaterial.CHAIN, 0, 0);
this.maxStackSize = 1;
this.setMaxDamage(100);
this.setUnlocalizedName(SET_NAME);
this.armorPart = part;
this.baseProtection = baseProtection;
BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior);
}
public ArmorCore(int par1, int baseProtection, EnumArmorPart part)
{
super(par1, EnumArmorMaterial.CHAIN, 0, 0);
this.maxStackSize = 1;
this.setMaxDamage(100);
this.setUnlocalizedName(SET_NAME);
this.armorPart = part;
this.baseProtection = baseProtection;
BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior);
}
public String getArmorName() {
return this.getClass().getSimpleName();
}
public String getArmorName ()
{
return this.getClass().getSimpleName();
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
int i = EntityLiving.getArmorPosition(par1ItemStack) - 1;
ItemStack itemstack1 = par3EntityPlayer.getCurrentArmor(i);
public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
int i = EntityLiving.getArmorPosition(par1ItemStack) - 1;
ItemStack itemstack1 = par3EntityPlayer.getCurrentArmor(i);
if (itemstack1 == null) {
par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.
par1ItemStack.stackSize = 0;
}
if (itemstack1 == null)
{
par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.
par1ItemStack.stackSize = 0;
}
return par1ItemStack;
}
return par1ItemStack;
}
//ISpecialArmor overrides
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
NBTTagCompound tags = armor.getTagCompound();
//ISpecialArmor overrides
@Override
public ArmorProperties getProperties (EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot)
{
NBTTagCompound tags = armor.getTagCompound();
if (tags == null) {
return new ArmorProperties(0, damage / baseProtection, baseProtection);
}
if (tags == null)
{
return new ArmorProperties(0, damage / baseProtection, baseProtection);
}
NBTTagCompound data = tags.getCompoundTag(SET_NAME);
NBTTagCompound data = tags.getCompoundTag(SET_NAME);
return new ArmorProperties(0, data.getInteger("damageReduction") / damage, data.getInteger("maxAbsorb"));
}
return new ArmorProperties(0, data.getInteger("damageReduction") / damage, data.getInteger("maxAbsorb"));
}
@Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
return armor.getTagCompound() != null && armor.getTagCompound().getCompoundTag(SET_NAME) != null ? armor.getTagCompound().getCompoundTag(SET_NAME).getInteger("maxAbsorb") : this.baseProtection;
}
@Override
public int getArmorDisplay (EntityPlayer player, ItemStack armor, int slot)
{
return armor.getTagCompound() != null && armor.getTagCompound().getCompoundTag(SET_NAME) != null ? armor.getTagCompound().getCompoundTag(SET_NAME).getInteger("maxAbsorb")
: this.baseProtection;
}
@Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
NBTTagCompound tags = stack.getTagCompound();
NBTTagCompound data;
@Override
public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot)
{
NBTTagCompound tags = stack.getTagCompound();
NBTTagCompound data;
if (tags == null) {
tags = new NBTTagCompound();
stack.setTagCompound(tags);
data = new NBTTagCompound();
tags.setCompoundTag(SET_NAME, data);
data.setInteger("damageReduction", baseProtection);
data.setInteger("maxAbsorb", baseProtection);
}
if (tags == null)
{
tags = new NBTTagCompound();
stack.setTagCompound(tags);
data = new NBTTagCompound();
tags.setCompoundTag(SET_NAME, data);
data.setInteger("damageReduction", baseProtection);
data.setInteger("maxAbsorb", baseProtection);
}
data = tags.getCompoundTag(SET_NAME);
data = tags.getCompoundTag(SET_NAME);
if (tags.hasKey("charge")) {
int charge = tags.getInteger("charge");
if (charge > damage) {
charge -= damage;
tags.setInteger("charge", charge);
return;
} else {
damage -= charge;
tags.setInteger("charge", 0);
int dmg = data.getInteger("Damage");
dmg += damage;
data.setInteger("Damage", dmg);
}
if (tags.hasKey("charge"))
{
int charge = tags.getInteger("charge");
if (charge > damage)
{
charge -= damage;
tags.setInteger("charge", charge);
return;
}
else
{
damage -= charge;
tags.setInteger("charge", 0);
int dmg = data.getInteger("Damage");
dmg += damage;
data.setInteger("Damage", dmg);
}
} else {
int dmg = data.getInteger("Damage");
dmg += damage;
data.setInteger("Damage", dmg);
}
}
}
else
{
int dmg = data.getInteger("Damage");
dmg += damage;
data.setInteger("Damage", dmg);
}
}
/*
* IC2 API support
*/
/*
* IC2 API support
*/
@Override
public boolean canBeStoredInToolbox(ItemStack stack) {
return true;
}
@Override
public boolean canBeStoredInToolbox (ItemStack stack)
{
return true;
}
@Override
public boolean canProvideEnergy(ItemStack stack) {
NBTTagCompound tags = stack.getTagCompound();
@Override
public boolean canProvideEnergy (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
return tags.hasKey("charge");
}
return tags.hasKey("charge");
}
@Override
public int getChargedItemId(ItemStack stack) {
return this.itemID;
}
@Override
public int getChargedItemId (ItemStack stack)
{
return this.itemID;
}
@Override
public int getEmptyItemId(ItemStack stack) {
return this.itemID;
}
@Override
public int getEmptyItemId (ItemStack stack)
{
return this.itemID;
}
@Override
public int getMaxCharge(ItemStack stack) {
NBTTagCompound tags = stack.getTagCompound();
return tags.hasKey("charge") ? 10000 : 0;
}
@Override
public int getMaxCharge (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
return tags.hasKey("charge") ? 10000 : 0;
}
@Override
public int getTier(ItemStack stack) {
return 0;
}
@Override
public int getTier (ItemStack stack)
{
return 0;
}
@Override
public int getTransferLimit(ItemStack stack) {
NBTTagCompound tags = stack.getTagCompound();
@Override
public int getTransferLimit (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
return tags.hasKey("charge") ? 32 : 0;
}
return tags.hasKey("charge") ? 32 : 0;
}
@Override
public int charge(ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) {
NBTTagCompound tags = stack.getTagCompound();
if (!tags.hasKey("charge")) {
return 0;
}
@Override
public int charge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
NBTTagCompound tags = stack.getTagCompound();
if (!tags.hasKey("charge"))
{
return 0;
}
if (amount > 0) {
if (amount > getTransferLimit(stack) && !ignoreTransferLimit) {
amount = getTransferLimit(stack);
}
if (amount > 0)
{
if (amount > getTransferLimit(stack) && !ignoreTransferLimit)
{
amount = getTransferLimit(stack);
}
int charge = tags.getInteger("charge");
int charge = tags.getInteger("charge");
if (amount > getMaxCharge(stack)) {
amount = getMaxCharge(stack);
}
if (amount > getMaxCharge(stack))
{
amount = getMaxCharge(stack);
}
charge += amount;
charge += amount;
if (!simulate) {
tags.setInteger("charge", charge);
stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / getMaxCharge(stack));
}
return amount;
}
if (!simulate)
{
tags.setInteger("charge", charge);
stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / getMaxCharge(stack));
}
return amount;
}
else
return 0;
}
else
return 0;
}
@Override
public int discharge(ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) {
NBTTagCompound tags = stack.getTagCompound();
if (!tags.hasKey("charge")) {
return 0;
}
@Override
public int discharge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
NBTTagCompound tags = stack.getTagCompound();
if (!tags.hasKey("charge"))
{
return 0;
}
if (amount > 0) {
if (amount > getTransferLimit(stack)) {
amount = getTransferLimit(stack);
}
if (amount > 0)
{
if (amount > getTransferLimit(stack))
{
amount = getTransferLimit(stack);
}
int charge = tags.getInteger("charge");
int charge = tags.getInteger("charge");
if (amount > charge) {
amount = charge;
}
if (amount > charge)
{
amount = charge;
}
charge -= amount;
charge -= amount;
if (!simulate) {
tags.setInteger("charge", charge);
stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / getMaxCharge(stack));
}
if (!simulate)
{
tags.setInteger("charge", charge);
stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / getMaxCharge(stack));
}
return charge;
}
return charge;
}
else
return 0;
}
else
return 0;
}
@Override
public boolean canUse(ItemStack stack, int amount) {
return false;
}
@Override
public boolean canUse (ItemStack stack, int amount)
{
return false;
}
@Override
public boolean canShowChargeToolTip(ItemStack stack) {
return false;
}
@Override
public boolean canShowChargeToolTip (ItemStack stack)
{
return false;
}
// Vanilla overrides
public boolean isItemTool(ItemStack par1ItemStack) {
return false;
}
// Vanilla overrides
public boolean isItemTool (ItemStack par1ItemStack)
{
return false;
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
return false;
}
@Override
public boolean getIsRepairable (ItemStack par1ItemStack, ItemStack par2ItemStack)
{
return false;
}
public boolean isRepairable() {
return false;
}
public boolean isRepairable ()
{
return false;
}
public int getItemEnchantability() {
return 0;
}
public int getItemEnchantability ()
{
return 0;
}
public boolean isFull3D() {
return true;
}
public boolean isFull3D ()
{
return true;
}
public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) {
return this.armorPart.getPartId() == armorType;
}
public boolean isValidArmor (ItemStack stack, int armorType, Entity entity)
{
return this.armorPart.getPartId() == armorType;
}
/* Proper stack damage */
public int getItemMaxDamageFromStack(ItemStack stack) {
NBTTagCompound tags = stack.getTagCompound();
if (tags == null) {
return 0;
}
/* Proper stack damage */
public int getItemMaxDamageFromStack (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (tags == null)
{
return 0;
}
if (tags.hasKey("charge")) {
int charge = tags.getInteger("charge");
if (charge > 0) {
return this.getMaxCharge(stack);
}
}
if (tags.hasKey("charge"))
{
int charge = tags.getInteger("charge");
if (charge > 0)
{
return this.getMaxCharge(stack);
}
}
return tags.getCompoundTag(SET_NAME).getInteger("TotalDurability");
}
return tags.getCompoundTag(SET_NAME).getInteger("TotalDurability");
}
public int getItemMaxDamageFromStackForDisplay(ItemStack stack) {
NBTTagCompound tags = stack.getTagCompound();
if (tags == null) {
return 0;
}
public int getItemMaxDamageFromStackForDisplay (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (tags == null)
{
return 0;
}
if (tags.hasKey("charge")) {
int charge = tags.getInteger("charge");
if (charge > 0) {
return this.getMaxCharge(stack) - charge;
}
}
if (tags.hasKey("charge"))
{
int charge = tags.getInteger("charge");
if (charge > 0)
{
return this.getMaxCharge(stack) - charge;
}
}
return tags.getCompoundTag(SET_NAME).getInteger("Damage");
}
return tags.getCompoundTag(SET_NAME).getInteger("Damage");
}
}
@@ -18,27 +18,27 @@ final class BehaviorDispenseArmorCopy extends BehaviorDefaultDispenseItem
/**
* Dispense the specified stack, play the dispense sound and spawn particles.
*/
protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
protected ItemStack dispenseStack (IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1));
AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1));
List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new EntitySelectorArmoredMob(par2ItemStack));
if (list.size() > 0)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
EntityLivingBase entitylivingbase = (EntityLivingBase) list.get(0);
int l = entitylivingbase instanceof EntityPlayer ? 1 : 0;
int i1 = EntityLiving.getArmorPosition(par2ItemStack);
ItemStack itemstack1 = par2ItemStack.copy();
itemstack1.stackSize = 1;
entitylivingbase.setCurrentItemOrArmor(i1, itemstack1); //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.
entitylivingbase.setCurrentItemOrArmor(i1, itemstack1); //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.
if (entitylivingbase instanceof EntityLiving)
{
((EntityLiving)entitylivingbase).setEquipmentDropChance(i1, 2.0F);
((EntityLiving) entitylivingbase).setEquipmentDropChance(i1, 2.0F);
}
--par2ItemStack.stackSize;
@@ -1,16 +1,19 @@
package tconstruct.library.armor;
public enum EnumArmorPart {
public enum EnumArmorPart
{
HELMET(0), CHESTPLATE(1), LEGGINGS(2), BOOTS(3);
HELMET(0), CHESTPLATE(1), LEGGINGS(2), BOOTS(3);
private final int partID;
private final int partID;
private EnumArmorPart(int partID) {
this.partID = partID;
}
private EnumArmorPart(int partID)
{
this.partID = partID;
}
public int getPartId() {
return this.partID;
}
public int getPartId ()
{
return this.partID;
}
}
@@ -7,168 +7,211 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.world.World;
public abstract class ExpandableInventoryLogic extends InventoryLogic implements IInventory {
public abstract class ExpandableInventoryLogic extends InventoryLogic implements IInventory
{
public ExpandableInventoryLogic() {
super(0);
}
public ExpandableInventoryLogic()
{
super(0);
}
protected ArrayList<ItemStack> inventory = new ArrayList<ItemStack>();
protected String invName;
protected ArrayList<ItemStack> inventory = new ArrayList<ItemStack>();
protected String invName;
@Override
public ItemStack getStackInSlot(int slot) {
return slot < inventory.size() ? inventory.get(slot) : null;
}
@Override
public ItemStack getStackInSlot (int slot)
{
return slot < inventory.size() ? inventory.get(slot) : null;
}
public boolean isStackInSlot(int slot) {
return slot < inventory.size() && inventory.get(slot) != null;
}
public boolean isStackInSlot (int slot)
{
return slot < inventory.size() && inventory.get(slot) != null;
}
@Override
public int getSizeInventory() {
return inventory.size();
}
@Override
public int getSizeInventory ()
{
return inventory.size();
}
public int getMaxSize() {
return 64;
}
public int getMaxSize ()
{
return 64;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public int getInventoryStackLimit ()
{
return 64;
}
public boolean canDropInventorySlot(int slot) {
return true;
}
public boolean canDropInventorySlot (int slot)
{
return true;
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemstack) {
if (slot < inventory.size()) {
inventory.set(slot, itemstack);
} else if (slot == inventory.size()) {
inventory.add(itemstack);
} else if (slot < getMaxSize()) {
inventory.ensureCapacity(slot);
inventory.set(slot, itemstack);
} else {
return;
}
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
itemstack.stackSize = getInventoryStackLimit();
}
}
@Override
public void setInventorySlotContents (int slot, ItemStack itemstack)
{
if (slot < inventory.size())
{
inventory.set(slot, itemstack);
}
else if (slot == inventory.size())
{
inventory.add(itemstack);
}
else if (slot < getMaxSize())
{
inventory.ensureCapacity(slot);
inventory.set(slot, itemstack);
}
else
{
return;
}
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
{
itemstack.stackSize = getInventoryStackLimit();
}
}
@Override
public ItemStack decrStackSize(int slot, int quantity) {
if (slot < inventory.size() && inventory.get(slot) != null) {
if (inventory.get(slot).stackSize <= quantity) {
ItemStack stack = inventory.get(slot);
inventory.set(slot, null);
return stack;
}
ItemStack split = inventory.get(slot).splitStack(quantity);
if (inventory.get(slot).stackSize == 0) {
inventory.set(slot, null);
}
return split;
} else {
return null;
}
}
@Override
public ItemStack decrStackSize (int slot, int quantity)
{
if (slot < inventory.size() && inventory.get(slot) != null)
{
if (inventory.get(slot).stackSize <= quantity)
{
ItemStack stack = inventory.get(slot);
inventory.set(slot, null);
return stack;
}
ItemStack split = inventory.get(slot).splitStack(quantity);
if (inventory.get(slot).stackSize == 0)
{
inventory.set(slot, null);
}
return split;
}
else
{
return null;
}
}
/* Supporting methods */
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
return false;
/* Supporting methods */
@Override
public boolean isUseableByPlayer (EntityPlayer entityplayer)
{
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
return false;
else
return entityplayer.getDistance((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D;
else
return entityplayer.getDistance((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D;
}
}
public abstract Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z);
public abstract Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z);
/* NBT */
@Override
public void readFromNBT(NBTTagCompound tags) {
super.readFromNBT(tags);
this.invName = tags.getString("InvName");
NBTTagList nbttaglist = tags.getTagList("Items");
inventory = new ArrayList<ItemStack>();
inventory.ensureCapacity(nbttaglist.tagCount() > getMaxSize() ? getMaxSize() : nbttaglist.tagCount());
for (int iter = 0; iter < nbttaglist.tagCount(); iter++) {
NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter);
byte slotID = tagList.getByte("Slot");
if (slotID >= 0 && slotID < inventory.size()) {
inventory.set(slotID, ItemStack.loadItemStackFromNBT(tagList));
}
}
}
/* NBT */
@Override
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
this.invName = tags.getString("InvName");
NBTTagList nbttaglist = tags.getTagList("Items");
inventory = new ArrayList<ItemStack>();
inventory.ensureCapacity(nbttaglist.tagCount() > getMaxSize() ? getMaxSize() : nbttaglist.tagCount());
for (int iter = 0; iter < nbttaglist.tagCount(); iter++)
{
NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter);
byte slotID = tagList.getByte("Slot");
if (slotID >= 0 && slotID < inventory.size())
{
inventory.set(slotID, ItemStack.loadItemStackFromNBT(tagList));
}
}
}
@Override
public void writeToNBT(NBTTagCompound tags) {
super.writeToNBT(tags);
if (invName != null)
tags.setString("InvName", invName);
NBTTagList nbttaglist = new NBTTagList();
for (int iter = 0; iter < inventory.size(); iter++) {
if (inventory.get(iter) != null) {
NBTTagCompound tagList = new NBTTagCompound();
tagList.setByte("Slot", (byte) iter);
inventory.get(iter).writeToNBT(tagList);
nbttaglist.appendTag(tagList);
}
}
@Override
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
if (invName != null)
tags.setString("InvName", invName);
NBTTagList nbttaglist = new NBTTagList();
for (int iter = 0; iter < inventory.size(); iter++)
{
if (inventory.get(iter) != null)
{
NBTTagCompound tagList = new NBTTagCompound();
tagList.setByte("Slot", (byte) iter);
inventory.get(iter).writeToNBT(tagList);
nbttaglist.appendTag(tagList);
}
}
tags.setTag("Items", nbttaglist);
}
tags.setTag("Items", nbttaglist);
}
/* Default implementations of hardly used methods */
public ItemStack getStackInSlotOnClosing(int slot) {
return null;
}
/* Default implementations of hardly used methods */
public ItemStack getStackInSlotOnClosing (int slot)
{
return null;
}
public void openChest() {
}
public void openChest ()
{
}
public void closeChest() {
}
public void closeChest ()
{
}
protected abstract String getDefaultName();
protected abstract String getDefaultName ();
public void setInvName(String name) {
this.invName = name;
}
public void setInvName (String name)
{
this.invName = name;
}
public String getInvName() {
return this.isInvNameLocalized() ? this.invName : getDefaultName();
}
public String getInvName ()
{
return this.isInvNameLocalized() ? this.invName : getDefaultName();
}
public boolean isInvNameLocalized() {
return this.invName != null && this.invName.length() > 0;
}
public boolean isInvNameLocalized ()
{
return this.invName != null && this.invName.length() > 0;
}
public void cleanInventory(){
Iterator<ItemStack> i1 = inventory.iterator();
while(i1.hasNext()){
if(i1.next() == null){
i1.remove();
}
}
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
if (slot < getSizeInventory()) {
if (inventory.get(slot) == null || itemstack.stackSize + inventory.get(slot).stackSize <= getInventoryStackLimit())
return true;
}else{
return slot < getMaxSize();
}
return false;
}
public void cleanInventory ()
{
Iterator<ItemStack> i1 = inventory.iterator();
while (i1.hasNext())
{
if (i1.next() == null)
{
i1.remove();
}
}
}
@Override
public boolean isItemValidForSlot (int slot, ItemStack itemstack)
{
if (slot < getSizeInventory())
{
if (inventory.get(slot) == null || itemstack.stackSize + inventory.get(slot).stackSize <= getInventoryStackLimit())
return true;
}
else
{
return slot < getMaxSize();
}
return false;
}
}
@@ -1,7 +1,8 @@
package tconstruct.library.blocks;
public interface IDrawbridgeLogicBase{
public interface IDrawbridgeLogicBase
{
public boolean hasExtended ();
public boolean hasExtended();
}
@@ -111,7 +111,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory
super.readFromNBT(tags);
readInventoryFromNBT(tags);
}
public void readInventoryFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
@@ -135,7 +135,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory
super.writeToNBT(tags);
writeInventoryToNBT(tags);
}
public void writeInventoryToNBT (NBTTagCompound tags)
{
if (invName != null)
@@ -154,7 +154,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory
tags.setTag("Items", nbttaglist);
}
/* Cause of the heisenbug. Do not uncomment! */
/*public void superReadFromNBT (NBTTagCompound tags)
{
@@ -165,7 +165,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory
{
super.writeToNBT(tags);
}*/
/* Default implementations of hardly used methods */
public ItemStack getStackInSlotOnClosing (int slot)
{
@@ -207,14 +207,14 @@ public abstract class InventoryLogic extends TileEntity implements IInventory
}
return false;
}
public void placeBlock (EntityLivingBase entity, ItemStack stack)
{
}
public void removeBlock()
public void removeBlock ()
{
}
}
@@ -1,54 +1,63 @@
package tconstruct.library.client;
public class FluidRenderProperties {
public class FluidRenderProperties
{
//Constant defaults
public static final FluidRenderProperties DEFAULT_TABLE = new FluidRenderProperties(Applications.TABLE);
public static final FluidRenderProperties DEFAULT_BASIN = new FluidRenderProperties(Applications.BASIN);
//Constant defaults
public static final FluidRenderProperties DEFAULT_TABLE = new FluidRenderProperties(Applications.TABLE);
public static final FluidRenderProperties DEFAULT_BASIN = new FluidRenderProperties(Applications.BASIN);
public float minHeight, maxHeight, minX, maxX, minZ, maxZ;
public float minHeight, maxHeight, minX, maxX, minZ, maxZ;
public FluidRenderProperties(float minHeight, float maxHeight, float minX, float maxX, float minZ, float maxZ) {
this.minHeight = minHeight;
this.maxHeight = maxHeight;
this.minX = minX;
this.maxX = maxX;
this.minZ = minZ;
this.maxZ = maxZ;
}
public FluidRenderProperties(float minHeight, float maxHeight, float minX, float maxX, float minZ, float maxZ)
{
this.minHeight = minHeight;
this.maxHeight = maxHeight;
this.minX = minX;
this.maxX = maxX;
this.minZ = minZ;
this.maxZ = maxZ;
}
public FluidRenderProperties(float minHeight, float maxHeight, Applications defaults) {
this(minHeight, maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ);
}
public FluidRenderProperties(float minHeight, float maxHeight, Applications defaults)
{
this(minHeight, maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ);
}
public FluidRenderProperties(float minHeight, float maxHeight, float minX, float maxX, Applications defaults) {
this(minHeight, maxHeight, minX, maxX, defaults.minZ, defaults.maxZ);
}
public FluidRenderProperties(float minHeight, float maxHeight, float minX, float maxX, Applications defaults)
{
this(minHeight, maxHeight, minX, maxX, defaults.minZ, defaults.maxZ);
}
public FluidRenderProperties(Applications defaults, float minX, float maxX) {
this(defaults.minHeight, defaults.maxHeight, minX, maxX, defaults.minZ, defaults.maxZ);
}
public FluidRenderProperties(Applications defaults, float minX, float maxX)
{
this(defaults.minHeight, defaults.maxHeight, minX, maxX, defaults.minZ, defaults.maxZ);
}
public FluidRenderProperties(Applications defaults, float minX, float maxX, float minZ, float maxZ) {
this(defaults.minHeight, defaults.maxHeight, minX, maxX, minZ, maxZ);
}
public FluidRenderProperties(Applications defaults, float minX, float maxX, float minZ, float maxZ)
{
this(defaults.minHeight, defaults.maxHeight, minX, maxX, minZ, maxZ);
}
public FluidRenderProperties(Applications defaults) {
this(defaults.minHeight, defaults.maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ);
}
public FluidRenderProperties(Applications defaults)
{
this(defaults.minHeight, defaults.maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ);
}
public static enum Applications {
TABLE(0.9375F, 1F, 0.0625F, 0.9375F, 0.0625F, 0.9375F), BASIN(0.25F, 0.95F, 0.0625F, 0.9375F, 0.0625F, 0.9375F);
public static enum Applications
{
TABLE(0.9375F, 1F, 0.0625F, 0.9375F, 0.0625F, 0.9375F), BASIN(0.25F, 0.95F, 0.0625F, 0.9375F, 0.0625F, 0.9375F);
public float minHeight, maxHeight, minX, maxX, minZ, maxZ;
public float minHeight, maxHeight, minX, maxX, minZ, maxZ;
Applications(float minHeight, float maxHeight, float minX, float maxX, float minZ, float maxZ) {
this.minHeight = minHeight;
this.maxHeight = maxHeight;
this.minX = minX;
this.maxX = maxX;
this.minZ = minZ;
this.maxZ = maxZ;
}
}
Applications(float minHeight, float maxHeight, float minX, float maxX, float minZ, float maxZ)
{
this.minHeight = minHeight;
this.maxHeight = maxHeight;
this.minX = minX;
this.maxX = maxX;
this.minZ = minZ;
this.maxZ = maxZ;
}
}
}
@@ -4,5 +4,5 @@ import java.util.List;
public interface IComponentHolder
{
public List<LogicComponent> getComponents();
public List<LogicComponent> getComponents ();
}
@@ -6,12 +6,12 @@ import net.minecraft.world.World;
public class LogicComponent
{
protected World world;
public void setWorld(World world)
public void setWorld (World world)
{
this.world = world;
}
public void readFromNBT (NBTTagCompound tags)
{
readNetworkNBT(tags);
@@ -19,16 +19,16 @@ public class LogicComponent
public void readNetworkNBT (NBTTagCompound tags)
{
}
public void writeToNBT (NBTTagCompound tags)
{
writeNetworkNBT(tags);
}
public void writeNetworkNBT (NBTTagCompound tags)
{
}
}
@@ -420,7 +420,7 @@ public class TankLayerScan extends LogicComponent
}
if (!canPass)
{
System.out.println("Coord: "+coord);
System.out.println("Coord: " + coord);
height = coord.y;
break;
}
@@ -49,7 +49,7 @@ public abstract class MultiblockBaseLogic extends TileEntity implements IMultibl
{
return (master != null);
}
@Override
public boolean willConnect (CoordTuple coord)
{
@@ -165,7 +165,7 @@ public abstract class MultiblockBaseLogic extends TileEntity implements IMultibl
{
return;
}
IMultiblockMember[] neighbors = getNeighboringMembers();
List<MultiblockMasterBaseLogic> masters = new LinkedList<MultiblockMasterBaseLogic>();
@@ -391,11 +391,11 @@ public abstract class MultiblockBaseLogic extends TileEntity implements IMultibl
this.master = null;
}
}
protected void destroySelf ()
{
pendingDestroy = true;
// this.detachSelf(false);
// this.detachSelf(false);
this.getMultiblockMaster().scheduleRemoveAndRevisit(this);
}
@@ -247,7 +247,7 @@ public abstract class MultiblockMasterBaseLogic
if (forceRevisit)
{
CoordTuple deadCoords;
forceRevisit = false;
while (!pendingRemovalBlocks.isEmpty())
{
@@ -258,7 +258,7 @@ public abstract class MultiblockMasterBaseLogic
{
referenceCoord = null;
}
connectedBlocks.remove(deadCoords);
connectedBlocks.remove(deadCoords);
}
}
if (referenceCoord == null)
@@ -290,12 +290,12 @@ public abstract class MultiblockMasterBaseLogic
((IMultiblockMember) te).becomeMultiblockSaveDelegate();
}
}
this.revisitBlocks();
forceRecheck = true;
}
if (this.connectedBlocks.isEmpty())
{
MultiblockRegistry.unregister(this);
@@ -9,7 +9,7 @@ public interface ISignalTransceiver
void setBusCoords (World world, int xCoord, int yCoord, int zCoord);
CoordTuple getBusCoords ();
byte[] getReceivedSignals ();
void receiveSignalUpdate (byte[] signals);
@@ -17,5 +17,5 @@ public interface ISignalTransceiver
int doUnregister (boolean reHoming);
int getDroppedWire ();
}
@@ -79,8 +79,8 @@ public abstract class HarvestTool extends ToolCore
}
return super.getStrVsBlock(stack, block, meta);
}
float calculateStrength(NBTTagCompound tags, Block block, int meta)
float calculateStrength (NBTTagCompound tags, Block block, int meta)
{
float mineSpeed = tags.getInteger("MiningSpeed");
int heads = 1;
+2 -2
View File
@@ -66,11 +66,11 @@ import cpw.mods.fml.relauncher.SideOnly;
public abstract class ToolCore extends Item implements IEnergyContainerItem, ICustomElectricItem, IBoxable, IBattlegearWeapon, IStorageCell, IAEChargeableItem
{
//TE power constants -- TODO grab these from the
//TE power constants -- TODO grab these from the
protected int capacity = 80000;
protected int maxReceive = 75;
protected int maxExtract = 75;
protected Random random = new Random();
protected int damageVsEntity;
public static Icon blankSprite;
+1 -2
View File
@@ -125,6 +125,5 @@ public abstract class Weapon extends ToolCore
public static Material[] web = new Material[] { Material.web };
public static Material[] none = new Material[0];
}
+1 -1
View File
@@ -12,7 +12,7 @@ public class CoordTuple implements Comparable
y = posY;
z = posZ;
}
public CoordTuple(double posX, double posY, double posZ)
{
x = (int) Math.floor(posX);
@@ -4,14 +4,14 @@ public class CoordTuplePair
{
public CoordTuple a;
public CoordTuple b;
public CoordTuplePair (CoordTuple a, CoordTuple b)
public CoordTuplePair(CoordTuple a, CoordTuple b)
{
this.a = a;
this.b = b;
}
public CoordTuplePair (int aX, int aY, int aZ, int bX, int bY, int bZ)
public CoordTuplePair(int aX, int aY, int aZ, int bX, int bY, int bZ)
{
this.a = new CoordTuple(aX, aY, aZ);
this.b = new CoordTuple(bX, bY, bZ);
@@ -6,20 +6,20 @@ public class CoordTupleSort implements Comparator
{
@Override
public int compare (Object o1, Object o2)
{
{
CoordTuple c1 = (CoordTuple) o1;
CoordTuple c2 = (CoordTuple) o2;
//Sort by y, then x, then z
if (c1.y != c2.y)
return c1.y - c2.y;
if (c1.x != c2.x)
return c1.x - c2.x;
if (c1.z != c2.z)
return c1.z - c2.z;
return 0;
}
}
+3 -3
View File
@@ -2,7 +2,7 @@ package tconstruct.library.util;
public interface IMasterNode extends IMasterLogic, IServantLogic
{
public boolean isCurrentlyMaster();
public boolean isEquivalentMaster(IMasterLogic master);
public boolean isCurrentlyMaster ();
public boolean isEquivalentMaster (IMasterLogic master);
}
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff. Show more