Skip to content
Permalink
Browse files

Cleanup

  • Loading branch information...
alcatrazEscapee committed Jun 19, 2018
1 parent 71c0aff commit 826d2e56559da046a491cb389c3715a8f1a13e8b
@@ -93,9 +93,6 @@ public void preInit(FMLPreInitializationEvent event)
int id = 0;
network.registerMessage(ChunkDataMessage.Handler.class, ChunkDataMessage.class, ++id, Side.CLIENT);
ChunkCapabilityHandler.preInit();
// For world item rendering
//network.registerMessage(PacketUpdateWorldItem.Handler.class, PacketUpdateWorldItem.class, ++id, Side.CLIENT);
//network.registerMessage(PacketRequestWorldItem.Handler.class, PacketRequestWorldItem.class, ++id, Side.SERVER);

CalenderTFC.reload();

@@ -18,11 +18,6 @@
@Override
public void render(TEWorldItem te, double x, double y, double z, float partialTicks, int destroyStage, float alpha){
ItemStack stack = te.inventory.getStackInSlot(0);
//if (stack.isEmpty())
//{
// TerraFirmaCraft.getNetwork().sendToServer(new PacketRequestWorldItem(te));
// return;
//}
GlStateManager.pushMatrix();
//GlStateManager.translate((i % 2 == 0 ? 1 : 0), 0, (i < 2 ? 1 : 0));
//GlStateManager.rotate(timeD, 0, 1, 0);

This file was deleted.

This file was deleted.

@@ -32,7 +32,7 @@
{
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.25D, 0D, 0.25D, 0.75D, 0.0625D, 0.75D);

public BlockWorldItem()
BlockWorldItem()
{
super(Material.CIRCUITS);
setDefaultState(blockState.getBaseState());
@@ -101,10 +101,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
TEWorldItem te = (TEWorldItem) worldIn.getTileEntity(pos);
if (te == null) return true;
te.inventory.setStackInSlot(0, playerIn.getHeldItem(hand).copy());
//worldIn.setBlockToAir(pos);
worldIn.setBlockToAir(pos);
return true;
}
}
@@ -27,18 +27,9 @@
@MethodsReturnNonnullByDefault
public class TEWorldItem extends TileEntity
{
public ItemStackHandler inventory = new ItemStackHandler(1);/*{
@Override
protected void onContentsChanged(int slot) {
if (!world.isRemote) {
TerraFirmaCraft.getNetwork().sendToAllAround(new PacketUpdateWorldItem(TEWorldItem.this),
new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 32));
}
}
};*/
public ItemStackHandler inventory = new ItemStackHandler(1);

public static final ResourceLocation ID = new ResourceLocation(MOD_ID, "world_item");
//private ItemStack item = ItemStack.EMPTY;

public TEWorldItem()
{
@@ -52,45 +43,18 @@ public void onBreakBlock()
InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), inventory.getStackInSlot(0));
}

/*public void setItem(ItemStack item){
this.item = item;
//updateBlock(doMarkDirty);
if(!world.isRemote)
{
this.markDirty();
TerraFirmaCraft.getNetwork().sendToAllAround(new PacketUpdateWorldItem(this),
new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 64));
}
}*/

/*public void setItem(){
}*/

/*public ItemStack getItem(){
//if(item == ItemStack.EMPTY)
// updateBlock(false);
return item;
}*/

@Override
public void readFromNBT(NBTTagCompound compound)
{
inventory.deserializeNBT(compound.getCompoundTag("inventory"));
super.readFromNBT(compound);
//ItemStack stack = new ItemStack(compound.getCompoundTag("Item"));
//TerraFirmaCraft.getLog().debug("Trying to load state + "+compound.getCompoundTag("Item")+" and "+stack.getDisplayName());
//if(stack != null && !stack.isEmpty())
// setItem(stack);
}

@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
compound.setTag("inventory", inventory.serializeNBT());
return super.writeToNBT(compound);
//compound.setTag("Item", item.writeToNBT(new NBTTagCompound()));
//return compound;
}

