Merge branch 'development'
This commit is contained in:
commit
959505258d
|
@ -14,9 +14,14 @@ Support
|
|||
* Make sure you used the latest Versions even try dev versions.
|
||||
* use Pastebin to make it easier and so we don't have to scroll down a giant wall of text.
|
||||
|
||||
Support
|
||||
======
|
||||
* Make sure you used the latest Versions even try dev versions.
|
||||
* use Pastebin to make it easier and so we don't have to scroll down a giant wall of text.
|
||||
|
||||
### Artist
|
||||
* Archadia
|
||||
* CyanideX
|
||||
|
||||
### License
|
||||
"Resonant Induction" is under the Calclavia Mod License: http://calclavia.com/license/cl
|
||||
"Resonant Induction" is under the Calclavia Mod License: http://calclavia.com/calclavia-mod-license/
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
package resonantinduction.archaic;
|
||||
|
||||
import resonant.lib.render.item.GlobalItemRenderer;
|
||||
import resonantinduction.archaic.fluid.tank.TileTank;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
@Override
|
||||
public void preInit()
|
||||
{
|
||||
GlobalItemRenderer.register(Archaic.blockTank.blockID, TileTank.ItemRenderer.instance);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,18 +9,17 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import resonant.lib.utility.LanguageUtility;
|
||||
import resonantinduction.archaic.Archaic;
|
||||
import resonantinduction.core.grid.fluid.TileFluidDistribution;
|
||||
import universalelectricity.api.energy.UnitDisplay;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
import universalelectricity.api.energy.UnitDisplay.UnitPrefix;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
||||
/** @author Darkguardsman */
|
||||
/**
|
||||
* @author Darkguardsman
|
||||
*/
|
||||
public class ItemBlockTank extends ItemBlock implements IFluidContainerItem
|
||||
{
|
||||
public ItemBlockTank(int id)
|
||||
|
@ -38,11 +37,11 @@ public class ItemBlockTank extends ItemBlock implements IFluidContainerItem
|
|||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||
if (itemStack.getTagCompound() != null && itemStack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
FluidStack fluid = getFluid(stack);
|
||||
FluidStack fluid = getFluid(itemStack);
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package resonantinduction.archaic.fluid.tank;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.PriorityQueue;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import resonant.lib.utility.FluidUtility;
|
||||
import resonantinduction.core.grid.fluid.FluidDistributionetwork;
|
||||
import resonantinduction.core.grid.fluid.IFluidDistribution;
|
||||
|
||||
|
@ -23,52 +26,31 @@ public class TankNetwork extends FluidDistributionetwork
|
|||
public void update()
|
||||
{
|
||||
final FluidStack networkTankFluid = getTank().getFluid();
|
||||
int lowestY = 255;
|
||||
int highestY = 0;
|
||||
int connectorCount = 0;
|
||||
int totalFluid = networkTankFluid != null ? networkTankFluid.amount : 0;
|
||||
|
||||
//If we only have one tank only fill one tank
|
||||
int lowestY = 255, highestY = 0;
|
||||
|
||||
if (getConnectors().size() > 0)
|
||||
{
|
||||
int totalFluid = networkTankFluid != null ? networkTankFluid.amount : 0;
|
||||
|
||||
IFluidDistribution tank = ((IFluidDistribution) getConnectors().toArray()[0]);
|
||||
if (getConnectors().size() == 1)
|
||||
HashMap<Integer, Integer> heightCount = new HashMap();
|
||||
PriorityQueue<IFluidDistribution> heightPriorityQueue = new PriorityQueue(1024, new Comparator()
|
||||
{
|
||||
tank.getInternalTank().setFluid(networkTankFluid);
|
||||
tank.onFluidChanged();
|
||||
needsUpdate = false;
|
||||
return;
|
||||
}
|
||||
if (networkTankFluid != null)
|
||||
@Override
|
||||
public int compare(Object a, Object b)
|
||||
{
|
||||
//If fluid is gaseous fill all tanks equally
|
||||
if (networkTankFluid.getFluid().isGaseous())
|
||||
{
|
||||
connectorCount = this.getConnectors().size();
|
||||
for (IFluidDistribution connector : this.getConnectors())
|
||||
{
|
||||
FluidStack input = networkTankFluid.copy();
|
||||
input.amount = (totalFluid / connectorCount) + (totalFluid % connectorCount);
|
||||
connector.getInternalTank().setFluid(null);
|
||||
totalFluid -= connector.getInternalTank().fill(input, true);
|
||||
connector.onFluidChanged();
|
||||
if (networkTankFluid != null && networkTankFluid.getFluid().isGaseous())
|
||||
return 0;
|
||||
|
||||
if (connectorCount > 0)
|
||||
connectorCount--;
|
||||
TileEntity wa = (TileEntity) a;
|
||||
TileEntity wb = (TileEntity) b;
|
||||
return wa.yCoord - wb.yCoord;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HashMap<Integer, LinkedList<IFluidDistribution>> heightMap = new HashMap<Integer, LinkedList<IFluidDistribution>>();
|
||||
});
|
||||
|
||||
//Build map of all tanks by their y level
|
||||
for (IFluidDistribution connector : this.getConnectors())
|
||||
{
|
||||
if (connector instanceof TileEntity)
|
||||
{
|
||||
LinkedList<IFluidDistribution> list = new LinkedList<IFluidDistribution>();
|
||||
int yCoord = ((TileEntity) connector).yCoord;
|
||||
|
||||
if (yCoord < lowestY)
|
||||
|
@ -81,62 +63,60 @@ public class TankNetwork extends FluidDistributionetwork
|
|||
highestY = yCoord;
|
||||
}
|
||||
|
||||
if (heightMap.containsKey(yCoord))
|
||||
{
|
||||
list = heightMap.get(yCoord);
|
||||
}
|
||||
list.add(connector);
|
||||
heightMap.put(yCoord, list);
|
||||
heightPriorityQueue.add(connector);
|
||||
heightCount.put(yCoord, heightCount.containsKey(yCoord) ? heightCount.get(yCoord) + 1 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
//Loop threw levels
|
||||
for (int yLevel = lowestY; yLevel <= highestY; yLevel++)
|
||||
{
|
||||
if (heightMap.containsKey(yLevel))
|
||||
{
|
||||
connectorCount = heightMap.get(yLevel).size();
|
||||
boolean didChange = false;
|
||||
|
||||
if (connectorCount <= 0)
|
||||
continue;
|
||||
//Loop threw tanks in each level
|
||||
for (IFluidDistribution connector : heightMap.get(yLevel))
|
||||
while (!heightPriorityQueue.isEmpty())
|
||||
{
|
||||
//If tank is empty clear internal and move on
|
||||
IFluidDistribution distributeNode = heightPriorityQueue.poll();
|
||||
int yCoord = ((TileEntity) distributeNode).yCoord;
|
||||
int connectorCount = heightCount.get(yCoord);
|
||||
|
||||
if (totalFluid <= 0)
|
||||
{
|
||||
connector.getInternalTank().setFluid(null);
|
||||
connector.onFluidChanged();
|
||||
distributeNode.getInternalTank().setFluid(null);
|
||||
distributeNode.onFluidChanged();
|
||||
continue;
|
||||
}
|
||||
|
||||
FluidStack input = networkTankFluid.copy();
|
||||
input.amount = (totalFluid / connectorCount) + (totalFluid % connectorCount);
|
||||
connector.getInternalTank().setFluid(null);
|
||||
totalFluid -= connector.getInternalTank().fill(input, true);
|
||||
connector.onFluidChanged();
|
||||
int fluidPer = totalFluid / connectorCount;
|
||||
int deltaFluidAmount = fluidPer - distributeNode.getInternalTank().getFluidAmount();
|
||||
|
||||
int current = distributeNode.getInternalTank().getFluidAmount();
|
||||
|
||||
if (deltaFluidAmount > 0)
|
||||
{
|
||||
int filled = distributeNode.getInternalTank().fill(FluidUtility.getStack(networkTankFluid, deltaFluidAmount), false);
|
||||
distributeNode.getInternalTank().fill(FluidUtility.getStack(networkTankFluid, deltaFluidAmount / 10), true);
|
||||
totalFluid -= current + filled;
|
||||
}
|
||||
else
|
||||
{
|
||||
FluidStack drain = distributeNode.getInternalTank().drain(Math.abs(deltaFluidAmount), false);
|
||||
distributeNode.getInternalTank().drain(Math.abs(deltaFluidAmount / 10), true);
|
||||
|
||||
if (drain != null)
|
||||
totalFluid -= current - drain.amount;
|
||||
}
|
||||
|
||||
if (deltaFluidAmount != 0)
|
||||
didChange = true;
|
||||
|
||||
if (connectorCount > 1)
|
||||
connectorCount--;
|
||||
|
||||
heightCount.put(yCoord, connectorCount);
|
||||
distributeNode.onFluidChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//In the cases the tank is empty just clear all tanks
|
||||
//instead of doing additional logic that is wasting ticks
|
||||
for (IFluidDistribution connector : this.getConnectors())
|
||||
{
|
||||
connector.getInternalTank().setFluid(null);
|
||||
connector.onFluidChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!didChange)
|
||||
needsUpdate = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TankNetwork newInstance()
|
||||
|
|
|
@ -18,13 +18,13 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonant.api.IRemovable.ISneakPickup;
|
||||
import resonant.api.items.ISimpleItemRenderer;
|
||||
import resonant.lib.content.module.TileBlock.IComparatorInputOverride;
|
||||
import resonant.lib.content.module.TileRender;
|
||||
import resonant.lib.render.FluidRenderUtility;
|
||||
import resonant.lib.render.RenderUtility;
|
||||
import resonant.lib.utility.FluidUtility;
|
||||
import resonant.lib.utility.WorldUtility;
|
||||
import resonant.lib.utility.inventory.InventoryUtility;
|
||||
import resonant.lib.utility.render.RenderBlockUtility;
|
||||
import resonantinduction.archaic.Archaic;
|
||||
import resonantinduction.core.Reference;
|
||||
|
@ -36,9 +36,11 @@ import universalelectricity.api.vector.Vector3;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/** Tile/Block class for basic Dynamic tanks
|
||||
/**
|
||||
* Tile/Block class for basic Dynamic tanks
|
||||
*
|
||||
* @author Darkguardsman */
|
||||
* @author Darkguardsman
|
||||
*/
|
||||
public class TileTank extends TileFluidDistribution implements IComparatorInputOverride, ISneakPickup
|
||||
{
|
||||
public static final int VOLUME = 16;
|
||||
|
@ -197,36 +199,79 @@ public class TileTank extends TileFluidDistribution implements IComparatorInputO
|
|||
renderTank(TileTank.this, position.x, position.y, position.z, getInternalTank().getFluid());
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderItem(ItemStack itemStack)
|
||||
public static class ItemRenderer implements ISimpleItemRenderer
|
||||
{
|
||||
public static ItemRenderer instance = new ItemRenderer();
|
||||
|
||||
public void renderTank(double x, double y, double z, FluidStack fluid, int capacity)
|
||||
{
|
||||
FluidTank tank = new FluidTank(fluid, capacity);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glTranslated(0.02, 0.02, 0.02);
|
||||
GL11.glScaled(0.92, 0.92, 0.92);
|
||||
|
||||
if (fluid != null)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (!fluid.getFluid().isGaseous())
|
||||
{
|
||||
double percentageFilled = (double) tank.getFluidAmount() / (double) tank.getCapacity();
|
||||
FluidRenderUtility.renderFluidTesselation(tank, percentageFilled, percentageFilled, percentageFilled, percentageFilled);
|
||||
}
|
||||
else
|
||||
{
|
||||
double filledPercentage = (double) fluid.amount / (double) capacity;
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
Color color = new Color(fluid.getFluid().getColor());
|
||||
RenderUtility.enableBlending();
|
||||
GL11.glColor4d(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, fluid.getFluid().isGaseous() ? filledPercentage : 1);
|
||||
|
||||
RenderUtility.bind(FluidRenderUtility.getFluidSheet(fluid));
|
||||
FluidRenderUtility.renderFluidTesselation(tank, 1, 1, 1, 1);
|
||||
RenderUtility.disableBlending();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventoryItem(ItemStack itemStack)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0.5, 0.5, 0.5);
|
||||
RenderBlockUtility.tessellateBlockWithConnectedTextures(itemStack.getItemDamage(), Archaic.blockTank, null, RenderUtility.getIcon(Reference.PREFIX + "tankEdge"));
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(0, -0.1, 0);
|
||||
|
||||
FluidStack fluid = null;
|
||||
|
||||
if (itemStack.getTagCompound() != null && itemStack.getTagCompound().hasKey("fluid"))
|
||||
{
|
||||
fluid = FluidStack.loadFluidStackFromNBT(itemStack.getTagCompound().getCompoundTag("fluid"));
|
||||
renderTank(0, 0, 0, FluidStack.loadFluidStackFromNBT(itemStack.getTagCompound().getCompoundTag("fluid")), VOLUME * FluidContainerRegistry.BUCKET_VOLUME);
|
||||
}
|
||||
|
||||
renderTank(TileTank.this, 0, 0, 0, fluid);
|
||||
GL11.glPopMatrix();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getRemovedItems(EntityPlayer entity)
|
||||
{
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
List<ItemStack> drops = new ArrayList();
|
||||
|
||||
ItemStack itemStack = new ItemStack(Archaic.blockTank, 1, 0);
|
||||
if (itemStack != null)
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent.Save;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
@ -53,40 +52,38 @@ import resonant.lib.prefab.ore.OreGenerator;
|
|||
import resonant.lib.recipe.UniversalRecipe;
|
||||
import resonant.lib.render.RenderUtility;
|
||||
import resonant.lib.thermal.EventThermal.EventThermalUpdate;
|
||||
import resonant.lib.utility.nbt.NBTUtility;
|
||||
import resonantinduction.atomic.base.ItemCell;
|
||||
import resonantinduction.atomic.fission.BlockUraniumOre;
|
||||
import resonantinduction.atomic.fission.ItemBreederFuel;
|
||||
import resonantinduction.atomic.fission.ItemFissileFuel;
|
||||
import resonantinduction.atomic.fission.ItemRadioactive;
|
||||
import resonantinduction.atomic.fission.ItemUranium;
|
||||
import resonantinduction.atomic.fission.reactor.BlockToxicWaste;
|
||||
import resonantinduction.atomic.fission.reactor.TileControlRod;
|
||||
import resonantinduction.atomic.fission.reactor.TileReactorCell;
|
||||
import resonantinduction.atomic.fusion.BlockPlasmaHeater;
|
||||
import resonantinduction.atomic.fusion.TileElectromagnet;
|
||||
import resonantinduction.atomic.fusion.TilePlasma;
|
||||
import resonantinduction.atomic.fusion.TilePlasmaHeater;
|
||||
import resonantinduction.atomic.particle.accelerator.BlockAccelerator;
|
||||
import resonantinduction.atomic.particle.accelerator.EntityParticle;
|
||||
import resonantinduction.atomic.particle.accelerator.ItemDarkMatter;
|
||||
import resonantinduction.atomic.particle.accelerator.TileAccelerator;
|
||||
import resonantinduction.atomic.particle.fulmination.FulminationHandler;
|
||||
import resonantinduction.atomic.particle.fulmination.ItemAntimatter;
|
||||
import resonantinduction.atomic.particle.fulmination.TileFulmination;
|
||||
import resonantinduction.atomic.particle.quantum.TileQuantumAssembler;
|
||||
import resonantinduction.atomic.process.BlockChemicalExtractor;
|
||||
import resonantinduction.atomic.process.ItemHazmat;
|
||||
import resonantinduction.atomic.process.TileChemicalExtractor;
|
||||
import resonantinduction.atomic.process.fission.BlockCentrifuge;
|
||||
import resonantinduction.atomic.process.fission.BlockNuclearBoiler;
|
||||
import resonantinduction.atomic.process.fission.TileCentrifuge;
|
||||
import resonantinduction.atomic.process.fission.TileNuclearBoiler;
|
||||
import resonantinduction.atomic.process.sensor.TileSiren;
|
||||
import resonantinduction.atomic.process.sensor.TileThermometer;
|
||||
import resonantinduction.atomic.process.turbine.BlockElectricTurbine;
|
||||
import resonantinduction.atomic.process.turbine.TileElectricTurbine;
|
||||
import resonantinduction.atomic.process.turbine.TileFunnel;
|
||||
import resonantinduction.atomic.blocks.BlockToxicWaste;
|
||||
import resonantinduction.atomic.blocks.BlockUraniumOre;
|
||||
import resonantinduction.atomic.blocks.TileElectromagnet;
|
||||
import resonantinduction.atomic.blocks.TileSiren;
|
||||
import resonantinduction.atomic.items.ItemAntimatter;
|
||||
import resonantinduction.atomic.items.ItemBreederFuel;
|
||||
import resonantinduction.atomic.items.ItemCell;
|
||||
import resonantinduction.atomic.items.ItemDarkMatter;
|
||||
import resonantinduction.atomic.items.ItemFissileFuel;
|
||||
import resonantinduction.atomic.items.ItemHazmat;
|
||||
import resonantinduction.atomic.items.ItemRadioactive;
|
||||
import resonantinduction.atomic.items.ItemUranium;
|
||||
import resonantinduction.atomic.machine.accelerator.EntityParticle;
|
||||
import resonantinduction.atomic.machine.accelerator.TileAccelerator;
|
||||
import resonantinduction.atomic.machine.boiler.BlockNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.boiler.TileNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.centrifuge.BlockCentrifuge;
|
||||
import resonantinduction.atomic.machine.centrifuge.TileCentrifuge;
|
||||
import resonantinduction.atomic.machine.extractor.BlockChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.extractor.TileChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.extractor.turbine.BlockElectricTurbine;
|
||||
import resonantinduction.atomic.machine.extractor.turbine.TileElectricTurbine;
|
||||
import resonantinduction.atomic.machine.extractor.turbine.TileFunnel;
|
||||
import resonantinduction.atomic.machine.fulmination.FulminationHandler;
|
||||
import resonantinduction.atomic.machine.fulmination.TileFulmination;
|
||||
import resonantinduction.atomic.machine.plasma.BlockPlasmaHeater;
|
||||
import resonantinduction.atomic.machine.plasma.TilePlasma;
|
||||
import resonantinduction.atomic.machine.plasma.TilePlasmaHeater;
|
||||
import resonantinduction.atomic.machine.quantum.TileQuantumAssembler;
|
||||
import resonantinduction.atomic.machine.reactor.TileControlRod;
|
||||
import resonantinduction.atomic.machine.reactor.TileReactorCell;
|
||||
import resonantinduction.atomic.machine.thermometer.TileThermometer;
|
||||
import resonantinduction.atomic.schematic.SchematicAccelerator;
|
||||
import resonantinduction.atomic.schematic.SchematicBreedingReactor;
|
||||
import resonantinduction.atomic.schematic.SchematicFissionReactor;
|
||||
|
@ -305,7 +302,7 @@ public class Atomic
|
|||
blockElectromagnet = contentRegistry.newBlock(TileElectromagnet.class);
|
||||
blockSiren = contentRegistry.newBlock(TileSiren.class);
|
||||
blockSteamFunnel = contentRegistry.newBlock(TileFunnel.class);
|
||||
blockAccelerator = contentRegistry.createTile(BlockAccelerator.class, TileAccelerator.class);
|
||||
blockAccelerator = contentRegistry.newBlock(TileAccelerator.class);
|
||||
blockFulmination = contentRegistry.newBlock(TileFulmination.class);
|
||||
blockQuantumAssembler = contentRegistry.newBlock(TileQuantumAssembler.class);
|
||||
blockToxicWaste = contentRegistry.createBlock(BlockToxicWaste.class).setCreativeTab(null);
|
||||
|
|
|
@ -7,30 +7,30 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import resonant.lib.render.block.BlockRenderingHandler;
|
||||
import resonantinduction.atomic.fission.reactor.GuiReactorCell;
|
||||
import resonantinduction.atomic.fission.reactor.RenderReactorCell;
|
||||
import resonantinduction.atomic.fission.reactor.TileReactorCell;
|
||||
import resonantinduction.atomic.fusion.RenderPlasmaHeater;
|
||||
import resonantinduction.atomic.fusion.TilePlasmaHeater;
|
||||
import resonantinduction.atomic.particle.accelerator.EntityParticle;
|
||||
import resonantinduction.atomic.particle.accelerator.GuiAccelerator;
|
||||
import resonantinduction.atomic.particle.accelerator.RenderParticle;
|
||||
import resonantinduction.atomic.particle.accelerator.TileAccelerator;
|
||||
import resonantinduction.atomic.particle.quantum.GuiQuantumAssembler;
|
||||
import resonantinduction.atomic.particle.quantum.TileQuantumAssembler;
|
||||
import resonantinduction.atomic.process.RenderChemicalExtractor;
|
||||
import resonantinduction.atomic.process.TileChemicalExtractor;
|
||||
import resonantinduction.atomic.process.fission.GuiCentrifuge;
|
||||
import resonantinduction.atomic.process.fission.GuiChemicalExtractor;
|
||||
import resonantinduction.atomic.process.fission.GuiNuclearBoiler;
|
||||
import resonantinduction.atomic.process.fission.RenderCentrifuge;
|
||||
import resonantinduction.atomic.process.fission.RenderNuclearBoiler;
|
||||
import resonantinduction.atomic.process.fission.TileCentrifuge;
|
||||
import resonantinduction.atomic.process.fission.TileNuclearBoiler;
|
||||
import resonantinduction.atomic.process.sensor.RenderThermometer;
|
||||
import resonantinduction.atomic.process.sensor.TileThermometer;
|
||||
import resonantinduction.atomic.process.turbine.RenderElectricTurbine;
|
||||
import resonantinduction.atomic.process.turbine.TileElectricTurbine;
|
||||
import resonantinduction.atomic.machine.accelerator.EntityParticle;
|
||||
import resonantinduction.atomic.machine.accelerator.GuiAccelerator;
|
||||
import resonantinduction.atomic.machine.accelerator.RenderParticle;
|
||||
import resonantinduction.atomic.machine.accelerator.TileAccelerator;
|
||||
import resonantinduction.atomic.machine.boiler.GuiChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.boiler.GuiNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.boiler.RenderNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.boiler.TileNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.centrifuge.GuiCentrifuge;
|
||||
import resonantinduction.atomic.machine.centrifuge.RenderCentrifuge;
|
||||
import resonantinduction.atomic.machine.centrifuge.TileCentrifuge;
|
||||
import resonantinduction.atomic.machine.extractor.RenderChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.extractor.TileChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.extractor.turbine.RenderElectricTurbine;
|
||||
import resonantinduction.atomic.machine.extractor.turbine.TileElectricTurbine;
|
||||
import resonantinduction.atomic.machine.plasma.RenderPlasmaHeater;
|
||||
import resonantinduction.atomic.machine.plasma.TilePlasmaHeater;
|
||||
import resonantinduction.atomic.machine.quantum.GuiQuantumAssembler;
|
||||
import resonantinduction.atomic.machine.quantum.TileQuantumAssembler;
|
||||
import resonantinduction.atomic.machine.reactor.GuiReactorCell;
|
||||
import resonantinduction.atomic.machine.reactor.RenderReactorCell;
|
||||
import resonantinduction.atomic.machine.reactor.TileReactorCell;
|
||||
import resonantinduction.atomic.machine.thermometer.RenderThermometer;
|
||||
import resonantinduction.atomic.machine.thermometer.TileThermometer;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
|
|
|
@ -4,18 +4,18 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import resonant.lib.prefab.ProxyBase;
|
||||
import resonantinduction.atomic.fission.reactor.ContainerReactorCell;
|
||||
import resonantinduction.atomic.fission.reactor.TileReactorCell;
|
||||
import resonantinduction.atomic.fusion.ContainerNuclearBoiler;
|
||||
import resonantinduction.atomic.particle.accelerator.ContainerAccelerator;
|
||||
import resonantinduction.atomic.particle.accelerator.TileAccelerator;
|
||||
import resonantinduction.atomic.particle.quantum.ContainerQuantumAssembler;
|
||||
import resonantinduction.atomic.particle.quantum.TileQuantumAssembler;
|
||||
import resonantinduction.atomic.process.ContainerChemicalExtractor;
|
||||
import resonantinduction.atomic.process.TileChemicalExtractor;
|
||||
import resonantinduction.atomic.process.fission.ContainerCentrifuge;
|
||||
import resonantinduction.atomic.process.fission.TileCentrifuge;
|
||||
import resonantinduction.atomic.process.fission.TileNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.accelerator.ContainerAccelerator;
|
||||
import resonantinduction.atomic.machine.accelerator.TileAccelerator;
|
||||
import resonantinduction.atomic.machine.boiler.TileNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.centrifuge.ContainerCentrifuge;
|
||||
import resonantinduction.atomic.machine.centrifuge.TileCentrifuge;
|
||||
import resonantinduction.atomic.machine.extractor.ContainerChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.extractor.TileChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.plasma.ContainerNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.quantum.ContainerQuantumAssembler;
|
||||
import resonantinduction.atomic.machine.quantum.TileQuantumAssembler;
|
||||
import resonantinduction.atomic.machine.reactor.ContainerReactorCell;
|
||||
import resonantinduction.atomic.machine.reactor.TileReactorCell;
|
||||
|
||||
public class CommonProxy extends ProxyBase
|
||||
{
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
package resonantinduction.atomic.base;
|
||||
|
||||
import resonant.lib.prefab.item.ItemBase;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
|
||||
public class ItemASBase extends ItemBase
|
||||
{
|
||||
/** Must be called while in mod init phase. */
|
||||
public ItemASBase(int itemID, String name)
|
||||
{
|
||||
super(itemID);
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package resonantinduction.atomic.base;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import resonant.lib.render.EnumColor;
|
||||
import resonant.lib.utility.LanguageUtility;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
|
||||
public class ItemCell extends Item
|
||||
{
|
||||
public ItemCell(int itemID)
|
||||
{
|
||||
super(itemID);
|
||||
setContainerItem(Atomic.itemCell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4)
|
||||
{
|
||||
String tooltip = LanguageUtility.getLocal(getUnlocalizedName(itemStack) + ".tooltip");
|
||||
|
||||
if (tooltip != null && tooltip.length() > 0)
|
||||
{
|
||||
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
list.add(LanguageUtility.getLocal("tooltip.noShift").replace("%0", EnumColor.AQUA.toString()).replace("%1", EnumColor.GREY.toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
list.addAll(LanguageUtility.splitStringPerWord(tooltip, 5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
String localized = LanguageUtility.getLocal(getUnlocalizedName() + "." + itemstack.getItemDamage() + ".name");
|
||||
if (localized != null && !localized.isEmpty())
|
||||
{
|
||||
return getUnlocalizedName() + "." + itemstack.getItemDamage();
|
||||
}
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package resonantinduction.atomic.base;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.TabRI;
|
||||
import universalelectricity.api.UniversalClass;
|
||||
import universalelectricity.api.item.IEnergyItem;
|
||||
import universalelectricity.api.item.ItemElectric;
|
||||
|
||||
@UniversalClass
|
||||
public abstract class ItemElectricAS extends ItemElectric implements IEnergyItem
|
||||
{
|
||||
public ItemElectricAS(int itemID, String name)
|
||||
{
|
||||
super(Settings.CONFIGURATION.getItem(name, itemID).getInt());
|
||||
this.setUnlocalizedName(Reference.PREFIX + name);
|
||||
this.setCreativeTab(TabRI.DEFAULT);
|
||||
this.setTextureName(Reference.PREFIX + name);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission.reactor;
|
||||
package resonantinduction.atomic.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission;
|
||||
package resonantinduction.atomic.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class BlockUraniumOre extends BlockRadioactive
|
|||
this.canSpread = false;
|
||||
this.radius = 1f;
|
||||
this.amplifier = 0;
|
||||
this.spawnParticle = false;
|
||||
this.spawnParticle = true;
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fusion;
|
||||
package resonantinduction.atomic.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package resonantinduction.atomic.process.sensor;
|
||||
package resonantinduction.atomic.blocks;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonant.lib.content.module.TileBlock;
|
||||
import resonantinduction.core.Reference;
|
||||
|
@ -30,32 +31,28 @@ public class TileSiren extends TileBlock
|
|||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (worldObj == null)
|
||||
World world = worldObj;
|
||||
if (world != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int metadata = world.getBlockMetadata(x(), y(), z());
|
||||
|
||||
int metadata = worldObj.getBlockMetadata(x(), y(), z());
|
||||
|
||||
if (worldObj.getBlockPowerInput(x(), y(), z()) > 0)
|
||||
if (world.getBlockPowerInput(x(), y(), z()) > 0)
|
||||
{
|
||||
float volume = 0.5f;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Vector3 check = position().translate(ForgeDirection.getOrientation(i));
|
||||
int blockID = check.getBlockID(worldObj);
|
||||
|
||||
if (blockID == blockID())
|
||||
if (check.getBlockID(world) == blockID())
|
||||
{
|
||||
volume *= 1.5f;
|
||||
}
|
||||
}
|
||||
|
||||
worldObj.playSoundEffect(x(), y(), z(), Reference.PREFIX + "alarm", volume, 1f - 0.18f * (metadata / 15f));
|
||||
world.playSoundEffect(x(), y(), z(), Reference.PREFIX + "alarm", volume, 1f - 0.18f * (metadata / 15f));
|
||||
scheduelTick(30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean configure(EntityPlayer player, int side, Vector3 hit)
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.fulmination;
|
||||
package resonantinduction.atomic.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -19,7 +19,6 @@ import resonant.api.explosion.IExplosion;
|
|||
import resonant.lib.flag.FlagRegistry;
|
||||
import resonant.lib.prefab.poison.PoisonRadiation;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
import resonantinduction.atomic.base.ItemCell;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
|
@ -43,6 +42,8 @@ public class ItemAntimatter extends ItemCell
|
|||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
// Animated Icons
|
||||
//ResonantInduction.LOGGER.info(this.getUnlocalizedName().replace("item.", "") + "_milligram");
|
||||
this.itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().replace("item.", "") + "_milligram");
|
||||
this.iconGram = iconRegister.registerIcon(this.getUnlocalizedName().replace("item.", "") + "_gram");
|
||||
}
|
||||
|
@ -74,7 +75,7 @@ public class ItemAntimatter extends ItemCell
|
|||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
public void baoZhaEvent(ItemExpireEvent evt)
|
||||
public void antimatterExpireEvent(ItemExpireEvent evt)
|
||||
{
|
||||
if (evt.entityItem != null)
|
||||
{
|
||||
|
@ -90,7 +91,7 @@ public class ItemAntimatter extends ItemCell
|
|||
{
|
||||
if (!FlagRegistry.getModFlag(FlagRegistry.DEFAULT_NAME).containsValue(evt.entityItem.worldObj, Atomic.BAN_ANTIMATTER_POWER, "true", new Vector3(evt.entityItem)))
|
||||
{
|
||||
IExplosion explosive = new BzFanWuSu(evt.entity.worldObj, evt.entityItem, evt.entityItem.posX, evt.entityItem.posY, evt.entityItem.posZ, 4, itemStack.getItemDamage());
|
||||
IExplosion explosive = new AntimatterExposion(evt.entity.worldObj, evt.entityItem, evt.entityItem.posX, evt.entityItem.posY, evt.entityItem.posZ, 4, itemStack.getItemDamage());
|
||||
MinecraftForge.EVENT_BUS.post(new DoExplosionEvent(evt.entityItem.worldObj, explosive));
|
||||
evt.entityItem.worldObj.createExplosion(evt.entityItem, evt.entityItem.posX, evt.entityItem.posY, evt.entityItem.posZ, explosive.getRadius(), true);
|
||||
ResonantInduction.LOGGER.fine("Antimatter cell detonated at: " + evt.entityItem.posX + ", " + evt.entityItem.posY + ", " + evt.entityItem.posZ);
|
||||
|
@ -111,11 +112,11 @@ public class ItemAntimatter extends ItemCell
|
|||
}
|
||||
}
|
||||
|
||||
public static class BzFanWuSu extends Explosion implements IExplosion
|
||||
public static class AntimatterExposion extends Explosion implements IExplosion
|
||||
{
|
||||
private int tier;
|
||||
|
||||
public BzFanWuSu(World par1World, Entity par2Entity, double x, double y, double z, float size, int tier)
|
||||
public AntimatterExposion(World par1World, Entity par2Entity, double x, double y, double z, float size, int tier)
|
||||
{
|
||||
super(par1World, par2Entity, x, y, z, size + 2 * tier);
|
||||
this.tier = tier;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission;
|
||||
package resonantinduction.atomic.items;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -0,0 +1,45 @@
|
|||
package resonantinduction.atomic.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import resonant.api.IReactor;
|
||||
import resonant.lib.prefab.item.ItemTooltip;
|
||||
import resonant.lib.utility.LanguageUtility;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
|
||||
public class ItemCell extends ItemTooltip
|
||||
{
|
||||
public ItemCell(int itemID)
|
||||
{
|
||||
super(itemID);
|
||||
setContainerItem(Atomic.itemCell);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldPassSneakingClickToBlock(World world, int x, int y, int z)
|
||||
{
|
||||
return world.getBlockTileEntity(x, y, z) instanceof IReactor;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack)
|
||||
{
|
||||
String localized = LanguageUtility.getLocal(getUnlocalizedName() + "." + itemstack.getItemDamage() + ".name");
|
||||
if (localized != null && !localized.isEmpty())
|
||||
{
|
||||
return getUnlocalizedName() + "." + itemstack.getItemDamage();
|
||||
}
|
||||
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package resonantinduction.atomic.items;
|
||||
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
/** Strange matter cell */
|
||||
public class ItemDarkMatter extends ItemCell
|
||||
{
|
||||
public ItemDarkMatter(int itemID)
|
||||
{
|
||||
super(itemID);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons(IconRegister iconRegister)
|
||||
{
|
||||
// Animated Icon
|
||||
this.itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().replace("item.", ""));
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission;
|
||||
package resonantinduction.atomic.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -11,6 +11,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import resonant.api.IReactor;
|
||||
import resonant.api.IReactorComponent;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
import resonantinduction.atomic.machine.reactor.TileReactorCell;
|
||||
import resonantinduction.core.Settings;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -22,7 +23,7 @@ public class ItemFissileFuel extends ItemRadioactive implements IReactorComponen
|
|||
public static final int DECAY = 2500;
|
||||
|
||||
/** Temperature at which the fuel rod will begin to re-enrich itself. */
|
||||
public static final int BREEDING_TEMP = 1200;
|
||||
public static final int BREEDING_TEMP = 1100;
|
||||
|
||||
/** The energy in one KG of uranium is: 72PJ, 100TJ in one cell of uranium. */
|
||||
public static final long ENERGY = 100000000000L;
|
||||
|
@ -51,7 +52,7 @@ public class ItemFissileFuel extends ItemRadioactive implements IReactorComponen
|
|||
TileEntity tile = checkPos.getTileEntity(worldObj);
|
||||
|
||||
// Check that the other reactors not only exist but also are running.
|
||||
if (tile instanceof IReactor && ((IReactor) tile).getTemperature() > BREEDING_TEMP)
|
||||
if (tile instanceof TileReactorCell && ((TileReactorCell) tile).getTemperature() > BREEDING_TEMP)
|
||||
{
|
||||
reactors++;
|
||||
}
|
||||
|
@ -61,12 +62,15 @@ public class ItemFissileFuel extends ItemRadioactive implements IReactorComponen
|
|||
if (reactors >= 2)
|
||||
{
|
||||
// Begin the process of re-enriching the uranium rod but not consistently.
|
||||
if (worldObj.rand.nextInt(1000) <= 100 && reactor.getTemperature() > BREEDING_TEMP)
|
||||
// Note: The center reactor cell only needs to be half of breeding temperature for this to work.
|
||||
if (worldObj.rand.nextInt(1000) <= 100 && reactor.getTemperature() > (BREEDING_TEMP / 2))
|
||||
{
|
||||
// Cells can regain a random amount of health per tick.
|
||||
int healAmt = worldObj.rand.nextInt(5);
|
||||
itemStack.setItemDamage(Math.max(itemStack.getItemDamage() - healAmt, 0));
|
||||
|
||||
// Determine if this is a completely dead cell (creative menu fission rod is like this).
|
||||
//System.out.println("[Atomic Science] [Reactor Cell] Breeding " + String.valueOf(healAmt) + " back into fissle rod. " + String.valueOf(itemStack.getItemDamage()) + " / " + String.valueOf(itemStack.getMaxDamage()));
|
||||
itemStack.setItemDamage(Math.max(itemStack.getItemDamage() - healAmt, 0));
|
||||
}
|
||||
}
|
||||
else
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process;
|
||||
package resonantinduction.atomic.items;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission;
|
||||
package resonantinduction.atomic.items;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission;
|
||||
package resonantinduction.atomic.items;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.accelerator;
|
||||
package resonantinduction.atomic.machine.accelerator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
@ -1,7 +1,8 @@
|
|||
package resonantinduction.atomic.particle.accelerator;
|
||||
package resonantinduction.atomic.machine.accelerator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -51,9 +52,10 @@ public class EntityParticle extends Entity implements IEntityAdditionalSpawnData
|
|||
this.movementDirection = dir;
|
||||
}
|
||||
|
||||
public static boolean canRenderAcceleratedParticle(World world, Vector3 pos)
|
||||
public static boolean canSpawnParticle(World world, Vector3 pos)
|
||||
{
|
||||
if (pos.getBlockID(world) != 0)
|
||||
Block block = Block.blocksList[pos.getBlockID(world)];
|
||||
if (block != null && !block.isAirBlock(world, pos.intX(), pos.intY(), pos.intZ()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -178,7 +180,7 @@ public class EntityParticle extends Entity implements IEntityAdditionalSpawnData
|
|||
this.lastTurn--;
|
||||
|
||||
/** Checks if the current block condition allows the particle to exist */
|
||||
if (!canRenderAcceleratedParticle(this.worldObj, new Vector3(this)) || this.isCollided)
|
||||
if (!canSpawnParticle(this.worldObj, new Vector3(this)) || this.isCollided)
|
||||
{
|
||||
explode();
|
||||
return;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.accelerator;
|
||||
package resonantinduction.atomic.machine.accelerator;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import resonant.lib.gui.GuiContainerBase;
|
||||
|
@ -29,7 +29,7 @@ public class GuiAccelerator extends GuiContainerBase
|
|||
Vector3 position = new Vector3(this.tileEntity);
|
||||
position.translate(this.tileEntity.getDirection().getOpposite());
|
||||
|
||||
if (!EntityParticle.canRenderAcceleratedParticle(this.tileEntity.worldObj, position))
|
||||
if (!EntityParticle.canSpawnParticle(this.tileEntity.worldObj, position))
|
||||
{
|
||||
status = "\u00a74Fail to emit; try rotating.";
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.accelerator;
|
||||
package resonantinduction.atomic.machine.accelerator;
|
||||
|
||||
import java.util.Random;
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package resonantinduction.atomic.particle.accelerator;
|
||||
package resonantinduction.atomic.machine.accelerator;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
|
@ -13,10 +14,12 @@ import resonant.api.IRotatable;
|
|||
import resonant.lib.network.Synced;
|
||||
import resonant.lib.prefab.tile.TileElectricalInventory;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
import resonantinduction.atomic.particle.fulmination.ItemAntimatter;
|
||||
import resonantinduction.atomic.items.ItemAntimatter;
|
||||
import resonantinduction.atomic.items.ItemDarkMatter;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
import universalelectricity.api.electricity.IVoltageInput;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.energy.IEnergyInterface;
|
||||
|
@ -56,6 +59,7 @@ public class TileAccelerator extends TileElectricalInventory implements IElectro
|
|||
|
||||
public TileAccelerator()
|
||||
{
|
||||
super(UniversalElectricity.machine);
|
||||
energy = new EnergyStorageHandler(energyPerTick * 2, energyPerTick / 20);
|
||||
maxSlots = 4;
|
||||
antiMatterDensityMultiplyer = DENSITY_MULTIPLYER_DEFAULT;
|
||||
|
@ -147,16 +151,16 @@ public class TileAccelerator extends TileElectricalInventory implements IElectro
|
|||
// Creates a accelerated particle if one needs to exist (on world load for example or player login).
|
||||
if (getStackInSlot(0) != null && lastSpawnTick >= 40)
|
||||
{
|
||||
Vector3 spawnAcceleratedParticle = new Vector3(this);
|
||||
spawnAcceleratedParticle.translate(getDirection().getOpposite());
|
||||
spawnAcceleratedParticle.translate(0.5f);
|
||||
Vector3 spawn_vec = new Vector3(this);
|
||||
spawn_vec.translate(getDirection().getOpposite());
|
||||
spawn_vec.translate(0.5f);
|
||||
|
||||
// Only render the particle if container within the proper environment for it.
|
||||
if (EntityParticle.canRenderAcceleratedParticle(worldObj, spawnAcceleratedParticle))
|
||||
if (EntityParticle.canSpawnParticle(worldObj, spawn_vec))
|
||||
{
|
||||
// Spawn the particle.
|
||||
totalEnergyConsumed = 0;
|
||||
entityParticle = new EntityParticle(worldObj, spawnAcceleratedParticle, new Vector3(this), getDirection().getOpposite());
|
||||
entityParticle = new EntityParticle(worldObj, spawn_vec, new Vector3(this), getDirection().getOpposite());
|
||||
worldObj.spawnEntityInWorld(entityParticle);
|
||||
|
||||
// Grabs input block hardness if available, otherwise defaults are used.
|
||||
|
@ -240,6 +244,16 @@ public class TileAccelerator extends TileElectricalInventory implements IElectro
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean use(EntityPlayer player, int side, Vector3 hit)
|
||||
{
|
||||
if (!world().isRemote)
|
||||
{
|
||||
player.openGui(Atomic.INSTANCE, 0, world(), x(), y(), z());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CalculateParticleDensity()
|
||||
{
|
||||
ItemStack itemToAccelerate = this.getStackInSlot(0);
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.boiler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,10 +1,10 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.boiler;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import resonant.lib.gui.GuiContainerBase;
|
||||
import resonantinduction.atomic.process.ContainerChemicalExtractor;
|
||||
import resonantinduction.atomic.process.TileChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.extractor.ContainerChemicalExtractor;
|
||||
import resonantinduction.atomic.machine.extractor.TileChemicalExtractor;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
|
||||
public class GuiChemicalExtractor extends GuiContainerBase
|
|
@ -1,9 +1,9 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.boiler;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import resonant.lib.gui.GuiContainerBase;
|
||||
import resonantinduction.atomic.fusion.ContainerNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.plasma.ContainerNuclearBoiler;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
|
||||
public class GuiNuclearBoiler extends GuiContainerBase
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.boiler;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.boiler;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.centrifuge;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.centrifuge;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
@ -1,8 +1,9 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.centrifuge;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import resonant.lib.gui.GuiContainerBase;
|
||||
import resonantinduction.atomic.machine.boiler.TileNuclearBoiler;
|
||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||
|
||||
public class GuiCentrifuge extends GuiContainerBase
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.centrifuge;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.fission;
|
||||
package resonantinduction.atomic.machine.centrifuge;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process;
|
||||
package resonantinduction.atomic.machine.extractor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process;
|
||||
package resonantinduction.atomic.machine.extractor;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process;
|
||||
package resonantinduction.atomic.machine.extractor;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process;
|
||||
package resonantinduction.atomic.machine.extractor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process;
|
||||
package resonantinduction.atomic.machine.extractor;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.turbine;
|
||||
package resonantinduction.atomic.machine.extractor.turbine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.turbine;
|
||||
package resonantinduction.atomic.machine.extractor.turbine;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.turbine;
|
||||
package resonantinduction.atomic.machine.extractor.turbine;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
@ -41,11 +41,11 @@ public class TileElectricTurbine extends TileTurbine implements IBoilHandler
|
|||
@Override
|
||||
public void playSound()
|
||||
{
|
||||
if (this.worldObj.getWorldTime() % (Atomic.SECOND_IN_TICKS * 1.3F) == 0)
|
||||
if (this.worldObj.getWorldTime() % Atomic.SECOND_IN_TICKS == 0)
|
||||
{
|
||||
double maxVelocity = (getMaxPower() / torque) * 4;
|
||||
float percentage = angularVelocity * 4 / (float) maxVelocity;
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, Reference.PREFIX + "turbine", percentage, 1.0F);
|
||||
float percentage = Math.max(angularVelocity * 4 / (float) maxVelocity, 1.0f);
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, Reference.PREFIX + "turbine", percentage, 1.0f);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.turbine;
|
||||
package resonantinduction.atomic.machine.extractor.turbine;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.fulmination;
|
||||
package resonantinduction.atomic.machine.fulmination;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.fulmination;
|
||||
package resonantinduction.atomic.machine.fulmination;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fusion;
|
||||
package resonantinduction.atomic.machine.plasma;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fusion;
|
||||
package resonantinduction.atomic.machine.plasma;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
@ -9,7 +9,7 @@ import resonant.lib.gui.ContainerBase;
|
|||
import resonant.lib.prefab.slot.SlotEnergyItem;
|
||||
import resonant.lib.prefab.slot.SlotSpecific;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
import resonantinduction.atomic.process.fission.TileNuclearBoiler;
|
||||
import resonantinduction.atomic.machine.boiler.TileNuclearBoiler;
|
||||
|
||||
/** Nuclear boiler container */
|
||||
public class ContainerNuclearBoiler extends ContainerBase
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fusion;
|
||||
package resonantinduction.atomic.machine.plasma;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fusion;
|
||||
package resonantinduction.atomic.machine.plasma;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fusion;
|
||||
package resonantinduction.atomic.machine.plasma;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
@ -29,7 +29,7 @@ import com.google.common.io.ByteArrayDataInput;
|
|||
|
||||
public class TilePlasmaHeater extends TileElectrical implements IPacketReceiver, ITagRender, IFluidHandler
|
||||
{
|
||||
public static long DIAN = 10000000000L;
|
||||
public static long joules = 10000000000L;
|
||||
|
||||
@Config
|
||||
public static int plasmaHeatAmount = 100;
|
||||
|
@ -42,7 +42,7 @@ public class TilePlasmaHeater extends TileElectrical implements IPacketReceiver,
|
|||
|
||||
public TilePlasmaHeater()
|
||||
{
|
||||
energy = new EnergyStorageHandler(DIAN, DIAN / 20);
|
||||
energy = new EnergyStorageHandler(joules, joules / 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,11 +67,14 @@ public class TilePlasmaHeater extends TileElectrical implements IPacketReceiver,
|
|||
{
|
||||
if (energy.checkExtract())
|
||||
{
|
||||
if (tankInputDeuterium.getFluidAmount() >= plasmaHeatAmount && tankInputTritium.getFluidAmount() >= plasmaHeatAmount)
|
||||
// Creates plasma if there is enough Deuterium, Tritium AND Plasma output is not full.
|
||||
if (tankInputDeuterium.getFluidAmount() >= plasmaHeatAmount &&
|
||||
tankInputTritium.getFluidAmount() >= plasmaHeatAmount &&
|
||||
tankOutput.getFluidAmount() < tankOutput.getCapacity())
|
||||
{
|
||||
tankInputDeuterium.drain(plasmaHeatAmount, true);
|
||||
tankInputTritium.drain(plasmaHeatAmount, true);
|
||||
tankOutput.fill(new FluidStack(Atomic.FLUID_PLASMA, plasmaHeatAmount), true);
|
||||
tankOutput.fill(new FluidStack(Atomic.FLUID_PLASMA, tankOutput.getCapacity()), true);
|
||||
energy.extractEnergy();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.quantum;
|
||||
package resonantinduction.atomic.machine.quantum;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.quantum;
|
||||
package resonantinduction.atomic.machine.quantum;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.quantum;
|
||||
package resonantinduction.atomic.machine.quantum;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.particle.quantum;
|
||||
package resonantinduction.atomic.machine.quantum;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission.reactor;
|
||||
package resonantinduction.atomic.machine.reactor;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
|
@ -1,12 +1,12 @@
|
|||
package resonantinduction.atomic.fission.reactor;
|
||||
package resonantinduction.atomic.machine.reactor;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import resonant.lib.gui.ContainerBase;
|
||||
import resonant.lib.prefab.slot.SlotSpecific;
|
||||
import resonantinduction.atomic.fission.ItemBreederFuel;
|
||||
import resonantinduction.atomic.fission.ItemFissileFuel;
|
||||
import resonantinduction.atomic.items.ItemBreederFuel;
|
||||
import resonantinduction.atomic.items.ItemFissileFuel;
|
||||
|
||||
public class ContainerReactorCell extends ContainerBase
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission.reactor;
|
||||
package resonantinduction.atomic.machine.reactor;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission.reactor;
|
||||
package resonantinduction.atomic.machine.reactor;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission.reactor;
|
||||
package resonantinduction.atomic.machine.reactor;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import resonant.lib.content.module.TileBlock;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission.reactor;
|
||||
package resonantinduction.atomic.machine.reactor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -38,7 +38,7 @@ import resonant.lib.thermal.ThermalPhysics;
|
|||
import resonant.lib.utility.inventory.InventoryUtility;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
import resonantinduction.atomic.ReactorExplosion;
|
||||
import resonantinduction.atomic.fusion.TilePlasma;
|
||||
import resonantinduction.atomic.machine.plasma.TilePlasma;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
|
@ -110,15 +110,9 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
|
|||
{
|
||||
TileReactorCell tile = getMultiBlock().get();
|
||||
|
||||
if (!player.isSneaking())
|
||||
if (player.inventory.getCurrentItem() != null)
|
||||
{
|
||||
if (tile.getStackInSlot(0) != null)
|
||||
{
|
||||
InventoryUtility.dropItemStack(world(), new Vector3(player), tile.getStackInSlot(0), 0);
|
||||
tile.setInventorySlotContents(0, null);
|
||||
return true;
|
||||
}
|
||||
else if (player.inventory.getCurrentItem() != null)
|
||||
if (tile.getStackInSlot(0) == null)
|
||||
{
|
||||
if (player.inventory.getCurrentItem().getItem() instanceof IReactorComponent)
|
||||
{
|
||||
|
@ -130,9 +124,17 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (player.isSneaking() && tile.getStackInSlot(0) != null)
|
||||
{
|
||||
InventoryUtility.dropItemStack(world(), new Vector3(player), tile.getStackInSlot(0), 0);
|
||||
tile.setInventorySlotContents(0, null);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.openGui(Atomic.INSTANCE, 0, world(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -214,8 +216,7 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
|
|||
{
|
||||
if (worldObj.rand.nextFloat() > 0.65)
|
||||
{
|
||||
List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class,
|
||||
AxisAlignedBB.getBoundingBox(xCoord - RADIUS * 2, yCoord - RADIUS * 2, zCoord - RADIUS * 2, xCoord + RADIUS * 2, yCoord + RADIUS * 2, zCoord + RADIUS * 2));
|
||||
List<EntityLiving> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(xCoord - RADIUS * 2, yCoord - RADIUS * 2, zCoord - RADIUS * 2, xCoord + RADIUS * 2, yCoord + RADIUS * 2, zCoord + RADIUS * 2));
|
||||
|
||||
for (EntityLiving entity : entities)
|
||||
{
|
||||
|
@ -514,7 +515,8 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, side */
|
||||
/** Returns true if automation can insert the given item in the given slot from the given side.
|
||||
* Args: Slot, item, side */
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack items, int side)
|
||||
{
|
||||
|
@ -583,8 +585,7 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
|
|||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
return new FluidTankInfo[]
|
||||
{ tank.getInfo() };
|
||||
return new FluidTankInfo[] { tank.getInfo() };
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.fission.reactor;
|
||||
package resonantinduction.atomic.machine.reactor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.sensor;
|
||||
package resonantinduction.atomic.machine.thermometer;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.sensor;
|
||||
package resonantinduction.atomic.machine.thermometer;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.atomic.process.sensor;
|
||||
package resonantinduction.atomic.machine.thermometer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package resonantinduction.atomic.particle.accelerator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import resonant.lib.prefab.block.BlockRotatable;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
import universalelectricity.api.UniversalElectricity;
|
||||
|
||||
/** Accelerator block */
|
||||
public class BlockAccelerator extends BlockRotatable
|
||||
{
|
||||
public BlockAccelerator(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int metadata = par1World.getBlockMetadata(x, y, z);
|
||||
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
par5EntityPlayer.openGui(Atomic.INSTANCE, 0, par1World, x, y, z);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileAccelerator();
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package resonantinduction.atomic.particle.accelerator;
|
||||
|
||||
import resonantinduction.atomic.base.ItemCell;
|
||||
|
||||
/** Strange matter cell */
|
||||
public class ItemDarkMatter extends ItemCell
|
||||
{
|
||||
public ItemDarkMatter(int itemID)
|
||||
{
|
||||
super(itemID);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ package resonantinduction.electrical.battery;
|
|||
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glRotatef;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -21,14 +22,16 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import resonant.api.items.ISimpleItemRenderer;
|
||||
import resonant.lib.render.RenderUtility;
|
||||
import resonant.lib.utility.WorldUtility;
|
||||
import resonantinduction.core.Reference;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* @author Calclavia
|
||||
* TODO: Make this more efficient.
|
||||
*
|
||||
* @author Calclavia
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderBattery extends TileEntitySpecialRenderer implements ISimpleItemRenderer
|
||||
|
@ -83,8 +86,8 @@ public class RenderBattery extends TileEntitySpecialRenderer implements ISimpleI
|
|||
int energyLevel = (int) Math.round(((double) tile.getEnergyHandler().getEnergy() / (double) TileBattery.getEnergyForTier(tile.getBlockMetadata())) * 8);
|
||||
RenderUtility.bind(Reference.DOMAIN, Reference.MODEL_PATH + "battery/battery.png");
|
||||
|
||||
List<String> disabledParts = new ArrayList<String>();
|
||||
List<String> enabledParts = new ArrayList<String>();
|
||||
List<String> disabledParts = new ArrayList();
|
||||
List<String> enabledParts = new ArrayList();
|
||||
|
||||
for (ForgeDirection check : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
|
@ -128,6 +131,24 @@ public class RenderBattery extends TileEntitySpecialRenderer implements ISimpleI
|
|||
{
|
||||
GL11.glPushMatrix();
|
||||
RenderUtility.rotateBlockBasedOnDirection(check);
|
||||
|
||||
//TODO: Fix this horrible patch.
|
||||
switch (check)
|
||||
{
|
||||
case NORTH:
|
||||
glRotatef(0, 0, 1, 0);
|
||||
break;
|
||||
case SOUTH:
|
||||
glRotatef(0, 0, 1, 0);
|
||||
break;
|
||||
case WEST:
|
||||
glRotatef(-180, 0, 1, 0);
|
||||
break;
|
||||
case EAST:
|
||||
glRotatef(180, 0, 1, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
GL11.glRotatef(-90, 0, 1, 0);
|
||||
|
||||
int io = tile.getIO(check);
|
||||
|
|
|
@ -62,6 +62,7 @@ public class TileMotor extends TileElectrical implements IRotatable, INodeProvid
|
|||
if (node != null)
|
||||
{
|
||||
node.update(0.05f);
|
||||
|
||||
if (!isInversed)
|
||||
{
|
||||
receiveMechanical();
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import resonant.api.event.LaserEvent;
|
||||
import resonant.api.event.LaserFiredPlayerEvent;
|
||||
import resonant.lib.prefab.vector.RayTraceHelper;
|
||||
import resonant.lib.type.Pair;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
|
@ -120,7 +121,7 @@ public class ItemMiningLaser extends ItemEnergyTool
|
|||
|
||||
if (hit != null)
|
||||
{
|
||||
LaserEvent event = new LaserEvent.LaserFiredPlayerEvent(player, hit, stack);
|
||||
LaserEvent event = new LaserFiredPlayerEvent(player, hit, stack);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (!player.worldObj.isRemote && !event.isCanceled())
|
||||
{
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
package resonantinduction.electrical.laser.gun;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import resonant.api.event.LaserEvent;
|
||||
import resonant.lib.prefab.vector.RayTraceHelper;
|
||||
import resonant.lib.thermal.ThermalGrid;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import universalelectricity.api.item.ItemElectric;
|
||||
import universalelectricity.api.vector.IVector3;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.api.vector.VectorWorld;
|
||||
|
||||
/** Version of the mining laser that uses the thermal grid to melt blocks down
|
||||
*
|
||||
* @author DarkGuardsman */
|
||||
public class ItemThermalLaser extends ItemElectric
|
||||
{
|
||||
long batterySize = 100000;
|
||||
float wattPerShot = 1;
|
||||
float damageToEntities = 3.3f;
|
||||
int blockRange = 50;
|
||||
int firingDelay = 5;
|
||||
int breakTime = 15;
|
||||
boolean createLava = true, setFire = true;
|
||||
|
||||
public ItemThermalLaser(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setUnlocalizedName("MiningLaser");
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(CreativeTabs.tabTools);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack)
|
||||
{
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack)
|
||||
{
|
||||
//TODO change render of the laser too show it slowly over heat, when it over heats eg gets to max use damage the player, and tool
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
|
||||
{
|
||||
if (count > 5)
|
||||
{
|
||||
Vec3 playerPosition = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||
Vec3 playerLook = RayTraceHelper.getLook(player, 1.0f);
|
||||
Vec3 p = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord, playerPosition.yCoord + playerLook.yCoord, playerPosition.zCoord + playerLook.zCoord);
|
||||
|
||||
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * blockRange, playerPosition.yCoord + playerLook.yCoord * blockRange, playerPosition.zCoord + playerLook.zCoord * blockRange);
|
||||
MovingObjectPosition hit = RayTraceHelper.do_rayTraceFromEntity(player, new Vector3().toVec3(), blockRange, true);
|
||||
|
||||
//TODO fix sound
|
||||
if (hit != null)
|
||||
{
|
||||
LaserEvent event = new LaserEvent.LaserFiredPlayerEvent(player, hit, stack);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (!player.worldObj.isRemote && !event.isCanceled())
|
||||
{
|
||||
if (hit.typeOfHit == EnumMovingObjectType.ENTITY && hit.entityHit != null)
|
||||
{
|
||||
//TODO re-implements laser damage source
|
||||
DamageSource damageSource = DamageSource.causeMobDamage(player);
|
||||
hit.entityHit.attackEntityFrom(damageSource, damageToEntities);
|
||||
hit.entityHit.setFire(5);
|
||||
}
|
||||
else if (hit.typeOfHit == EnumMovingObjectType.TILE)
|
||||
{
|
||||
ThermalGrid.addTemperature(new VectorWorld(player.worldObj, hit.blockX, hit.blockY, hit.blockZ), 100f);
|
||||
}
|
||||
|
||||
}
|
||||
playerViewOffset = hit.hitVec;
|
||||
}
|
||||
//TODO make beam brighter the longer it has been used
|
||||
//TODO adjust the laser for the end of the gun
|
||||
float x = (float) (MathHelper.cos((float) (player.rotationYawHead * 0.0174532925)) * (-.4) - MathHelper.sin((float) (player.rotationYawHead * 0.0174532925)) * (-.1));
|
||||
float z = (float) (MathHelper.sin((float) (player.rotationYawHead * 0.0174532925)) * (-.4) + MathHelper.cos((float) (player.rotationYawHead * 0.0174532925)) * (-.1));
|
||||
ResonantInduction.proxy.renderBeam(player.worldObj, (IVector3) new Vector3(p).translate(new Vector3(x, -.25, z)), (IVector3) new Vector3(playerViewOffset), Color.ORANGE, 1);
|
||||
ResonantInduction.proxy.renderBeam(player.worldObj, (IVector3) new Vector3(p).translate(new Vector3(x, -.45, z)), (IVector3) new Vector3(playerViewOffset), Color.ORANGE, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World par2World, EntityPlayer player)
|
||||
{
|
||||
if (player.capabilities.isCreativeMode || this.getEnergy(itemStack) > this.wattPerShot)
|
||||
{
|
||||
player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEnergyCapacity(ItemStack theItem)
|
||||
{
|
||||
return this.batterySize;
|
||||
}
|
||||
|
||||
}
|
|
@ -41,7 +41,7 @@ import resonantinduction.mechanical.process.crusher.TileMechanicalPiston;
|
|||
import resonantinduction.mechanical.process.edit.TileBreaker;
|
||||
import resonantinduction.mechanical.process.edit.TilePlacer;
|
||||
import resonantinduction.mechanical.process.grinder.TileGrindingWheel;
|
||||
import resonantinduction.mechanical.process.purifier.TileMixer;
|
||||
import resonantinduction.mechanical.process.mixer.TileMixer;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
|
|
|
@ -17,28 +17,47 @@ import universalelectricity.api.vector.IVectorWorld;
|
|||
import universalelectricity.api.vector.Vector3;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
||||
/** A mechanical node for mechanical energy.
|
||||
/**
|
||||
* A mechanical node for mechanical energy.
|
||||
*
|
||||
* @author Calclavia, Darkguardsman */
|
||||
* @author Calclavia, Darkguardsman
|
||||
*/
|
||||
public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
|
||||
{
|
||||
/** Is debug enabled for the node */
|
||||
/**
|
||||
* Is debug enabled for the node
|
||||
*/
|
||||
public boolean doDebug = false;
|
||||
/** Used to note that you should trigger a packet update for rotation */
|
||||
/**
|
||||
* Used to note that you should trigger a packet update for rotation
|
||||
*/
|
||||
public boolean markRotationUpdate = false;
|
||||
/** Which section of debug is enabled */
|
||||
public boolean markTorqueUpdate = false;
|
||||
/**
|
||||
* Which section of debug is enabled
|
||||
*/
|
||||
public int debugCue = 0, maxDebugCue = 1, minDebugCue = 0;
|
||||
public static final int UPDATE_DEBUG = 0, CONNECTION_DEBUG = 1;
|
||||
/** Rotational Force */
|
||||
public double torque = 0;
|
||||
/** Rotational speed */
|
||||
/**
|
||||
* Rotational Force
|
||||
*/
|
||||
public double torque = 0, prevTorque;
|
||||
/**
|
||||
* Rotational speed
|
||||
*/
|
||||
public double prevAngularVelocity, angularVelocity = 0;
|
||||
/** Rotational acceleration */
|
||||
/**
|
||||
* Rotational acceleration
|
||||
*/
|
||||
public float acceleration = 2f;
|
||||
|
||||
/** The current rotation of the mechanical node. */
|
||||
/**
|
||||
* The current rotation of the mechanical node.
|
||||
*/
|
||||
public double renderAngle = 0, prev_angle = 0;
|
||||
/** Limits the max distance an object can rotate in a single update */
|
||||
/**
|
||||
* Limits the max distance an object can rotate in a single update
|
||||
*/
|
||||
protected double maxDeltaAngle = Math.toRadians(180);
|
||||
|
||||
protected double load = 2;
|
||||
|
@ -124,30 +143,20 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
|
|||
markRotationUpdate = true;
|
||||
}
|
||||
|
||||
if (Math.abs(prevTorque - torque) > 0.01f)
|
||||
{
|
||||
prevTorque = torque;
|
||||
markTorqueUpdate = true;
|
||||
}
|
||||
|
||||
//-----------------------------------
|
||||
// Loss calculations
|
||||
//-----------------------------------
|
||||
double torqueLoss = Math.min(Math.abs(getTorque()), (Math.abs(getTorque() * getTorqueLoad()) + getTorqueLoad() / 10) * deltaTime);
|
||||
|
||||
if (torque > 0)
|
||||
{
|
||||
torque -= torqueLoss;
|
||||
}
|
||||
else
|
||||
{
|
||||
torque += torqueLoss;
|
||||
}
|
||||
torque += torque > 0 ? -torqueLoss : torqueLoss;
|
||||
|
||||
double velocityLoss = Math.min(Math.abs(getAngularSpeed()), (Math.abs(getAngularSpeed() * getAngularVelocityLoad()) + getAngularVelocityLoad() / 10) * deltaTime);
|
||||
|
||||
if (angularVelocity > 0)
|
||||
{
|
||||
angularVelocity -= velocityLoss;
|
||||
}
|
||||
else
|
||||
{
|
||||
angularVelocity += velocityLoss;
|
||||
}
|
||||
angularVelocity += angularVelocity > 0 ? -velocityLoss : velocityLoss;
|
||||
|
||||
if (getEnergy() <= 0)
|
||||
{
|
||||
|
@ -214,7 +223,9 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
|
|||
|
||||
}
|
||||
|
||||
/** Called when one revolution is made. */
|
||||
/**
|
||||
* Called when one revolution is made.
|
||||
*/
|
||||
protected void revolve()
|
||||
{
|
||||
|
||||
|
@ -251,7 +262,9 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
|
|||
return true;
|
||||
}
|
||||
|
||||
/** The energy percentage loss due to resistance in seconds. */
|
||||
/**
|
||||
* The energy percentage loss due to resistance in seconds.
|
||||
*/
|
||||
public double getTorqueLoad()
|
||||
{
|
||||
return load;
|
||||
|
@ -262,7 +275,9 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
|
|||
return load;
|
||||
}
|
||||
|
||||
/** Checks to see if a connection is allowed from side and from a source */
|
||||
/**
|
||||
* Checks to see if a connection is allowed from side and from a source
|
||||
*/
|
||||
public boolean canConnect(ForgeDirection from, Object source)
|
||||
{
|
||||
if (source instanceof MechanicalNode)
|
||||
|
@ -318,6 +333,8 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
|
|||
|
||||
@Override
|
||||
public void recache()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
getConnections().clear();
|
||||
|
||||
|
@ -340,14 +357,19 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets the node provider for this node */
|
||||
/**
|
||||
* Gets the node provider for this node
|
||||
*/
|
||||
public INodeProvider getParent()
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
/** Sets the node provider for the node */
|
||||
/**
|
||||
* Sets the node provider for the node
|
||||
*/
|
||||
public void setParent(INodeProvider parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
|
@ -378,18 +400,30 @@ public class MechanicalNode implements IMechanicalNode, ISaveObj, IVectorWorld
|
|||
@Override
|
||||
public double z()
|
||||
{
|
||||
if (this.getParent() instanceof TileEntity)
|
||||
{
|
||||
return ((TileEntity) this.getParent()).zCoord;
|
||||
}
|
||||
return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).z() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double x()
|
||||
{
|
||||
if (this.getParent() instanceof TileEntity)
|
||||
{
|
||||
return ((TileEntity) this.getParent()).xCoord;
|
||||
}
|
||||
return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).x() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double y()
|
||||
{
|
||||
if (this.getParent() instanceof TileEntity)
|
||||
{
|
||||
return ((TileEntity) this.getParent()).yCoord;
|
||||
}
|
||||
return this.getParent() instanceof TMultiPart && ((TMultiPart) this.getParent()).tile() != null ? ((TMultiPart) this.getParent()).y() : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
package resonantinduction.mechanical.energy.grid;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Label;
|
||||
import java.awt.Panel;
|
||||
|
||||
import javax.swing.AbstractListModel;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonant.api.grid.INode;
|
||||
import resonant.api.grid.INodeProvider;
|
||||
import resonantinduction.core.debug.FrameNodeDebug;
|
||||
import resonantinduction.core.debug.UpdatePanel;
|
||||
import resonantinduction.core.debug.UpdatedLabel;
|
||||
|
||||
/** Java GUI used to help debug gear information
|
||||
*
|
||||
* @author Darkguardsman */
|
||||
@SuppressWarnings("serial")
|
||||
public class MechanicalNodeFrame extends FrameNodeDebug
|
||||
{
|
||||
JList<String> connectionList_component = null;
|
||||
DefaultListModel<String> connectionList_model = new DefaultListModel<String>();;
|
||||
|
||||
public MechanicalNodeFrame(INodeProvider node)
|
||||
{
|
||||
super(node, MechanicalNode.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTop(UpdatePanel panel)
|
||||
{
|
||||
panel.setLayout(new GridLayout(1, 2, 0, 0));
|
||||
UpdatedLabel tickLabel = new UpdatedLabel("Node: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + MechanicalNodeFrame.this.getNode();
|
||||
}
|
||||
};
|
||||
panel.add(tickLabel);
|
||||
|
||||
UpdatedLabel xLabel = new UpdatedLabel("Parent: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + (MechanicalNodeFrame.this.getNode() != null ? MechanicalNodeFrame.this.getNode().getParent() : "null");
|
||||
}
|
||||
};
|
||||
panel.add(xLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildCenter(UpdatePanel panel)
|
||||
{
|
||||
panel.setLayout(new BorderLayout());
|
||||
TableModel dataModel = new AbstractTableModel()
|
||||
{
|
||||
@Override
|
||||
public int getColumnCount()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column)
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
case 0:
|
||||
return "Direction";
|
||||
case 1:
|
||||
return "Tile";
|
||||
case 2:
|
||||
return "Torque";
|
||||
case 3:
|
||||
return "Speed";
|
||||
}
|
||||
return "---";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount()
|
||||
{
|
||||
if (getNode() != null && getNode().getConnections() != null)
|
||||
{
|
||||
return getNode().getConnections().size();
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int row, int col)
|
||||
{
|
||||
if (getNode() != null && getNode().getConnections() != null)
|
||||
{
|
||||
ForgeDirection dir = (ForgeDirection) getNode().getConnections().values().toArray()[row];
|
||||
MechanicalNode node = (MechanicalNode) getNode().getConnections().keySet().toArray()[row];
|
||||
switch(col)
|
||||
{
|
||||
case 0: return dir;
|
||||
case 1: return node;
|
||||
case 2: return node.getTorque();
|
||||
case 3: return node.getAngularSpeed();
|
||||
}
|
||||
}
|
||||
return "00000";
|
||||
}
|
||||
};
|
||||
JTable table = new JTable(dataModel);
|
||||
table.setAutoCreateRowSorter(true);
|
||||
JScrollPane tableScroll = new JScrollPane(table);
|
||||
Dimension tablePreferred = tableScroll.getPreferredSize();
|
||||
tableScroll.setPreferredSize(new Dimension(tablePreferred.width, tablePreferred.height / 3));
|
||||
|
||||
panel.add(tableScroll, BorderLayout.SOUTH);
|
||||
|
||||
UpdatePanel topPanel = new UpdatePanel();
|
||||
topPanel.setLayout(new GridLayout(1, 3, 0, 0));
|
||||
|
||||
UpdatedLabel velLabel = new UpdatedLabel("Vel: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + MechanicalNodeFrame.this.getNode().angularVelocity;
|
||||
}
|
||||
};
|
||||
topPanel.add(velLabel);
|
||||
|
||||
UpdatedLabel angleLabel = new UpdatedLabel("Angle: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + MechanicalNodeFrame.this.getNode().renderAngle;
|
||||
}
|
||||
};
|
||||
topPanel.add(angleLabel);
|
||||
|
||||
UpdatedLabel torqueLabel = new UpdatedLabel("Torque: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + MechanicalNodeFrame.this.getNode().torque;
|
||||
}
|
||||
};
|
||||
topPanel.add(torqueLabel);
|
||||
panel.add(topPanel, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MechanicalNode getNode()
|
||||
{
|
||||
INode node = super.getNode();
|
||||
if (node instanceof MechanicalNode)
|
||||
{
|
||||
return (MechanicalNode) node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonant.api.grid.INode;
|
||||
import resonant.api.grid.INodeProvider;
|
||||
import resonant.core.ResonantEngine;
|
||||
import resonantinduction.mechanical.gear.GearDebugFrame;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
|
@ -32,7 +31,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
/** Packets */
|
||||
boolean markPacketUpdate = false;
|
||||
/** Simple debug external GUI */
|
||||
GearDebugFrame frame = null;
|
||||
MechanicalNodeFrame frame = null;
|
||||
|
||||
/** Side of the block this is placed on */
|
||||
public ForgeDirection placementSide = ForgeDirection.UNKNOWN;
|
||||
|
@ -55,7 +54,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
}
|
||||
|
||||
//Make sure to update on both sides
|
||||
this.node.update(0.05f);
|
||||
this.node.update();
|
||||
|
||||
if (!world().isRemote)
|
||||
{
|
||||
|
@ -83,7 +82,7 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu
|
|||
//Opens a debug GUI
|
||||
if (frame == null)
|
||||
{
|
||||
frame = new GearDebugFrame(this);
|
||||
frame = new MechanicalNodeFrame(this);
|
||||
frame.showDebugFrame();
|
||||
} //Closes the debug GUI
|
||||
else
|
||||
|
|
|
@ -1,30 +1,43 @@
|
|||
package resonantinduction.mechanical.energy.grid;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonant.api.grid.INode;
|
||||
import resonant.api.grid.INodeProvider;
|
||||
import resonant.core.ResonantEngine;
|
||||
import resonant.lib.References;
|
||||
import resonant.lib.content.module.TileBase;
|
||||
import resonant.lib.network.IPacketReceiver;
|
||||
import resonant.lib.network.IPacketReceiverWithID;
|
||||
import resonant.lib.network.PacketHandler;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
/** Prefab for mechanical tiles
|
||||
*
|
||||
* @author Calclavia */
|
||||
public abstract class TileMechanical extends TileBase implements INodeProvider, IPacketReceiver
|
||||
public abstract class TileMechanical extends TileBase implements INodeProvider, IPacketReceiverWithID
|
||||
{
|
||||
protected static final int PACKET_VELOCITY = Mechanical.contentRegistry.getNextPacketID();
|
||||
protected static final int PACKET_NBT = 0;
|
||||
protected static final int PACKET_VELOCITY = 1;
|
||||
|
||||
/** Node that handles most mechanical actions */
|
||||
public MechanicalNode mechanicalNode;
|
||||
|
||||
/** External debug GUI */
|
||||
MechanicalNodeFrame frame = null;
|
||||
|
||||
@Deprecated
|
||||
public TileMechanical()
|
||||
{
|
||||
|
@ -34,7 +47,7 @@ public abstract class TileMechanical extends TileBase implements INodeProvider,
|
|||
public TileMechanical(Material material)
|
||||
{
|
||||
super(material);
|
||||
mechanicalNode = new MechanicalNode(this).setLoad(0.5f);
|
||||
this.mechanicalNode = new MechanicalNode(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,12 +69,59 @@ public abstract class TileMechanical extends TileBase implements INodeProvider,
|
|||
{
|
||||
super.updateEntity();
|
||||
mechanicalNode.update();
|
||||
if (mechanicalNode.markRotationUpdate && ticks % 10 == 0)
|
||||
|
||||
if(frame != null)
|
||||
{
|
||||
frame.update();
|
||||
if(!frame.isVisible())
|
||||
{
|
||||
frame.dispose();
|
||||
frame = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.getWorldObj().isRemote)
|
||||
{
|
||||
if (ticks % 3 == 0 && (mechanicalNode.markTorqueUpdate || mechanicalNode.markRotationUpdate))
|
||||
{
|
||||
//ResonantInduction.LOGGER.info("[mechanicalNode] Sending Update");
|
||||
sendRotationPacket();
|
||||
mechanicalNode.markRotationUpdate = false;
|
||||
mechanicalNode.markTorqueUpdate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean use(EntityPlayer player, int side, Vector3 hit)
|
||||
{
|
||||
ItemStack itemStack = player.getHeldItem();
|
||||
if (ResonantEngine.runningAsDev)
|
||||
{
|
||||
if (itemStack != null && !world().isRemote)
|
||||
{
|
||||
if (itemStack.getItem().itemID == Item.stick.itemID)
|
||||
{
|
||||
//Set the nodes debug mode
|
||||
if (ControlKeyModifer.isControlDown(player))
|
||||
{
|
||||
//Opens a debug GUI
|
||||
if (frame == null)
|
||||
{
|
||||
frame = new MechanicalNodeFrame(this);
|
||||
frame.showDebugFrame();
|
||||
} //Closes the debug GUI
|
||||
else
|
||||
{
|
||||
frame.closeDebugFrame();
|
||||
frame = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
|
@ -71,21 +131,45 @@ public abstract class TileMechanical extends TileBase implements INodeProvider,
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return References.PACKET_TILE.getPacketWithID(PACKET_NBT, this, tag);
|
||||
}
|
||||
|
||||
private void sendRotationPacket()
|
||||
{
|
||||
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, PACKET_VELOCITY, mechanicalNode.angularVelocity), worldObj, new Vector3(this), 20);
|
||||
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacketWithID(PACKET_VELOCITY, this, mechanicalNode.angularVelocity, mechanicalNode.torque), worldObj, new Vector3(this), 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
public boolean onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
onReceivePacket(data.readInt(), data, player, extra);
|
||||
try
|
||||
{
|
||||
if (world().isRemote)
|
||||
{
|
||||
if (id == PACKET_NBT)
|
||||
{
|
||||
readFromNBT(PacketHandler.readNBTTagCompound(data));
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
else if (id == PACKET_VELOCITY)
|
||||
{
|
||||
if (id == PACKET_VELOCITY)
|
||||
mechanicalNode.angularVelocity = data.readDouble();
|
||||
mechanicalNode.torque = data.readDouble();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import resonant.api.items.ISimpleItemRenderer;
|
||||
import resonant.lib.render.RenderUtility;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -30,13 +31,33 @@ public class RenderWaterTurbine extends TileEntitySpecialRenderer implements ISi
|
|||
GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Determine if the turbine is facing horizontally or vertical.
|
||||
RenderUtility.rotateBlockBasedOnDirectionUp(tile.getDirection());
|
||||
GL11.glRotatef((float) Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 1, 0);
|
||||
|
||||
// Get the rotation directly from the mechanical node running client side.
|
||||
double mechanicalNodeRenderAngle = tile.mechanicalNode.renderAngle;
|
||||
|
||||
// We need to convert this value into something the model renderer can understand.
|
||||
// Note: Check for NaN and if so then just defaults to zero.
|
||||
float renderAngleInDegrees = 0;
|
||||
if (!Double.isNaN(mechanicalNodeRenderAngle))
|
||||
{
|
||||
renderAngleInDegrees = (float) Math.toDegrees(mechanicalNodeRenderAngle);
|
||||
}
|
||||
|
||||
// Call to actually rotate the gear model to the specified degree.
|
||||
GL11.glRotatef(renderAngleInDegrees, 0, 1, 0);
|
||||
//ResonantInduction.LOGGER.info("[RenderWaterTurbine] Render Angle: " + renderAngleInDegrees);
|
||||
|
||||
// Determine what type of water turbine model we need to use based on orientation.
|
||||
if (tile.getDirection().offsetY != 0)
|
||||
{
|
||||
renderWaterTurbine(tile.tier, tile.multiBlockRadius, tile.getMultiBlock().isConstructed());
|
||||
}
|
||||
else
|
||||
{
|
||||
renderWaterWheel(tile.tier, tile.multiBlockRadius, tile.getMultiBlock().isConstructed());
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopMatrix();
|
||||
|
|
|
@ -32,7 +32,8 @@ public class RenderWindTurbine extends TileEntitySpecialRenderer implements ISim
|
|||
|
||||
RenderUtility.rotateBlockBasedOnDirectionUp(tile.getDirection());
|
||||
|
||||
GL11.glTranslatef(0, -0.35f, 0);
|
||||
GL11.glTranslatef(0, 0.35f, 0);
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
GL11.glRotatef((float) Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 1, 0);
|
||||
|
||||
render(tile.tier, tile.multiBlockRadius, tile.getMultiBlock().isConstructed());
|
||||
|
|
|
@ -1,35 +1,23 @@
|
|||
package resonantinduction.mechanical.energy.turbine;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonant.api.grid.INode;
|
||||
import resonant.api.grid.INodeProvider;
|
||||
import resonant.lib.References;
|
||||
import resonant.lib.content.module.TileBase;
|
||||
import resonant.lib.multiblock.IMultiBlockStructure;
|
||||
import resonant.lib.network.IPacketReceiverWithID;
|
||||
import resonant.lib.network.PacketHandler;
|
||||
import resonant.lib.network.Synced;
|
||||
import resonant.lib.network.Synced.SyncedInput;
|
||||
import resonant.lib.network.Synced.SyncedOutput;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.TileMechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/** Reduced version of the main turbine class */
|
||||
public class TileTurbine extends TileBase implements IMultiBlockStructure<TileTurbine>, INodeProvider, IPacketReceiverWithID
|
||||
public class TileTurbine extends TileMechanical implements IMultiBlockStructure<TileTurbine>, INodeProvider, IPacketReceiverWithID
|
||||
{
|
||||
/** Tier of the tile */
|
||||
public int tier = 0;
|
||||
|
@ -44,9 +32,9 @@ public class TileTurbine extends TileBase implements IMultiBlockStructure<TileTu
|
|||
public long power = 0;
|
||||
|
||||
protected final long defaultTorque = 5000;
|
||||
protected double prevAngularVelocity = 0;
|
||||
/** Node that handles most of the mechanical connections */
|
||||
protected MechanicalNode mechanicalNode;
|
||||
|
||||
/** MutliBlock methods. */
|
||||
private TurbineMBlockHandler multiBlock;
|
||||
|
||||
public TileTurbine()
|
||||
{
|
||||
|
@ -54,23 +42,10 @@ public class TileTurbine extends TileBase implements IMultiBlockStructure<TileTu
|
|||
mechanicalNode = new TurbineNode(this);
|
||||
}
|
||||
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
return ForgeDirection.getOrientation(getBlockMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
mechanicalNode.reconstruct();
|
||||
super.initiate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
mechanicalNode.update();
|
||||
getMultiBlock().update();
|
||||
|
||||
if (getMultiBlock().isPrimary())
|
||||
|
@ -79,12 +54,6 @@ public class TileTurbine extends TileBase implements IMultiBlockStructure<TileTu
|
|||
{
|
||||
/** Set angular velocity based on power and torque. */
|
||||
mechanicalNode.angularVelocity = (float) ((double) power / mechanicalNode.torque);
|
||||
|
||||
if (ticks % 3 == 0 && prevAngularVelocity != mechanicalNode.angularVelocity)
|
||||
{
|
||||
sendPowerUpdate();
|
||||
prevAngularVelocity = mechanicalNode.angularVelocity;
|
||||
}
|
||||
}
|
||||
|
||||
if (mechanicalNode.angularVelocity != 0)
|
||||
|
@ -118,40 +87,23 @@ public class TileTurbine extends TileBase implements IMultiBlockStructure<TileTu
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return References.PACKET_TILE.getPacketWithID(0, this, tag);
|
||||
}
|
||||
|
||||
public void sendPowerUpdate()
|
||||
{
|
||||
References.PACKET_TILE.getPacketWithID(1, this, this.mechanicalNode.angularVelocity);
|
||||
}
|
||||
|
||||
/** Reads a tile entity from NBT. */
|
||||
@Override
|
||||
@SyncedInput
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.readFromNBT(nbt);
|
||||
multiBlockRadius = nbt.getInteger("multiBlockRadius");
|
||||
tier = nbt.getInteger("tier");
|
||||
mechanicalNode.load(nbt);
|
||||
getMultiBlock().load(nbt);
|
||||
}
|
||||
|
||||
/** Writes a tile entity to NBT. */
|
||||
@Override
|
||||
@SyncedOutput
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("multiBlockRadius", multiBlockRadius);
|
||||
nbt.setInteger("tier", tier);
|
||||
mechanicalNode.save(nbt);
|
||||
getMultiBlock().save(nbt);
|
||||
}
|
||||
|
||||
|
@ -162,9 +114,6 @@ public class TileTurbine extends TileBase implements IMultiBlockStructure<TileTu
|
|||
return AxisAlignedBB.getAABBPool().getAABB(this.xCoord - multiBlockRadius, this.yCoord - multiBlockRadius, this.zCoord - multiBlockRadius, this.xCoord + 1 + multiBlockRadius, this.yCoord + 1 + multiBlockRadius, this.zCoord + 1 + multiBlockRadius);
|
||||
}
|
||||
|
||||
/** MutliBlock methods. */
|
||||
private TurbineMBlockHandler multiBlock;
|
||||
|
||||
@Override
|
||||
public Vector3[] getMultiBlockVectors()
|
||||
{
|
||||
|
@ -216,44 +165,4 @@ public class TileTurbine extends TileBase implements IMultiBlockStructure<TileTu
|
|||
{
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
|
||||
{
|
||||
if (nodeType.isAssignableFrom(mechanicalNode.getClass()))
|
||||
return ((TileTurbine) getMultiBlock().get()).mechanicalNode;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
mechanicalNode.deconstruct();
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onReceivePacket(int id, ByteArrayDataInput data, EntityPlayer player, Object... extra)
|
||||
{
|
||||
if (world().isRemote)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
readFromNBT(PacketHandler.readNBTTagCompound(data));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (id == 1)
|
||||
{
|
||||
this.mechanicalNode.angularVelocity = data.readDouble();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,14 +9,15 @@ import net.minecraft.util.Vec3;
|
|||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonant.api.grid.INodeProvider;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
/**
|
||||
* The vertical wind turbine collects airflow.
|
||||
* The horizontal wind turbine collects steam from steam power plants.
|
||||
* The vertical water turbine collects flowing water flowing on X axis.
|
||||
* The horizontal water turbine collects flowing water on Z axis.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
|
@ -56,9 +57,13 @@ public class TileWaterTurbine extends TileTurbine
|
|||
public void updateEntity()
|
||||
{
|
||||
if (getMultiBlock().isConstructed())
|
||||
{
|
||||
mechanicalNode.torque = (long) (defaultTorque / (1d / multiBlockRadius));
|
||||
}
|
||||
else
|
||||
{
|
||||
mechanicalNode.torque = defaultTorque / 12;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is a horizontal turbine.
|
||||
|
@ -108,12 +113,21 @@ public class TileWaterTurbine extends TileTurbine
|
|||
Vector3 vector = new Vector3((Vec3) m.invoke(Block.waterMoving, worldObj, check.intX(), check.intY(), check.intZ()));
|
||||
|
||||
if ((currentDir.offsetZ > 0 && vector.x < 0) || (currentDir.offsetZ < 0 && vector.x > 0) || (currentDir.offsetX > 0 && vector.z > 0) || (currentDir.offsetX < 0 && vector.z < 0))
|
||||
{
|
||||
mechanicalNode.torque = -mechanicalNode.torque;
|
||||
}
|
||||
|
||||
if (getDirection().offsetX != 0)
|
||||
{
|
||||
getMultiBlock().get().power += Math.abs(getWaterPower() * vector.z * (7 - metadata) / 7f);
|
||||
powerTicks = 20;
|
||||
}
|
||||
|
||||
if (getDirection().offsetZ != 0)
|
||||
{
|
||||
getMultiBlock().get().power += Math.abs(getWaterPower() * vector.x * (7 - metadata) / 7f);
|
||||
powerTicks = 20;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -23,7 +23,6 @@ public class TileWindTurbine extends TileTurbine
|
|||
private long windPower = 0;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
|
|
|
@ -4,9 +4,12 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonantinduction.core.interfaces.IMechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
|
||||
/** Turbine's Mechanical node
|
||||
/**
|
||||
* Turbine's Mechanical node
|
||||
* Turbines always face forward and connect from behind.
|
||||
*
|
||||
* @author Calclavia, Darkguardsman */
|
||||
* @author Calclavia, Darkguardsman
|
||||
*/
|
||||
public class TurbineNode extends MechanicalNode
|
||||
{
|
||||
public TurbineNode(TileTurbine tileTurbineBase)
|
||||
|
@ -22,7 +25,7 @@ public class TurbineNode extends MechanicalNode
|
|||
@Override
|
||||
public boolean canConnect(ForgeDirection from, Object source)
|
||||
{
|
||||
return source instanceof MechanicalNode && !(source instanceof TurbineNode) && from == turbine().getDirection().getOpposite();
|
||||
return turbine().getMultiBlock().isPrimary() && source instanceof MechanicalNode && !(source instanceof TurbineNode) && from == turbine().getDirection().getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package resonantinduction.mechanical.fluid.pipe;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
@ -12,6 +15,7 @@ import net.minecraftforge.fluids.FluidTank;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonant.api.grid.INode;
|
||||
import resonant.core.ResonantEngine;
|
||||
import resonant.lib.type.EvictingList;
|
||||
import resonant.lib.utility.WorldUtility;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
|
@ -19,12 +23,14 @@ import resonantinduction.core.grid.fluid.FluidPressureNode;
|
|||
import resonantinduction.core.grid.fluid.IPressureNodeProvider;
|
||||
import resonantinduction.core.prefab.part.PartFramedNode;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNodeFrame;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.IconTransformation;
|
||||
import codechicken.lib.render.RenderUtils;
|
||||
import codechicken.lib.vec.Translation;
|
||||
import codechicken.microblock.IHollowConnect;
|
||||
import codechicken.multipart.ControlKeyModifer;
|
||||
import codechicken.multipart.JNormalOcclusion;
|
||||
import codechicken.multipart.TSlottedPart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
@ -39,6 +45,7 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode
|
|||
/** Computes the average fluid for client to render. */
|
||||
private EvictingList<Integer> averageTankData = new EvictingList<Integer>(20);
|
||||
private boolean markPacket = true;
|
||||
private PipeNodeFrame frame = null;
|
||||
|
||||
public PartPipe()
|
||||
{
|
||||
|
@ -82,6 +89,11 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode
|
|||
sendFluidUpdate();
|
||||
markPacket = false;
|
||||
}
|
||||
|
||||
if (frame != null)
|
||||
{
|
||||
frame.update();
|
||||
}
|
||||
}
|
||||
|
||||
/** Sends fluid level to the client to be used in the renderer */
|
||||
|
@ -220,4 +232,44 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, FluidPressureNode
|
|||
public void onFluidChanged()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack itemStack)
|
||||
{
|
||||
if (ResonantEngine.runningAsDev)
|
||||
{
|
||||
if (itemStack != null && !world().isRemote)
|
||||
{
|
||||
if (itemStack.getItem().itemID == Item.stick.itemID)
|
||||
{
|
||||
//Set the nodes debug mode
|
||||
if (ControlKeyModifer.isControlDown(player))
|
||||
{
|
||||
//Opens a debug GUI
|
||||
if (frame == null)
|
||||
{
|
||||
frame = new PipeNodeFrame(this);
|
||||
frame.showDebugFrame();
|
||||
} //Closes the debug GUI
|
||||
else
|
||||
{
|
||||
frame.closeDebugFrame();
|
||||
frame = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.activate(player, hit, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWorldSeparate()
|
||||
{
|
||||
super.onWorldSeparate();
|
||||
if (frame != null)
|
||||
{
|
||||
frame.closeDebugFrame();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
package resonantinduction.mechanical.fluid.pipe;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonant.api.grid.INode;
|
||||
import resonant.api.grid.INodeProvider;
|
||||
import resonantinduction.core.debug.FrameNodeDebug;
|
||||
import resonantinduction.core.debug.UpdatePanel;
|
||||
import resonantinduction.core.debug.UpdatedLabel;
|
||||
|
||||
/** Java GUI used to help debug pipe information
|
||||
*
|
||||
* @author Darkguardsman */
|
||||
@SuppressWarnings("serial")
|
||||
public class PipeNodeFrame extends FrameNodeDebug
|
||||
{
|
||||
public PipeNodeFrame(INodeProvider node)
|
||||
{
|
||||
super(node, PipePressureNode.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTop(UpdatePanel panel)
|
||||
{
|
||||
panel.setLayout(new GridLayout(1, 2, 0, 0));
|
||||
UpdatedLabel tickLabel = new UpdatedLabel("Node: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + PipeNodeFrame.this.getNode();
|
||||
}
|
||||
};
|
||||
panel.add(tickLabel);
|
||||
|
||||
UpdatedLabel xLabel = new UpdatedLabel("Parent: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + (PipeNodeFrame.this.getNode() != null ? PipeNodeFrame.this.getNode().pipe() : "null");
|
||||
}
|
||||
};
|
||||
panel.add(xLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildCenter(UpdatePanel panel)
|
||||
{
|
||||
panel.setLayout(new BorderLayout());
|
||||
TableModel dataModel = new AbstractTableModel()
|
||||
{
|
||||
@Override
|
||||
public int getColumnCount()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int column)
|
||||
{
|
||||
switch (column)
|
||||
{
|
||||
case 0:
|
||||
return "Direction";
|
||||
case 1:
|
||||
return "Tile";
|
||||
case 2:
|
||||
return "Pressure";
|
||||
}
|
||||
return "---";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount()
|
||||
{
|
||||
if (getNode() != null && getNode().getConnections() != null)
|
||||
{
|
||||
return getNode().getConnections().size();
|
||||
}
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int row, int col)
|
||||
{
|
||||
if (getNode() != null && getNode().getConnections() != null)
|
||||
{
|
||||
ForgeDirection dir = (ForgeDirection) getNode().getConnections().values().toArray()[row];
|
||||
switch (col)
|
||||
{
|
||||
case 0:
|
||||
return dir;
|
||||
case 1:
|
||||
return getNode().getConnections().keySet().toArray()[row];
|
||||
case 2:
|
||||
return getNode().getPressure(dir);
|
||||
}
|
||||
}
|
||||
return "00000";
|
||||
}
|
||||
};
|
||||
JTable table = new JTable(dataModel);
|
||||
table.setAutoCreateRowSorter(true);
|
||||
JScrollPane tableScroll = new JScrollPane(table);
|
||||
Dimension tablePreferred = tableScroll.getPreferredSize();
|
||||
tableScroll.setPreferredSize(new Dimension(tablePreferred.width, tablePreferred.height / 3));
|
||||
|
||||
panel.add(tableScroll, BorderLayout.SOUTH);
|
||||
|
||||
UpdatePanel topPanel = new UpdatePanel();
|
||||
topPanel.setLayout(new GridLayout(1, 2, 0, 0));
|
||||
UpdatedLabel velLabel = new UpdatedLabel("Fluid: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + PipeNodeFrame.this.getNode().pipe().tank.getFluid();
|
||||
}
|
||||
};
|
||||
topPanel.add(velLabel);
|
||||
|
||||
UpdatedLabel angleLabel = new UpdatedLabel("Volume: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + PipeNodeFrame.this.getNode().pipe().tank.getFluidAmount() + "mb";
|
||||
}
|
||||
};
|
||||
topPanel.add(angleLabel);
|
||||
panel.add(topPanel, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PipePressureNode getNode()
|
||||
{
|
||||
INode node = super.getNode();
|
||||
if (node instanceof PipePressureNode)
|
||||
{
|
||||
return (PipePressureNode) node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -103,4 +103,10 @@ public class PipePressureNode extends FluidPressureNode
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.getClass().getSimpleName() + this.hashCode();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,192 +0,0 @@
|
|||
package resonantinduction.mechanical.gear;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Frame;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Label;
|
||||
import java.awt.Panel;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.PartMechanical;
|
||||
|
||||
/** Java GUI used to help debug gear information
|
||||
*
|
||||
* @author Darkguardsman */
|
||||
@SuppressWarnings("serial")
|
||||
public class GearDebugFrame extends Frame implements ActionListener
|
||||
{
|
||||
List<UpdatedLabel> dataLabels = new ArrayList<UpdatedLabel>();
|
||||
Label[] connections = new Label[20];
|
||||
|
||||
long tick = 0;
|
||||
PartMechanical part = null;
|
||||
|
||||
public GearDebugFrame(PartMechanical part)
|
||||
{
|
||||
this.part = part;
|
||||
setLayout(new BorderLayout());
|
||||
setBackground(Color.LIGHT_GRAY);
|
||||
|
||||
//Top bar
|
||||
Panel topPanel = new Panel(new GridLayout(1, 4, 0, 0));
|
||||
|
||||
UpdatedLabel tickLabel = new UpdatedLabel("Tick: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + tick;
|
||||
}
|
||||
};
|
||||
dataLabels.add(tickLabel);
|
||||
topPanel.add(tickLabel);
|
||||
|
||||
UpdatedLabel xLabel = new UpdatedLabel("X: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + GearDebugFrame.this.part.x();
|
||||
}
|
||||
};
|
||||
dataLabels.add(xLabel);
|
||||
topPanel.add(xLabel);
|
||||
|
||||
UpdatedLabel yLabel = new UpdatedLabel("Y: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + GearDebugFrame.this.part.y();
|
||||
}
|
||||
};
|
||||
topPanel.add(yLabel);
|
||||
dataLabels.add(yLabel);
|
||||
|
||||
UpdatedLabel zLabel = new UpdatedLabel("Z: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + GearDebugFrame.this.part.z();
|
||||
}
|
||||
};
|
||||
topPanel.add(zLabel);
|
||||
dataLabels.add(zLabel);
|
||||
|
||||
add(topPanel, BorderLayout.NORTH);
|
||||
|
||||
//Middle bar
|
||||
Panel middlePanel = new Panel(new GridLayout(3, 1, 0, 0));
|
||||
|
||||
UpdatedLabel velLabel = new UpdatedLabel("Vel: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + GearDebugFrame.this.part.node.angularVelocity;
|
||||
}
|
||||
};
|
||||
dataLabels.add(velLabel);
|
||||
middlePanel.add(velLabel);
|
||||
|
||||
UpdatedLabel angleLabel = new UpdatedLabel("Angle: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + GearDebugFrame.this.part.node.renderAngle;
|
||||
}
|
||||
};
|
||||
dataLabels.add(angleLabel);
|
||||
middlePanel.add(angleLabel);
|
||||
|
||||
UpdatedLabel torqueLabel = new UpdatedLabel("Torque: ")
|
||||
{
|
||||
@Override
|
||||
public String buildLabel()
|
||||
{
|
||||
return super.buildLabel() + GearDebugFrame.this.part.node.torque;
|
||||
}
|
||||
};
|
||||
dataLabels.add(torqueLabel);
|
||||
middlePanel.add(torqueLabel);
|
||||
|
||||
add(middlePanel, BorderLayout.CENTER);
|
||||
|
||||
Panel connectionPanel = new Panel(new GridLayout(this.connections.length / 4, 4, 0, 0));
|
||||
for (int i = 0; i < connections.length; i++)
|
||||
{
|
||||
this.connections[i] = new Label("Connection" + i + ": ----");
|
||||
connectionPanel.add(connections[i]);
|
||||
}
|
||||
add(connectionPanel, BorderLayout.SOUTH);
|
||||
|
||||
//exit icon handler
|
||||
addWindowListener(new WindowAdapter()
|
||||
{
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
Frame f = (Frame) e.getSource();
|
||||
f.setVisible(false);
|
||||
f.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Called each cpu cycle */
|
||||
public void update()
|
||||
{
|
||||
tick++;
|
||||
if (this.part != null)
|
||||
{
|
||||
for (UpdatedLabel label : dataLabels)
|
||||
{
|
||||
label.update();
|
||||
}
|
||||
int c = 0;
|
||||
for (Entry<MechanicalNode, ForgeDirection> entry : part.node.getConnections().entrySet())
|
||||
{
|
||||
if (entry.getKey() != null)
|
||||
{
|
||||
this.connections[c].setText("Connection" + c + ": " + entry.getKey());
|
||||
c++;
|
||||
}
|
||||
}
|
||||
for (int i = c; i < connections.length; i++)
|
||||
{
|
||||
this.connections[i].setText("Connection" + i + ": NONE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Shows the frame */
|
||||
public void showDebugFrame()
|
||||
{
|
||||
setTitle("Resonant Engine Debug Window");
|
||||
setBounds(200, 200, 450, 600);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
/** Hides the frame and tells it to die off */
|
||||
public void closeDebugFrame()
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -10,9 +10,11 @@ import codechicken.lib.vec.Rotation;
|
|||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
/** Node for the gear
|
||||
/**
|
||||
* Node for the gear
|
||||
*
|
||||
* @author Calclavia, Edited by: Darkguardsman */
|
||||
* @author Calclavia, Edited by: Darkguardsman
|
||||
*/
|
||||
public class GearNode extends MechanicalNode
|
||||
{
|
||||
public GearNode(PartGear parent)
|
||||
|
@ -80,6 +82,8 @@ public class GearNode extends MechanicalNode
|
|||
|
||||
@Override
|
||||
public void recache()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
getConnections().clear();
|
||||
|
||||
|
@ -152,12 +156,15 @@ public class GearNode extends MechanicalNode
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Can this gear be connected BY the source?
|
||||
/**
|
||||
* Can this gear be connected BY the source?
|
||||
*
|
||||
* @param from - Direction source is coming from.
|
||||
* @param with - The source of the connection.
|
||||
* @return True is so. */
|
||||
* @return True is so.
|
||||
*/
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection from, Object with)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ import resonant.api.grid.INodeProvider;
|
|||
import resonantinduction.core.interfaces.IMechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.gear.PartGear;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
||||
public class GearShaftNode extends MechanicalNode
|
||||
{
|
||||
|
@ -41,6 +42,8 @@ public class GearShaftNode extends MechanicalNode
|
|||
|
||||
@Override
|
||||
public void recache()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
getConnections().clear();
|
||||
List<ForgeDirection> dirs = new ArrayList<ForgeDirection>();
|
||||
|
@ -72,7 +75,7 @@ public class GearShaftNode extends MechanicalNode
|
|||
{
|
||||
if (!getConnections().containsValue(checkDir) && (checkDir == shaft().placementSide || checkDir == shaft().placementSide.getOpposite()))
|
||||
{
|
||||
TileEntity checkTile = new universalelectricity.api.vector.Vector3(shaft().tile()).translate(checkDir).getTileEntity(world());
|
||||
TileEntity checkTile = new Vector3(shaft().tile()).translate(checkDir).getTileEntity(world());
|
||||
|
||||
if (checkTile instanceof INodeProvider)
|
||||
{
|
||||
|
@ -87,6 +90,7 @@ public class GearShaftNode extends MechanicalNode
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection from, Object source)
|
||||
|
|
|
@ -33,6 +33,9 @@ public class RenderMechanicalPiston extends TileEntitySpecialRenderer
|
|||
|
||||
if (tile.worldObj != null)
|
||||
{
|
||||
if (tile.getDirection() != ForgeDirection.UP && tile.getDirection() != ForgeDirection.DOWN)
|
||||
RenderUtility.rotateBlockBasedOnDirection(tile.getDirection().getOpposite());
|
||||
else
|
||||
RenderUtility.rotateBlockBasedOnDirection(tile.getDirection());
|
||||
}
|
||||
|
||||
|
@ -43,17 +46,13 @@ public class RenderMechanicalPiston extends TileEntitySpecialRenderer
|
|||
final String[] staticParts = { "baseRing", "leg1", "leg2", "leg3", "leg4", "connector", "basePlate", "basePlateTop", "connectorBar", "centerPiston" };
|
||||
final String[] shaftParts = { "topPlate", "outerPiston" };
|
||||
|
||||
/**
|
||||
* Render Piston Rotor
|
||||
*/
|
||||
/** Render Piston Rotor */
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(-Math.toDegrees(angle), 0, 0, 1);
|
||||
MODEL.renderAllExcept(ArrayUtils.addAll(shaftParts, staticParts));
|
||||
GL11.glPopMatrix();
|
||||
|
||||
/**
|
||||
* Render Piston Shaft
|
||||
*/
|
||||
/** Render Piston Shaft */
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (tile.worldObj != null)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package resonantinduction.mechanical.process.crusher;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -19,15 +19,17 @@ import resonantinduction.core.ResonantInduction;
|
|||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.TileMechanical;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
||||
{
|
||||
@Config
|
||||
@Config(comment = "Outdated, not used anymore. use mechanicalPistonMultiplier as its based on block hardness now")
|
||||
@Deprecated
|
||||
private static int mechanicalPistonBreakCount = 5;
|
||||
|
||||
private int breakCount = mechanicalPistonBreakCount;
|
||||
@Config
|
||||
private static int mechanicalPistonMultiplier = 2;
|
||||
|
||||
private boolean markRevolve = false;
|
||||
|
||||
|
@ -74,9 +76,11 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
|||
Vector3 moveNewPosition = movePosition.clone().translate(getDirection());
|
||||
|
||||
if (canMove(movePosition, moveNewPosition))
|
||||
{
|
||||
move(movePosition, moveNewPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
markRevolve = false;
|
||||
}
|
||||
|
@ -88,6 +92,9 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
|||
|
||||
if (block != null)
|
||||
{
|
||||
int breakCount = (int) (mechanicalPistonMultiplier * block.blockHardness);
|
||||
final int startBreakCount = breakCount;
|
||||
|
||||
ItemStack blockStack = new ItemStack(block);
|
||||
RecipeResource[] resources = MachineRecipes.INSTANCE.getOutput(ResonantInduction.RecipeType.CRUSHER.name(), blockStack);
|
||||
|
||||
|
@ -95,12 +102,11 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
|||
{
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
int breakStatus = (int) (((float) (mechanicalPistonBreakCount - breakCount) / (float) mechanicalPistonBreakCount) * 10f);
|
||||
int breakStatus = (int) (((float) (startBreakCount - breakCount) / (float) startBreakCount) * 10f);
|
||||
world().destroyBlockInWorldPartially(0, blockPos.intX(), blockPos.intY(), blockPos.intZ(), breakStatus);
|
||||
ResonantInduction.LOGGER.info("[Mechanical Piston] Break Count: " + breakCount);
|
||||
|
||||
if (breakCount <= 0)
|
||||
{
|
||||
if (!world().isRemote)
|
||||
if (breakCount >= mechanicalPistonMultiplier)
|
||||
{
|
||||
for (RecipeResource recipe : resources)
|
||||
{
|
||||
|
@ -112,9 +118,6 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
|||
|
||||
getWorldObj().destroyBlock(blockPos.intX(), blockPos.intY(), blockPos.intZ(), false);
|
||||
}
|
||||
|
||||
breakCount = mechanicalPistonBreakCount;
|
||||
}
|
||||
}
|
||||
|
||||
ResonantInduction.proxy.renderBlockParticle(worldObj, blockPos.clone().translate(0.5), new Vector3((Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3), block.blockID, 1);
|
||||
|
@ -123,10 +126,11 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
|||
}
|
||||
}
|
||||
|
||||
breakCount = mechanicalPistonBreakCount;
|
||||
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
world().destroyBlockInWorldPartially(0, blockPos.intX(), blockPos.intY(), blockPos.intZ(), -1);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -174,9 +178,7 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
|||
|
||||
if (tileEntity != null && tileData != null)
|
||||
{
|
||||
/**
|
||||
* Forge Multipart Support. Use FMP's custom TE creator.
|
||||
*/
|
||||
/** Forge Multipart Support. Use FMP's custom TE creator. */
|
||||
boolean isMultipart = tileData.getString("id").equals("savedMultipart");
|
||||
|
||||
TileEntity newTile = null;
|
||||
|
@ -238,9 +240,7 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
|
|||
{
|
||||
if (Loader.isModLoaded("BuildCraft|Factory"))
|
||||
{
|
||||
/**
|
||||
* Special quarry compatibility code.
|
||||
*/
|
||||
/** Special quarry compatibility code. */
|
||||
try
|
||||
{
|
||||
Class clazz = Class.forName("buildcraft.factory.TileQuarry");
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package resonantinduction.mechanical.process.grinder;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.interfaces.IMechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
|
||||
/** Node just for the grinder
|
||||
*
|
||||
* @author Darkguardsman */
|
||||
public class GrinderNode extends MechanicalNode
|
||||
{
|
||||
public GrinderNode(TileGrindingWheel parent)
|
||||
{
|
||||
super(parent);
|
||||
}
|
||||
|
||||
public TileGrindingWheel grider()
|
||||
{
|
||||
return (TileGrindingWheel) getParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection from, Object source)
|
||||
{
|
||||
if(grider().getDirection() == ForgeDirection.UP || grider().getDirection() == ForgeDirection.DOWN)
|
||||
{
|
||||
return grider().getDirection() == from || grider().getDirection().getOpposite() == from;
|
||||
}
|
||||
return grider().getDirection() != from && grider().getDirection().getOpposite() != from;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inverseRotation(ForgeDirection dir, IMechanicalNode with)
|
||||
{
|
||||
return !(dir.offsetX > 0 || dir.offsetZ < 0 || dir.offsetY < 0);
|
||||
}
|
||||
}
|
|
@ -34,7 +34,7 @@ public class RenderGrindingWheel extends TileEntitySpecialRenderer
|
|||
glTranslatef((float) x + 0.5F, (float) y + 0.5f, (float) z + 0.5F);
|
||||
glScalef(0.51f, 0.5f, 0.5f);
|
||||
ForgeDirection dir = tile.getDirection();
|
||||
dir = ForgeDirection.getOrientation(!(dir.ordinal() % 2 == 0) ? dir.ordinal() - 1 : dir.ordinal());
|
||||
//dir = ForgeDirection.getOrientation(!(dir.ordinal() % 2 == 0) ? dir.ordinal() - 1 : dir.ordinal());
|
||||
RenderUtility.rotateBlockBasedOnDirection(dir);
|
||||
glRotatef((float) Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 0, 1);
|
||||
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png");
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import resonant.api.IRotatable;
|
||||
import resonant.api.recipe.MachineRecipes;
|
||||
import resonant.api.recipe.RecipeResource;
|
||||
import resonant.lib.prefab.CustomDamageSource;
|
||||
import resonant.lib.prefab.vector.Cuboid;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
|
@ -22,43 +23,24 @@ import universalelectricity.api.vector.Vector3;
|
|||
|
||||
/**
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class TileGrindingWheel extends TileMechanical implements IRotatable
|
||||
{
|
||||
public static final int PROCESS_TIME = 20 * 20;
|
||||
/** A map of ItemStacks and their remaining grind-time left. */
|
||||
public static final Timer<EntityItem> timer = new Timer<EntityItem>();
|
||||
/**
|
||||
* A map of ItemStacks and their remaining grind-time left.
|
||||
*/
|
||||
public static final Timer<EntityItem> timer = new Timer();
|
||||
|
||||
public EntityItem grindingItem = null;
|
||||
|
||||
private final long requiredTorque = 1000;
|
||||
private final long requiredTorque = 250;
|
||||
private double counter = 0;
|
||||
|
||||
public TileGrindingWheel()
|
||||
{
|
||||
super(Material.rock);
|
||||
|
||||
mechanicalNode = new MechanicalNode(this)
|
||||
{
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection from, Object source)
|
||||
{
|
||||
if (getDirection().ordinal() < 2)
|
||||
{
|
||||
return from.offsetY != 0;
|
||||
}
|
||||
|
||||
return getDirection().getRotation(ForgeDirection.UP) == from || getDirection().getRotation(ForgeDirection.DOWN) == from;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inverseRotation(ForgeDirection dir, IMechanicalNode with)
|
||||
{
|
||||
return !(dir.offsetX > 0 || dir.offsetZ < 0 || dir.offsetY < 0);
|
||||
}
|
||||
}.setLoad(2);
|
||||
|
||||
mechanicalNode = new GrinderNode(this).setLoad(2);
|
||||
bounds = new Cuboid(0.05f, 0.05f, 0.05f, 0.95f, 0.95f, 0.95f);
|
||||
isOpaqueCube = false;
|
||||
normalRender = false;
|
||||
|
@ -67,6 +49,14 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
|
|||
textureName = "material_steel_dark";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
counter = Math.max(counter + Math.abs(mechanicalNode.torque), 0);
|
||||
doWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collide(Entity entity)
|
||||
{
|
||||
|
@ -98,7 +88,7 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
|
|||
}
|
||||
else
|
||||
{
|
||||
entity.attackEntityFrom(DamageSource.cactus, 2);
|
||||
entity.attackEntityFrom(new CustomDamageSource("grinder", this), 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -109,16 +99,23 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
|
|||
ForgeDirection dir = getDirection();
|
||||
dir = ForgeDirection.getOrientation(!(dir.ordinal() % 2 == 0) ? dir.ordinal() - 1 : dir.ordinal()).getOpposite();
|
||||
double speed = mechanicalNode.getAngularSpeed() / 20;
|
||||
entity.addVelocity(dir.offsetX * speed, Math.random() * speed, dir.offsetZ * speed);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
double speedX = dir.offsetX * speed;
|
||||
double speedZ = dir.offsetZ * speed;
|
||||
double speedY = Math.random() * speed;
|
||||
if (Math.abs(speedX) > 1)
|
||||
{
|
||||
super.updateEntity();
|
||||
counter = Math.max(counter + mechanicalNode.torque, 0);
|
||||
doWork();
|
||||
speedX = speedX > 0 ? 1 : -1;
|
||||
}
|
||||
if (Math.abs(speedZ) > 1)
|
||||
{
|
||||
speedZ = speedZ > 0 ? 1 : -1;
|
||||
}
|
||||
if (Math.abs(speedZ) > 1)
|
||||
{
|
||||
speedY = speedY > 0 ? 1 : -1;
|
||||
}
|
||||
entity.addVelocity(speedX, speedY, speedZ);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package resonantinduction.mechanical.process.mixer;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonant.api.grid.INodeProvider;
|
||||
import resonantinduction.core.interfaces.IMechanicalNode;
|
||||
import resonantinduction.mechanical.energy.grid.MechanicalNode;
|
||||
|
||||
public class MixerNode extends MechanicalNode
|
||||
{
|
||||
|
||||
public MixerNode(INodeProvider parent)
|
||||
{
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inverseRotation(ForgeDirection dir, IMechanicalNode with)
|
||||
{
|
||||
return dir == ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.mechanical.process.purifier;
|
||||
package resonantinduction.mechanical.process.mixer;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
|
@ -1,4 +1,4 @@
|
|||
package resonantinduction.mechanical.process.purifier;
|
||||
package resonantinduction.mechanical.process.mixer;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
@ -41,17 +41,7 @@ public class TileMixer extends TileMechanical implements IInventory
|
|||
public TileMixer()
|
||||
{
|
||||
super(Material.iron);
|
||||
|
||||
mechanicalNode = new MechanicalNode(this)
|
||||
{
|
||||
@Override
|
||||
public boolean inverseRotation(ForgeDirection dir, IMechanicalNode with)
|
||||
{
|
||||
return dir == ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
}.setConnection(Byte.parseByte("000011", 2));
|
||||
|
||||
mechanicalNode = new MixerNode(this).setConnection(Byte.parseByte("000011", 2));
|
||||
isOpaqueCube = false;
|
||||
normalRender = false;
|
||||
customItemRender = true;
|
|
@ -49,8 +49,8 @@ item.resonantinduction\:handCrank.name=Hand Crank
|
|||
item.resonantinduction\:devStaff.name=Staff of Devs
|
||||
item.resonantinduction\:flour.name=Flour
|
||||
item.dough.name=Dough
|
||||
|
||||
|
||||
item.resonantinduction\:laserDrill.name=Laser Drill
|
||||
item.resonantinduction\:biomass.name=Biomass
|
||||
|
||||
## Machines
|
||||
tile.resonantinduction\:castingMold.name=Casting Mold
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue