Skip to content

Commit

Permalink
Add Infinite Emitter tileentity
Browse files Browse the repository at this point in the history
  • Loading branch information
jakimfett committed May 29, 2014
1 parent 8370127 commit 303beb8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import particlephysics.BetterLoader;
import particlephysics.ModParticlePhysics;
import particlephysics.Settings;
import particlephysics.tileentity.emitter.EmitterTileEntity;
import particlephysics.utility.BasicComplexBlock;
import cpw.mods.fml.common.registry.GameRegistry;
import particlephysics.tileentity.emitter.EmitterBlock;
Expand Down Expand Up @@ -42,7 +41,6 @@ public void addStacksDroppedOnBlockBreak(TileEntity tileEntity, ArrayList<ItemSt
itemStacks.add(itemstack);
}
}
return;
}

@Override
Expand All @@ -66,7 +64,7 @@ public String getTop()
@Override
public Class getTileEntityClass()
{
return EmitterTileEntity.class;
return InfiniteEmitterTileEntity.class;
}

@Override
Expand Down Expand Up @@ -106,7 +104,7 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer e
{

TileEntity te = world.getBlockTileEntity(x, y, z);
if (te != null && te instanceof EmitterTileEntity)
if (te != null && te instanceof InfiniteEmitterTileEntity)
{
entityPlayer.openGui(ModParticlePhysics.INSTANCE, 0, world, x, y, z);
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package particlephysics.tileentity.infiniteemitter;

import net.minecraft.block.Block;
import net.minecraftforge.common.ForgeDirection;
import particlephysics.entity.particle.TemplateParticle;
import particlephysics.tileentity.emitter.EmitterTileEntity;

public class InfiniteEmitterTileEntity extends EmitterTileEntity
{
@Override
public void updateEntity()
{
this.intervalReset = (int) (worldObj.getTotalWorldTime() % ((20 * interval) + 20));
if (!worldObj.isRemote && intervalReset == 0)
{
if (this.inventory != null)
{
if (this.inventory[0] != null && isValidFuel(this.inventory[0].itemID))
{
// TODO: Get fuel amount from ItemMolecule.getSize() * 100;
this.fuelStored = 100;

this.fuelType = this.inventory[0].itemID;

this.fuelMeta = this.inventory[0].getItemDamage();
}

}
if (this.fuelStored > 0)
{
ForgeDirection[] outputDirections =
{
ForgeDirection.SOUTH, ForgeDirection.NORTH, ForgeDirection.WEST, ForgeDirection.EAST
};
for (ForgeDirection dir : outputDirections)
{

TemplateParticle particle = getParticleFromFuel(fuelType, fuelMeta);
if (particle == null)
{
return;
}
particle.addVelocity(dir.offsetX, dir.offsetY, dir.offsetZ);
particle.setPosition(xCoord + dir.offsetX + 0.375, yCoord + dir.offsetY + 0.375, zCoord + dir.offsetZ + 0.375);
worldObj.spawnEntityInWorld(particle);

}
}
}
}
}

0 comments on commit 303beb8

Please sign in to comment.