@Override
@@ -101,17 +65,15 @@ public double getMaxRenderDistanceSquared()
}

@Override
public void onLoad(){
//if (world.isRemote) {
// TerraFirmaCraft.getNetwork().sendToServer(new PacketRequestWorldItem(this));
//}
// updateBlock(false);
}

public NBTTagCompound getUpdatePacketTag(NBTTagCompound nbt)
public NBTTagCompound getUpdateTag()
{
nbt.setTag("inventory", inventory.serializeNBT());
return nbt;
// The tag from this method is used for the initial chunk packet, and it needs to have the TE position!
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("x", this.getPos().getX());
nbt.setInteger("y", this.getPos().getY());
nbt.setInteger("z", this.getPos().getZ());
return getUpdatePacketTag(nbt);

}

@Override
@@ -127,19 +89,10 @@ public SPacketUpdateTileEntity getUpdatePacket()
}

@Override
public NBTTagCompound getUpdateTag()
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
// The tag from this method is used for the initial chunk packet,
// and it needs to have the TE position!
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("x", this.getPos().getX());
nbt.setInteger("y", this.getPos().getY());
nbt.setInteger("z", this.getPos().getZ());
getUpdatePacketTag(nbt);
//nbt.setTag("inventory", inventory.serializeNBT());

// Add the per-block data to the tag
return nbt;
return new AxisAlignedBB(getPos(), getPos().add(1D, 1D, 1D));
}

@Override
@@ -155,43 +108,11 @@ public void handleUpdateTag(NBTTagCompound tag)
{
inventory.deserializeNBT(tag.getCompoundTag("inventory"));
}
//TerraFirmaCraft.getLog().debug("Got update packet!");
}

/*public void updateBlock(boolean doMarkDirty)
{
if(world == null) return;
IBlockState state = world.getBlockState(pos);
world.notifyBlockUpdate(pos, state, state, 2); // sync TE
if(doMarkDirty)
markDirty();
}*/

/*@Nullable
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
return new SPacketUpdateTileEntity(pos, 127, getUpdateTag());
}
@Override
public NBTTagCompound getUpdateTag()
{
return item.writeToNBT(new NBTTagCompound());
}

@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
private NBTTagCompound getUpdatePacketTag(NBTTagCompound nbt)
{
//readFromNBT(pkt.getNbtCompound());
setItem(new ItemStack(pkt.getNbtCompound()));
//updateBlock();
}*/

@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
return new AxisAlignedBB(getPos(), getPos().add(1D, 1D, 1D));//TODO:see block bounding box method
nbt.setTag("inventory", inventory.serializeNBT());
return nbt;
}
}
@@ -77,16 +77,10 @@ private void generateRock(World world, BlockPos pos, @Nullable VeinType vein, Ro
IBlockState stateAt = world.getBlockState(pos.down());
if (world.isAirBlock(pos) && stateAt.isFullCube())
{
// todo: replace this with actual ore stone blocks
// ores are gotten from vein.oreSpawnData.ore
// the current rock can be gotten from the rock
world.setBlockState(pos, BlocksTFC.WORLD_ITEM.getDefaultState(),2);
TEWorldItem tile = (TEWorldItem) world.getTileEntity(pos);
if(tile != null)
tile.inventory.setStackInSlot(0, vein == null ? ItemRock.get(rock, 1) : ItemSmallOre.get(vein.oreSpawnData.ore, 1));
//TerraFirmaCraft.getNetwork().sendToAllAround(new PacketUpdateWorldItem(tile),
// new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 32));
//world.setBlockState(pos, vein == null ? BlockRockVariant.get(rock, Rock.Type.RAW).getDefaultState() : BlockOreTFC.get(vein.oreSpawnData.ore, Rock.ANDESITE, Ore.Grade.NORMAL), 2);
}
}

0 comments on commit 826d2e5

Please sign in to comment.
You can’t perform that action at this time.