textures for the controller + basic code for directional blocks
This commit is contained in:
@@ -61,6 +61,8 @@ public class TileController extends TileSC implements IEnergyHandler, INetworkTi
|
||||
}
|
||||
|
||||
storage.extractEnergy(energyUsage, false);
|
||||
} else {
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package storagecraft.tile;
|
||||
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
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.minecraftforge.common.util.ForgeDirection;
|
||||
import storagecraft.SC;
|
||||
import storagecraft.network.MessageTileUpdate;
|
||||
|
||||
public class TileSC extends TileEntity {
|
||||
public static final int UPDATE_RANGE = 64;
|
||||
|
||||
private ForgeDirection direction;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
@@ -20,4 +27,40 @@ public class TileSC extends TileEntity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setDirection(ForgeDirection direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public ForgeDirection getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
direction = ForgeDirection.getOrientation(nbt.getInteger("Direction"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setInteger("Direction", direction.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
nbt.setInteger("Direction", direction.ordinal());
|
||||
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
direction = ForgeDirection.getOrientation(packet.func_148857_g().getInteger("Direction"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user