More updating to 1.7.10 aka error hunting

This commit is contained in:
Robert S 2014-08-11 08:13:27 -04:00
parent d1e1f47441
commit c09d9af837
63 changed files with 570 additions and 777 deletions

View file

@ -2,6 +2,7 @@ package resonantinduction.archaic.process;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
@ -17,7 +18,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class RenderCastingMold extends TileEntitySpecialRenderer
{
public static RenderCastingMold INSTANCE = new RenderCastingMold();
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "castingMold.tcn");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(), Reference.modelDirectory() + "castingMold.tcn"));
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float var8)
@ -30,11 +31,11 @@ public class RenderCastingMold extends TileEntitySpecialRenderer
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
GL11.glTranslated(0, -0.25, 0);
GL11.glScalef(0.5f, 0.5f, 0.5f);
RenderUtility.bind(Reference.DOMAIN, Reference.MODEL_PATH + "castingMold.png");
RenderUtility.bind(Reference.domain(), Reference.modelPath() + "castingMold.png");
MODEL.renderAll();
GL11.glPopMatrix();
if (tile.worldObj != null)
if (tile.getWorldObj() != null)
RenderItemOverlayUtility.renderItemOnSides(tileEntity, tile.getStackInSlot(0), x, y, z, "");
}
}

View file

@ -14,6 +14,8 @@ import resonantinduction.core.{Reference, ResonantTab}
*/
object AtomicContent extends ContentHolder
{
manager.setTab(ResonantTab).setPrefix(Reference.prefix)
/** Block and Items */
@ -50,6 +52,7 @@ object AtomicContent extends ContentHolder
var itemHazmatBody: Item = null
var itemHazmatLeggings: Item = null
var itemHazmatBoots: Item = null
val itemQuantumGlyph: Item = null
/** Water, Uranium Hexafluoride, Steam, Deuterium, Toxic waste */
var FLUIDSTACK_WATER: FluidStack = null

View file

@ -29,12 +29,11 @@ import net.minecraft.tileentity.TileEntity
import net.minecraft.world.World
import cpw.mods.fml.client.registry.ClientRegistry
import cpw.mods.fml.client.registry.RenderingRegistry
import resonantinduction.electrical.em.laser.BlockRenderingHandler
import resonantinduction.mechanical.turbine.{TileElectricTurbine, RenderElectricTurbine}
class ClientProxy extends CommonProxy {
override def preInit {
RenderingRegistry.registerBlockHandler(BlockRenderingHandler)
//RenderingRegistry.registerBlockHandler(BlockRenderingHandler)
}
override def getArmorIndex(armor: String): Int = {
@ -63,7 +62,7 @@ class ClientProxy extends CommonProxy {
return new GuiChemicalExtractor(player.inventory, (tileEntity.asInstanceOf[TileChemicalExtractor]))
}
else if (tileEntity.isInstanceOf[TileAccelerator]) {
return new GuiAccelerator(player.inventory, (tileEntity.asInstanceOf[TileAccelerator]))
return new GuiAccelerator(player, (tileEntity.asInstanceOf[TileAccelerator]))
}
else if (tileEntity.isInstanceOf[TileQuantumAssembler]) {
return new GuiQuantumAssembler(player.inventory, (tileEntity.asInstanceOf[TileQuantumAssembler]))

View file

@ -14,7 +14,7 @@ import net.minecraft.tileentity.TileEntity
import net.minecraft.util.{ChatComponentText, MovingObjectPosition}
import resonant.api.blocks.IBlockFrequency
import resonant.api.mffs.fortron.FrequencyGridRegistry
import resonantinduction.electrical.ElectricalContent
import resonantinduction.atomic.AtomicContent
import universalelectricity.core.transform.vector.VectorWorld
import scala.collection.JavaConversions._
@ -118,21 +118,21 @@ class PartQuantumGlyph extends JCuboidPart with TSlottedPart with JNormalOcclusi
return new Cuboid6(0, 0, 0, 0.5, 0.5, 0.5)
}
override def getOcclusionBoxes: Iterable[codechicken.lib.vec.Cuboid6] = return Array[Cuboid6](getBounds)
override def getOcclusionBoxes: Array[codechicken.lib.vec.Cuboid6] = return Array[Cuboid6](getBounds)
def getSlotMask: Int = {
return 1 << slot
}
protected def getItem: ItemStack = {
return new ItemStack(ElectricalContent.itemQuantumGlyph, 1, number)
return new ItemStack(AtomicContent.itemQuantumGlyph, 1, number)
}
override def getDrops: Iterable[net.minecraft.item.ItemStack] = {
override def getDrops: Array[ItemStack] = {
super.getDrops
val drops: Array[ItemStack] = new Array[ItemStack](1)
drops(0) = getItem
return wrapRefArray(drops)
return drops
}
override def pickItem(hit: MovingObjectPosition): ItemStack = {

View file

@ -12,6 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import resonant.api.IReactor;
import resonant.api.IReactorComponent;
import resonantinduction.atomic.AtomicContent;
import resonantinduction.atomic.machine.reactor.TileReactorCell;
import resonantinduction.core.Settings;
import universalelectricity.core.transform.vector.Vector3;
@ -86,7 +87,7 @@ public class ItemFissileFuel extends ItemRadioactive implements IReactorComponen
// Create toxic waste.
if (Settings.allowToxicWaste() && worldObj.rand.nextFloat() > 0.5)
{
FluidStack fluid = Atomic.FLUIDSTACK_TOXIC_WASTE.copy();
FluidStack fluid = AtomicContent.FLUIDSTACK_TOXIC_WASTE().copy();
fluid.amount = 1;
reactor.fill(ForgeDirection.UNKNOWN, fluid, true);
}

View file

@ -19,7 +19,7 @@ public class ItemHazmat extends ItemArmor implements IAntiPoisonArmor
public static final ItemArmor.ArmorMaterial hazmatArmorMaterial = EnumHelper.addArmorMaterial("HAZMAT", 0, new int[]{0, 0, 0, 0}, 0);
public ItemHazmat(String name, int slot)
{
super(hazmatArmorMaterial, Atomic.proxy.getArmorIndex("hazmat"), slot);
super(hazmatArmorMaterial, Atomic.proxy().getArmorIndex("hazmat"), slot);
this.setUnlocalizedName(Reference.prefix() + name);
this.setCreativeTab(ResonantTab.tab());
this.setMaxDamage(200000);

View file

@ -9,6 +9,7 @@ import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;
import resonant.lib.gui.ContainerBase;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
/** Accelerator container */
public class ContainerAccelerator extends ContainerBase
@ -42,7 +43,7 @@ public class ContainerAccelerator extends ContainerBase
if (par1 > 2)
{
if (itemStack.getItem() == Atomic.itemCell)
if (itemStack.getItem() == AtomicContent.itemCell())
{
if (!this.mergeItemStack(itemStack, 1, 2, false))
{

View file

@ -109,7 +109,7 @@ public class EntityParticle extends Entity implements IEntityAdditionalSpawnData
if (this.updateTicket == null)
{
this.updateTicket = ForgeChunkManager.requestTicket(Atomic.INSTANCE, this.worldObj, Type.ENTITY);
this.updateTicket = ForgeChunkManager.requestTicket(Atomic.INSTANCE(), this.worldObj, Type.ENTITY);
this.updateTicket.getModData();
this.updateTicket.bindEntity(this);
}
@ -225,11 +225,14 @@ public class EntityParticle extends Entity implements IEntityAdditionalSpawnData
* @return The new velocity. */
private double turn()
{
ForgeDirection zuoFangXiang = VectorHelper.getOrientationFromSide(this.movementDirection, ForgeDirection.EAST);
int[][] RELATIVE_MATRIX = { { 3, 2, 1, 0, 5, 4 }, { 4, 5, 0, 1, 2, 3 }, { 0, 1, 3, 2, 4, 5 }, { 0, 1, 2, 3, 5, 4 }, { 0, 1, 5, 4, 3, 2 }, { 0, 1, 4, 5, 2, 3 } };
ForgeDirection zuoFangXiang = ForgeDirection.getOrientation(RELATIVE_MATRIX[this.movementDirection.ordinal()][ForgeDirection.EAST.ordinal()]);
Vector3 zuoBian = new Vector3(this).floor();
zuoBian.add(zuoFangXiang);
ForgeDirection youFangXiang = VectorHelper.getOrientationFromSide(this.movementDirection, ForgeDirection.WEST);
ForgeDirection youFangXiang = ForgeDirection.getOrientation(RELATIVE_MATRIX[this.movementDirection.ordinal()][ForgeDirection.WEST.ordinal()]);
Vector3 youBian = new Vector3(this).floor();
youBian.add(youFangXiang);

View file

@ -1,5 +1,6 @@
package resonantinduction.atomic.machine.accelerator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import resonant.lib.gui.GuiContainerBase;
import universalelectricity.api.UnitDisplay;
@ -12,9 +13,9 @@ public class GuiAccelerator extends GuiContainerBase
private int containerWidth;
private int containerHeight;
public GuiAccelerator(InventoryPlayer par1InventoryPlayer, TileAccelerator tileEntity)
public GuiAccelerator(EntityPlayer player, TileAccelerator tileEntity)
{
super(new ContainerAccelerator(par1InventoryPlayer, tileEntity));
super(new ContainerAccelerator(player, tileEntity));
this.tileEntity = tileEntity;
}

View file

@ -6,6 +6,7 @@ import resonant.engine.ResonantEngine;
import resonant.lib.network.discriminator.PacketAnnotation;
import resonant.lib.utility.BlockUtility;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import resonantinduction.atomic.items.ItemAntimatter;
import resonantinduction.atomic.items.ItemDarkMatter;
import net.minecraft.block.Block;
@ -86,7 +87,7 @@ public class TileAccelerator extends TileElectricInventory implements IElectroma
if (getStackInSlot(2) != null)
{
// Increase the existing amount of anti-matter if stack already exists.
if (getStackInSlot(2).getItem() == Atomic.itemAntimatter)
if (getStackInSlot(2).getItem() == AtomicContent.itemAntimatter())
{
ItemStack newStack = getStackInSlot(2).copy();
if (newStack.stackSize < newStack.getMaxStackSize())
@ -106,7 +107,7 @@ public class TileAccelerator extends TileElectricInventory implements IElectroma
// Remove some of the internal reserves of anti-matter and use it to craft an individual item.
antimatter -= 125;
decrStackSize(1, 1);
setInventorySlotContents(2, new ItemStack(Atomic.itemAntimatter));
setInventorySlotContents(2, new ItemStack(AtomicContent.itemAntimatter()));
}
}
}
@ -152,7 +153,7 @@ public class TileAccelerator extends TileElectricInventory implements IElectroma
{
if (worldObj.rand.nextFloat() <= Settings.darkMatterSpawnChance())
{
incrStackSize(3, new ItemStack(Atomic.itemDarkMatter));
incrStackSize(3, new ItemStack(AtomicContent.itemDarkMatter()));
}
}
@ -220,7 +221,7 @@ public class TileAccelerator extends TileElectricInventory implements IElectroma
{
if (!world().isRemote)
{
player.openGui(Atomic.INSTANCE, 0, world(), x(), y(), z());
player.openGui(Atomic.INSTANCE(), 0, world(), x(), y(), z());
}
return true;
}

View file

@ -10,6 +10,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.AtomicContent;
/** Nuclear boiler container */
public class ContainerNuclearBoiler extends ContainerBase
@ -28,7 +29,7 @@ public class ContainerNuclearBoiler extends ContainerBase
// Gas Output
this.addSlotToContainer(new Slot((IInventory)tileEntity, 2, 136, 50));
// Yellowcake Input
this.addSlotToContainer(new SlotSpecific((IInventory)tileEntity, 3, 81, 26, new ItemStack(Atomic.itemYellowCake), new ItemStack(Atomic.blockUraniumOre)));
this.addSlotToContainer(new SlotSpecific((IInventory)tileEntity, 3, 81, 26, new ItemStack(AtomicContent.itemYellowCake()), new ItemStack(AtomicContent.blockUraniumOre())));
this.addPlayerInventory(player);
}
@ -59,7 +60,7 @@ public class ContainerNuclearBoiler extends ContainerBase
return null;
}
}
else if (Atomic.FLUIDSTACK_WATER.isFluidEqual(FluidContainerRegistry.getFluidForFilledItem(itemStack)))
else if (AtomicContent.FLUIDSTACK_WATER().isFluidEqual(FluidContainerRegistry.getFluidForFilledItem(itemStack)))
{
if (!this.mergeItemStack(itemStack, 1, 2, false))
{

View file

@ -23,6 +23,7 @@ import net.minecraftforge.fluids.IFluidHandler;
import resonant.api.IRotatable;
import resonant.lib.network.Synced;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.Settings;
@ -37,9 +38,9 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
public final static long DIAN = 50000;
public final int SHI_JIAN = 20 * 15;
@Synced
public final FluidTank waterTank = new FluidTank(Atomic.FLUIDSTACK_WATER.copy(), FluidContainerRegistry.BUCKET_VOLUME * 5);
public final FluidTank waterTank = new FluidTank(AtomicContent.FLUIDSTACK_WATER().copy(), FluidContainerRegistry.BUCKET_VOLUME * 5);
@Synced
public final FluidTank gasTank = new FluidTank(Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.copy(), FluidContainerRegistry.BUCKET_VOLUME * 5);
public final FluidTank gasTank = new FluidTank(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().copy(), FluidContainerRegistry.BUCKET_VOLUME * 5);
// How many ticks has this item been extracting for?
@Synced
public int timer = 0;
@ -71,7 +72,7 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
{
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(getStackInSlot(1));
if (liquid.isFluidEqual(Atomic.FLUIDSTACK_WATER))
if (liquid.isFluidEqual(AtomicContent.FLUIDSTACK_WATER()))
{
if (this.fill(ForgeDirection.UNKNOWN, liquid, false) > 0)
{
@ -139,8 +140,8 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
try
{
this.timer = data.readInt();
this.waterTank.setFluid(new FluidStack(Atomic.FLUIDSTACK_WATER.fluidID, data.readInt()));
this.gasTank.setFluid(new FluidStack(Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.fluidID, data.readInt()));
this.waterTank.setFluid(new FluidStack(AtomicContent.FLUIDSTACK_WATER().fluidID, data.readInt()));
this.gasTank.setFluid(new FluidStack(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().fluidID, data.readInt()));
}
catch (Exception e)
{
@ -174,7 +175,7 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
@Override
public boolean use(EntityPlayer player, int side, Vector3 hit)
{
openGui(player, Atomic.INSTANCE);
openGui(player, Atomic.INSTANCE());
return true;
}
@ -187,7 +188,7 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
{
if (getStackInSlot(3) != null)
{
if (Atomic.itemYellowCake == getStackInSlot(3).getItem() || Atomic.isItemStackUraniumOre(getStackInSlot(3)))
if (AtomicContent.itemYellowCake() == getStackInSlot(3).getItem() || Atomic.isItemStackUraniumOre(getStackInSlot(3)))
{
if (Atomic.getFluidAmount(this.gasTank.getFluid()) < this.gasTank.getCapacity())
{
@ -207,7 +208,7 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
if (this.nengYong())
{
this.waterTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
FluidStack liquid = Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.copy();
FluidStack liquid = AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().copy();
liquid.amount = Settings.uraniumHexaflourideRatio() * 2;
this.gasTank.fill(liquid, true);
this.decrStackSize(3, 1);
@ -254,7 +255,7 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
if (Atomic.FLUIDSTACK_WATER.isFluidEqual(resource))
if (AtomicContent.FLUIDSTACK_WATER().isFluidEqual(resource))
{
return this.waterTank.fill(resource, doFill);
}
@ -265,7 +266,7 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
if (Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.isFluidEqual(resource))
if (AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().isFluidEqual(resource))
{
return this.gasTank.drain(resource.amount, doDrain);
}
@ -282,13 +283,13 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return Atomic.FLUIDSTACK_WATER.fluidID == fluid.getID();
return AtomicContent.FLUIDSTACK_WATER().fluidID == fluid.getID();
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.fluidID == fluid.getID();
return AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().fluidID == fluid.getID();
}
@Override
@ -308,7 +309,7 @@ public class TileNuclearBoiler extends TileElectricInventory implements IPacketR
}
else if (slotID == 3)
{
return itemStack.getItem() == Atomic.itemYellowCake;
return itemStack.getItem() == AtomicContent.itemYellowCake();
}
return false;

View file

@ -1,5 +1,6 @@
package resonantinduction.atomic.machine.centrifuge;
import net.minecraft.inventory.IInventory;
import resonantinduction.atomic.Atomic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@ -18,18 +19,17 @@ public class ContainerCentrifuge extends ContainerBase
public ContainerCentrifuge(InventoryPlayer par1InventoryPlayer, TileCentrifuge tileEntity)
{
super(tileEntity);
super((IInventory)tileEntity);
this.tileEntity = tileEntity;
// Electric Item
this.addSlotToContainer(new SlotEnergyItem(tileEntity, 0, 131, 26));
this.addSlotToContainer(new SlotEnergyItem((IInventory) tileEntity, 0, 131, 26));
// Uranium Gas Tank
this.addSlotToContainer(new Slot(tileEntity, 1, 25, 50));
this.addSlotToContainer(new Slot((IInventory)tileEntity, 1, 25, 50));
// Output Uranium 235
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, tileEntity, 2, 81, 26));
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, (IInventory)tileEntity, 2, 81, 26));
// Output Uranium 238
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, tileEntity, 3, 101, 26));
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, (IInventory)tileEntity, 3, 101, 26));
this.addPlayerInventory(par1InventoryPlayer.player);
tileEntity.openChest();
}
@Override

View file

@ -39,7 +39,7 @@ public class GuiCentrifuge extends GuiContainerBase
this.fontRendererObj.drawString("Status: " + displayText, 70, 50, 4210752);
this.renderUniversalDisplay(8, 112, TileCentrifuge.DIAN * 20, mouseX, mouseY, UnitDisplay.Unit.WATT);
this.renderUniversalDisplay(100, 112, this.tileEntity.getVoltageInput(null), mouseX, mouseY, UnitDisplay.Unit.VOLTAGE);
this.renderUniversalDisplay(100, 112, this.tileEntity.electricNode().getVoltage(), mouseX, mouseY, UnitDisplay.Unit.VOLTAGE);
this.fontRendererObj.drawString("The centrifuge spins", 8, 75, 4210752);
this.fontRendererObj.drawString("uranium hexafluoride gas into", 8, 85, 4210752);

View file

@ -16,15 +16,15 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderCentrifuge extends TileEntitySpecialRenderer
{
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "centrifuge.tcn");
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "centrifuge.png");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.modelDirectory() + "centrifuge.tcn"));
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "centrifuge.png");
public void render(TileCentrifuge tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
if (tileEntity.worldObj != null)
if (tileEntity.getWorldObj() != null)
{
RenderUtility.rotateBlockBasedOnDirection(tileEntity.getDirection());
}

View file

@ -22,6 +22,7 @@ import resonant.lib.network.discriminator.PacketTile;
import resonant.lib.network.discriminator.PacketType;
import resonant.lib.network.handle.IPacketReceiver;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.Settings;
import universalelectricity.compatibility.Compatibility;
@ -36,7 +37,7 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
public static final int SHI_JIAN = 20 * 60;
public static final long DIAN = 500000;
public final FluidTank gasTank = new FluidTank(Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.copy(), FluidContainerRegistry.BUCKET_VOLUME * 5);
public final FluidTank gasTank = new FluidTank(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().copy(), FluidContainerRegistry.BUCKET_VOLUME * 5);
public int timer = 0;
public float rotation = 0;
@ -75,7 +76,7 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
if (fluidHandler != null)
{
FluidStack requestFluid = Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.copy();
FluidStack requestFluid = AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().copy();
requestFluid.amount = this.gasTank.getCapacity() - Atomic.getFluidAmount(this.gasTank.getFluid());
FluidStack receiveFluid = fluidHandler.drain(direction.getOpposite(), requestFluid, true);
@ -141,7 +142,7 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
@Override
public boolean use(EntityPlayer player, int side, Vector3 hit)
{
openGui(player, Atomic.INSTANCE);
openGui(player, Atomic.INSTANCE());
return true;
}
@ -151,7 +152,7 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
try
{
this.timer = data.readInt();
this.gasTank.setFluid(new FluidStack(Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.fluidID, data.readInt()));
this.gasTank.setFluid(new FluidStack(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().fluidID, data.readInt()));
}
catch (Exception e)
{
@ -172,7 +173,7 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
{
if (this.gasTank.getFluid().amount >= Settings.uraniumHexaflourideRatio())
{
return isItemValidForSlot(2, new ItemStack(Atomic.itemUranium)) && isItemValidForSlot(3, new ItemStack(Atomic.itemUranium, 1, 1));
return isItemValidForSlot(2, new ItemStack(AtomicContent.itemUranium())) && isItemValidForSlot(3, new ItemStack(AtomicContent.itemUranium(), 1, 1));
}
}
@ -188,11 +189,11 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
if (this.worldObj.rand.nextFloat() > 0.6)
{
this.incrStackSize(2, new ItemStack(Atomic.itemUranium));
this.incrStackSize(2, new ItemStack(AtomicContent.itemUranium()));
}
else
{
this.incrStackSize(3, new ItemStack(Atomic.itemUranium, 1, 1));
this.incrStackSize(3, new ItemStack(AtomicContent.itemUranium(), 1, 1));
}
}
}
@ -227,7 +228,7 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
if (Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.isFluidEqual(resource))
if (AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().isFluidEqual(resource))
{
return this.gasTank.fill(resource, doFill);
}
@ -250,7 +251,7 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return Atomic.FLUIDSTACK_URANIUM_HEXAFLOURIDE.fluidID == fluid.getID();
return AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE().fluidID == fluid.getID();
}
@Override
@ -297,9 +298,9 @@ public class TileCentrifuge extends TileElectricInventory implements IPacketRece
case 1:
return true;
case 2:
return itemStack.getItem() == Atomic.itemUranium;
return itemStack.getItem() == AtomicContent.itemUranium();
case 3:
return itemStack.getItem() == Atomic.itemUranium;
return itemStack.getItem() == AtomicContent.itemUranium();
}
return false;

View file

@ -22,7 +22,7 @@ public class GuiChemicalExtractor extends GuiContainerBase
this.fontRendererObj.drawString("Chemical Extractor", 45, 6, 4210752);
this.renderUniversalDisplay(8, 112, TileChemicalExtractor.ENERGY * 20, mouseX, mouseY, UnitDisplay.Unit.WATT);
this.renderUniversalDisplay(100, 112, this.tileEntity.getVoltageInput(null), mouseX, mouseY, UnitDisplay.Unit.VOLTAGE);
this.renderUniversalDisplay(100, 112, this.tileEntity.electricNode().getVoltage(), mouseX, mouseY, UnitDisplay.Unit.VOLTAGE);
this.fontRendererObj.drawString("The extractor can extract", 8, 75, 4210752);
this.fontRendererObj.drawString("uranium, deuterium and tritium.", 8, 85, 4210752);

View file

@ -5,10 +5,10 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import resonant.lib.render.RenderUtility;
import resonant.lib.render.model.TechneAdvancedModel;
import resonantinduction.core.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -16,26 +16,26 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderChemicalExtractor extends TileEntitySpecialRenderer
{
public static final TechneAdvancedModel MODEL = (TechneAdvancedModel) AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "chemicalExtractor.tcn");
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "chemicalExtractor.png");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.modelDirectory() + "chemicalExtractor.tcn"));
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "chemicalExtractor.png");
public void render(TileChemicalExtractor tileEntity, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
if (tileEntity.worldObj != null)
if (tileEntity.getWorldObj() != null)
{
RenderUtility.rotateBlockBasedOnDirection(tileEntity.getDirection());
}
bindTexture(TEXTURE);
GL11.glPushMatrix();
MODEL.renderOnlyAroundPivot(Math.toDegrees(tileEntity.rotation), 0, 0, 1, "MAIN CHAMBER-ROTATES", "MAGNET 1-ROTATES", "MAGNET 2-ROTATES");
GL11.glPopMatrix();
MODEL.renderAllExcept("MAIN CHAMBER-ROTATES", "MAGNET 1-ROTATES", "MAGNET 2-ROTATES");
//GL11.glPushMatrix();
//MODEL.renderOnlyAroundPivot(Math.toDegrees(tileEntity.rotation), 0, 0, 1, "MAIN CHAMBER-ROTATES", "MAGNET 1-ROTATES", "MAGNET 2-ROTATES");
//GL11.glPopMatrix();
MODEL.renderAll();
//MODEL.renderAllExcept("MAIN CHAMBER-ROTATES", "MAGNET 1-ROTATES", "MAGNET 2-ROTATES");
GL11.glPopMatrix();
}

View file

@ -20,6 +20,7 @@ import net.minecraftforge.fluids.IFluidHandler;
import resonant.api.IRotatable;
import resonant.lib.network.Synced;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.Settings;
import universalelectricity.compatibility.Compatibility;
@ -128,7 +129,7 @@ public class TileChemicalExtractor extends TileProcess implements IFluidHandler
@Override
public boolean use(EntityPlayer player, int side, Vector3 hit)
{
openGui(player, Atomic.INSTANCE);
openGui(player, Atomic.INSTANCE());
return true;
}
@ -139,7 +140,7 @@ public class TileChemicalExtractor extends TileProcess implements IFluidHandler
{
if (inputTank.getFluid().amount >= FluidContainerRegistry.BUCKET_VOLUME && Atomic.isItemStackUraniumOre(getStackInSlot(inputSlot)))
{
if (isItemValidForSlot(outputSlot, new ItemStack(Atomic.itemYellowCake)))
if (isItemValidForSlot(outputSlot, new ItemStack(AtomicContent.itemYellowCake())))
{
return true;
}
@ -147,9 +148,9 @@ public class TileChemicalExtractor extends TileProcess implements IFluidHandler
if (outputTank.getFluidAmount() < outputTank.getCapacity())
{
if (inputTank.getFluid().getFluid().getID() == Atomic.FLUID_DEUTERIUM.getID() && inputTank.getFluid().amount >= Settings.deutermiumPerTritium() * EXTRACT_SPEED)
if (inputTank.getFluid().getFluid().getID() == AtomicContent.FLUID_DEUTERIUM().getID() && inputTank.getFluid().amount >= Settings.deutermiumPerTritium() * EXTRACT_SPEED)
{
if (outputTank.getFluid() == null || Atomic.FLUIDSTACK_TRITIUM.equals(outputTank.getFluid()))
if (outputTank.getFluid() == null || AtomicContent.FLUIDSTACK_TRITIUM().equals(outputTank.getFluid()))
{
return true;
}
@ -157,7 +158,7 @@ public class TileChemicalExtractor extends TileProcess implements IFluidHandler
if (inputTank.getFluid().getFluid().getID() == FluidRegistry.WATER.getID() && inputTank.getFluid().amount >= Settings.waterPerDeutermium() * EXTRACT_SPEED)
{
if (outputTank.getFluid() == null || Atomic.FLUIDSTACK_DEUTERIUM.equals(outputTank.getFluid()))
if (outputTank.getFluid() == null || AtomicContent.FLUIDSTACK_DEUTERIUM().equals(outputTank.getFluid()))
{
return true;
}
@ -176,7 +177,7 @@ public class TileChemicalExtractor extends TileProcess implements IFluidHandler
if (Atomic.isItemStackUraniumOre(getStackInSlot(inputSlot)))
{
inputTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
incrStackSize(outputSlot, new ItemStack(Atomic.itemYellowCake, 3));
incrStackSize(outputSlot, new ItemStack(AtomicContent.itemYellowCake(), 3));
decrStackSize(inputSlot, 1);
return true;
}
@ -193,7 +194,7 @@ public class TileChemicalExtractor extends TileProcess implements IFluidHandler
if (drain != null && drain.amount >= 1 && drain.getFluid().getID() == FluidRegistry.WATER.getID())
{
if (outputTank.fill(new FluidStack(Atomic.FLUIDSTACK_DEUTERIUM, EXTRACT_SPEED), true) >= EXTRACT_SPEED)
if (outputTank.fill(new FluidStack(AtomicContent.FLUIDSTACK_DEUTERIUM(), EXTRACT_SPEED), true) >= EXTRACT_SPEED)
{
inputTank.drain(Settings.waterPerDeutermium() * EXTRACT_SPEED, true);
return true;
@ -212,9 +213,9 @@ public class TileChemicalExtractor extends TileProcess implements IFluidHandler
FluidStack drain = inputTank.drain(Settings.deutermiumPerTritium() * EXTRACT_SPEED, false);
if (drain != null && drain.amount >= 1 && drain.getFluid().getID() == Atomic.FLUID_DEUTERIUM.getID())
if (drain != null && drain.amount >= 1 && drain.getFluid().getID() == AtomicContent.FLUID_DEUTERIUM().getID())
{
if (outputTank.fill(new FluidStack(Atomic.FLUIDSTACK_TRITIUM, EXTRACT_SPEED), true) >= EXTRACT_SPEED)
if (outputTank.fill(new FluidStack(AtomicContent.FLUIDSTACK_TRITIUM(), EXTRACT_SPEED), true) >= EXTRACT_SPEED)
{
inputTank.drain(Settings.deutermiumPerTritium() * EXTRACT_SPEED, true);
return true;
@ -287,7 +288,7 @@ public class TileChemicalExtractor extends TileProcess implements IFluidHandler
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return FluidRegistry.WATER.getID() == fluid.getID() || Atomic.FLUID_DEUTERIUM.getID() == fluid.getID();
return FluidRegistry.WATER.getID() == fluid.getID() || AtomicContent.FLUID_DEUTERIUM().getID() == fluid.getID();
}
@Override

View file

@ -8,6 +8,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import resonantinduction.atomic.Atomic;
import net.minecraft.util.Vec3;
import resonant.api.explosion.ExplosionEvent.DoExplosionEvent;
import resonantinduction.atomic.AtomicContent;
import universalelectricity.core.transform.vector.Vector3;
/** Atomic Science Event Handling. */
@ -51,7 +52,7 @@ public class FulminationHandler
if (juLi <= evt.iExplosion.getRadius() && juLi > 0)
{
float miDu = evt.world.getBlockDensity(Vec3.createVectorHelper(evt.x, evt.y, evt.z), Atomic.blockFulmination.getCollisionBoundingBoxFromPool(evt.world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
float miDu = evt.world.getBlockDensity(Vec3.createVectorHelper(evt.x, evt.y, evt.z), AtomicContent.blockFulmination().getCollisionBoundingBoxFromPool(evt.world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
if (miDu < 1)
{
@ -67,7 +68,7 @@ public class FulminationHandler
for (TileFulmination tileEntity : avaliableGenerators)
{
float density = evt.world.getBlockDensity(Vec3.createVectorHelper(evt.x, evt.y, evt.z), Atomic.blockFulmination.getCollisionBoundingBoxFromPool(evt.world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
float density = evt.world.getBlockDensity(Vec3.createVectorHelper(evt.x, evt.y, evt.z), AtomicContent.blockFulmination().getCollisionBoundingBoxFromPool(evt.world, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord));
double juLi = new Vector3(tileEntity).distance(new Vector3(evt.x, evt.y, evt.z));
long energy = (long) Math.min(maxEnergyPerGenerator, maxEnergyPerGenerator / (juLi / evt.iExplosion.getRadius()));

View file

@ -1,52 +0,0 @@
package resonantinduction.atomic.machine.plasma;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import resonant.lib.prefab.block.BlockTile;
import resonant.lib.render.block.BlockRenderingHandler;
import resonant.lib.utility.FluidUtility;
import universalelectricity.api.UniversalElectricity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** Fusion reactor */
public class BlockPlasmaHeater extends BlockTile
{
public BlockPlasmaHeater(int ID)
{
super(ID, UniversalElectricity.machine);
}
@Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
return FluidUtility.playerActivatedFluidItem(world, x, y, z, player, side);
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderType()
{
return BlockRenderingHandler.ID;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TilePlasmaHeater();
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
@ -21,8 +22,10 @@ import resonant.lib.config.Config;
import resonant.lib.network.discriminator.PacketTile;
import resonant.lib.network.discriminator.PacketType;
import resonant.lib.network.handle.IPacketReceiver;
import resonant.lib.utility.FluidUtility;
import resonant.lib.utility.LanguageUtility;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import resonantinduction.core.ResonantInduction;
import universalelectricity.api.UnitDisplay;
import universalelectricity.core.transform.vector.Vector3;
@ -68,7 +71,7 @@ public class TilePlasmaHeater extends TileElectric implements IPacketReceiver, I
{
tankInputDeuterium.drain(plasmaHeatAmount, true);
tankInputTritium.drain(plasmaHeatAmount, true);
tankOutput.fill(new FluidStack(Atomic.FLUID_PLASMA, tankOutput.getCapacity()), true);
tankOutput.fill(new FluidStack(AtomicContent.FLUID_PLASMA(), tankOutput.getCapacity()), true);
electricNode().energy().extractEnergy();
}
}
@ -170,12 +173,12 @@ public class TilePlasmaHeater extends TileElectric implements IPacketReceiver, I
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
{
if (resource.isFluidEqual(Atomic.FLUIDSTACK_DEUTERIUM))
if (resource.isFluidEqual(AtomicContent.FLUIDSTACK_DEUTERIUM()))
{
return tankInputDeuterium.fill(resource, doFill);
}
if (resource.isFluidEqual(Atomic.FLUIDSTACK_TRITIUM))
if (resource.isFluidEqual(AtomicContent.FLUIDSTACK_TRITIUM()))
{
return tankInputTritium.fill(resource, doFill);
}
@ -198,13 +201,13 @@ public class TilePlasmaHeater extends TileElectric implements IPacketReceiver, I
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return fluid.getID() == Atomic.FLUID_DEUTERIUM.getID() || fluid.getID() == Atomic.FLUID_TRITIUM.getID();
return fluid.getID() == AtomicContent.FLUID_DEUTERIUM().getID() || fluid.getID() == AtomicContent.FLUID_TRITIUM().getID();
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
return fluid == Atomic.FLUID_PLASMA;
return fluid == AtomicContent.FLUID_PLASMA();
}
@Override
@ -214,4 +217,10 @@ public class TilePlasmaHeater extends TileElectric implements IPacketReceiver, I
{ tankInputDeuterium.getInfo(), tankInputTritium.getInfo(), tankOutput.getInfo() };
}
@Override
public boolean use(EntityPlayer player, int side, Vector3 hit)
{
return FluidUtility.playerActivatedFluidItem(world(), x(), y(), z(), player, side);
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
/* Atomic assembler container */
public class ContainerQuantumAssembler extends Container
@ -71,7 +72,7 @@ public class ContainerQuantumAssembler extends Container
if (par1 > 6)
{
if (itemStack.getItem() == Atomic.itemDarkMatter)
if (itemStack.getItem() == AtomicContent.itemDarkMatter())
{
if (!this.mergeItemStack(itemStack, 0, 6, false))
{

View file

@ -13,7 +13,7 @@ import universalelectricity.api.UnitDisplay;
public class GuiQuantumAssembler extends GuiContainerBase
{
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Atomic.GUI_TEXTURE_DIRECTORY + "gui_atomic_assembler.png");
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.guiDirectory() + "gui_atomic_assembler.png");
private TileQuantumAssembler tileEntity;

View file

@ -14,6 +14,7 @@ import resonant.lib.network.discriminator.PacketTile;
import resonant.lib.network.discriminator.PacketType;
import resonant.lib.network.handle.IPacketReceiver;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction;
import universalelectricity.core.transform.vector.Vector3;
@ -52,7 +53,7 @@ public class TileQuantumAssembler extends TileElectricInventory implements IPack
public boolean use(EntityPlayer player, int side, Vector3 hit)
{
if (!world().isRemote)
player.openGui(Atomic.INSTANCE, 0, world(), x(), y(), z());
player.openGui(Atomic.INSTANCE(), 0, world(), x(), y(), z());
return true;
}
@ -175,7 +176,7 @@ public class TileQuantumAssembler extends TileElectricInventory implements IPack
{
if (getStackInSlot(i) == null)
return false;
if (getStackInSlot(i).getItem() != Atomic.itemDarkMatter)
if (getStackInSlot(i).getItem() != AtomicContent.itemDarkMatter())
return false;
}
return getStackInSlot(6).stackSize < 64;
@ -225,6 +226,6 @@ public class TileQuantumAssembler extends TileElectricInventory implements IPack
{
return true;
}
return itemStack.getItem() == Atomic.itemDarkMatter;
return itemStack.getItem() == AtomicContent.itemDarkMatter();
}
}

View file

@ -23,7 +23,6 @@ import resonant.lib.network.discriminator.PacketTile;
import resonant.lib.utility.inventory.InventoryUtility;
import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction;
import resonantinduction.electrical.em.laser.TileBase;
import universalelectricity.core.transform.vector.Vector3;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;

View file

@ -7,6 +7,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import resonant.lib.schematic.Schematic;
import resonant.lib.type.Pair;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import universalelectricity.core.transform.vector.Vector3;
public class SchematicAccelerator extends Schematic
@ -32,7 +33,7 @@ public class SchematicAccelerator extends Schematic
{
if (x == -r || x == r - 1 || z == -r || z == r - 1)
{
returnMap.put(new Vector3(x, y, z), new Pair(Atomic.blockElectromagnet, 0));
returnMap.put(new Vector3(x, y, z), new Pair(AtomicContent.blockElectromagnet(), 0));
}
}
}
@ -48,7 +49,7 @@ public class SchematicAccelerator extends Schematic
{
if (x == -r || x == r - 1 || z == -r || z == r - 1)
{
returnMap.put(new Vector3(x, y, z), new Pair(Atomic.blockElectromagnet, 0));
returnMap.put(new Vector3(x, y, z), new Pair(AtomicContent.blockElectromagnet(), 0));
}
}
}
@ -66,7 +67,7 @@ public class SchematicAccelerator extends Schematic
{
if (y == -1 || y == 1)
{
returnMap.put(new Vector3(x, y, z), new Pair(Atomic.blockElectromagnet, 1));
returnMap.put(new Vector3(x, y, z), new Pair(AtomicContent.blockElectromagnet(), 1));
}
else if (y == 0)
{

View file

@ -8,6 +8,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import resonant.lib.schematic.Schematic;
import resonant.lib.type.Pair;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import universalelectricity.core.transform.vector.Vector3;
public class SchematicBreedingReactor extends Schematic
@ -45,15 +46,15 @@ public class SchematicBreedingReactor extends Schematic
{
if (!((x == -r || x == r) && (z == -r || z == r)))
{
returnMap.put(new Vector3(x, 0, z), new Pair(Atomic.blockReactorCell, 0));
returnMap.put(new Vector3(x, -1, z), new Pair(Atomic.blockThermometer, 0));
returnMap.put(new Vector3(x, -3, z), new Pair(Atomic.blockSiren, 0));
returnMap.put(new Vector3(x, 0, z), new Pair(AtomicContent.blockReactorCell(), 0));
returnMap.put(new Vector3(x, -1, z), new Pair(AtomicContent.blockThermometer(), 0));
returnMap.put(new Vector3(x, -3, z), new Pair(AtomicContent.blockSiren(), 0));
returnMap.put(new Vector3(x, -2, z), new Pair(Blocks.redstone_wire, 0));
}
else
{
returnMap.put(new Vector3(x, -1, z), new Pair(Atomic.blockControlRod, 0));
returnMap.put(new Vector3(x, -1, z), new Pair(AtomicContent.blockControlRod(), 0));
returnMap.put(new Vector3(x, -2, z), new Pair(Blocks.piston, 1));
}
}
@ -62,7 +63,7 @@ public class SchematicBreedingReactor extends Schematic
returnMap.put(new Vector3(0, -2, 0), new Pair(Blocks.stone, 0));
returnMap.put(new Vector3(0, -3, 0), new Pair(Blocks.stone, 0));
returnMap.put(new Vector3(), new Pair(Atomic.blockReactorCell, 0));
returnMap.put(new Vector3(), new Pair(AtomicContent.blockReactorCell(), 0));
return returnMap;
}
}

View file

@ -9,6 +9,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import resonant.lib.schematic.Schematic;
import resonant.lib.type.Pair;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import universalelectricity.core.transform.vector.Vector3;
public class SchematicFissionReactor extends Schematic
@ -45,21 +46,21 @@ public class SchematicFissionReactor extends Schematic
for (int z = -r; z <= r; z++)
{
Vector3 targetPosition = new Vector3(x, 1, z);
returnMap.put(targetPosition, new Pair(Atomic.blockElectricTurbine, 0));
returnMap.put(targetPosition, new Pair(Block.getBlockFromName("electricTurbine"), 0));
if (!((x == -r || x == r) && (z == -r || z == r)) && new Vector3(x, 0, z).magnitude() <= 1)
{
returnMap.put(new Vector3(x, -1, z), new Pair(Atomic.blockControlRod, 0));
returnMap.put(new Vector3(x, -1, z), new Pair(AtomicContent.blockControlRod(), 0));
returnMap.put(new Vector3(x, -2, z), new Pair(Blocks.sticky_piston, 1));
}
}
}
returnMap.put(new Vector3(0, -1, 0), new Pair(Atomic.blockThermometer, 0));
returnMap.put(new Vector3(0, -1, 0), new Pair(AtomicContent.blockThermometer(), 0));
// TODO: IF Siren is a Tile, don't do this. Redstone can't hold it.
returnMap.put(new Vector3(0, -3, 0), new Pair(Atomic.blockSiren, 0));
returnMap.put(new Vector3(0, -3, 0), new Pair(AtomicContent.blockSiren(), 0));
returnMap.put(new Vector3(0, -2, 0), new Pair(Blocks.redstone_wire, 0));
returnMap.put(new Vector3(), new Pair(Atomic.blockReactorCell, 0));
returnMap.put(new Vector3(), new Pair(AtomicContent.blockReactorCell(), 0));
}
else
{
@ -78,7 +79,7 @@ public class SchematicFissionReactor extends Schematic
{
if (targetPosition.distance(leveledPosition) == 2)
{
returnMap.put(targetPosition, new Pair(Atomic.blockControlRod, 0));
returnMap.put(targetPosition, new Pair(AtomicContent.blockControlRod(), 0));
/** Place piston base to push control rods in. */
int rotationMetadata = 0;
@ -102,7 +103,7 @@ public class SchematicFissionReactor extends Schematic
}
else if (x == 0 && z == 0)
{
returnMap.put(targetPosition, new Pair(Atomic.blockReactorCell, 0));
returnMap.put(targetPosition, new Pair(AtomicContent.blockReactorCell(), 0));
}
else
{
@ -111,7 +112,7 @@ public class SchematicFissionReactor extends Schematic
}
else if (targetPosition.distance(leveledPosition) < 2)
{
returnMap.put(targetPosition, new Pair(Atomic.blockElectricTurbine, 0));
returnMap.put(targetPosition, new Pair(Block.getBlockFromName("electricTurbine"), 0));
}
}
}

View file

@ -7,6 +7,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import resonant.lib.schematic.Schematic;
import resonant.lib.type.Pair;
import resonantinduction.atomic.Atomic;
import resonantinduction.atomic.AtomicContent;
import universalelectricity.core.transform.vector.Vector3;
public class SchematicFusionReactor extends Schematic
@ -47,12 +48,12 @@ public class SchematicFusionReactor extends Schematic
{
double yDeviation = (y == 0 ? size / 3 : -size / 3) + (y == 0 ? -1 : 1) * Math.sin(magnitude / radius * Math.PI) * size / 2d;
Vector3 newPos = position.clone().add(0, yDeviation, 0);
returnMap.put(newPos.round(), new Pair(Atomic.blockElectromagnet, 1));
returnMap.put(newPos.round(), new Pair(AtomicContent.blockElectromagnet(), 1));
}
}
else if (magnitude > radius - 1)
{
returnMap.put(position, new Pair(Atomic.blockElectromagnet, 0));
returnMap.put(position, new Pair(AtomicContent.blockElectromagnet(), 0));
}
}
}
@ -61,14 +62,14 @@ public class SchematicFusionReactor extends Schematic
/** Fusion Core */
for (int y = 0; y < size; y++)
{
returnMap.put(new Vector3(0, y, 0), new Pair(Atomic.blockReactorCell, 0));
returnMap.put(new Vector3(1, y, 0), new Pair(Atomic.blockElectromagnet, 0));
returnMap.put(new Vector3(0, y, 1), new Pair(Atomic.blockElectromagnet, 0));
returnMap.put(new Vector3(0, y, -1), new Pair(Atomic.blockElectromagnet, 0));
returnMap.put(new Vector3(-1, y, 0), new Pair(Atomic.blockElectromagnet, 0));
returnMap.put(new Vector3(0, y, 0), new Pair(AtomicContent.blockReactorCell(), 0));
returnMap.put(new Vector3(1, y, 0), new Pair(AtomicContent.blockElectromagnet(), 0));
returnMap.put(new Vector3(0, y, 1), new Pair(AtomicContent.blockElectromagnet(), 0));
returnMap.put(new Vector3(0, y, -1), new Pair(AtomicContent.blockElectromagnet(), 0));
returnMap.put(new Vector3(-1, y, 0), new Pair(AtomicContent.blockElectromagnet(), 0));
}
returnMap.put(new Vector3(0, 0, 0), new Pair(Atomic.blockReactorCell, 0));
returnMap.put(new Vector3(0, 0, 0), new Pair(AtomicContent.blockReactorCell(), 0));
return returnMap;
}

View file

@ -6,17 +6,17 @@ import universalelectricity.api.core.grid.{INode, INodeProvider}
trait TraitNodeProvider extends TileMultipart with INodeProvider
{
def getNode(nodeType: Class[INode], from: ForgeDirection): INode =
override def getNode(nodeType: Class[_ <: INode], from: ForgeDirection): INode =
{
var part = partMap(from.ordinal)
var nodePart = partMap(from.ordinal)
if (part == null)
if (nodePart == null)
{
part = partMap(PartMap.CENTER.ordinal)
nodePart = partMap(PartMap.CENTER.ordinal)
}
if (part.isInstanceOf[INodeProvider])
if (nodePart.isInstanceOf[INodeProvider])
{
return part.asInstanceOf[INodeProvider].getNode(nodeType, from)
return nodePart.asInstanceOf[INodeProvider].getNode(nodeType, from)
}
return null

View file

@ -8,7 +8,7 @@ import universalelectricity.api.core.grid.INodeProvider
import scala.collection.convert.wrapAll._
class FluidPressureNode(parent: TileTankNode) extends TankNode(parent)
class FluidPressureNode(parent: INodeProvider) extends TankNode(parent)
{
protected var connectionMap: Byte = java.lang.Byte.parseByte("111111", 2)
private var pressure = 0

View file

@ -1,5 +1,6 @@
package resonantinduction.core.prefab.part
import java.util
import java.util.{Collection, HashSet, Set}
import codechicken.lib.data.{MCDataInput, MCDataOutput}
@ -43,23 +44,25 @@ abstract class PartFramedNode[M](insulationType: Item) extends PartColorableMate
return NormalOcclusionTest.apply(this, other)
}
override def getSubParts: Iterable[IndexedCuboid6] = {
override def getSubParts: java.lang.Iterable[IndexedCuboid6] = {
super.getSubParts
val currentSides: Array[IndexedCuboid6] = if (isInsulated) PartFramedNode.insulatedSides.clone() else PartFramedNode.sides.clone()
if (tile != null) {
for (side <- ForgeDirection.VALID_DIRECTIONS) {
val ord: Int = side.ordinal
if (PartFramedNode.connectionMapContainsSide(getAllCurrentConnections, side) || side == testingSide) currentSides(ord) = null
val list : util.LinkedList[IndexedCuboid6] = new util.LinkedList[IndexedCuboid6]
if (tile != null)
{
for (side <- ForgeDirection.VALID_DIRECTIONS)
{
if (PartFramedNode.connectionMapContainsSide(getAllCurrentConnections, side) || side == testingSide) list.add(currentSides(side.ordinal()))
}
}
return currentSides
return list
}
/** Rendering and block bounds. */
override def getCollisionBoxes: Iterable[Cuboid6] = {
override def getCollisionBoxes: Set[Cuboid6] = {
val collisionBoxes: Set[Cuboid6] = new HashSet[Cuboid6]
collisionBoxes.addAll(getSubParts.asInstanceOf[Collection[_ <: Cuboid6]])
return collisionBoxes.toArray().asInstanceOf[Array[Cuboid6]];
return collisionBoxes;
}
override def getStrength(hit: MovingObjectPosition, player: EntityPlayer): Float = {
@ -70,7 +73,7 @@ abstract class PartFramedNode[M](insulationType: Item) extends PartColorableMate
return new Cuboid6(0.375, 0.375, 0.375, 0.625, 0.625, 0.625)
}
def getBreakingIcon(subPart: AnyRef, side: Int): IIcon = {
override def getBreakingIcon(subPart: Any, side: Int): IIcon = {
return breakIcon
}
@ -78,7 +81,7 @@ abstract class PartFramedNode[M](insulationType: Item) extends PartColorableMate
return breakIcon
}
def getOcclusionBoxes: Iterable[Cuboid6] = {
def getOcclusionBoxes: Set[Cuboid6] = {
return getCollisionBoxes
}

View file

@ -3,7 +3,7 @@ package resonantinduction.electrical.transformer
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.util.ForgeDirection
import universalelectricity.api.core.grid.INodeProvider
import universalelectricity.api.core.grid.electric.IEnergyNode
import universalelectricity.compatibility.Compatibility
import universalelectricity.core.grid.node.ElectricNode
import universalelectricity.core.transform.vector.VectorWorld
@ -53,12 +53,10 @@ class ElectricTransformerNode(parent: INodeProvider) extends ElectricNode(parent
def sendEnergy(wattage: Double, doAdd: Boolean): Double =
{
val tile : TileEntity = new VectorWorld(parent.asInstanceOf[TileEntity]).add(connectionDirection).getTileEntity
if(tile.isInstanceOf[INodeProvider] && tile.asInstanceOf[INodeProvider].getNode(Class[IEnergyNode], connectionDirection.getOpposite).isInstanceOf[IEnergyNode])
if(Compatibility.isHandler(tile))
{
val node :IEnergyNode = tile.asInstanceOf[INodeProvider].getNode(Class[IEnergyNode], connectionDirection.getOpposite).asInstanceOf[IEnergyNode]
return node.addEnergy(wattage, doAdd)
return Compatibility.fill(tile, connectionDirection.getOpposite, wattage, doAdd)
}
return 0
}

View file

@ -47,7 +47,7 @@ import universalelectricity.api.core.grid.NodeRegistry;
*
* @author DarkCow, Calclavia
*/
@Mod(modid = Mechanical.ID, name = Mechanical.NAME, version = Reference.version(), dependencies = "before:ThermalExpansion;required-after:" + ResonantInduction.ID + ";after:ResonantInduction|Archaic")
@Mod(modid = Mechanical.ID, name = "Resonant Induction Mechanical", version = Reference.version(), dependencies = "before:ThermalExpansion;required-after:" + ResonantInduction.ID + ";after:ResonantInduction|Archaic")
public class Mechanical
{
/** Mod Information */
@ -106,8 +106,8 @@ public class Mechanical
itemGearShaft = contentRegistry.newItem(ItemGearShaft.class);
itemPipe = contentRegistry.newItem(ItemPipe.class);
blockWindTurbine = contentRegistry.newBlock(BlockWindTurbine.class, ItemBlockMetadata.class, TileWindTurbine.class);
blockWaterTurbine = contentRegistry.newBlock(BlockWaterTurbine.class, ItemBlockMetadata.class, TileWaterTurbine.class);
blockWindTurbine = contentRegistry.newBlock(TileWindTurbine.class);
blockWaterTurbine = contentRegistry.newBlock(TileWaterTurbine.class);
blockDetector = contentRegistry.newBlock(TileDetector.class);
blockPump = contentRegistry.newBlock(TilePump.class);

View file

@ -19,16 +19,20 @@ import codechicken.multipart.JNormalOcclusion;
import codechicken.multipart.TSlottedPart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import universalelectricity.api.core.grid.INode;
import java.util.Set;
/** Fluid transport pipe
*
* @author Calclavia, Darkguardsman */
public class PartPipe extends PartFramedNode<EnumPipeMaterial, PipePressureNode, PartPipe> implements TSlottedPart, JNormalOcclusion, IFluidHandler
public class PartPipe extends PartFramedNode<EnumPipeMaterial> implements TSlottedPart, JNormalOcclusion, IFluidHandler
{
protected final FluidTank tank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
/** Computes the average fluid for client to render. */
private EvictingList<Integer> averageTankData = new EvictingList<Integer>(20);
private boolean markPacket = true;
private PipePressureNode node = null;
public PartPipe()
{
@ -200,12 +204,12 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, PipePressureNode,
{
super.load(nbt);
tank.readFromNBT(nbt);
node.setMaxFlowRate(getMaterial().maxFlowRate);
node.setMaxPressure(getMaterial().maxPressure);
node().setMaxFlowRate(getMaterial().maxFlowRate);
node().setMaxPressure(getMaterial().maxPressure);
}
@Override
public Iterable<Cuboid6> getOcclusionBoxes() {
public Set<Cuboid6> getOcclusionBoxes() {
return null;
}
@ -213,4 +217,15 @@ public class PartPipe extends PartFramedNode<EnumPipeMaterial, PipePressureNode,
public int getSlotMask() {
return 0;
}
@Override
public INode node() {
return node;
}
@Override
public void node_$eq(INode node) {
if(node instanceof PipePressureNode)
this.node = (PipePresureNode)node;
}
}

View file

@ -32,7 +32,7 @@ public class PipePressureNode extends FluidPressureNode
if (world() != null)
{
byte previousConnections = pipe().getAllCurrentConnections();
pipe().currentConnections = 0;
pipe().currentConnections(0);
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{

View file

@ -5,6 +5,7 @@ import java.awt.Color;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.common.util.ForgeDirection;
@ -12,7 +13,7 @@ import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import resonant.api.items.ISimpleItemRenderer;
import resonant.content.prefab.scala.render.ISimpleItemRenderer;
import resonant.lib.render.FluidRenderUtility;
import resonant.lib.render.RenderUtility;
import resonant.lib.utility.WorldUtility;
@ -25,20 +26,20 @@ public class RenderPipe implements ISimpleItemRenderer
{
public static final RenderPipe INSTANCE = new RenderPipe();
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "pipe.tcn");
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe.png");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.modelDirectory() + "pipe.tcn"));
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "pipe.png");
public void render(PartPipe part, double x, double y, double z, float f)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
render(part.getMaterialID(), part.getColor() > 0 ? ItemDye.dyeColors[part.getColor()] : -1, part.getAllCurrentConnections());
render(part.getMaterialID(), part.getColor() > 0 ? ItemDye.field_150922_c[part.getColor()] : -1, part.getAllCurrentConnections());
GL11.glPopMatrix();
GL11.glPushMatrix();
FluidStack fluid = part.getPressureTank().getFluid();
int capacity = part.getPressureTank().getCapacity();
FluidStack fluid = part.tank.getFluid();
int capacity = part.tank.getCapacity();
byte renderSides = part.getAllCurrentConnections();
if (fluid != null && fluid.amount > 0)
@ -169,7 +170,7 @@ public class RenderPipe implements ISimpleItemRenderer
}
@Override
public void renderInventoryItem(ItemStack itemStack)
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data)
{
GL11.glPushMatrix();
render(itemStack.getItemDamage(), -1, Byte.parseByte("001100", 2));

View file

@ -17,7 +17,7 @@ public class GearMultiBlockHandler extends MultiBlockHandler<PartGear>
@Override
public PartGear getWrapperAt(Vector3 position)
{
TileEntity tile = position.getTileEntity(self.getWorld());
TileEntity tile = position.getTileEntity(this.tile.getWorld());
if (tile instanceof TileMultipart)
{
@ -25,7 +25,7 @@ public class GearMultiBlockHandler extends MultiBlockHandler<PartGear>
if (part instanceof PartGear)
{
if (((PartGear) part).tier == self.tier)
if (((PartGear) part).tier == this.tile.tier)
{
return (PartGear) part;
}
@ -37,6 +37,6 @@ public class GearMultiBlockHandler extends MultiBlockHandler<PartGear>
public ForgeDirection getPlacementSide()
{
return self.placementSide;
return tile.placementSide;
}
}

View file

@ -18,8 +18,8 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderMechanicalPiston extends TileEntitySpecialRenderer
{
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "piston/mechanicalPiston.tcn");
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "piston/mechanicalPiston_iron.png");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.modelDirectory() + "piston/mechanicalPiston.tcn"));
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "piston/mechanicalPiston_iron.png");
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
@ -31,7 +31,7 @@ public class RenderMechanicalPiston extends TileEntitySpecialRenderer
GL11.glRotated(-90, 0, 1, 0);
GL11.glRotated(180, 0, 0, 1);
if (tile.worldObj != null)
if (tile.getWorldObj() != null)
{
if (tile.getDirection() != ForgeDirection.UP && tile.getDirection() != ForgeDirection.DOWN)
RenderUtility.rotateBlockBasedOnDirection(tile.getDirection().getOpposite());
@ -55,7 +55,7 @@ public class RenderMechanicalPiston extends TileEntitySpecialRenderer
/** Render Piston Shaft */
GL11.glPushMatrix();
if (tile.worldObj != null)
if (tile.getWorldObj() != null)
{
ForgeDirection dir = tile.getDirection();

View file

@ -53,17 +53,17 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
}.setLoad(0.5f);
isOpaqueCube = false;
normalRender = false;
customItemRender = true;
rotationMask = Byte.parseByte("111111", 2);
textureName = "material_steel_dark";
isOpaqueCube(false);
normalRender(false);
customItemRender(true);
//rotationMask = Byte.parseByte("111111", 2);
setTextureName("material_steel_dark");
}
@Override
public void updateEntity()
public void update()
{
super.updateEntity();
super.update();
if (markRevolve)
{
@ -88,15 +88,15 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
public boolean hitOreBlock(Vector3 blockPos)
{
Block block = Block.blocksList[blockPos.getBlock(world())];
Block block = blockPos.getBlock(world());
if (block != null)
{
int breakCount = (int) (mechanicalPistonMultiplier * block.blockHardness);
int breakCount = (int) (mechanicalPistonMultiplier * block.getBlockHardness(world(), blockPos.xi(), blockPos.yi(), blockPos.zi()));
final int startBreakCount = breakCount;
ItemStack blockStack = new ItemStack(block);
RecipeResource[] resources = MachineRecipes.INSTANCE.getOutput(ResonantInduction.RecipeType.CRUSHER.name(), blockStack);
RecipeResource[] resources = MachineRecipes.INSTANCE.getOutput(ResonantInduction.RecipeType.CRUSHER().toString(), blockStack);
if (resources.length > 0)
{
@ -104,7 +104,7 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
{
int breakStatus = (int) (((float) (startBreakCount - breakCount) / (float) startBreakCount) * 10f);
world().destroyBlockInWorldPartially(0, blockPos.xi(), blockPos.yi(), blockPos.zi(), breakStatus);
ResonantInduction.LOGGER.info("[Mechanical Piston] Break Count: " + breakCount);
//ResonantInduction.LOGGER.info("[Mechanical Piston] Break Count: " + breakCount);
if (breakCount >= mechanicalPistonMultiplier)
{
@ -116,11 +116,11 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
}
}
getWorldObj().destroyBlock(blockPos.xi(), blockPos.yi(), blockPos.zi(), false);
blockPos.setBlockToAir(world());
}
}
ResonantInduction.proxy.renderBlockParticle(worldObj, blockPos.clone().add(0.5), new Vector3((Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3), block.blockID, 1);
ResonantInduction.proxy().renderBlockParticle(worldObj, blockPos.clone().add(0.5), new Vector3((Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3), Block.getIdFromBlock(block), 1);
breakCount--;
return true;
}
@ -134,12 +134,6 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
return false;
}
@Override
public void onRemove(int par5, int par6)
{
super.onRemove(par5, par6);
}
public boolean canMove(Vector3 from, Vector3 to)
{
TileEntity tileEntity = from.getTileEntity(worldObj);
@ -150,9 +144,9 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
}
/** Check Target */
int targetBlock = to.getBlock(worldObj);
Block targetBlock = to.getBlock(worldObj);
if (!(worldObj.isAirBlock(to.xi(), to.yi(), to.zi()) || (targetBlock > 0 && (Block.blocksList[targetBlock].isBlockReplaceable(worldObj, to.xi(), to.yi(), to.zi())))))
if (!(worldObj.isAirBlock(to.xi(), to.yi(), to.zi()) || (targetBlock != null && (targetBlock.canBeReplacedByLeaves(worldObj, to.xi(), to.yi(), to.zi())))))
{
return false;
}
@ -162,7 +156,7 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
public void move(Vector3 from, Vector3 to)
{
int blockID = from.getBlock(worldObj);
Block blockID = from.getBlock(worldObj);
int blockMetadata = from.getBlockMetadata(worldObj);
TileEntity tileEntity = from.getTileEntity(worldObj);
@ -174,7 +168,7 @@ public class TileMechanicalPiston extends TileMechanical implements IRotatable
tileEntity.writeToNBT(tileData);
}
MovementUtility.setBlockSneaky(worldObj, from, 0, 0, null);
MovementUtility.setBlockSneaky(worldObj, from, null, 0, null);
if (tileEntity != null && tileData != null)
{

View file

@ -2,37 +2,37 @@ package resonantinduction.mechanical.process.edit;
import java.util.ArrayList;
import cpw.mods.fml.common.network.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import resonant.api.IRotatable;
import resonant.lib.content.module.TileBase;
import resonant.lib.content.module.TileRender;
import resonant.lib.network.IPacketReceiver;
import resonant.lib.network.PacketHandler;
import resonant.lib.render.RotatedTextureRenderer;
import resonant.content.prefab.java.TileAdvanced;
import resonant.lib.network.discriminator.PacketTile;
import resonant.lib.network.discriminator.PacketType;
import resonant.lib.network.handle.IPacketReceiver;
import resonant.lib.utility.inventory.InternalInventoryHandler;
import resonantinduction.core.ResonantInduction;
import universalelectricity.core.transform.vector.Vector3;
import universalelectricity.api.vector.VectorWorld;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import universalelectricity.core.transform.vector.VectorWorld;
/**
* @author tgame14
* @since 18/03/14
*/
public class TileBreaker extends TileBase implements IRotatable, IPacketReceiver
public class TileBreaker extends TileAdvanced implements IRotatable, IPacketReceiver
{
@SideOnly(Side.CLIENT)
private static IIcon iconFront, iconBack;
@ -43,8 +43,8 @@ public class TileBreaker extends TileBase implements IRotatable, IPacketReceiver
public TileBreaker()
{
super(Material.iron);
normalRender = false;
rotationMask = Byte.parseByte("111111", 2);
normalRender(false);
//rotationMask = Byte.parseByte("111111", 2);
}
public InternalInventoryHandler getInvHandler()
@ -63,13 +63,13 @@ public class TileBreaker extends TileBase implements IRotatable, IPacketReceiver
}
@Override
public void onNeighborChanged()
public void onNeighborChanged(Block block)
{
work();
}
@Override
public void updateEntity()
public void update()
{
if (doWork)
{
@ -104,7 +104,7 @@ public class TileBreaker extends TileBase implements IRotatable, IPacketReceiver
Vector3 check = position().add(dir);
VectorWorld put = (VectorWorld) position().add(dir.getOpposite());
Block block = Block.blocksList[check.getBlock(world())];
Block block = check.getBlock(world());
if (block != null)
{
@ -112,7 +112,7 @@ public class TileBreaker extends TileBase implements IRotatable, IPacketReceiver
boolean flag = true;
//Get items dropped
ArrayList<ItemStack> drops = block.getBlockDropped(getWorldObj(), check.xi(), check.yi(), check.zi(), candidateMeta, 0);
ArrayList<ItemStack> drops = block.getDrops(getWorldObj(), check.xi(), check.yi(), check.zi(), candidateMeta, 0);
for (ItemStack stack : drops)
{
@ -127,9 +127,9 @@ public class TileBreaker extends TileBase implements IRotatable, IPacketReceiver
}
//Destroy block
ResonantInduction.proxy.renderBlockParticle(worldObj, check.xi(), check.yi(), check.zi(), new Vector3((Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3), world().getBlockId(check.xi(), check.yi(), check.zi()), 1);
ResonantInduction.proxy().renderBlockParticle(worldObj, check.xi(), check.yi(), check.zi(), new Vector3((Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3), Block.getIdFromBlock(block), 1);
getWorldObj().destroyBlock(check.xi(), check.yi(), check.zi(), false);
getWorldObj().setBlockToAir(check.xi(), check.yi(), check.zi());
getWorldObj().playAuxSFX(1012, check.xi(), check.yi(), check.zi(), 0);
}
@ -137,11 +137,11 @@ public class TileBreaker extends TileBase implements IRotatable, IPacketReceiver
}
@Override
public Packet getDescriptionPacket()
public PacketTile getDescPacket()
{
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
return ResonantInduction.PACKET_TILE.getPacket(this, nbt);
return new PacketTile(this, nbt);
}
@Override
@ -188,18 +188,11 @@ public class TileBreaker extends TileBase implements IRotatable, IPacketReceiver
}
@Override
@SideOnly(Side.CLIENT)
protected TileRender newRenderer()
{
return new RotatedTextureRenderer(this);
}
@Override
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
public void read(ByteBuf data, EntityPlayer player, PacketType type)
{
try
{
readFromNBT(PacketHandler.readNBTTagCompound(data));
readFromNBT(ByteBufUtils.readTag(data));
}
catch (Exception e)
{

View file

@ -2,13 +2,15 @@ package resonantinduction.mechanical.process.edit;
import java.util.EnumSet;
import cpw.mods.fml.common.network.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
@ -16,12 +18,10 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import resonant.api.IRotatable;
import resonant.lib.content.module.TileRender;
import resonant.lib.content.module.prefab.TileInventory;
import resonant.lib.network.IPacketReceiver;
import resonant.lib.network.PacketHandler;
import resonant.lib.network.discriminator.PacketTile;
import resonant.lib.network.discriminator.PacketType;
import resonant.lib.network.handle.IPacketReceiver;
import resonant.lib.render.RenderItemOverlayUtility;
import resonant.lib.render.RotatedTextureRenderer;
import resonant.lib.utility.LanguageUtility;
import resonant.lib.utility.inventory.InternalInventoryHandler;
import resonant.lib.utility.inventory.InventoryUtility;
@ -32,6 +32,7 @@ import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import resonant.lib.content.prefab.java.TileInventory;
/**
* @author tgame14
@ -49,9 +50,9 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
public TilePlacer()
{
super(Material.rock);
normalRender = false;
maxSlots = 1;
rotationMask = Byte.parseByte("111111", 2);
normalRender(false);
setSizeInventory(1);
//rotationMask = Byte.parseByte("111111", 2);
}
public InternalInventoryHandler getInvHandler()
@ -70,7 +71,7 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
}
@Override
public void onNeighborChanged()
public void onNeighborChanged(Block block)
{
work();
}
@ -82,9 +83,10 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
}
@Override
public void updateEntity()
public void update()
{
if (autoPullItems && this.ticks % 5 == 0)
super.update();
if (autoPullItems && this.ticks() % 5 == 0)
{
if (getStackInSlot(0) == null)
{
@ -136,37 +138,37 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
}
@Override
protected boolean use(EntityPlayer player, int hitSide, Vector3 hit)
public boolean use(EntityPlayer player, int hitSide, Vector3 hit)
{
interactCurrentItem(this, 0, player);
return true;
}
protected boolean configure(EntityPlayer player, int side, Vector3 hit)
public boolean configure(EntityPlayer player, int side, Vector3 hit)
{
if (player.isSneaking())
{
this.autoPullItems = !this.autoPullItems;
player.sendChatToPlayer(ChatMessageComponent.createFromText("AutoExtract: " + this.autoPullItems));
player.addChatComponentMessage(new ChatComponentText("AutoExtract: " + this.autoPullItems));
return true;
}
return super.configure(player, side, hit);
}
@Override
public Packet getDescriptionPacket()
public PacketTile getDescPacket()
{
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
return ResonantInduction.PACKET_TILE.getPacket(this, nbt);
return new PacketTile(this, nbt);
}
@Override
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player, Object... extra)
public void read(ByteBuf data, EntityPlayer player, PacketType type)
{
try
{
readFromNBT(PacketHandler.readNBTTagCompound(data));
readFromNBT(ByteBufUtils.readTag(data));
}
catch (Exception e)
{
@ -240,27 +242,18 @@ public class TilePlacer extends TileInventory implements IRotatable, IPacketRece
iconBack = iconRegister.registerIcon(getTextureName() + "_back");
}
@Override
@SideOnly(Side.CLIENT)
protected TileRender newRenderer()
public void renderDynamic(Vector3 position, float frame, int pass)
{
return new RotatedTextureRenderer(this)
{
@Override
public boolean renderDynamic(Vector3 position, boolean isItem, float frame)
{
if (world() != null && !isItem)
if (world() != null)
{
EnumSet set = EnumSet.allOf(ForgeDirection.class);
set.remove(getDirection());
set.remove(getDirection().getOpposite());
GL11.glPushMatrix();
RenderItemOverlayUtility.renderItemOnSides(tile(), getStackInSlot(0), position.x, position.y, position.z, LanguageUtility.getLocal("tooltip.noOutput"), set);
RenderItemOverlayUtility.renderItemOnSides(tile(), getStackInSlot(0), position.x(), position.y(), position.z(), LanguageUtility.getLocal("tooltip.noOutput"), set);
GL11.glPopMatrix();
}
return false;
}
};
}
}

View file

@ -7,6 +7,7 @@ import static org.lwjgl.opengl.GL11.glScalef;
import static org.lwjgl.opengl.GL11.glTranslatef;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import net.minecraftforge.common.util.ForgeDirection;
@ -22,7 +23,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderGrindingWheel extends TileEntitySpecialRenderer
{
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "grinder.obj");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.modelDirectory() + "grinder.obj"));
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
@ -37,9 +38,9 @@ public class RenderGrindingWheel extends TileEntitySpecialRenderer
//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");
RenderUtility.bind(Reference.blockTextureDirectory() + "planks_oak.png");
MODEL.renderAllExcept("teeth");
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "cobblestone.png");
MODEL.renderOnly("teeth");
glPopMatrix();
}

View file

@ -1,5 +1,6 @@
package resonantinduction.mechanical.process.grinder;
import resonant.lib.prefab.damage.CustomDamageSource;
import resonantinduction.mechanical.energy.grid.TileMechanical;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
@ -10,12 +11,11 @@ import net.minecraftforge.common.util.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;
import resonantinduction.core.ResonantInduction.RecipeType;
import resonantinduction.core.Timer;
import universalelectricity.core.transform.region.Cuboid;
import universalelectricity.core.transform.vector.Vector3;
/**
@ -38,18 +38,18 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
{
super(Material.rock);
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;
customItemRender = true;
rotationMask = Byte.parseByte("111111", 2);
textureName = "material_steel_dark";
bounds(new Cuboid(0.05f, 0.05f, 0.05f, 0.95f, 0.95f, 0.95f));
isOpaqueCube(false);
normalRender(false);
customItemRender(true);
//rotationMask = Byte.parseByte("111111", 2);
setTextureName("material_steel_dark");
}
@Override
public void updateEntity()
public void update()
{
super.updateEntity();
super.update();
counter = Math.max(counter + Math.abs(mechanicalNode.torque), 0);
doWork();
}
@ -133,7 +133,7 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
if (grindingItem != null)
{
if (timer.containsKey(grindingItem) && !grindingItem.isDead && new Vector3(this).add(0.5).distance(grindingItem) < 1)
if (timer.containsKey(grindingItem) && !grindingItem.isDead && new Vector3(this).add(0.5).distance(new Vector3(grindingItem)) < 1)
{
int timeLeft = timer.decrease(grindingItem);
@ -161,7 +161,7 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
if (grindingItem.getEntityItem().getItem() instanceof ItemBlock)
{
ResonantInduction.proxy.renderBlockParticle(worldObj, new Vector3(grindingItem), new Vector3((Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3), ((ItemBlock) grindingItem.getEntityItem().getItem()).getBlock(), 1);
ResonantInduction.proxy().renderBlockParticle(worldObj, new Vector3(grindingItem), new Vector3((Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3, (Math.random() - 0.5f) * 3), 3, 1);
}
else
{
@ -180,9 +180,9 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
if (didWork)
{
if (this.ticks % 8 == 0)
if (this.ticks() % 8 == 0)
{
worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, Reference.PREFIX + "grinder", 0.5f, 1);
worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, Reference.prefix() + "grinder", 0.5f, 1);
}
counter -= requiredTorque;
@ -192,14 +192,14 @@ public class TileGrindingWheel extends TileMechanical implements IRotatable
public boolean canGrind(ItemStack itemStack)
{
return MachineRecipes.INSTANCE.getOutput(RecipeType.GRINDER.name(), itemStack).length > 0;
return MachineRecipes.INSTANCE.getOutput(RecipeType.GRINDER().toString(), itemStack).length > 0;
}
private boolean doGrind(EntityItem entity)
{
ItemStack itemStack = entity.getEntityItem();
RecipeResource[] results = MachineRecipes.INSTANCE.getOutput(RecipeType.GRINDER.name(), itemStack);
RecipeResource[] results = MachineRecipes.INSTANCE.getOutput(RecipeType.GRINDER().toString(), itemStack);
for (RecipeResource resource : results)
{

View file

@ -1,9 +1,9 @@
package resonantinduction.mechanical.process.mixer;
import net.minecraftforge.common.util.ForgeDirection;
import resonant.api.grid.INodeProvider;
import resonantinduction.core.interfaces.IMechanicalNode;
import resonantinduction.mechanical.energy.grid.MechanicalNode;
import universalelectricity.api.core.grid.INodeProvider;
public class MixerNode extends MechanicalNode
{

View file

@ -8,12 +8,13 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import resonant.api.items.ISimpleItemRenderer;
import resonant.content.prefab.scala.render.ISimpleItemRenderer;
import resonant.lib.render.RenderUtility;
import resonantinduction.core.Reference;
import cpw.mods.fml.relauncher.Side;
@ -26,8 +27,8 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderMixer extends TileEntitySpecialRenderer implements ISimpleItemRenderer
{
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "mixer.tcn");
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "mixer.png");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(),Reference.modelDirectory() + "mixer.tcn"));
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "mixer.png");
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
@ -48,7 +49,7 @@ public class RenderMixer extends TileEntitySpecialRenderer implements ISimpleIte
}
@Override
public void renderInventoryItem(ItemStack itemStack)
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data)
{
glPushMatrix();
GL11.glScalef(0.5f, 0.5f, 0.5f);

View file

@ -4,9 +4,9 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.init.Blocks;
import resonantinduction.mechanical.energy.grid.TileMechanical;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
@ -23,6 +23,7 @@ import resonantinduction.core.ResonantInduction.RecipeType;
import resonantinduction.core.Timer;
import resonantinduction.core.resource.ResourceGenerator;
import resonantinduction.core.resource.fluid.BlockFluidMixture;
import universalelectricity.core.transform.rotation.Quaternion;
import universalelectricity.core.transform.vector.Vector3;
/**
@ -40,16 +41,17 @@ public class TileMixer extends TileMechanical implements IInventory
{
super(Material.iron);
mechanicalNode = new MixerNode(this).setConnection(Byte.parseByte("000011", 2));
isOpaqueCube = false;
normalRender = false;
customItemRender = true;
textureName = "material_metal_top";
isOpaqueCube(false);
normalRender(false);
customItemRender(true);
setTextureName("material_metal_top");
}
@Override
public void updateEntity()
public void update()
{
if (!world().isRemote && ticks % 20 == 0)
super.update();
if (!world().isRemote && ticks() % 20 == 0)
{
this.areaBlockedFromMoving = false;
for (int x = -1; x <= 1; x++)
@ -58,10 +60,9 @@ public class TileMixer extends TileMechanical implements IInventory
{
if (x != 0 && z != 0)
{
int id = position().add(x, 0, z).getBlock(world());
Block block = Block.blocksList[id];
Block block = position().add(x, 0, z).getBlock(world());
if (block != null && !(block instanceof IFluidBlock) && !(block instanceof BlockFluid))
if (block != null && !(block instanceof IFluidBlock))
{
this.areaBlockedFromMoving = true;
return;
@ -94,7 +95,7 @@ public class TileMixer extends TileMechanical implements IInventory
boolean didWork = false;
// Search for an item to "process"
AxisAlignedBB aabb = AxisAlignedBB.getAABBPool().getAABB(this.xCoord - 1, this.yCoord, this.zCoord - 1, this.xCoord + 2, this.yCoord + 1, this.zCoord + 2);
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(this.xCoord - 1, this.yCoord, this.zCoord - 1, this.xCoord + 2, this.yCoord + 1, this.zCoord + 2);
List<Entity> entities = this.worldObj.getEntitiesWithinAABB(Entity.class, aabb);
Set<EntityItem> processItems = new LinkedHashSet<EntityItem>();
@ -105,16 +106,16 @@ public class TileMixer extends TileMechanical implements IInventory
*/
Vector3 originalPosition = new Vector3(entity);
Vector3 relativePosition = originalPosition.clone().subtract(new Vector3(this).add(0.5));
relativePosition.rotate(-mechanicalNode.getAngularSpeed(), 0, 0);
relativePosition.transform(new Quaternion(- mechanicalNode.getAngularSpeed(), new Vector3(1,0,0)));
Vector3 newPosition = new Vector3(this).add(0.5).add(relativePosition);
Vector3 difference = newPosition.difference(originalPosition).scale(0.5);
Vector3 difference = newPosition.subtract(originalPosition).multiply(0.5);
entity.addVelocity(difference.x, difference.y, difference.z);
entity.addVelocity(difference.x(), difference.y(), difference.z());
entity.onGround = false;
if (entity instanceof EntityItem)
{
if (MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER.name(), ((EntityItem) entity).getEntityItem()).length > 0)
if (MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER().toString(), ((EntityItem) entity).getEntityItem()).length > 0)
{
processItems.add((EntityItem) entity);
}
@ -128,7 +129,7 @@ public class TileMixer extends TileMechanical implements IInventory
timer.put(processingItem, PROCESS_TIME);
}
if (!processingItem.isDead && new Vector3(this).add(0.5).distance(processingItem) < 2)
if (!processingItem.isDead && new Vector3(this).add(0.5).distance(new Vector3(processingItem)) < 2)
{
int timeLeft = timer.decrease(processingItem);
@ -165,9 +166,9 @@ public class TileMixer extends TileMechanical implements IInventory
if (didWork)
{
if (this.ticks % 20 == 0)
if (this.ticks() % 20 == 0)
{
this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, Reference.PREFIX + "mixer", 0.5f, 1);
this.worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, Reference.prefix() + "mixer", 0.5f, 1);
}
}
}
@ -176,9 +177,9 @@ public class TileMixer extends TileMechanical implements IInventory
{
Vector3 mixPosition = new Vector3(entity.posX, yCoord, entity.posZ);
if (mixPosition.getBlock(world()) != blockID())
if (mixPosition.getBlock(world()) != getBlockType())
{
Block block = Block.blocksList[mixPosition.getBlock(worldObj)];
Block block = mixPosition.getBlock(worldObj);
Block blockFluidFinite = ResourceGenerator.getMixture(ResourceGenerator.getName(entity.getEntityItem()));
if (blockFluidFinite != null)
@ -193,9 +194,9 @@ public class TileMixer extends TileMechanical implements IInventory
return true;
}
}
else if (block != null && (block.blockID == Block.waterStill.blockID || block.blockID == Block.waterMoving.blockID))
else if (block != null && (block == Blocks.water || block == Blocks.flowing_water))
{
mixPosition.setBlock(worldObj, blockFluidFinite.blockID);
mixPosition.setBlock(worldObj, blockFluidFinite);
}
}
}
@ -238,44 +239,38 @@ public class TileMixer extends TileMechanical implements IInventory
}
@Override
public String getInvName()
{
return null;
public String getInventoryName() {
return "Mixer";
}
@Override
public boolean isInvNameLocalized()
{
return false;
public boolean hasCustomInventoryName() {
return true;
}
@Override
public int getInventoryStackLimit()
{
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
return false;
}
@Override
public void openChest()
{
public void openInventory() {
}
@Override
public void closeChest()
{
public void closeInventory() {
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
return MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER.name(), itemstack).length > 0;
return MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER().toString(), itemstack).length > 0;
}
}

View file

@ -1,32 +0,0 @@
package resonantinduction.mechanical.turbine;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import resonant.lib.prefab.turbine.BlockTurbine;
import resonant.lib.render.block.BlockRenderingHandler;
import resonantinduction.core.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockElectricTurbine extends BlockTurbine
{
public BlockElectricTurbine(int id)
{
super(id, Material.iron);
setTextureName(Reference.PREFIX + "machine");
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderType()
{
return BlockRenderingHandler.ID;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileElectricTurbine();
}
}

View file

@ -1,172 +0,0 @@
package resonantinduction.mechanical.turbine;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import resonant.lib.prefab.block.BlockRotatable;
import resonantinduction.core.Reference;
import resonantinduction.mechanical.gear.ItemHandCrank;
public class BlockTurbine extends BlockRotatable
{
public BlockTurbine(int id)
{
super(id, Material.iron);
setTextureName(Reference.PREFIX + "material_wood_surface");
rotationMask = Byte.parseByte("111111", 2);
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6)
{
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileTurbine)
{
((TileTurbine) tileEntity).getMultiBlock().deconstruct();
}
dropDamage = getDamageValue(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
@Override
public boolean renderAsNormalBlock()
{
return false;
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public int getDamageValue(World world, int x, int y, int z)
{
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileTurbine)
return ((TileTurbine) tile).tier;
return 0;
}
/** Temporarily "cheat" var for dropping with damage. */
int dropDamage = 0;
@Override
public int damageDropped(int par1)
{
return dropDamage;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
{
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileTurbine)
{
((TileTurbine) tileEntity).tier = itemStack.getItemDamage();
}
}
@Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemHandCrank)
{
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileTurbine)
{
if (!world.isRemote)
{
TileTurbine tile = (TileTurbine) tileEntity;
tile.mechanicalNode.torque = -tile.mechanicalNode.torque;
tile.mechanicalNode.angularVelocity = -tile.mechanicalNode.angularVelocity;
}
return true;
}
}
return false;
}
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileTurbine)
{
TileTurbine tile = (TileTurbine) tileEntity;
if (tile.getMultiBlock().isConstructed())
{
tile.getMultiBlock().deconstruct();
tile.multiBlockRadius++;
if (!tile.getMultiBlock().construct())
{
tile.multiBlockRadius = 1;
}
return true;
}
else
{
if (!tile.getMultiBlock().construct())
{
tile.multiBlockRadius = 1;
tile.getMultiBlock().construct();
}
}
return true;
}
return false;
}
@Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (!world.isRemote && tileEntity instanceof TileTurbine)
{
Set<TileTurbine> toFlip = new HashSet<TileTurbine>();
if (!((TileTurbine) tileEntity).getMultiBlock().isConstructed())
{
toFlip.add((TileTurbine) tileEntity);
}
else
{
Set<TileTurbine> str = ((TileTurbine) tileEntity).getMultiBlock().getPrimary().getMultiBlock().getStructure();
if (str != null)
toFlip.addAll(str);
}
for (TileTurbine turbine : toFlip)
{
if (side == turbine.getDirection().ordinal())
world.setBlockMetadataWithNotify(turbine.xCoord, turbine.yCoord, turbine.zCoord, side ^ 1, 3);
else
world.setBlockMetadataWithNotify(turbine.xCoord, turbine.yCoord, turbine.zCoord, side, 3);
}
}
return true;
}
}

View file

@ -1,39 +0,0 @@
package resonantinduction.mechanical.turbine;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import resonant.lib.render.block.BlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockWaterTurbine extends BlockTurbine
{
public BlockWaterTurbine(int id)
{
super(id);
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < 3; i++)
par3List.add(new ItemStack(par1, 1, i));
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderType()
{
return BlockRenderingHandler.ID;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileWaterTurbine();
}
}

View file

@ -1,39 +0,0 @@
package resonantinduction.mechanical.turbine;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import resonant.lib.render.block.BlockRenderingHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockWindTurbine extends BlockTurbine
{
public BlockWindTurbine(int id)
{
super(id);
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < 3; i++)
par3List.add(new ItemStack(par1, 1, i));
}
@SideOnly(Side.CLIENT)
@Override
public int getRenderType()
{
return BlockRenderingHandler.ID;
}
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileWindTurbine();
}
}

View file

@ -9,7 +9,6 @@ import net.minecraftforge.client.model.IModelCustom;
import org.apache.commons.lang3.ArrayUtils;
import org.lwjgl.opengl.GL11;
import resonant.lib.prefab.turbine.TileTurbine;
import resonantinduction.core.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -17,10 +16,10 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderElectricTurbine extends TileEntitySpecialRenderer
{
public static final IModelCustom MODEL_SMALL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "turbineSmall.tcn");
public static final IModelCustom MODEL_LARGE = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "turbineLarge.tcn");
public static final ResourceLocation SMALL_TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "turbineSmall.png");
public static final ResourceLocation LARGE_TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "turbineLarge.png");
public static final IModelCustom MODEL_SMALL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(),Reference.modelDirectory() + "turbineSmall.tcn"));
public static final IModelCustom MODEL_LARGE = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(),Reference.modelDirectory() + "turbineLarge.tcn"));
public static final ResourceLocation SMALL_TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "turbineSmall.png");
public static final ResourceLocation LARGE_TEXTURE = new ResourceLocation(Reference.domain(), Reference.modelPath() + "turbineLarge.png");
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
@ -45,13 +44,13 @@ public class RenderElectricTurbine extends TileEntitySpecialRenderer
{ "LargeBlade1", "LargeBlade2", "LargeBlade3", "LargeBlade4", "LargeBlade5", "LargeBlade6" };
GL11.glPushMatrix();
GL11.glRotated(Math.toDegrees(tile.rotation), 0, 1, 0);
GL11.glRotated(Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 1, 0);
MODEL_LARGE.renderOnly(blades);
MODEL_LARGE.renderOnly(largeBlades);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glRotated(-Math.toDegrees(tile.rotation), 0, 1, 0);
GL11.glRotated(-Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 1, 0);
MODEL_LARGE.renderOnly(mediumBlades);
GL11.glPopMatrix();
@ -90,12 +89,12 @@ public class RenderElectricTurbine extends TileEntitySpecialRenderer
final String[] renderB = ArrayUtils.addAll(bladesB, sheildsB);
GL11.glPushMatrix();
GL11.glRotated(Math.toDegrees(tile.rotation), 0, 1, 0);
GL11.glRotated(Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 1, 0);
MODEL_SMALL.renderOnly(renderA);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glRotated(-Math.toDegrees(tile.rotation), 0, 1, 0);
GL11.glRotated(-Math.toDegrees(tile.mechanicalNode.renderAngle), 0, 1, 0);
MODEL_SMALL.renderOnly(renderB);
GL11.glPopMatrix();

View file

@ -3,12 +3,14 @@ package resonantinduction.mechanical.turbine;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import resonant.api.items.ISimpleItemRenderer;
import resonant.content.prefab.scala.render.ISimpleItemRenderer;
import resonant.lib.render.RenderUtility;
import resonantinduction.core.Reference;
import cpw.mods.fml.relauncher.Side;
@ -17,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderWaterTurbine extends TileEntitySpecialRenderer implements ISimpleItemRenderer
{
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "waterTurbines.obj");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(), Reference.modelDirectory() + "waterTurbines.obj"));
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
@ -64,7 +66,7 @@ public class RenderWaterTurbine extends TileEntitySpecialRenderer implements ISi
}
@Override
public void renderInventoryItem(ItemStack itemStack)
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data)
{
GL11.glPushMatrix();
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
@ -81,13 +83,13 @@ public class RenderWaterTurbine extends TileEntitySpecialRenderer implements ISi
GL11.glPushMatrix();
GL11.glScalef(1, 1.6f, 1);
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "cobblestone.png");
MODEL.renderOnly("bigwheel_endknot", "horizontal_centre_shaft");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(1, 1.4f, 1);
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_spruce.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "planks_spruce.png");
MODEL.renderOnly("bigwheel_supporters");
bindTexture(tier);
MODEL.renderOnly("bigwheel_scoops", "bigwheel_supportercircle");
@ -98,7 +100,7 @@ public class RenderWaterTurbine extends TileEntitySpecialRenderer implements ISi
{
GL11.glPushMatrix();
GL11.glScalef(0.7f, 1, 0.7f);
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "cobblestone.png");
MODEL.renderOnly("small_waterwheel_endknot");
bindTexture(tier);
MODEL.renderOnly("small_waterwheel", "small_waterwheel_supporters", "horizontal_centre_shaft");
@ -120,7 +122,7 @@ public class RenderWaterTurbine extends TileEntitySpecialRenderer implements ISi
{
GL11.glPushMatrix();
GL11.glScalef(0.9f, 1f, 0.9f);
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "log_oak.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "log_oak.png");
MODEL.renderOnly("small_waterwheel_endknot");
bindTexture(tier);
MODEL.renderOnly("small_turbine_blades");
@ -133,13 +135,13 @@ public class RenderWaterTurbine extends TileEntitySpecialRenderer implements ISi
switch (tier)
{
case 0:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "planks_oak.png");
break;
case 1:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "cobblestone.png");
break;
case 2:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "iron_block.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "iron_block.png");
break;
}
}

View file

@ -3,12 +3,14 @@ package resonantinduction.mechanical.turbine;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import resonant.api.items.ISimpleItemRenderer;
import resonant.content.prefab.scala.render.ISimpleItemRenderer;
import resonant.lib.render.RenderUtility;
import resonantinduction.core.Reference;
import cpw.mods.fml.relauncher.Side;
@ -17,7 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderWindTurbine extends TileEntitySpecialRenderer implements ISimpleItemRenderer
{
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "windTurbines.obj");
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain(), Reference.modelDirectory() + "windTurbines.obj"));
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
@ -44,7 +46,7 @@ public class RenderWindTurbine extends TileEntitySpecialRenderer implements ISim
}
@Override
public void renderInventoryItem(ItemStack itemStack)
public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data)
{
GL11.glPushMatrix();
GL11.glTranslatef(0.5f, 0.5f, 0.5f);
@ -57,13 +59,13 @@ public class RenderWindTurbine extends TileEntitySpecialRenderer implements ISim
switch (tier)
{
case 0:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "planks_oak.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "planks_oak.png");
break;
case 1:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "cobblestone.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "cobblestone.png");
break;
case 2:
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "iron_block.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "iron_block.png");
break;
}
@ -84,14 +86,14 @@ public class RenderWindTurbine extends TileEntitySpecialRenderer implements ISim
GL11.glScalef(1f, 2f, 1f);
GL11.glTranslatef(0, -0.05f, 0);
MODEL.renderOnly("LargeHub");
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "wool_colored_white.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "wool_colored_white.png");
MODEL.renderOnly("LargeBlade");
}
}
else
{
MODEL.renderOnly("SmallBlade");
RenderUtility.bind(Reference.BLOCK_TEXTURE_DIRECTORY + "log_oak.png");
RenderUtility.bind(Reference.blockTextureDirectory() + "log_oak.png");
MODEL.renderOnly("SmallHub");
}

