Clean up and reformat
This commit is contained in:
parent
747bbd4c3f
commit
e09dc2c489
25 changed files with 489 additions and 482 deletions
|
@ -64,13 +64,13 @@ public class ClientProxy extends CommonProxy
|
||||||
@Override
|
@Override
|
||||||
public boolean isPaused()
|
public boolean isPaused()
|
||||||
{
|
{
|
||||||
if(FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient().getIntegratedServer().getPublic())
|
if (FMLClientHandler.instance().getClient().isSingleplayer() && !FMLClientHandler.instance().getClient().getIntegratedServer().getPublic())
|
||||||
{
|
{
|
||||||
GuiScreen screen = FMLClientHandler.instance().getClient().currentScreen;
|
GuiScreen screen = FMLClientHandler.instance().getClient().currentScreen;
|
||||||
|
|
||||||
if(screen != null)
|
if (screen != null)
|
||||||
{
|
{
|
||||||
if(screen.doesGuiPauseGame())
|
if (screen.doesGuiPauseGame())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.Configuration;
|
import net.minecraftforge.common.Configuration;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import resonantinduction.battery.BatteryManager;
|
|
||||||
import resonantinduction.battery.BlockBattery;
|
import resonantinduction.battery.BlockBattery;
|
||||||
import resonantinduction.battery.ItemCapacitor;
|
import resonantinduction.battery.ItemCapacitor;
|
||||||
import resonantinduction.battery.TileEntityBattery;
|
import resonantinduction.battery.TileEntityBattery;
|
||||||
|
@ -37,8 +36,6 @@ import cpw.mods.fml.common.network.NetworkMod;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||||
import cpw.mods.fml.common.registry.TickRegistry;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
|
@ -170,7 +167,7 @@ public class ResonantInduction
|
||||||
|
|
||||||
ResonantInduction.proxy.registerRenderers();
|
ResonantInduction.proxy.registerRenderers();
|
||||||
|
|
||||||
TabRI.ITEMSTACK = new ItemStack(blockTesla);
|
TabRI.ITEMSTACK = new ItemStack(blockBattery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package resonantinduction.base;
|
package resonantinduction.base;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
|
@ -11,9 +11,9 @@ public class ListUtil
|
||||||
{
|
{
|
||||||
List<V> toReturn = new ArrayList<V>();
|
List<V> toReturn = new ArrayList<V>();
|
||||||
|
|
||||||
for(int i = list.size()-1; i >= 0; i--)
|
for (int i = list.size() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
toReturn.add((V)list.get(i));
|
toReturn.add(list.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
@ -23,20 +23,21 @@ public class ListUtil
|
||||||
{
|
{
|
||||||
List<V> toReturn = new ArrayList<V>();
|
List<V> toReturn = new ArrayList<V>();
|
||||||
|
|
||||||
if(list.size() <= cap)
|
if (list.size() <= cap)
|
||||||
{
|
{
|
||||||
toReturn = copy(list);
|
toReturn = copy(list);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for(V obj : list)
|
for (V obj : list)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
toReturn.add(obj);
|
toReturn.add(obj);
|
||||||
|
|
||||||
if(count == cap)
|
if (count == cap)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +51,7 @@ public class ListUtil
|
||||||
{
|
{
|
||||||
List<V> toReturn = new ArrayList<V>();
|
List<V> toReturn = new ArrayList<V>();
|
||||||
|
|
||||||
for(V obj : list)
|
for (V obj : list)
|
||||||
{
|
{
|
||||||
toReturn.add(obj);
|
toReturn.add(obj);
|
||||||
}
|
}
|
||||||
|
@ -62,12 +63,12 @@ public class ListUtil
|
||||||
{
|
{
|
||||||
List<V> newList = new ArrayList<V>();
|
List<V> newList = new ArrayList<V>();
|
||||||
|
|
||||||
for(V obj : listOne)
|
for (V obj : listOne)
|
||||||
{
|
{
|
||||||
newList.add(obj);
|
newList.add(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(V obj : listTwo)
|
for (V obj : listTwo)
|
||||||
{
|
{
|
||||||
newList.add(obj);
|
newList.add(obj);
|
||||||
}
|
}
|
||||||
|
@ -79,23 +80,24 @@ public class ListUtil
|
||||||
{
|
{
|
||||||
List<V> toReturn = new ArrayList<V>();
|
List<V> toReturn = new ArrayList<V>();
|
||||||
|
|
||||||
if(list.size() <= cap)
|
if (list.size() <= cap)
|
||||||
{
|
{
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
List<V> inverse = inverse(list);
|
List<V> inverse = inverse(list);
|
||||||
|
|
||||||
int iterNeeded = list.size()-cap;
|
int iterNeeded = list.size() - cap;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for(V obj : list)
|
for (V obj : list)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
toReturn.add(obj);
|
toReturn.add(obj);
|
||||||
|
|
||||||
if(count == iterNeeded)
|
if (count == iterNeeded)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -107,31 +109,31 @@ public class ListUtil
|
||||||
|
|
||||||
public static <V> ArrayList<List<V>> split(List<V> list, int divide)
|
public static <V> ArrayList<List<V>> split(List<V> list, int divide)
|
||||||
{
|
{
|
||||||
int remain = list.size()%divide;
|
int remain = list.size() % divide;
|
||||||
int size = (list.size()-remain)/divide;
|
int size = (list.size() - remain) / divide;
|
||||||
|
|
||||||
ArrayList<List<V>> toReturn = new ArrayList<List<V>>();
|
ArrayList<List<V>> toReturn = new ArrayList<List<V>>();
|
||||||
|
|
||||||
for(int i = 0; i < divide; i++)
|
for (int i = 0; i < divide; i++)
|
||||||
{
|
{
|
||||||
toReturn.add(i, new ArrayList<V>());
|
toReturn.add(i, new ArrayList<V>());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(List<V> iterSet : toReturn)
|
for (List<V> iterSet : toReturn)
|
||||||
{
|
{
|
||||||
List<V> removed = new ArrayList<V>();
|
List<V> removed = new ArrayList<V>();
|
||||||
|
|
||||||
int toAdd = size;
|
int toAdd = size;
|
||||||
|
|
||||||
if(remain > 0)
|
if (remain > 0)
|
||||||
{
|
{
|
||||||
remain--;
|
remain--;
|
||||||
toAdd++;
|
toAdd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(V obj : list)
|
for (V obj : list)
|
||||||
{
|
{
|
||||||
if(toAdd == 0)
|
if (toAdd == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +143,7 @@ public class ListUtil
|
||||||
toAdd--;
|
toAdd--;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(V obj : removed)
|
for (V obj : removed)
|
||||||
{
|
{
|
||||||
list.remove(obj);
|
list.remove(obj);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +154,7 @@ public class ListUtil
|
||||||
|
|
||||||
public static <V> V getTop(List<V> list)
|
public static <V> V getTop(List<V> list)
|
||||||
{
|
{
|
||||||
for(V obj : list)
|
for (V obj : list)
|
||||||
{
|
{
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
@ -162,6 +164,6 @@ public class ListUtil
|
||||||
|
|
||||||
public static <V> List<V> asList(Set<V> set)
|
public static <V> List<V> asList(Set<V> set)
|
||||||
{
|
{
|
||||||
return (List<V>)Arrays.asList(set.toArray());
|
return (List<V>) Arrays.asList(set.toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class TileEntityBase extends TileEntity
|
||||||
this.initiate();
|
this.initiate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doPacket && !worldObj.isRemote)
|
if (doPacket && !worldObj.isRemote)
|
||||||
{
|
{
|
||||||
for (EntityPlayer player : this.playersUsing)
|
for (EntityPlayer player : this.playersUsing)
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class BatteryUpdateProtocol
|
||||||
|
|
||||||
private void loopThrough(TileEntity tile)
|
private void loopThrough(TileEntity tile)
|
||||||
{
|
{
|
||||||
if(structureFound == null)
|
if (structureFound == null)
|
||||||
{
|
{
|
||||||
World worldObj = tile.worldObj;
|
World worldObj = tile.worldObj;
|
||||||
|
|
||||||
|
@ -46,30 +46,29 @@ public class BatteryUpdateProtocol
|
||||||
|
|
||||||
int x = 0, y = 0, z = 0;
|
int x = 0, y = 0, z = 0;
|
||||||
|
|
||||||
if((isBattery(origX + 1, origY, origZ) && isBattery(origX - 1, origY, origZ)) ||
|
if ((isBattery(origX + 1, origY, origZ) && isBattery(origX - 1, origY, origZ)) || (isBattery(origX, origY + 1, origZ) && isBattery(origX, origY - 1, origZ)) || (isBattery(origX, origY, origZ + 1) && isBattery(origX, origY, origZ - 1)))
|
||||||
(isBattery(origX, origY + 1, origZ) && isBattery(origX, origY - 1, origZ)) ||
|
|
||||||
(isBattery(origX, origY, origZ + 1) && isBattery(origX, origY, origZ - 1)))
|
|
||||||
{
|
{
|
||||||
isCorner = false;
|
isCorner = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isCorner)
|
if (isCorner)
|
||||||
{
|
{
|
||||||
if(isBattery(origX+1, origY, origZ))
|
if (isBattery(origX + 1, origY, origZ))
|
||||||
{
|
{
|
||||||
xmin = 0;
|
xmin = 0;
|
||||||
|
|
||||||
while(isBattery(origX+x+1, origY, origZ))
|
while (isBattery(origX + x + 1, origY, origZ))
|
||||||
{
|
{
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmax = x;
|
xmax = x;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
xmax = 0;
|
xmax = 0;
|
||||||
|
|
||||||
while(isBattery(origX+x-1, origY, origZ))
|
while (isBattery(origX + x - 1, origY, origZ))
|
||||||
{
|
{
|
||||||
x--;
|
x--;
|
||||||
}
|
}
|
||||||
|
@ -77,21 +76,22 @@ public class BatteryUpdateProtocol
|
||||||
xmin = x;
|
xmin = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isBattery(origX, origY+1, origZ))
|
if (isBattery(origX, origY + 1, origZ))
|
||||||
{
|
{
|
||||||
ymin = 0;
|
ymin = 0;
|
||||||
|
|
||||||
while(isBattery(origX, origY+y+1, origZ))
|
while (isBattery(origX, origY + y + 1, origZ))
|
||||||
{
|
{
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ymax = y;
|
ymax = y;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
ymax = 0;
|
ymax = 0;
|
||||||
|
|
||||||
while(isBattery(origX, origY+y-1 ,origZ))
|
while (isBattery(origX, origY + y - 1, origZ))
|
||||||
{
|
{
|
||||||
y--;
|
y--;
|
||||||
}
|
}
|
||||||
|
@ -99,21 +99,22 @@ public class BatteryUpdateProtocol
|
||||||
ymin = y;
|
ymin = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isBattery(origX, origY, origZ+1))
|
if (isBattery(origX, origY, origZ + 1))
|
||||||
{
|
{
|
||||||
zmin = 0;
|
zmin = 0;
|
||||||
|
|
||||||
while(isBattery(origX, origY, origZ+z+1))
|
while (isBattery(origX, origY, origZ + z + 1))
|
||||||
{
|
{
|
||||||
z++;
|
z++;
|
||||||
}
|
}
|
||||||
|
|
||||||
zmax = z;
|
zmax = z;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
zmax = 0;
|
zmax = 0;
|
||||||
|
|
||||||
while(isBattery(origX, origY, origZ+z-1))
|
while (isBattery(origX, origY, origZ + z - 1))
|
||||||
{
|
{
|
||||||
z--;
|
z--;
|
||||||
}
|
}
|
||||||
|
@ -121,51 +122,52 @@ public class BatteryUpdateProtocol
|
||||||
zmin = z;
|
zmin = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(x = xmin; x <= xmax; x++)
|
for (x = xmin; x <= xmax; x++)
|
||||||
{
|
{
|
||||||
for(y = ymin; y <= ymax; y++)
|
for (y = ymin; y <= ymax; y++)
|
||||||
{
|
{
|
||||||
for(z = zmin; z <= zmax; z++)
|
for (z = zmin; z <= zmax; z++)
|
||||||
{
|
{
|
||||||
if(!isBattery(origX+x, origY+y, origZ+z))
|
if (!isBattery(origX + x, origY + y, origZ + z))
|
||||||
{
|
{
|
||||||
rightBlocks = false;
|
rightBlocks = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
locations.add(new Vector3(tile).translate(new Vector3(x, y, z)));
|
locations.add(new Vector3(tile).translate(new Vector3(x, y, z)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!rightBlocks)
|
if (!rightBlocks)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!rightBlocks)
|
if (!rightBlocks)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(locations.size() >= 1 && locations.size() < 512)
|
if (locations.size() >= 1 && locations.size() < 512)
|
||||||
{
|
{
|
||||||
if(rightBlocks && isCorner)
|
if (rightBlocks && isCorner)
|
||||||
{
|
{
|
||||||
SynchronizedBatteryData structure = new SynchronizedBatteryData();
|
SynchronizedBatteryData structure = new SynchronizedBatteryData();
|
||||||
structure.locations = locations;
|
structure.locations = locations;
|
||||||
structure.length = Math.abs(xmax-xmin)+1;
|
structure.length = Math.abs(xmax - xmin) + 1;
|
||||||
structure.height = Math.abs(ymax-ymin)+1;
|
structure.height = Math.abs(ymax - ymin) + 1;
|
||||||
structure.width = Math.abs(zmax-zmin)+1;
|
structure.width = Math.abs(zmax - zmin) + 1;
|
||||||
|
|
||||||
if(structure.getVolume() > 1)
|
if (structure.getVolume() > 1)
|
||||||
{
|
{
|
||||||
structure.isMultiblock = true;
|
structure.isMultiblock = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(structure.locations.contains(new Vector3(pointer)))
|
if (structure.locations.contains(new Vector3(pointer)))
|
||||||
{
|
{
|
||||||
structureFound = structure;
|
structureFound = structure;
|
||||||
}
|
}
|
||||||
|
@ -173,15 +175,15 @@ public class BatteryUpdateProtocol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iteratedNodes.add((TileEntityBattery)tile);
|
iteratedNodes.add((TileEntityBattery) tile);
|
||||||
|
|
||||||
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = new Vector3(tile).getFromSide(side).getTileEntity(tile.worldObj);
|
TileEntity tileEntity = new Vector3(tile).getFromSide(side).getTileEntity(tile.worldObj);
|
||||||
|
|
||||||
if(tileEntity instanceof TileEntityBattery)
|
if (tileEntity instanceof TileEntityBattery)
|
||||||
{
|
{
|
||||||
if(!iteratedNodes.contains(tileEntity))
|
if (!iteratedNodes.contains(tileEntity))
|
||||||
{
|
{
|
||||||
loopThrough(tileEntity);
|
loopThrough(tileEntity);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +193,7 @@ public class BatteryUpdateProtocol
|
||||||
|
|
||||||
private boolean isBattery(int x, int y, int z)
|
private boolean isBattery(int x, int y, int z)
|
||||||
{
|
{
|
||||||
if(pointer.worldObj.getBlockTileEntity(x, y, z) instanceof TileEntityBattery)
|
if (pointer.worldObj.getBlockTileEntity(x, y, z) instanceof TileEntityBattery)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -203,18 +205,18 @@ public class BatteryUpdateProtocol
|
||||||
{
|
{
|
||||||
SynchronizedBatteryData oldStructure = null;
|
SynchronizedBatteryData oldStructure = null;
|
||||||
|
|
||||||
for(TileEntityBattery tile : iteratedNodes)
|
for (TileEntityBattery tile : iteratedNodes)
|
||||||
{
|
{
|
||||||
if(tile.structure.isMultiblock)
|
if (tile.structure.isMultiblock)
|
||||||
{
|
{
|
||||||
oldStructure = tile.structure;
|
oldStructure = tile.structure;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldStructure != null)
|
if (oldStructure != null)
|
||||||
{
|
{
|
||||||
int maxCells = iteratedNodes.size()*BatteryManager.CELLS_PER_BATTERY;
|
int maxCells = iteratedNodes.size() * BatteryManager.CELLS_PER_BATTERY;
|
||||||
|
|
||||||
List<ItemStack> rejected = ListUtil.capRemains(oldStructure.inventory, maxCells);
|
List<ItemStack> rejected = ListUtil.capRemains(oldStructure.inventory, maxCells);
|
||||||
ejectItems(rejected, new Vector3(pointer));
|
ejectItems(rejected, new Vector3(pointer));
|
||||||
|
@ -224,12 +226,12 @@ public class BatteryUpdateProtocol
|
||||||
|
|
||||||
boolean didVisibleInventory = false;
|
boolean didVisibleInventory = false;
|
||||||
|
|
||||||
for(int i = 0; i < iterList.size(); i++)
|
for (int i = 0; i < iterList.size(); i++)
|
||||||
{
|
{
|
||||||
TileEntityBattery tile = iterList.get(i);
|
TileEntityBattery tile = iterList.get(i);
|
||||||
tile.structure = SynchronizedBatteryData.getBase(tile, inventories.get(i));
|
tile.structure = SynchronizedBatteryData.getBase(tile, inventories.get(i));
|
||||||
|
|
||||||
if(!didVisibleInventory)
|
if (!didVisibleInventory)
|
||||||
{
|
{
|
||||||
tile.structure.visibleInventory = oldStructure.visibleInventory;
|
tile.structure.visibleInventory = oldStructure.visibleInventory;
|
||||||
didVisibleInventory = true;
|
didVisibleInventory = true;
|
||||||
|
@ -240,7 +242,7 @@ public class BatteryUpdateProtocol
|
||||||
|
|
||||||
private void ejectItems(List<ItemStack> items, Vector3 vec)
|
private void ejectItems(List<ItemStack> items, Vector3 vec)
|
||||||
{
|
{
|
||||||
for(ItemStack itemStack : items)
|
for (ItemStack itemStack : items)
|
||||||
{
|
{
|
||||||
float motion = 0.7F;
|
float motion = 0.7F;
|
||||||
double motionX = (pointer.worldObj.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
double motionX = (pointer.worldObj.rand.nextFloat() * motion) + (1.0F - motion) * 0.5D;
|
||||||
|
@ -257,11 +259,11 @@ public class BatteryUpdateProtocol
|
||||||
{
|
{
|
||||||
loopThrough(pointer);
|
loopThrough(pointer);
|
||||||
|
|
||||||
if(structureFound != null)
|
if (structureFound != null)
|
||||||
{
|
{
|
||||||
for(TileEntityBattery tileEntity : iteratedNodes)
|
for (TileEntityBattery tileEntity : iteratedNodes)
|
||||||
{
|
{
|
||||||
if(!structureFound.locations.contains(new Vector3(tileEntity)))
|
if (!structureFound.locations.contains(new Vector3(tileEntity)))
|
||||||
{
|
{
|
||||||
disperseCells();
|
disperseCells();
|
||||||
|
|
||||||
|
@ -269,13 +271,13 @@ public class BatteryUpdateProtocol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Vector3 obj : structureFound.locations)
|
for (Vector3 obj : structureFound.locations)
|
||||||
{
|
{
|
||||||
TileEntityBattery tileEntity = (TileEntityBattery)obj.getTileEntity(pointer.worldObj);
|
TileEntityBattery tileEntity = (TileEntityBattery) obj.getTileEntity(pointer.worldObj);
|
||||||
|
|
||||||
structureFound.inventory = ListUtil.merge(structureFound.inventory, tileEntity.structure.inventory);
|
structureFound.inventory = ListUtil.merge(structureFound.inventory, tileEntity.structure.inventory);
|
||||||
|
|
||||||
if(tileEntity.structure.hasVisibleInventory())
|
if (tileEntity.structure.hasVisibleInventory())
|
||||||
{
|
{
|
||||||
structureFound.visibleInventory = tileEntity.structure.visibleInventory;
|
structureFound.visibleInventory = tileEntity.structure.visibleInventory;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +290,8 @@ public class BatteryUpdateProtocol
|
||||||
|
|
||||||
structureFound.inventory = ListUtil.cap(structureFound.inventory, structureFound.getMaxCells());
|
structureFound.inventory = ListUtil.cap(structureFound.inventory, structureFound.getMaxCells());
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
disperseCells();
|
disperseCells();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ public class BlockBattery extends BlockBase implements ITileEntityProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer)
|
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer)
|
||||||
|
{
|
||||||
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
if (!entityPlayer.capabilities.isCreativeMode)
|
if (!entityPlayer.capabilities.isCreativeMode)
|
||||||
{
|
{
|
||||||
|
@ -44,6 +46,8 @@ public class BlockBattery extends BlockBase implements ITileEntityProvider
|
||||||
if (tileEntity.structure.inventory.remove(itemStack))
|
if (tileEntity.structure.inventory.remove(itemStack))
|
||||||
{
|
{
|
||||||
entityPlayer.dropPlayerItem(itemStack);
|
entityPlayer.dropPlayerItem(itemStack);
|
||||||
|
tileEntity.updateInventory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +73,7 @@ public class BlockBattery extends BlockBase implements ITileEntityProvider
|
||||||
tileEntity.structure.inventory.add(entityPlayer.getCurrentEquippedItem());
|
tileEntity.structure.inventory.add(entityPlayer.getCurrentEquippedItem());
|
||||||
tileEntity.structure.sortInventory();
|
tileEntity.structure.sortInventory();
|
||||||
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
|
entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null);
|
||||||
|
tileEntity.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,15 +24,15 @@ public class ContainerBattery extends Container
|
||||||
|
|
||||||
int slotX;
|
int slotX;
|
||||||
|
|
||||||
for(slotX = 0; slotX < 3; ++slotX)
|
for (slotX = 0; slotX < 3; ++slotX)
|
||||||
{
|
{
|
||||||
for(int slotY = 0; slotY < 9; ++slotY)
|
for (int slotY = 0; slotY < 9; ++slotY)
|
||||||
{
|
{
|
||||||
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 125 + slotX * 18));
|
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 125 + slotX * 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(slotX = 0; slotX < 9; ++slotX)
|
for (slotX = 0; slotX < 9; ++slotX)
|
||||||
{
|
{
|
||||||
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 183));
|
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 183));
|
||||||
}
|
}
|
||||||
|
@ -46,15 +46,15 @@ public class ContainerBattery extends Container
|
||||||
{
|
{
|
||||||
ItemStack stack = super.slotClick(slotID, par2, par3, par4EntityPlayer);
|
ItemStack stack = super.slotClick(slotID, par2, par3, par4EntityPlayer);
|
||||||
|
|
||||||
if(slotID == 1)
|
if (slotID == 1)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = ((Slot)inventorySlots.get(slotID)).getStack();
|
ItemStack itemstack = ((Slot) inventorySlots.get(slotID)).getStack();
|
||||||
ItemStack itemstack1 = itemstack == null ? null : itemstack.copy();
|
ItemStack itemstack1 = itemstack == null ? null : itemstack.copy();
|
||||||
inventoryItemStacks.set(slotID, itemstack1);
|
inventoryItemStacks.set(slotID, itemstack1);
|
||||||
|
|
||||||
for (int j = 0; j < crafters.size(); ++j)
|
for (int j = 0; j < crafters.size(); ++j)
|
||||||
{
|
{
|
||||||
((ICrafting)crafters.get(j)).sendSlotContents(this, slotID, itemstack1);
|
((ICrafting) crafters.get(j)).sendSlotContents(this, slotID, itemstack1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,66 +79,69 @@ public class ContainerBattery extends Container
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
|
||||||
{
|
{
|
||||||
ItemStack stack = null;
|
ItemStack stack = null;
|
||||||
Slot currentSlot = (Slot)inventorySlots.get(slotID);
|
Slot currentSlot = (Slot) inventorySlots.get(slotID);
|
||||||
|
|
||||||
if(currentSlot != null && currentSlot.getHasStack())
|
if (currentSlot != null && currentSlot.getHasStack())
|
||||||
{
|
{
|
||||||
ItemStack slotStack = currentSlot.getStack();
|
ItemStack slotStack = currentSlot.getStack();
|
||||||
stack = slotStack.copy();
|
stack = slotStack.copy();
|
||||||
|
|
||||||
if(slotID == 0 || slotID == 1)
|
if (slotID == 0 || slotID == 1)
|
||||||
{
|
{
|
||||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
if (!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(slotID == 2 || slotID == 3)
|
else if (slotID == 2 || slotID == 3)
|
||||||
{
|
{
|
||||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
if (!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(slotStack.getItem() instanceof IBattery)
|
else if (slotStack.getItem() instanceof IBattery)
|
||||||
{
|
{
|
||||||
if(!mergeItemStack(slotStack, 0, 1, false))
|
if (!mergeItemStack(slotStack, 0, 1, false))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
if(slotID >= 4 && slotID <= 30)
|
|
||||||
{
|
{
|
||||||
if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
|
if (slotID >= 4 && slotID <= 30)
|
||||||
|
{
|
||||||
|
if (!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(slotID > 30)
|
else if (slotID > 30)
|
||||||
{
|
{
|
||||||
if(!mergeItemStack(slotStack, 4, 30, false))
|
if (!mergeItemStack(slotStack, 4, 30, false))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
{
|
||||||
|
if (!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slotStack.stackSize == 0)
|
if (slotStack.stackSize == 0)
|
||||||
{
|
{
|
||||||
currentSlot.putStack((ItemStack)null);
|
currentSlot.putStack((ItemStack) null);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
currentSlot.onSlotChanged();
|
currentSlot.onSlotChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(slotStack.stackSize == stack.stackSize)
|
if (slotStack.stackSize == stack.stackSize)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class GuiBattery extends GuiContainer
|
||||||
{
|
{
|
||||||
super(new ContainerBattery(inventory, tentity));
|
super(new ContainerBattery(inventory, tentity));
|
||||||
tileEntity = tentity;
|
tileEntity = tentity;
|
||||||
ySize+=41;
|
ySize += 41;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,7 +30,7 @@ public class GuiBattery extends GuiContainer
|
||||||
fontRenderer.drawString("Battery", 43, 6, 0x404040);
|
fontRenderer.drawString("Battery", 43, 6, 0x404040);
|
||||||
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 0x404040);
|
||||||
fontRenderer.drawString("Cells: " + tileEntity.clientCells + " / " + tileEntity.structure.getMaxCells(), 62, 23, 0x404040);
|
fontRenderer.drawString("Cells: " + tileEntity.clientCells + " / " + tileEntity.structure.getMaxCells(), 62, 23, 0x404040);
|
||||||
fontRenderer.drawString("Energy: " + (int)tileEntity.getEnergyStored() + " / " + (int)tileEntity.getMaxEnergyStored(), 62, 32, 0x404040);
|
fontRenderer.drawString("Energy: " + (int) tileEntity.getEnergyStored() + " / " + (int) tileEntity.getMaxEnergyStored(), 62, 32, 0x404040);
|
||||||
fontRenderer.drawString("Volume: " + tileEntity.structure.getVolume(), 62, 41, 0x404040);
|
fontRenderer.drawString("Volume: " + tileEntity.structure.getVolume(), 62, 41, 0x404040);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class GuiBattery extends GuiContainer
|
||||||
int xAxis = (mouseX - (width - xSize) / 2);
|
int xAxis = (mouseX - (width - xSize) / 2);
|
||||||
int yAxis = (mouseY - (height - ySize) / 2);
|
int yAxis = (mouseY - (height - ySize) / 2);
|
||||||
|
|
||||||
int scale = (int)((tileEntity.getEnergyStored() / tileEntity.getMaxEnergyStored()) * 105);
|
int scale = (int) ((tileEntity.getEnergyStored() / tileEntity.getMaxEnergyStored()) * 105);
|
||||||
drawTexturedModalRect(guiWidth + 61, guiHeight + 102, 0, 207, scale, 12);
|
drawTexturedModalRect(guiWidth + 61, guiHeight + 102, 0, 207, scale, 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class ItemCapacitor extends ItemBase implements IBattery
|
||||||
@Override
|
@Override
|
||||||
public float getTransfer(ItemStack itemStack)
|
public float getTransfer(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
return getMaxEnergyStored(itemStack)*0.05F;
|
return getMaxEnergyStored(itemStack) * 0.05F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,9 +17,7 @@ public class SynchronizedBatteryData
|
||||||
public List<ItemStack> inventory = new ArrayList<ItemStack>();
|
public List<ItemStack> inventory = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slot 0: Cell input slot
|
* Slot 0: Cell input slot Slot 1: Battery charge slot Slot 2: Battery discharge slot
|
||||||
* Slot 1: Battery charge slot
|
|
||||||
* Slot 2: Battery discharge slot
|
|
||||||
*/
|
*/
|
||||||
public ItemStack[] visibleInventory = new ItemStack[3];
|
public ItemStack[] visibleInventory = new ItemStack[3];
|
||||||
|
|
||||||
|
@ -39,12 +37,12 @@ public class SynchronizedBatteryData
|
||||||
|
|
||||||
public int getVolume()
|
public int getVolume()
|
||||||
{
|
{
|
||||||
return length*width*height;
|
return length * width * height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxCells()
|
public int getMaxCells()
|
||||||
{
|
{
|
||||||
return getVolume()*BatteryManager.CELLS_PER_BATTERY;
|
return getVolume() * BatteryManager.CELLS_PER_BATTERY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sortInventory()
|
public void sortInventory()
|
||||||
|
@ -53,25 +51,25 @@ public class SynchronizedBatteryData
|
||||||
|
|
||||||
ItemStack[] toSort = new ItemStack[array.length];
|
ItemStack[] toSort = new ItemStack[array.length];
|
||||||
|
|
||||||
for(int i = 0; i < array.length; i++)
|
for (int i = 0; i < array.length; i++)
|
||||||
{
|
{
|
||||||
toSort[i] = (ItemStack)array[i];
|
toSort[i] = (ItemStack) array[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean cont = true;
|
boolean cont = true;
|
||||||
ItemStack temp;
|
ItemStack temp;
|
||||||
|
|
||||||
while(cont)
|
while (cont)
|
||||||
{
|
{
|
||||||
cont = false;
|
cont = false;
|
||||||
|
|
||||||
for(int i = 0; i < toSort.length-1; i++)
|
for (int i = 0; i < toSort.length - 1; i++)
|
||||||
{
|
{
|
||||||
if(((IBattery)toSort[i].getItem()).getEnergyStored(toSort[i]) < ((IBattery)toSort[i+1].getItem()).getEnergyStored(toSort[i+1]))
|
if (((IBattery) toSort[i].getItem()).getEnergyStored(toSort[i]) < ((IBattery) toSort[i + 1].getItem()).getEnergyStored(toSort[i + 1]))
|
||||||
{
|
{
|
||||||
temp = toSort[i];
|
temp = toSort[i];
|
||||||
toSort[i] = toSort[i+1];
|
toSort[i] = toSort[i + 1];
|
||||||
toSort[i+1] = temp;
|
toSort[i + 1] = temp;
|
||||||
cont = true;
|
cont = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +77,7 @@ public class SynchronizedBatteryData
|
||||||
|
|
||||||
inventory = new ArrayList<ItemStack>();
|
inventory = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
for(ItemStack itemStack : toSort)
|
for (ItemStack itemStack : toSort)
|
||||||
{
|
{
|
||||||
inventory.add(itemStack);
|
inventory.add(itemStack);
|
||||||
}
|
}
|
||||||
|
@ -87,9 +85,9 @@ public class SynchronizedBatteryData
|
||||||
|
|
||||||
public boolean hasVisibleInventory()
|
public boolean hasVisibleInventory()
|
||||||
{
|
{
|
||||||
for(ItemStack itemStack : visibleInventory)
|
for (ItemStack itemStack : visibleInventory)
|
||||||
{
|
{
|
||||||
if(itemStack != null)
|
if (itemStack != null)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -131,19 +129,19 @@ public class SynchronizedBatteryData
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if(!(obj instanceof SynchronizedBatteryData))
|
if (!(obj instanceof SynchronizedBatteryData))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynchronizedBatteryData data = (SynchronizedBatteryData)obj;
|
SynchronizedBatteryData data = (SynchronizedBatteryData) obj;
|
||||||
|
|
||||||
if(!data.locations.equals(locations))
|
if (!data.locations.equals(locations))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.length != length || data.width != width || data.height != height)
|
if (data.length != length || data.width != width || data.height != height)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
{
|
{
|
||||||
if (playersUsing.size() > 0)
|
if (playersUsing.size() > 0)
|
||||||
{
|
{
|
||||||
PacketHandler.sendTileEntityPacketToClients(this, getNetworkedData(new ArrayList()).toArray());
|
this.updateInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ticks == 5 && !structure.isMultiblock)
|
if (ticks == 5 && !structure.isMultiblock)
|
||||||
|
@ -110,6 +110,11 @@ public class TileEntityBattery extends TileEntityBase implements IPacketReceiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateInventory()
|
||||||
|
{
|
||||||
|
PacketHandler.sendTileEntityPacketToClients(this, getNetworkedData(new ArrayList()).toArray());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package resonantinduction.contractor;
|
package resonantinduction.contractor;
|
||||||
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -15,7 +16,6 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.PacketHandler;
|
import resonantinduction.PacketHandler;
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
import resonantinduction.api.ITesla;
|
|
||||||
import resonantinduction.base.IPacketReceiver;
|
import resonantinduction.base.IPacketReceiver;
|
||||||
import resonantinduction.base.InventoryUtil;
|
import resonantinduction.base.InventoryUtil;
|
||||||
import resonantinduction.base.TileEntityBase;
|
import resonantinduction.base.TileEntityBase;
|
||||||
|
@ -123,7 +123,7 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
|
||||||
{
|
{
|
||||||
Vector3 result = this.pathfinder.results.get(i);
|
Vector3 result = this.pathfinder.results.get(i);
|
||||||
|
|
||||||
if (this.canBePath(this.worldObj, result))
|
if (TileEntityEMContractor.canBePath(this.worldObj, result))
|
||||||
{
|
{
|
||||||
if (i - 1 >= 0)
|
if (i - 1 >= 0)
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,8 @@ public class TileEntityEMContractor extends TileEntityBase implements IPacketRec
|
||||||
|
|
||||||
public static boolean canBePath(World world, Vector3 position)
|
public static boolean canBePath(World world, Vector3 position)
|
||||||
{
|
{
|
||||||
return position.getBlockID(world) == 0 || position.getTileEntity(world) instanceof TileEntityEMContractor;
|
Block block = Block.blocksList[position.getBlockID(world)];
|
||||||
|
return block == null || position.getTileEntity(world) instanceof TileEntityEMContractor || (block != null && !block.isBlockNormalCube(world, (int) position.x, (int) position.y, (int) position.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveEntity(EntityItem entityItem, ForgeDirection direction, Vector3 lockVector)
|
private void moveEntity(EntityItem entityItem, ForgeDirection direction, Vector3 lockVector)
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
package resonantinduction.entangler;
|
package resonantinduction.entangler;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import resonantinduction.base.Vector3;
|
import resonantinduction.base.Vector3;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -90,10 +90,10 @@ public class FXElectricBolt extends EntityFX
|
||||||
this.segments.add(new BoltSegment(this.start, this.end));
|
this.segments.add(new BoltSegment(this.start, this.end));
|
||||||
this.recalculate();
|
this.recalculate();
|
||||||
double offsetRatio = this.boltLength * this.complexity;
|
double offsetRatio = this.boltLength * this.complexity;
|
||||||
this.split(2, offsetRatio / 10, 0.7f, 0.1f, 20/2);
|
this.split(2, offsetRatio / 10, 0.7f, 0.1f, 20 / 2);
|
||||||
this.split(2, offsetRatio / 15, 0.5f, 0.1f, 25/2);
|
this.split(2, offsetRatio / 15, 0.5f, 0.1f, 25 / 2);
|
||||||
this.split(2, offsetRatio / 25, 0.5f, 0.1f, 28/2);
|
this.split(2, offsetRatio / 25, 0.5f, 0.1f, 28 / 2);
|
||||||
this.split(2, offsetRatio / 38, 0.5f, 0.1f, 30/2);
|
this.split(2, offsetRatio / 38, 0.5f, 0.1f, 30 / 2);
|
||||||
this.split(2, offsetRatio / 55, 0, 0, 0);
|
this.split(2, offsetRatio / 55, 0, 0, 0);
|
||||||
this.split(2, offsetRatio / 70, 0, 0, 0);
|
this.split(2, offsetRatio / 70, 0, 0, 0);
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ public class BlockMultimeter extends BlockBase implements ITileEntityProvider
|
||||||
* Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY,
|
* Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY,
|
||||||
* hi@OverridetZ, block metadata
|
* hi@OverridetZ, block metadata
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int side, float hitX, float hitY, float hitZ, int metadata)
|
public int onBlockPlaced(World par1World, int par2, int par3, int par4, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||||
{
|
{
|
||||||
return ForgeDirection.getOrientation(side).getOpposite().ordinal();
|
return ForgeDirection.getOrientation(side).getOpposite().ordinal();
|
||||||
|
|
|
@ -5,7 +5,6 @@ package resonantinduction.multimeter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import resonantinduction.base.Vector3;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -48,7 +47,7 @@ public class ItemBlockMultimeter extends ItemBlock
|
||||||
{
|
{
|
||||||
if (!par2EntityPlayer.isSneaking())
|
if (!par2EntityPlayer.isSneaking())
|
||||||
{
|
{
|
||||||
//if (!world.isRemote)
|
// if (!world.isRemote)
|
||||||
{
|
{
|
||||||
par2EntityPlayer.addChatMessage("Energy: " + TileEntityMultimeter.getDetectedEnergy(world.getBlockTileEntity(x, y, z)) + " J");
|
par2EntityPlayer.addChatMessage("Energy: " + TileEntityMultimeter.getDetectedEnergy(world.getBlockTileEntity(x, y, z)) + " J");
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,20 +60,21 @@ public class RenderBattery extends TileEntitySpecialRenderer
|
||||||
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
|
||||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||||
|
|
||||||
if(((TileEntityBattery)t).structure.isMultiblock)
|
if (((TileEntityBattery) t).structure.isMultiblock)
|
||||||
{
|
{
|
||||||
this.func_110628_a(TEXTURE_MULTI);
|
this.func_110628_a(TEXTURE_MULTI);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
this.func_110628_a(TEXTURE);
|
this.func_110628_a(TEXTURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MODEL.render(0.0625f);
|
MODEL.render(0.0625f);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
int renderAmount = Math.min(((TileEntityBattery)t).clientCells, 16);
|
int renderAmount = Math.min(((TileEntityBattery) t).clientCells, 16);
|
||||||
|
|
||||||
if(renderAmount == 0)
|
if (renderAmount == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -158,10 +159,10 @@ public class RenderBattery extends TileEntitySpecialRenderer
|
||||||
icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
|
icon = ((TextureMap) texturemanager.func_110581_b(resourcelocation)).func_110572_b("missingno");
|
||||||
}
|
}
|
||||||
|
|
||||||
float f4 = ((Icon) icon).getMinU();
|
float f4 = icon.getMinU();
|
||||||
float f5 = ((Icon) icon).getMaxU();
|
float f5 = icon.getMaxU();
|
||||||
float f6 = ((Icon) icon).getMinV();
|
float f6 = icon.getMinV();
|
||||||
float f7 = ((Icon) icon).getMaxV();
|
float f7 = icon.getMaxV();
|
||||||
float f8 = 1.0F;
|
float f8 = 1.0F;
|
||||||
float f9 = 0.5F;
|
float f9 = 0.5F;
|
||||||
float f10 = 0.25F;
|
float f10 = 0.25F;
|
||||||
|
@ -175,7 +176,7 @@ public class RenderBattery extends TileEntitySpecialRenderer
|
||||||
int j = itemstack.stackSize;
|
int j = itemstack.stackSize;
|
||||||
byte b0 = getMiniItemCount(itemstack);
|
byte b0 = getMiniItemCount(itemstack);
|
||||||
|
|
||||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * b0 / 2.0F));
|
||||||
|
|
||||||
for (int kj = 0; kj < b0; ++kj)
|
for (int kj = 0; kj < b0; ++kj)
|
||||||
{
|
{
|
||||||
|
@ -203,7 +204,7 @@ public class RenderBattery extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glColor4f(1, 1, 1, 1.0F);
|
GL11.glColor4f(1, 1, 1, 1.0F);
|
||||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon) icon).getOriginX(), ((Icon) icon).getOriginY(), f12);
|
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, icon.getOriginX(), icon.getOriginY(), f12);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
|
@ -60,11 +60,12 @@ public class RenderEMContractor extends TileEntitySpecialRenderer
|
||||||
this.func_110628_a(TEXTURE_PUSH);
|
this.func_110628_a(TEXTURE_PUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((TileEntityEMContractor)t).canFunction() && !ResonantInduction.proxy.isPaused())
|
if (((TileEntityEMContractor) t).canFunction() && !ResonantInduction.proxy.isPaused())
|
||||||
{
|
{
|
||||||
MODEL_SPIN.render(0.0625f);
|
MODEL_SPIN.render(0.0625f);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
MODEL.render(0.0625f);
|
MODEL.render(0.0625f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
import resonantinduction.contractor.TileEntityEMContractor;
|
|
||||||
import resonantinduction.model.ModelMultimeter;
|
import resonantinduction.model.ModelMultimeter;
|
||||||
import resonantinduction.multimeter.TileEntityMultimeter;
|
import resonantinduction.multimeter.TileEntityMultimeter;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
Loading…
Reference in a new issue