v5.5.5 Beta #5

*Began work on Electric Disperser.
*Fixed Dynamic Tank issues.
*Faster rendering for Dynamic Tanks.
*Much more efficient liquid transferring.
*Ability for Configurator to reset an Electric Pump's calculation.
*Steel instead of Osmium for Dynamic Tanks.
*Fixed Factory GUIs (for real).
This commit is contained in:
Aidan Brady 2013-04-30 21:30:43 -04:00
parent 5133880b68
commit bc1a52d06f
16 changed files with 133 additions and 210 deletions

View file

@ -61,7 +61,7 @@ public class GasTransferProtocol
for(IGasAcceptor acceptor : acceptors)
{
if(acceptor != null)
if(acceptor != null && !availableAcceptors.contains(acceptor))
{
if(acceptor != original && acceptor.canReceiveGas(ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor)).getOpposite(), transferType))
{

View file

@ -6,6 +6,9 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
/*
* Credit to BuildCraft
*/
public class ObjectRenderer
{
private static RenderBlocks renderBlocks = new RenderBlocks();

View file

@ -255,7 +255,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
private int getStages(int height)
{
return (height-2)*1000;
return (height-2)*100;
}
private double getX(int x)

View file

@ -79,7 +79,7 @@ public class EnergyTransferProtocol
for(TileEntity acceptor : acceptors)
{
if(acceptor != original && !ignoredAcceptors.contains(acceptor))
if(acceptor != original && !ignoredAcceptors.contains(acceptor) && !availableAcceptors.contains(acceptor))
{
if(acceptor instanceof IStrictEnergyAcceptor)
{

View file

@ -62,8 +62,11 @@ public class EntityObsidianTNT extends Entity
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
motionY -= 0.04;
moveEntity(motionX, motionY, motionZ);
motionX *= 0.98;
motionY *= 0.98;
motionZ *= 0.98;
@ -88,12 +91,12 @@ public class EntityObsidianTNT extends Entity
setDead();
}
else {
worldObj.spawnParticle("lava", posX, posY + 0.5D, posZ, 0.0D, 0.0D, 0.0D);
worldObj.spawnParticle("lava", posX, posY + 0.5, posZ, 0, 0, 0);
}
}
}
else {
worldObj.spawnParticle("lava", posX, posY + 0.5D, posZ, 0.0D, 0.0D, 0.0D);
worldObj.spawnParticle("lava", posX, posY + 0.5, posZ, 0, 0, 0);
}
}
@ -104,20 +107,20 @@ public class EntityObsidianTNT extends Entity
}
@Override
protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
protected void writeEntityToNBT(NBTTagCompound nbtTags)
{
par1NBTTagCompound.setByte("Fuse", (byte)fuse);
nbtTags.setByte("Fuse", (byte)fuse);
}
@Override
protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
protected void readEntityFromNBT(NBTTagCompound nbtTags)
{
fuse = par1NBTTagCompound.getByte("Fuse");
fuse = nbtTags.getByte("Fuse");
}
@Override
public float getShadowSize()
{
return 0.0F;
return 0;
}
}

View file

