Added particles and texture change to vanilla electric furnace

This commit is contained in:
Calclavia 2013-12-25 00:08:23 +08:00
parent 1ba7e3281a
commit 2d14ce5e07
4 changed files with 49 additions and 8 deletions

@ -1 +1 @@
Subproject commit 5c224d52622de8708ae8168e962a63a963699bde
Subproject commit 7b88562fffd04fc7c799a7176c05f0f655515852

View file

@ -65,12 +65,12 @@ public class CommonProxy implements IGuiHandler
public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color)
{
this.renderElectricShock(world, start, target, color.r / 255, color.g / 255, color.b / 255);
this.renderElectricShock(world, start, target, (float) color.r / 255f, (float) color.g / 255f, (float) color.b / 255f);
}
public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color, boolean split)
{
this.renderElectricShock(world, start, target, color.r / 255, color.g / 255, color.b / 255, split);
this.renderElectricShock(world, start, target, (float) color.r / 255f, (float) color.g / 255f, (float) color.b / 255f, split);
}
public void renderElectricShock(World world, Vector3 start, Vector3 target)

View file

@ -1,7 +1,15 @@
package resonantinduction.furnace;
import java.util.ArrayList;
import com.google.common.io.ByteArrayDataInput;
import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.IPacketSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.ForgeDirection;
@ -20,7 +28,7 @@ import universalelectricity.api.vector.Vector3;
*
*/
@UniversalClass
public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInterface, IEnergyContainer
public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInterface, IEnergyContainer, IPacketSender, IPacketReceiver
{
private static final float WATTAGE = 5;
@ -127,7 +135,6 @@ public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInt
if (doBlockStateUpdate != this.furnaceBurnTime > 0)
{
// TODO: Send descript packet.
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
@ -212,4 +219,37 @@ public class TileAdvancedFurnace extends TileEntityFurnace implements IEnergyInt
{
return this.energy.getEnergyCapacity();
}
@Override
public Packet getDescriptionPacket()
{
return ResonantInduction.PACKET_TILE.getPacket(this, this.getPacketData(0).toArray());
}
/**
* 1 - Description Packet
* 2 - Energy Update
* 3 - Tesla Beam
*/
@Override
public ArrayList getPacketData(int type)
{
ArrayList data = new ArrayList();
data.add(this.furnaceBurnTime);
return data;
}
@Override
public void onReceivePacket(ByteArrayDataInput data, EntityPlayer player)
{
try
{
this.furnaceBurnTime = data.readInt();
this.worldObj.markBlockForRenderUpdate(this.xCoord, this.yCoord, this.zCoord);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

View file

@ -11,6 +11,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@ -214,7 +215,7 @@ public class TileTesla extends TileEntityElectrical implements ITesla, IPacketSe
}
double distance = topTeslaVector.distance(targetVector);
ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), (float) ResonantInduction.DYE_COLORS[this.dyeID].r / 255, (float) ResonantInduction.DYE_COLORS[this.dyeID].g / 255, (float) ResonantInduction.DYE_COLORS[this.dyeID].b / 255);
ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), ResonantInduction.DYE_COLORS[this.dyeID]);
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP));
@ -223,7 +224,7 @@ public class TileTesla extends TileEntityElectrical implements ITesla, IPacketSe
this.sendPacket(3);
}
/*if (this.attackEntities && this.zapCounter % 5 == 0)
if (this.attackEntities && this.zapCounter % 5 == 0)
{
MovingObjectPosition mop = topTeslaVector.clone().translate(0.5).rayTraceEntities(this.worldObj, targetVector.clone().translate(0.5));
@ -235,7 +236,7 @@ public class TileTesla extends TileEntityElectrical implements ITesla, IPacketSe
ResonantInduction.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).clone().translate(0.5), new Vector3(mop.entityHit));
}
}
}*/
}
if (count++ > 1)
{