View file

@ -2,6 +2,7 @@ package resonantinduction.mechanical.turbine;
import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraftforge.common.util.ForgeDirection;
import resonant.lib.schematic.Schematic;
import resonant.lib.type.Pair;
@ -17,9 +18,9 @@ public class SchematicWaterTurbine extends Schematic
}
@Override
public HashMap<Vector3, Pair<Integer, Integer>> getStructure(ForgeDirection dir, int size)
public HashMap<Vector3, Pair<Block, Integer>> getStructure(ForgeDirection dir, int size)
{
HashMap<Vector3, Pair<Integer, Integer>> returnMap = new HashMap<Vector3, Pair<Integer, Integer>>();
HashMap<Vector3, Pair<Block, Integer>> returnMap = new HashMap<Vector3, Pair<Block, Integer>>();
int r = size;
@ -32,7 +33,7 @@ public class SchematicWaterTurbine extends Schematic
if ((dir.offsetX != 0 && x == 0) || (dir.offsetY != 0 && y == 0) || (dir.offsetZ != 0 && z == 0))
{
Vector3 targetPosition = new Vector3(x, y, z);
returnMap.put(targetPosition, new Pair(Mechanical.blockWaterTurbine.blockID, dir.ordinal()));
returnMap.put(targetPosition, new Pair(Mechanical.blockWaterTurbine, dir.ordinal()));
}
}
}

View file

@ -2,6 +2,7 @@ package resonantinduction.mechanical.turbine;
import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraftforge.common.util.ForgeDirection;
import resonant.lib.schematic.Schematic;
import resonant.lib.type.Pair;
@ -17,9 +18,9 @@ public class SchematicWindTurbine extends Schematic
}
@Override
public HashMap<Vector3, Pair<Integer, Integer>> getStructure(ForgeDirection dir, int size)
public HashMap<Vector3, Pair<Block, Integer>> getStructure(ForgeDirection dir, int size)
{
HashMap<Vector3, Pair<Integer, Integer>> returnMap = new HashMap<Vector3, Pair<Integer, Integer>>();
HashMap<Vector3, Pair<Block, Integer>> returnMap = new HashMap<Vector3, Pair<Block, Integer>>();
int r = size;
@ -32,7 +33,7 @@ public class SchematicWindTurbine extends Schematic
if ((dir.offsetX != 0 && x == 0) || (dir.offsetY != 0 && y == 0) || (dir.offsetZ != 0 && z == 0))
{
Vector3 targetPosition = new Vector3(x, y, z);
returnMap.put(targetPosition, new Pair(Mechanical.blockWindTurbine.blockID, dir.ordinal()));
returnMap.put(targetPosition, new Pair(Mechanical.blockWindTurbine, dir.ordinal()));
}
}
}

View file

@ -1,55 +0,0 @@
package resonantinduction.mechanical.turbine;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import resonant.api.IBoilHandler;
import resonantinduction.core.Reference;
import resonantinduction.core.Settings;
public class TileElectricTurbine extends TileTurbine implements IBoilHandler
{
public TileElectricTurbine()
{
super();
maxPower = 5000000;
}
@Override
public void updateEntity()
{
if (getMultiBlock().isConstructed())
{
torque = defaultTorque * 500 * getArea();
}
else
{
torque = defaultTorque * 500;
}
super.updateEntity();
}
@Override
public void onProduce()
{
energy.receiveEnergy((long) (power * Settings.turbineOutputMultiplier), true);
produce();
}
@Override
public void playSound()
{
if (this.worldObj.getWorldTime() % Atomic.SECOND_IN_TICKS == 0)
{
double maxVelocity = (getMaxPower() / torque) * 4;
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);
}
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
return from == ForgeDirection.DOWN && super.canFill(from, fluid);
}
}

View file

@ -0,0 +1,53 @@
package resonantinduction.mechanical.turbine
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids.{FluidTank, Fluid, FluidStack, FluidTankInfo}
import resonant.api.IBoilHandler
import resonant.lib.content.prefab.TElectric
import resonantinduction.core.{Reference, Settings}
class TileElectricTurbine extends TileTurbine with IBoilHandler with TElectric {
var tank : FluidTank = new FluidTank(1000);
maxPower = 5000000
override def update {
if (getMultiBlock.isConstructed) {
mechanicalNode.torque = defaultTorque * 500 * getArea
}
else {
mechanicalNode.torque = defaultTorque * 500
}
super.updateEntity
}
def onProduce {
energy.receiveEnergy((power * Settings.turbineOutputMultiplier).asInstanceOf[Long], true)
}
override def playSound {
if (this.worldObj.getWorldTime % 1200 == 0) {
val maxVelocity: Double = (getMaxPower / mechanicalNode.torque) * 4
val percentage: Float = Math.max(mechanicalNode.angularVelocity * 4 / maxVelocity.asInstanceOf[Float], 1.0f).asInstanceOf[Float]
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, Reference.prefix + "turbine", percentage, 1.0f)
}
}
def canFill(from: ForgeDirection, fluid: Fluid): Boolean = {
return from == ForgeDirection.DOWN && fluid.getName.contains("steam")
}
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean): Int = tank.fill(resource, doFill)
override def drain(from: ForgeDirection, resource: FluidStack, doDrain: Boolean): FluidStack = null
override def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack = null
override def canDrain(from: ForgeDirection, fluid: Fluid): Boolean = false
override def getTankInfo(from: ForgeDirection): Array[FluidTankInfo] = {
val re : Array[FluidTankInfo] = new Array[FluidTankInfo](1)
re(1) = tank.getInfo
return re
}
}

View file

@ -3,14 +3,19 @@ package resonantinduction.mechanical.turbine;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import resonant.lib.multiblock.reference.IMultiBlockStructure;
import resonant.lib.network.handle.IPacketIDReceiver;
import resonantinduction.core.Reference;
import resonantinduction.mechanical.energy.grid.TileMechanical;
import net.minecraft.block.material.Material;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import resonantinduction.mechanical.gear.ItemHandCrank;
import universalelectricity.api.core.grid.INodeProvider;
import universalelectricity.core.transform.vector.Vector3;
import cpw.mods.fml.relauncher.Side;
@ -39,7 +44,18 @@ public class TileTurbine extends TileMechanical implements IMultiBlockStructure<
public TileTurbine()
{
super(Material.wood);
normalRender(false);
isOpaqueCube(false);
setTextureName("material_wood_surface");
mechanicalNode = new TurbineNode(this);
//rotationMask = Byte.parseByte("111111", 2);
}
@Override
public void onRemove(Block block, int par1)
{
super.onRemove(block, par1);
getMultiBlock().deconstruct();
}
@Override
@ -111,7 +127,7 @@ public class TileTurbine extends TileMechanical implements IMultiBlockStructure<
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
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);
return AxisAlignedBB.getBoundingBox(this.xCoord - multiBlockRadius, this.yCoord - multiBlockRadius, this.zCoord - multiBlockRadius, this.xCoord + 1 + multiBlockRadius, this.yCoord + 1 + multiBlockRadius, this.zCoord + 1 + multiBlockRadius);
}
@Override
@ -156,7 +172,7 @@ public class TileTurbine extends TileMechanical implements IMultiBlockStructure<
@Override
public void onMultiBlockChanged()
{
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType() != null ? getBlockType().blockID : 0);
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType() != null ? getBlockType() : null);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@ -165,4 +181,66 @@ public class TileTurbine extends TileMechanical implements IMultiBlockStructure<
{
return worldObj;
}
@Override
public boolean use(EntityPlayer player, int side, Vector3 hit)
{
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemHandCrank)
{
if (!world().isRemote)
{
mechanicalNode.torque = -mechanicalNode.torque;
mechanicalNode.angularVelocity = -mechanicalNode.angularVelocity;
}
return true;
}
return false;
}
@Override
public boolean configure(EntityPlayer player, int side, Vector3 hit)
{
if(!player.isSneaking()) {
if (getMultiBlock().isConstructed()) {
getMultiBlock().deconstruct();
multiBlockRadius++;
if (!getMultiBlock().construct()) {
multiBlockRadius = 1;
}
return true;
} else {
if (!getMultiBlock().construct()) {
multiBlockRadius = 1;
getMultiBlock().construct();
}
}
}else
{
Set<TileTurbine> toFlip = new HashSet<TileTurbine>();
if (!getMultiBlock().isConstructed())
{
toFlip.add(this);
}
else
{
Set<TileTurbine> str = getMultiBlock().getPrimary().getMultiBlock().getStructure();
if (str != null)
toFlip.addAll(str);
}
for (TileTurbine turbine : toFlip)
{
if (side == turbine.getDirection().ordinal())
world().setBlockMetadataWithNotify(turbine.xCoord, turbine.yCoord, turbine.zCoord, side ^ 1, 3);
else
world().setBlockMetadataWithNotify(turbine.xCoord, turbine.yCoord, turbine.zCoord, side, 3);
}
}
return true;
}
}