@ -36,13 +36,26 @@ public class ItemConfigurator extends ItemEnergized
{
if(!world.isRemote)
{
if(player.isSneaking() && world.getBlockTileEntity(x, y, z) instanceof TileEntityMechanicalPipe)
if(player.isSneaking())
{
TileEntityMechanicalPipe tileEntity = (TileEntityMechanicalPipe)world.getBlockTileEntity(x, y, z);
tileEntity.isActive = !tileEntity.isActive;
PacketHandler.sendTileEntityPacketToClients(tileEntity, 0, tileEntity.getNetworkedData(new ArrayList()));
return true;
if(world.getBlockTileEntity(x, y, z) instanceof TileEntityMechanicalPipe)
{
TileEntityMechanicalPipe tileEntity = (TileEntityMechanicalPipe)world.getBlockTileEntity(x, y, z);
tileEntity.isActive = !tileEntity.isActive;
PacketHandler.sendTileEntityPacketToClients(tileEntity, 0, tileEntity.getNetworkedData(new ArrayList()));
return true;
}
else if(world.getBlockTileEntity(x, y, z) instanceof TileEntityElectricPump)
{
TileEntityElectricPump tileEntity = (TileEntityElectricPump)world.getBlockTileEntity(x, y, z);
tileEntity.recurringNodes.clear();
tileEntity.cleaningNodes.clear();
player.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Reset Electric Pump calculation.");
return true;
}
}
if(getState(stack) == 0)
{
if(world.getBlockTileEntity(x, y, z) instanceof IConfigurable)

View file

@ -65,64 +65,13 @@ public class LiquidTransferProtocol
for(ITankContainer acceptor : acceptors)
{
if(acceptor != null)
if(acceptor != null && !availableAcceptors.contains(acceptor))
{
ForgeDirection side = ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor)).getOpposite();
if(acceptor != original && !(acceptor instanceof IMechanicalPipe))
{
ILiquidTank[] tanks = acceptor.getTanks(side);
boolean hasTank = false;
if(tanks != null)
{
for(ILiquidTank tank : tanks)
{
if(tank != null)
{
if(tank.getLiquid() == null)
{
hasTank = true;
break;
}
else {
if(tank.getLiquid().isLiquidEqual(liquidToSend))
{
if(tank.getCapacity()-tank.getLiquid().amount != 0)
{
hasTank = true;
break;
}
}
}
}
}
}
if(!hasTank)
{
if(acceptor.getTank(side, liquidToSend) != null)
{
ILiquidTank tank = acceptor.getTank(side, liquidToSend);
if(tank.getLiquid() == null)
{
hasTank = true;
break;
}
else {
if(tank.getLiquid().isLiquidEqual(liquidToSend))
{
if(tank.getCapacity()-tank.getLiquid().amount != 0)
{
hasTank = true;
break;
}
}
}
}
}
if(hasTank)
if(acceptor.fill(side, liquidToSend, false) > 0)
{
availableAcceptors.add(acceptor);
acceptorDirections.put(acceptor, ForgeDirection.getOrientation(Arrays.asList(acceptors).indexOf(acceptor)).getOpposite());
@ -195,33 +144,7 @@ public class LiquidTransferProtocol
remaining--;
}
if(acceptor.getTanks(acceptorDirections.get(acceptor)).length != 0)
{
int tankDivider = acceptor.getTanks(acceptorDirections.get(acceptor)).length;
int tankRemaining = currentSending % tankDivider;
int tankSending = (currentSending-tankRemaining)/tankDivider;
for(ILiquidTank tank : acceptor.getTanks(acceptorDirections.get(acceptor)))
{
int tankCurrentSending = tankSending;
if(tankRemaining > 0)
{
tankCurrentSending++;
tankRemaining--;
}
liquidSent += acceptor.fill(acceptorDirections.get(acceptor), new LiquidStack(liquidToSend.itemID, tankCurrentSending, liquidToSend.itemMeta), true);
}
}
else {
if(acceptor.getTank(acceptorDirections.get(acceptor), liquidToSend) != null)
{
ILiquidTank tank = acceptor.getTank(acceptorDirections.get(acceptor), liquidToSend);
liquidSent += acceptor.fill(acceptorDirections.get(acceptor), new LiquidStack(liquidToSend.itemID, currentSending, liquidToSend.itemMeta), true);
}
}
liquidSent += acceptor.fill(acceptorDirections.get(acceptor), new LiquidStack(liquidToSend.itemID, currentSending, liquidToSend.itemMeta), true);
}
}

View file

@ -327,13 +327,13 @@ public class Mekanism
"O O", Character.valueOf('O'), "ingotOsmium"
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 4, 9), new Object[] {
" O ", "OSO", " O ", Character.valueOf('O'), "ingotOsmium", Character.valueOf('S'), Block.cobblestone
" I ", "ISI", " I ", Character.valueOf('I'), "ingotSteel", Character.valueOf('S'), Block.cobblestone
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 4, 10), new Object[] {
" O ", "OGO", " O ", Character.valueOf('O'), "ingotOsmium", Character.valueOf('G'), Block.glass
" I ", "IGI", " I ", Character.valueOf('I'), "ingotSteel", Character.valueOf('G'), Block.glass
}));
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(BasicBlock, 1, 11), new Object[] {
" O ", "OCO", " O ", Character.valueOf('O'), "ingotOsmium", Character.valueOf('C'), ControlCircuit
" I ", "ICI", " I ", Character.valueOf('I'), "ingotSteel", Character.valueOf('C'), ControlCircuit
}));
//Factory Recipes
@ -1031,6 +1031,7 @@ public class Mekanism
{
hooks = new MekanismHooks();
hooks.hook();
addIntegratedItems();
if(!EnumGas.HYDROGEN.hasTexture())

View file

@ -20,7 +20,7 @@ public class TankUpdateProtocol
public Set<TileEntityDynamicTank> iteratedNodes = new HashSet<TileEntityDynamicTank>();
/** The structures found, all connected by some nodes to the pointer. */
public List<SynchronizedTankData> structuresFound = new ArrayList<SynchronizedTankData>();
public SynchronizedTankData structureFound = null;
/** The original block the calculation is getting run from. */
public TileEntity pointer;
@ -45,6 +45,7 @@ public class TankUpdateProtocol
boolean isCorner = true;
boolean isHollowPrism = true;
boolean tooBig = false;
Set<Object3D> locations = new HashSet<Object3D>();
@ -128,52 +129,60 @@ public class TankUpdateProtocol
zmin = z;
}
for(x = xmin; x <= xmax; x++)
if(Math.abs(xmax-xmin)+1 > 18 || Math.abs(ymax-ymin)+1 > 18 || Math.abs(zmax-zmin) > 18)
{
for(y = ymin; y <= ymax; y++)
{
for(z = zmin; z <= zmax; z++)
{
if(x == xmin || x == xmax || y == ymin || y == ymax || z == zmin || z == zmax)
{
if(!isViableNode(origX+x, origY+y, origZ+z))
{
isHollowPrism = false;
break;
}
else if(isFrame(new Object3D(origX+x, origY+y, origZ+z), origX+xmin, origX+xmax, origY+ymin, origY+ymax, origZ+zmin, origZ+zmax) && !isValidFrame(origX+x, origY+y, origZ+z))
{
isHollowPrism = false;
break;
}
else {
locations.add(new Object3D(origX+x, origY+y, origZ+z));
}
}
else {
if(!isAir(origX+x, origY+y, origZ+z))
{
isHollowPrism = false;
break;
}
volume++;
}
}
if(!isHollowPrism)
{
break;
}
}
if(!isHollowPrism)
{
break;
}
tooBig = true;
}
if(!tooBig)
{
for(x = xmin; x <= xmax; x++)
{
for(y = ymin; y <= ymax; y++)
{
for(z = zmin; z <= zmax; z++)
{
if(x == xmin || x == xmax || y == ymin || y == ymax || z == zmin || z == zmax)
{
if(!isViableNode(origX+x, origY+y, origZ+z))
{
isHollowPrism = false;
break;
}
else if(isFrame(new Object3D(origX+x, origY+y, origZ+z), origX+xmin, origX+xmax, origY+ymin, origY+ymax, origZ+zmin, origZ+zmax) && !isValidFrame(origX+x, origY+y, origZ+z))
{
isHollowPrism = false;
break;
}
else {
locations.add(new Object3D(origX+x, origY+y, origZ+z));
}
}
else {
if(!isAir(origX+x, origY+y, origZ+z))
{
isHollowPrism = false;
break;
}
volume++;
}
}
if(!isHollowPrism)
{
break;
}
}
if(!isHollowPrism)
{
break;
}
}
}
}
if(isHollowPrism && isCorner && volume > 0 && volume <= 5832 && locations.size() >= 9)
if(!tooBig && isHollowPrism && isCorner && volume > 0 && volume <= 4096 && locations.size() >= 9)
{
SynchronizedTankData structure = new SynchronizedTankData();
structure.locations = locations;
@ -194,19 +203,14 @@ public class TankUpdateProtocol
structure.valves.add(data);
}
}
if(!structuresFound.contains(structure))
if(structure.locations.contains(Object3D.get(pointer)) && isCorrectCorner(new Object3D(origX, origY, origZ), origX+xmin, origY+ymin, origZ+zmin))
{
if(structure.locations.contains(Object3D.get(pointer)) && isCorrectCorner(new Object3D(origX, origY, origZ), origX+xmin, origY+ymin, origZ+zmin))
{
if(!entitiesInside(structure))
{
structuresFound.add(structure);
}
}
else {
pointerNotPartOf = true;
}
structureFound = structure;
return;
}
else {
pointerNotPartOf = true;
}
}
@ -256,36 +260,6 @@ public class TankUpdateProtocol
return ForgeDirection.UNKNOWN;
}
/**
* Checks whether or not there are entities inside this dynamic tank.
*/
public boolean entitiesInside(SynchronizedTankData structure)
{
int x = structure.renderLocation.xCoord;
int y = structure.renderLocation.yCoord;
int z = structure.renderLocation.zCoord;
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x, y, z, x+structure.volLength, y+structure.volHeight, z+structure.volWidth);
for(Object obj : pointer.worldObj.getEntitiesWithinAABB(Entity.class, boundingBox))
{
if(obj instanceof Entity)
{
Entity entity = (Entity)obj;
if(entity instanceof EntityPlayer)
{
return true;
}
else {
pointer.worldObj.removeEntity(entity);
}
}
}
return false;
}
/**
* Whether or not the block at the specified location is an air block.
* @param x - x coordinate
@ -307,14 +281,9 @@ public class TankUpdateProtocol
*/
private boolean isViableNode(int x, int y, int z)
{
TileEntity tileEntity = pointer.worldObj.getBlockTileEntity(x, y, z);
if(tileEntity != null)
if(pointer.worldObj.getBlockTileEntity(x, y, z) instanceof TileEntityDynamicTank)
{
if(tileEntity instanceof TileEntityDynamicTank)
{
return true;
}
return true;
}
return false;
@ -401,10 +370,8 @@ public class TankUpdateProtocol
{
loopThrough(pointer);
if(structuresFound.size() == 1)
if(structureFound != null)
{
SynchronizedTankData structureFound = structuresFound.get(0);
int idFound = -1;
for(Object3D obj : structureFound.locations)

View file

@ -13,8 +13,8 @@ public class TileEntityAdvancedFactory extends TileEntityFactory
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 5, new int[] {2, 3, 4, 5, 6}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 7, 5, new int[] {7, 8, 9, 10, 11}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, 4, 5, new int[] {4, 5, 6, 7, 8}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 9, 5, new int[] {9, 10, 11, 12, 13}));
sideConfig = new byte[] {4, 3, 0, 0, 2, 1};
}

View file

@ -0,0 +1,16 @@
package mekanism.common;
import net.minecraft.item.ItemStack;
import net.minecraftforge.liquids.LiquidTank;
public class TileEntityElectricDisperser extends TileEntityElectricBlock
{
public LiquidTank liquidTank;
public TileEntityElectricDisperser()
{
super("Electric Disperser", 10000);
liquidTank = new LiquidTank(10000);
inventory = new ItemStack[3];
}
}

View file

@ -104,13 +104,10 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
if(suck(true))
{
clean(true);
PacketHandler.sendTileEntityPacketToClients(this, 50, getNetworkedData(new ArrayList()));
}
else {
clean(true);
cleaningNodes.clear();
}
clean(true);
}
}

View file

@ -13,8 +13,8 @@ public class TileEntityEliteFactory extends TileEntityFactory
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 7, new int[] {2, 3, 4, 5, 6, 7, 8}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 9, 7, new int[] {9, 10, 11, 12, 13, 14, 15}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, 4, 7, new int[] {4, 5, 6, 7, 8, 9, 10}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 11, 7, new int[] {11, 12, 13, 14, 15, 16, 17}));
sideConfig = new byte[] {4, 3, 0, 0, 2, 1};
}

View file

@ -86,8 +86,8 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IEnerg
sideOutputs.add(new SideData(EnumColor.GREY, 0, 0, new int[0]));
sideOutputs.add(new SideData(EnumColor.ORANGE, 0, 1, new int[] {0}));
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, 1, 1, new int[] {1}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, 2, 3, new int[] {2, 3, 4}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 5, 3, new int[] {5, 6, 7}));
sideOutputs.add(new SideData(EnumColor.DARK_RED, 4, 3, new int[] {4, 5, 6}));
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, 7, 3, new int[] {7, 8, 9}));
sideConfig = new byte[] {4, 3, 0, 0, 2, 1};
}

