Tile Entity Package and Registry
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package nmd.primal.energy.common;
|
||||
|
||||
import nmd.primal.energy.util.CustomTab;
|
||||
import nmd.primal.energy.tileents.TileRegistry;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -15,7 +16,7 @@ public class CommonProxy {
|
||||
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
|
||||
TileRegistry.init();
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
|
||||
60
src/main/java/nmd/primal/energy/tileents/TileBase.java
Normal file
60
src/main/java/nmd/primal/energy/tileents/TileBase.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package nmd.primal.energy.tileents;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileBase extends TileEntity{
|
||||
|
||||
private String specName;
|
||||
|
||||
public TileBase(String name){
|
||||
specName = name;
|
||||
}
|
||||
|
||||
public void markForUpdate(){
|
||||
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
World world = getWorldObj();
|
||||
int x = this.xCoord;
|
||||
int y = this.yCoord;
|
||||
int z = this.zCoord;
|
||||
|
||||
if (worldObj.isRemote) return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
if (tagCompound.hasKey("CustomName", 8)) {
|
||||
specName = tagCompound.getString("CustomName");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -998, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
readFromNBT(pkt.func_148857_g());
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
}
|
||||
11
src/main/java/nmd/primal/energy/tileents/TileRegistry.java
Normal file
11
src/main/java/nmd/primal/energy/tileents/TileRegistry.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package nmd.primal.energy.tileents;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class TileRegistry {
|
||||
|
||||
public static final void init() {
|
||||
|
||||
//GameRegistry.registerTileEntity(TileEntityTestForge.class, "TestForge");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user