View file

@ -1,16 +1,21 @@
package resonantinduction.mechanical.turbine;
import java.lang.reflect.Method;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
import resonant.api.grid.INodeProvider;
import resonantinduction.core.Settings;
import resonantinduction.mechanical.energy.grid.MechanicalNode;
import universalelectricity.api.core.grid.INodeProvider;
import universalelectricity.core.transform.vector.Vector3;
import cpw.mods.fml.relauncher.ReflectionHelper;
@ -53,8 +58,9 @@ public class TileWaterTurbine extends TileTurbine
}
@Override
public void updateEntity()
public void update()
{
super.update();
if (getMultiBlock().isConstructed())
{
mechanicalNode.torque = (long) (defaultTorque / (1d / multiBlockRadius));
@ -77,17 +83,17 @@ public class TileWaterTurbine extends TileTurbine
powerTicks--;
}
if (ticks % 20 == 0)
if (ticks() % 20 == 0)
{
int blockIDAbove = worldObj.getBlockId(xCoord, yCoord + 1, zCoord);
Block blockIDAbove = worldObj.getBlock(xCoord, yCoord + 1, zCoord);
int metadata = worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord);
boolean isWater = (blockIDAbove == Block.waterStill.blockID || blockIDAbove == Block.waterMoving.blockID);
boolean isWater = (blockIDAbove == Blocks.water || blockIDAbove == Blocks.flowing_water);
if (isWater && worldObj.isAirBlock(xCoord, yCoord - 1, zCoord) && metadata == 0)
{
powerTicks = 20;
worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);
worldObj.setBlock(xCoord, yCoord - 1, zCoord, Block.waterMoving.blockID);
worldObj.setBlock(xCoord, yCoord - 1, zCoord, Blocks.flowing_water);
}
}
}
@ -101,30 +107,30 @@ public class TileWaterTurbine extends TileTurbine
if (dir != currentDir && dir != currentDir.getOpposite())
{
Vector3 check = new Vector3(this).add(dir);
int blockID = worldObj.getBlockId(check.xi(), check.yi(), check.zi());
Block blockID = worldObj.getBlock(check.xi(), check.yi(), check.zi());
int metadata = worldObj.getBlockMetadata(check.xi(), check.yi(), check.zi());
if (blockID == Block.waterMoving.blockID || blockID == Block.waterStill.blockID)
if (blockID == Blocks.water || blockID == Blocks.flowing_water)
{
try
{
Method m = ReflectionHelper.findMethod(BlockFluid.class, null, new String[] { "getFlowVector", "func_72202_i" }, IBlockAccess.class, Integer.TYPE, Integer.TYPE, Integer.TYPE);
Vector3 vector = new Vector3((Vec3) m.invoke(Block.waterMoving, worldObj, check.xi(), check.yi(), check.zi()));
Method m = ReflectionHelper.findMethod(BlockDynamicLiquid.class, null, new String[] { "getFlowVector", "func_72202_i" }, IBlockAccess.class, Integer.TYPE, Integer.TYPE, Integer.TYPE);
Vector3 vector = new Vector3((Vec3) m.invoke(Blocks.water, worldObj, check.xi(), check.yi(), check.zi()));
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))
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);
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);
getMultiBlock().get().power += Math.abs(getWaterPower() * vector.x() * (7 - metadata) / 7f);
powerTicks = 20;
}
}
@ -136,8 +142,6 @@ public class TileWaterTurbine extends TileTurbine
}
}
}
super.updateEntity();
}
/**
@ -146,6 +150,13 @@ public class TileWaterTurbine extends TileTurbine
*/
private long getWaterPower()
{
return (maxPower / (2 - tier + 1)) * Settings.WATER_POWER_RATIO;
return (maxPower / (2 - tier + 1)) * Settings.WATER_POWER_RATIO();
}
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < 3; i++)
par3List.add(new ItemStack(par1, 1, i));
}
}

View file

@ -1,6 +1,9 @@
package resonantinduction.mechanical.turbine;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
@ -11,6 +14,8 @@ import resonant.lib.utility.inventory.InventoryUtility;
import resonantinduction.core.Settings;
import universalelectricity.core.transform.vector.Vector3;
import java.util.List;
/** The vertical wind turbine collects airflow. The horizontal wind turbine collects steam from steam
* power plants.
*
@ -24,13 +29,13 @@ public class TileWindTurbine extends TileTurbine
@Override
public void updateEntity()
public void update()
{
/** Break under storm. */
if (tier == 0 && getDirection().offsetY == 0 && worldObj.isRaining() && worldObj.isThundering() && worldObj.rand.nextFloat() < 0.00000008)
{
InventoryUtility.dropItemStack(worldObj, new Vector3(this), new ItemStack(Block.cloth, 1 + worldObj.rand.nextInt(2)));
InventoryUtility.dropItemStack(worldObj, new Vector3(this), new ItemStack(Item.stick, 3 + worldObj.rand.nextInt(8)));
InventoryUtility.dropItemStack(worldObj, new Vector3(this), new ItemStack(Blocks.wool, 1 + worldObj.rand.nextInt(2)));
InventoryUtility.dropItemStack(worldObj, new Vector3(this), new ItemStack(Items.stick, 3 + worldObj.rand.nextInt(8)));
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
return;
}
@ -44,7 +49,7 @@ public class TileWindTurbine extends TileTurbine
{
maxPower = 3000;
if (ticks % 20 == 0 && !worldObj.isRemote)
if (ticks() % 20 == 0 && !worldObj.isRemote)
computePower();
getMultiBlock().get().power += windPower;
@ -109,6 +114,13 @@ public class TileWindTurbine extends TileTurbine
boolean hasBonus = biome instanceof BiomeGenOcean || biome instanceof BiomeGenPlains || biome == BiomeGenBase.river;
float windSpeed = (worldObj.rand.nextFloat() / 8) + (yCoord / 256f) * (hasBonus ? 1.2f : 1) + worldObj.getRainStrength(1.5f);
windPower = (long) Math.min(materialMultiplier * multiblockMultiplier * windSpeed * efficiency * Settings.WIND_POWER_RATIO, maxPower * Settings.WIND_POWER_RATIO);
windPower = (long) Math.min(materialMultiplier * multiblockMultiplier * windSpeed * efficiency * Settings.WIND_POWER_RATIO(), maxPower * Settings.WIND_POWER_RATIO());
}
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
for (int i = 0; i < 3; i++)
par3List.add(new ItemStack(par1, 1, i));
}
}

View file

@ -1,7 +1,7 @@
package resonantinduction.mechanical.turbine;
import net.minecraft.tileentity.TileEntity;
import resonant.lib.multiblock.MultiBlockHandler;
import resonant.lib.multiblock.reference.MultiBlockHandler;
import universalelectricity.core.transform.vector.Vector3;
public class TurbineMBlockHandler extends MultiBlockHandler<TileTurbine>
@ -13,11 +13,11 @@ public class TurbineMBlockHandler extends MultiBlockHandler<TileTurbine>
public TileTurbine getWrapperAt(Vector3 position)
{
TileEntity tile = position.getTileEntity(self.getWorld());
TileEntity tile = position.getTileEntity(this.tile.getWorld());
if (tile != null && wrapperClass.isAssignableFrom(tile.getClass()))
{
if (((TileTurbine) tile).getDirection() == self.getDirection() && ((TileTurbine) tile).tier == self.tier)
if (((TileTurbine) tile).getDirection() == this.tile.getDirection() && ((TileTurbine) tile).tier == this.tile.tier)
{
return (TileTurbine) tile;
}