View file

@ -31,7 +31,7 @@ import dan200.computer.api.IComputerAccess;
public class TileEntityHeatGenerator extends TileEntityGenerator implements ITankContainer
{
/** The LiquidSlot fuel instance for this generator. */
/** The LiquidTank for this generator. */
public LiquidTank lavaTank = new LiquidTank(24000);
/** The amount of electricity this machine can produce with a unit of fuel. */
@ -62,13 +62,13 @@ public class TileEntityHeatGenerator extends TileEntityGenerator implements ITan
{
lavaTank.fill(liquid, true);
if(inventory[0].isItemEqual(new ItemStack(Item.bucketLava)))
if(LiquidContainerRegistry.isBucket(inventory[0]))
{
inventory[0] = new ItemStack(Item.bucketEmpty);
}
else {
inventory[0].stackSize--;
if(inventory[0].stackSize == 0)
{
inventory[0] = null;

View file

@ -52,8 +52,8 @@ public class MekanismTools implements IModule
//Enums: Armor
public static EnumArmorMaterial armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN", 50, new int[]{5, 12, 8, 5}, 50);
public static EnumArmorMaterial armorLAZULI = EnumHelper.addArmorMaterial("LAZULI", 13, new int[]{2, 5, 4, 2}, 50);
public static EnumArmorMaterial armorOSMIUM = EnumHelper.addArmorMaterial("OSMIUM", 30, new int[]{3, 9, 7, 3}, 50);
public static EnumArmorMaterial armorBRONZE = EnumHelper.addArmorMaterial("BRONZE", 35, new int[]{3, 8, 6, 2}, 50);
public static EnumArmorMaterial armorOSMIUM = EnumHelper.addArmorMaterial("OSMIUM", 30, new int[]{3, 5, 6, 3}, 50);
public static EnumArmorMaterial armorBRONZE = EnumHelper.addArmorMaterial("BRONZE", 35, new int[]{3, 6, 5, 2}, 50);
public static EnumArmorMaterial armorGLOWSTONE = EnumHelper.addArmorMaterial("GLOWSTONE", 18, new int[]{3, 7, 6, 3}, 50);
public static EnumArmorMaterial armorSTEEL = EnumHelper.addArmorMaterial("STEEL", 40, new int[] {3, 7, 6, 3}, 50);