generated from tilera/1710mod
feat: implement void chest
This commit is contained in:
parent
e307d77dc4
commit
981e1152b9
|
@ -22,6 +22,7 @@ import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
|||
import net.anvilcraft.thaummach.tiles.TileFilter;
|
||||
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
import net.anvilcraft.thaummach.tiles.TileVoidChest;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
@Override
|
||||
|
@ -52,6 +53,7 @@ public class ClientProxy extends CommonProxy {
|
|||
GameRegistry.registerTileEntity(TileCrucible.class, "crucible");
|
||||
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
||||
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
||||
GameRegistry.registerTileEntity(TileVoidChest.class, "voidChest");
|
||||
|
||||
ClientRegistry.registerTileEntity(TileBore.class, "bore", new TileBoreRenderer());
|
||||
ClientRegistry.registerTileEntity(
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
|||
import net.anvilcraft.thaummach.tiles.TileFilter;
|
||||
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||
import net.anvilcraft.thaummach.tiles.TileVoidChest;
|
||||
|
||||
public class CommonProxy {
|
||||
public void preInit() {}
|
||||
|
@ -32,5 +33,6 @@ public class CommonProxy {
|
|||
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
||||
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
||||
GameRegistry.registerTileEntity(TileSeal.class, "seal");
|
||||
GameRegistry.registerTileEntity(TileVoidChest.class, "voidChest");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@ import net.anvilcraft.thaummach.render.apparatus.apparati.metal.ArcaneFurnaceApp
|
|||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.BoreApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.CrucibleApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.CrystallizerApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.VoidChestApparatusRenderer;
|
||||
import net.anvilcraft.thaummach.tiles.TileArcaneFurnace;
|
||||
import net.anvilcraft.thaummach.tiles.TileBore;
|
||||
import net.anvilcraft.thaummach.tiles.TileConduitTank;
|
||||
import net.anvilcraft.thaummach.tiles.TileCrucible;
|
||||
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
||||
import net.anvilcraft.thaummach.tiles.TileVoidChest;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -154,6 +156,8 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
case BORE:
|
||||
return BoreApparatusRenderer.INSTANCE;
|
||||
|
||||
case VOID_CHEST:
|
||||
return VoidChestApparatusRenderer.INSTANCE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -167,7 +171,7 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
tc.setTier((short) (md.ordinal() + 1));
|
||||
return tc;
|
||||
} else if (md == MetaVals.ARCANE_FURNACE) {
|
||||
//return new TileArcaneFurnace();
|
||||
return new TileArcaneFurnace();
|
||||
} else if (md == MetaVals.GENERATOR) {
|
||||
//return new TileGenerator();
|
||||
} else if (md == MetaVals.CRYSTALLIZER) {
|
||||
|
@ -175,7 +179,7 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
} else if (md == MetaVals.BORE) {
|
||||
return new TileBore();
|
||||
} else if (md == MetaVals.VOID_CHEST) {
|
||||
//return new TileVoidChest();
|
||||
return new TileVoidChest();
|
||||
} else if (md == MetaVals.VOID_INTERFACE) {
|
||||
//return new TileVoidInterface();
|
||||
} else if (md == MetaVals.TANK) {
|
||||
|
@ -241,11 +245,9 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
if (meta == MetaVals.GENERATOR) {
|
||||
return this.iconGenerator2;
|
||||
} else if (meta == MetaVals.VOID_CHEST) {
|
||||
if (i == 0) {
|
||||
return this.iconVoidChestBottom;
|
||||
} else {
|
||||
return i == 1 ? this.iconVoidChestTop : this.iconVoidChestSide;
|
||||
}
|
||||
return i == 0 ? this.iconVoidChestBottom
|
||||
: i == 1 ? this.iconVoidChestTop
|
||||
: this.iconVoidChestSide;
|
||||
} else if (meta == MetaVals.VOID_INTERFACE) {
|
||||
return i <= 1 ? this.iconVoidInterfaceBottom : this.iconVoidInterfaceSide;
|
||||
} else if (meta == MetaVals.SOUL_BRAZIER) {
|
||||
|
@ -312,6 +314,10 @@ public class BlockApparatusMetal extends BlockApparatus {
|
|||
} else {
|
||||
return this.iconCrystallizerSide;
|
||||
}
|
||||
} else if (meta == MetaVals.VOID_CHEST) {
|
||||
return side == 0 ? this.iconVoidChestBottom
|
||||
: side == 1 ? this.iconVoidChestTop
|
||||
: this.iconVoidChestSide;
|
||||
}
|
||||
//else if (meta == 8) {
|
||||
// if (side == 0) {
|
||||
|
|
|
@ -42,6 +42,7 @@ public class CrystallizerApparatusRenderer implements IApparatusRenderer {
|
|||
rb.renderStandardBlock(block, i, j, k);
|
||||
}
|
||||
|
||||
// TODO: no inside in inventory
|
||||
if (!inv) {
|
||||
float w3 = 0.1875F;
|
||||
rb.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F + w2, 1.0F);
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package net.anvilcraft.thaummach.render.apparatus.apparati.metal;
|
||||
|
||||
import net.anvilcraft.thaummach.blocks.BlockApparatusMetal;
|
||||
import net.anvilcraft.thaummach.render.apparatus.ApparatusRenderingHelper;
|
||||
import net.anvilcraft.thaummach.render.apparatus.IApparatusRenderer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
public class VoidChestApparatusRenderer implements IApparatusRenderer {
|
||||
public static final VoidChestApparatusRenderer INSTANCE
|
||||
= new VoidChestApparatusRenderer();
|
||||
|
||||
@Override
|
||||
public void renderApparatus(
|
||||
IBlockAccess w,
|
||||
RenderBlocks rb,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
Block block_,
|
||||
int meta,
|
||||
boolean inv
|
||||
) {
|
||||
BlockApparatusMetal block = (BlockApparatusMetal) block_;
|
||||
if (inv) {
|
||||
ApparatusRenderingHelper.drawFaces(
|
||||
rb,
|
||||
block,
|
||||
block.iconVoidChestBottom,
|
||||
block.iconVoidChestTop,
|
||||
block.iconVoidChestSide,
|
||||
block.iconVoidChestSide,
|
||||
block.iconVoidChestSide,
|
||||
block.iconVoidChestSide,
|
||||
true
|
||||
);
|
||||
} else if (block.getRenderBlockPass() == 0) {
|
||||
rb.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,13 @@
|
|||
package net.anvilcraft.thaummach.tiles;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import dev.tilera.auracore.api.HelperLocation;
|
||||
import net.anvilcraft.thaummach.TMItems;
|
||||
import net.anvilcraft.thaummach.items.ItemFocus;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -15,6 +18,9 @@ import net.minecraft.inventory.ISidedInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
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.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
@ -57,189 +63,152 @@ public class TileBore extends TileEntity implements ISidedInventory {
|
|||
this.rotation -= 360;
|
||||
}
|
||||
|
||||
// TODO: actually implement the bore
|
||||
//if (!super.worldObj.isRemote) {
|
||||
// int a;
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus0.shiftedIndex
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus1.shiftedIndex
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus2.shiftedIndex
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus3.shiftedIndex
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// != mod_ThaumCraft.itemFocus4.shiftedIndex) {
|
||||
// if (this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemSingularity.shiftedIndex) {
|
||||
// if (this.boreItemStacks[1] == null) {
|
||||
// this.boreItemStacks[1] = this.boreItemStacks[0];
|
||||
// this.boreItemStacks[0] = null;
|
||||
// } else if (this.boreItemStacks[1].getItem().shiftedIndex ==
|
||||
// mod_ThaumCraft.itemSingularity.shiftedIndex) {
|
||||
// a = Math.min(
|
||||
// this.boreItemStacks[0].stackSize,
|
||||
// 64 - this.boreItemStacks[1].stackSize
|
||||
// );
|
||||
// ItemStack var10000 = this.boreItemStacks[1];
|
||||
// var10000.stackSize += a;
|
||||
// var10000 = this.boreItemStacks[0];
|
||||
// var10000.stackSize -= a;
|
||||
// }
|
||||
// }
|
||||
if (!super.worldObj.isRemote) {
|
||||
int a;
|
||||
if (this.boreItemStacks[0] != null
|
||||
&& this.boreItemStacks[0].getItem() instanceof ItemFocus) {
|
||||
if (this.boreItemStacks[0] != null) {
|
||||
float f = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem = new EntityItem(
|
||||
super.worldObj,
|
||||
(double) ((float) super.xCoord + f),
|
||||
(double) ((float) super.yCoord + f1),
|
||||
(double) ((float) super.zCoord + f2),
|
||||
ItemStack.copyItemStack(this.boreItemStacks[0])
|
||||
);
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX
|
||||
= (double) ((float) super.worldObj.rand.nextGaussian() * f3);
|
||||
entityitem.motionY = (double
|
||||
) ((float) super.worldObj.rand.nextGaussian() * f3 + 0.2F);
|
||||
entityitem.motionZ
|
||||
= (double) ((float) super.worldObj.rand.nextGaussian() * f3);
|
||||
super.worldObj.spawnEntityInWorld(entityitem);
|
||||
this.boreItemStacks[0] = null;
|
||||
}
|
||||
}
|
||||
|
||||
// if (this.boreItemStacks[0] != null) {
|
||||
// float f = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
// float f1 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
// float f2 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||
// EntityItem entityitem = new EntityItem(
|
||||
// super.worldObj,
|
||||
// (double) ((float) super.xCoord + f),
|
||||
// (double) ((float) super.yCoord + f1),
|
||||
// (double) ((float) super.zCoord + f2),
|
||||
// ItemStack.copyItemStack(this.boreItemStacks[0])
|
||||
// );
|
||||
// float f3 = 0.05F;
|
||||
// entityitem.motionX
|
||||
// = (double) ((float) super.worldObj.rand.nextGaussian() * f3);
|
||||
// entityitem.motionY = (double
|
||||
// ) ((float) super.worldObj.rand.nextGaussian() * f3 + 0.2F);
|
||||
// entityitem.motionZ
|
||||
// = (double) ((float) super.worldObj.rand.nextGaussian() * f3);
|
||||
// super.worldObj.spawnEntityInWorld(entityitem);
|
||||
// this.boreItemStacks[0] = null;
|
||||
// }
|
||||
// }
|
||||
this.focus = -1;
|
||||
if (this.boreItemStacks[0] != null
|
||||
&& this.boreItemStacks[0].getItem() == TMItems.focus0) {
|
||||
this.range = 40;
|
||||
this.area = 2;
|
||||
this.delay = 4;
|
||||
this.conserve = false;
|
||||
this.focus = 0;
|
||||
}
|
||||
|
||||
// this.focus = -1;
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus0.shiftedIndex) {
|
||||
// this.range = 40;
|
||||
// this.area = 2;
|
||||
// this.delay = 4;
|
||||
// this.conserve = false;
|
||||
// this.focus = 0;
|
||||
// }
|
||||
if (this.boreItemStacks[0] != null
|
||||
&& this.boreItemStacks[0].getItem() == TMItems.focus1) {
|
||||
this.range = 40;
|
||||
this.area = 3;
|
||||
this.delay = 2;
|
||||
this.conserve = false;
|
||||
this.focus = 1;
|
||||
}
|
||||
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus1.shiftedIndex) {
|
||||
// this.range = 40;
|
||||
// this.area = 3;
|
||||
// this.delay = 2;
|
||||
// this.conserve = false;
|
||||
// this.focus = 1;
|
||||
// }
|
||||
if (this.boreItemStacks[0] != null
|
||||
&& this.boreItemStacks[0].getItem() == TMItems.focus2) {
|
||||
this.range = 80;
|
||||
this.area = 3;
|
||||
this.delay = 4;
|
||||
this.conserve = false;
|
||||
this.focus = 2;
|
||||
}
|
||||
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus2.shiftedIndex) {
|
||||
// this.range = 80;
|
||||
// this.area = 3;
|
||||
// this.delay = 4;
|
||||
// this.conserve = false;
|
||||
// this.focus = 2;
|
||||
// }
|
||||
if (this.boreItemStacks[0] != null
|
||||
&& this.boreItemStacks[0].getItem() == TMItems.focus3) {
|
||||
this.range = 40;
|
||||
this.area = 5;
|
||||
this.delay = 4;
|
||||
this.conserve = false;
|
||||
this.focus = 3;
|
||||
}
|
||||
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus3.shiftedIndex) {
|
||||
// this.range = 40;
|
||||
// this.area = 5;
|
||||
// this.delay = 4;
|
||||
// this.conserve = false;
|
||||
// this.focus = 3;
|
||||
// }
|
||||
if (this.boreItemStacks[0] != null
|
||||
&& this.boreItemStacks[0].getItem() == TMItems.focus4) {
|
||||
this.range = 40;
|
||||
this.area = 3;
|
||||
this.delay = 4;
|
||||
this.conserve = true;
|
||||
this.focus = 4;
|
||||
}
|
||||
|
||||
// if (this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
||||
// == mod_ThaumCraft.itemFocus4.shiftedIndex) {
|
||||
// this.range = 40;
|
||||
// this.area = 3;
|
||||
// this.delay = 4;
|
||||
// this.conserve = true;
|
||||
// this.focus = 4;
|
||||
// }
|
||||
++this.minedelay;
|
||||
if (this.minedelay > this.delay) {
|
||||
this.minedelay = 0;
|
||||
}
|
||||
|
||||
// ++this.minedelay;
|
||||
// if (this.minedelay > this.delay) {
|
||||
// this.minedelay = 0;
|
||||
// }
|
||||
if (this.duration > 0 && this.gettingPower() && this.minedelay == 0
|
||||
&& this.boreItemStacks[0] != null) {
|
||||
for (a = 0; a < 4; ++a) {
|
||||
if (this.minedBlock()) {
|
||||
this.boreItemStacks[0].setItemDamage(
|
||||
this.boreItemStacks[0].getItemDamage() + 1
|
||||
);
|
||||
if (this.boreItemStacks[0].getItemDamage()
|
||||
> this.boreItemStacks[0].getMaxDamage()) {
|
||||
this.boreItemStacks[0] = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if (this.duration > 0 && this.gettingPower() && this.minedelay == 0
|
||||
// && this.boreItemStacks[0] != null) {
|
||||
// for (a = 0; a < 4; ++a) {
|
||||
// if (this.minedBlock()) {
|
||||
// this.boreItemStacks[0].setItemDamage(
|
||||
// this.boreItemStacks[0].getItemDamage() + 1
|
||||
// );
|
||||
// if (this.boreItemStacks[0].getItemDamage()
|
||||
// > this.boreItemStacks[0].getMaxDamage()) {
|
||||
// this.boreItemStacks[0] = null;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
super.worldObj.playSoundEffect(
|
||||
(double) super.xCoord,
|
||||
(double) super.yCoord,
|
||||
(double) super.zCoord,
|
||||
"mob.slimeattack",
|
||||
0.3F,
|
||||
0.1F + super.worldObj.rand.nextFloat() * 0.3F
|
||||
);
|
||||
--this.duration;
|
||||
HelperLocation hl = new HelperLocation(this, this.orientation);
|
||||
HelperLocation hl2 = new HelperLocation(this, this.orientation);
|
||||
hl.moveForwards(1.0);
|
||||
hl2.moveForwards(5.0);
|
||||
FXWisp ef = new FXWisp(
|
||||
super.worldObj,
|
||||
hl.x + 0.5,
|
||||
hl.y + 0.5,
|
||||
hl.z + 0.5,
|
||||
hl2.x + 0.5,
|
||||
hl2.y + 0.5,
|
||||
hl2.z + 0.5,
|
||||
0.6F,
|
||||
this.focus == 0 ? 5 : this.focus
|
||||
);
|
||||
ef.shrink = true;
|
||||
ef.blendmode = 1;
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(ef);
|
||||
}
|
||||
|
||||
// super.worldObj.playSoundEffect(
|
||||
// (double) super.xCoord,
|
||||
// (double) super.yCoord,
|
||||
// (double) super.zCoord,
|
||||
// "mob.slimeattack",
|
||||
// 0.3F,
|
||||
// 0.1F + super.worldObj.rand.nextFloat() * 0.3F
|
||||
// );
|
||||
// --this.duration;
|
||||
// if (!Config.lowGfx) {
|
||||
// HelperLocation hl = new HelperLocation(this, this.orientation);
|
||||
// HelperLocation hl2 = new HelperLocation(this, this.orientation);
|
||||
// hl.moveForwards(1.0);
|
||||
// hl2.moveForwards(5.0);
|
||||
// FXWisp ef = new FXWisp(
|
||||
// super.worldObj,
|
||||
// hl.x + 0.5,
|
||||
// hl.y + 0.5,
|
||||
// hl.z + 0.5,
|
||||
// hl2.x + 0.5,
|
||||
// hl2.y + 0.5,
|
||||
// hl2.z + 0.5,
|
||||
// 0.6F,
|
||||
// this.focus == 0 ? 5 : this.focus
|
||||
// );
|
||||
// ef.shrink = true;
|
||||
// ef.blendmode = 1;
|
||||
// ModLoader.getMinecraftInstance().effectRenderer.addEffect(ef);
|
||||
// }
|
||||
// }
|
||||
Collection<EntityItem> c = this.entities.values();
|
||||
|
||||
// Collection c = this.entities.values();
|
||||
for (EntityItem ac : c) {
|
||||
ac.noClip = false;
|
||||
ac.fireResistance = 1;
|
||||
}
|
||||
|
||||
// EntityItem ac;
|
||||
// for (Iterator i$ = c.iterator(); i$.hasNext(); ac.fireResistance = 1) {
|
||||
// ac = (EntityItem) i$.next();
|
||||
// ac.noClip = false;
|
||||
// }
|
||||
this.entities.clear();
|
||||
if (this.duration > 0 && this.gettingPower() && this.focus >= 0) {
|
||||
this.suckItems();
|
||||
}
|
||||
|
||||
// this.entities.clear();
|
||||
// if (this.duration > 0 && this.gettingPower() && this.focus >= 0) {
|
||||
// this.suckItems();
|
||||
// }
|
||||
|
||||
// if (this.duration == 0 && this.boreItemStacks[0] != null
|
||||
// && this.boreItemStacks[1] != null && this.gettingPower()
|
||||
// && this.boreItemStacks[1].isItemEqual(
|
||||
// new ItemStack(mod_ThaumCraft.itemSingularity)
|
||||
// )) {
|
||||
// this.maxDuration = 250;
|
||||
// this.duration = this.maxDuration;
|
||||
// --this.boreItemStacks[1].stackSize;
|
||||
// if (this.boreItemStacks[1].stackSize == 0) {
|
||||
// this.boreItemStacks[1] = null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
if (this.duration == 0 && this.boreItemStacks[0] != null
|
||||
&& this.boreItemStacks[1] != null && this.gettingPower()
|
||||
&& this.boreItemStacks[1].isItemEqual(new ItemStack(TMItems.singularity)
|
||||
)) {
|
||||
this.maxDuration = 250;
|
||||
this.duration = this.maxDuration;
|
||||
--this.boreItemStacks[1].stackSize;
|
||||
if (this.boreItemStacks[1].stackSize == 0) {
|
||||
this.boreItemStacks[1] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean gettingPower() {
|
||||
|
@ -915,4 +884,26 @@ public class TileBore extends TileEntity implements ISidedInventory {
|
|||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
|
||||
nbt.setShort("orientation", (short) this.orientation);
|
||||
nbt.setShort("duration", (short) this.duration);
|
||||
nbt.setShort("maxDuration", (short) this.maxDuration);
|
||||
|
||||
return new S35PacketUpdateTileEntity(
|
||||
this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
NBTTagCompound nbt = pkt.func_148857_g();
|
||||
|
||||
this.orientation = nbt.getShort("orientation");
|
||||
this.duration = nbt.getShort("duration");
|
||||
this.maxDuration = nbt.getShort("maxDuration");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,175 @@
|
|||
package net.anvilcraft.thaummach.tiles;
|
||||
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileVoidChest extends TileEntity implements ISidedInventory {
|
||||
private ItemStack[] vcItemStacks = new ItemStack[72];
|
||||
|
||||
// TODO: GUIs
|
||||
//public GuiScreen getGui(EntityPlayer player) {
|
||||
// return new GuiVoidChest(player.inventory, this);
|
||||
//}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
this.updateContainingBlockInfo();
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return this.vcItemStacks[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (this.vcItemStacks[i] != null) {
|
||||
ItemStack itemstack1;
|
||||
this.markDirty();
|
||||
if (this.vcItemStacks[i].stackSize <= j) {
|
||||
itemstack1 = this.vcItemStacks[i];
|
||||
this.vcItemStacks[i] = null;
|
||||
return itemstack1;
|
||||
} else {
|
||||
itemstack1 = this.vcItemStacks[i].splitStack(j);
|
||||
if (this.vcItemStacks[i].stackSize == 0) {
|
||||
this.vcItemStacks[i] = null;
|
||||
}
|
||||
|
||||
return itemstack1;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
this.vcItemStacks[i] = itemstack;
|
||||
if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) {
|
||||
itemstack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "Void Chest";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
super.readFromNBT(nbttagcompound);
|
||||
NBTTagList nbttaglist = nbttagcompound.getTagList("Items", 10);
|
||||
this.vcItemStacks = new ItemStack[this.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||
byte byte0 = nbttagcompound1.getByte("SlotVoidChest");
|
||||
if (byte0 >= 0 && byte0 < this.vcItemStacks.length) {
|
||||
this.vcItemStacks[byte0]
|
||||
= ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
super.writeToNBT(nbttagcompound);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.vcItemStacks.length; ++i) {
|
||||
if (this.vcItemStacks[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
nbttagcompound1.setByte("SlotVoidChest", (byte) i);
|
||||
this.vcItemStacks[i].writeToNBT(nbttagcompound1);
|
||||
nbttaglist.appendTag(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
nbttagcompound.setTag("Items", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int var1) {
|
||||
if (this.vcItemStacks[var1] != null) {
|
||||
ItemStack var2 = this.vcItemStacks[var1];
|
||||
this.vcItemStacks[var1] = null;
|
||||
return var2;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
super.worldObj.playSoundEffect(
|
||||
(double) ((float) super.xCoord + 0.5F),
|
||||
(double) ((float) super.yCoord + 0.5F),
|
||||
(double) ((float) super.zCoord + 0.5F),
|
||||
"thaummach:stoneclose",
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
return IntStream.rangeClosed(0, this.vcItemStacks.length - 1).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack otherStack, int side) {
|
||||
ItemStack thisStack = this.vcItemStacks[slot];
|
||||
return thisStack == null
|
||||
|| (thisStack.isItemEqual(otherStack)
|
||||
&& thisStack.stackSize + otherStack.stackSize
|
||||
<= thisStack.getMaxStackSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack otherStack, int side) {
|
||||
ItemStack thisStack = this.vcItemStacks[slot];
|
||||
|
||||
return thisStack != null && thisStack.isItemEqual(otherStack)
|
||||
&& thisStack.stackSize >= otherStack.stackSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return this.vcItemStacks.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue