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.TileFilter;
|
||||||
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
||||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileVoidChest;
|
||||||
|
|
||||||
public class ClientProxy extends CommonProxy {
|
public class ClientProxy extends CommonProxy {
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,6 +53,7 @@ public class ClientProxy extends CommonProxy {
|
||||||
GameRegistry.registerTileEntity(TileCrucible.class, "crucible");
|
GameRegistry.registerTileEntity(TileCrucible.class, "crucible");
|
||||||
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
||||||
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
||||||
|
GameRegistry.registerTileEntity(TileVoidChest.class, "voidChest");
|
||||||
|
|
||||||
ClientRegistry.registerTileEntity(TileBore.class, "bore", new TileBoreRenderer());
|
ClientRegistry.registerTileEntity(TileBore.class, "bore", new TileBoreRenderer());
|
||||||
ClientRegistry.registerTileEntity(
|
ClientRegistry.registerTileEntity(
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
||||||
import net.anvilcraft.thaummach.tiles.TileFilter;
|
import net.anvilcraft.thaummach.tiles.TileFilter;
|
||||||
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
import net.anvilcraft.thaummach.tiles.TilePurifier;
|
||||||
import net.anvilcraft.thaummach.tiles.TileSeal;
|
import net.anvilcraft.thaummach.tiles.TileSeal;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileVoidChest;
|
||||||
|
|
||||||
public class CommonProxy {
|
public class CommonProxy {
|
||||||
public void preInit() {}
|
public void preInit() {}
|
||||||
|
@ -32,5 +33,6 @@ public class CommonProxy {
|
||||||
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
GameRegistry.registerTileEntity(TileFilter.class, "filter");
|
||||||
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
GameRegistry.registerTileEntity(TilePurifier.class, "purifier");
|
||||||
GameRegistry.registerTileEntity(TileSeal.class, "seal");
|
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.BoreApparatusRenderer;
|
||||||
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.CrucibleApparatusRenderer;
|
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.CrystallizerApparatusRenderer;
|
||||||
|
import net.anvilcraft.thaummach.render.apparatus.apparati.metal.VoidChestApparatusRenderer;
|
||||||
import net.anvilcraft.thaummach.tiles.TileArcaneFurnace;
|
import net.anvilcraft.thaummach.tiles.TileArcaneFurnace;
|
||||||
import net.anvilcraft.thaummach.tiles.TileBore;
|
import net.anvilcraft.thaummach.tiles.TileBore;
|
||||||
import net.anvilcraft.thaummach.tiles.TileConduitTank;
|
import net.anvilcraft.thaummach.tiles.TileConduitTank;
|
||||||
import net.anvilcraft.thaummach.tiles.TileCrucible;
|
import net.anvilcraft.thaummach.tiles.TileCrucible;
|
||||||
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
import net.anvilcraft.thaummach.tiles.TileCrystallizer;
|
||||||
|
import net.anvilcraft.thaummach.tiles.TileVoidChest;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -154,6 +156,8 @@ public class BlockApparatusMetal extends BlockApparatus {
|
||||||
case BORE:
|
case BORE:
|
||||||
return BoreApparatusRenderer.INSTANCE;
|
return BoreApparatusRenderer.INSTANCE;
|
||||||
|
|
||||||
|
case VOID_CHEST:
|
||||||
|
return VoidChestApparatusRenderer.INSTANCE;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +171,7 @@ public class BlockApparatusMetal extends BlockApparatus {
|
||||||
tc.setTier((short) (md.ordinal() + 1));
|
tc.setTier((short) (md.ordinal() + 1));
|
||||||
return tc;
|
return tc;
|
||||||
} else if (md == MetaVals.ARCANE_FURNACE) {
|
} else if (md == MetaVals.ARCANE_FURNACE) {
|
||||||
//return new TileArcaneFurnace();
|
return new TileArcaneFurnace();
|
||||||
} else if (md == MetaVals.GENERATOR) {
|
} else if (md == MetaVals.GENERATOR) {
|
||||||
//return new TileGenerator();
|
//return new TileGenerator();
|
||||||
} else if (md == MetaVals.CRYSTALLIZER) {
|
} else if (md == MetaVals.CRYSTALLIZER) {
|
||||||
|
@ -175,7 +179,7 @@ public class BlockApparatusMetal extends BlockApparatus {
|
||||||
} else if (md == MetaVals.BORE) {
|
} else if (md == MetaVals.BORE) {
|
||||||
return new TileBore();
|
return new TileBore();
|
||||||
} else if (md == MetaVals.VOID_CHEST) {
|
} else if (md == MetaVals.VOID_CHEST) {
|
||||||
//return new TileVoidChest();
|
return new TileVoidChest();
|
||||||
} else if (md == MetaVals.VOID_INTERFACE) {
|
} else if (md == MetaVals.VOID_INTERFACE) {
|
||||||
//return new TileVoidInterface();
|
//return new TileVoidInterface();
|
||||||
} else if (md == MetaVals.TANK) {
|
} else if (md == MetaVals.TANK) {
|
||||||
|
@ -241,11 +245,9 @@ public class BlockApparatusMetal extends BlockApparatus {
|
||||||
if (meta == MetaVals.GENERATOR) {
|
if (meta == MetaVals.GENERATOR) {
|
||||||
return this.iconGenerator2;
|
return this.iconGenerator2;
|
||||||
} else if (meta == MetaVals.VOID_CHEST) {
|
} else if (meta == MetaVals.VOID_CHEST) {
|
||||||
if (i == 0) {
|
return i == 0 ? this.iconVoidChestBottom
|
||||||
return this.iconVoidChestBottom;
|
: i == 1 ? this.iconVoidChestTop
|
||||||
} else {
|
: this.iconVoidChestSide;
|
||||||
return i == 1 ? this.iconVoidChestTop : this.iconVoidChestSide;
|
|
||||||
}
|
|
||||||
} else if (meta == MetaVals.VOID_INTERFACE) {
|
} else if (meta == MetaVals.VOID_INTERFACE) {
|
||||||
return i <= 1 ? this.iconVoidInterfaceBottom : this.iconVoidInterfaceSide;
|
return i <= 1 ? this.iconVoidInterfaceBottom : this.iconVoidInterfaceSide;
|
||||||
} else if (meta == MetaVals.SOUL_BRAZIER) {
|
} else if (meta == MetaVals.SOUL_BRAZIER) {
|
||||||
|
@ -312,6 +314,10 @@ public class BlockApparatusMetal extends BlockApparatus {
|
||||||
} else {
|
} else {
|
||||||
return this.iconCrystallizerSide;
|
return this.iconCrystallizerSide;
|
||||||
}
|
}
|
||||||
|
} else if (meta == MetaVals.VOID_CHEST) {
|
||||||
|
return side == 0 ? this.iconVoidChestBottom
|
||||||
|
: side == 1 ? this.iconVoidChestTop
|
||||||
|
: this.iconVoidChestSide;
|
||||||
}
|
}
|
||||||
//else if (meta == 8) {
|
//else if (meta == 8) {
|
||||||
// if (side == 0) {
|
// if (side == 0) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class CrystallizerApparatusRenderer implements IApparatusRenderer {
|
||||||
rb.renderStandardBlock(block, i, j, k);
|
rb.renderStandardBlock(block, i, j, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: no inside in inventory
|
||||||
if (!inv) {
|
if (!inv) {
|
||||||
float w3 = 0.1875F;
|
float w3 = 0.1875F;
|
||||||
rb.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F + w2, 1.0F);
|
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;
|
package net.anvilcraft.thaummach.tiles;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import dev.tilera.auracore.api.HelperLocation;
|
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.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
@ -15,6 +18,9 @@ import net.minecraft.inventory.ISidedInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
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.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
@ -57,189 +63,152 @@ public class TileBore extends TileEntity implements ISidedInventory {
|
||||||
this.rotation -= 360;
|
this.rotation -= 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: actually implement the bore
|
if (!super.worldObj.isRemote) {
|
||||||
//if (!super.worldObj.isRemote) {
|
int a;
|
||||||
// int a;
|
if (this.boreItemStacks[0] != null
|
||||||
// if (this.boreItemStacks[0] != null
|
&& this.boreItemStacks[0].getItem() instanceof ItemFocus) {
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
if (this.boreItemStacks[0] != null) {
|
||||||
// != mod_ThaumCraft.itemFocus0.shiftedIndex
|
float f = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
float f1 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
// != mod_ThaumCraft.itemFocus1.shiftedIndex
|
float f2 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
EntityItem entityitem = new EntityItem(
|
||||||
// != mod_ThaumCraft.itemFocus2.shiftedIndex
|
super.worldObj,
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
(double) ((float) super.xCoord + f),
|
||||||
// != mod_ThaumCraft.itemFocus3.shiftedIndex
|
(double) ((float) super.yCoord + f1),
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
(double) ((float) super.zCoord + f2),
|
||||||
// != mod_ThaumCraft.itemFocus4.shiftedIndex) {
|
ItemStack.copyItemStack(this.boreItemStacks[0])
|
||||||
// if (this.boreItemStacks[0].getItem().shiftedIndex
|
);
|
||||||
// == mod_ThaumCraft.itemSingularity.shiftedIndex) {
|
float f3 = 0.05F;
|
||||||
// if (this.boreItemStacks[1] == null) {
|
entityitem.motionX
|
||||||
// this.boreItemStacks[1] = this.boreItemStacks[0];
|
= (double) ((float) super.worldObj.rand.nextGaussian() * f3);
|
||||||
// this.boreItemStacks[0] = null;
|
entityitem.motionY = (double
|
||||||
// } else if (this.boreItemStacks[1].getItem().shiftedIndex ==
|
) ((float) super.worldObj.rand.nextGaussian() * f3 + 0.2F);
|
||||||
// mod_ThaumCraft.itemSingularity.shiftedIndex) {
|
entityitem.motionZ
|
||||||
// a = Math.min(
|
= (double) ((float) super.worldObj.rand.nextGaussian() * f3);
|
||||||
// this.boreItemStacks[0].stackSize,
|
super.worldObj.spawnEntityInWorld(entityitem);
|
||||||
// 64 - this.boreItemStacks[1].stackSize
|
this.boreItemStacks[0] = null;
|
||||||
// );
|
}
|
||||||
// ItemStack var10000 = this.boreItemStacks[1];
|
}
|
||||||
// var10000.stackSize += a;
|
|
||||||
// var10000 = this.boreItemStacks[0];
|
|
||||||
// var10000.stackSize -= a;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.boreItemStacks[0] != null) {
|
this.focus = -1;
|
||||||
// float f = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
if (this.boreItemStacks[0] != null
|
||||||
// float f1 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
&& this.boreItemStacks[0].getItem() == TMItems.focus0) {
|
||||||
// float f2 = super.worldObj.rand.nextFloat() * 0.8F + 0.1F;
|
this.range = 40;
|
||||||
// EntityItem entityitem = new EntityItem(
|
this.area = 2;
|
||||||
// super.worldObj,
|
this.delay = 4;
|
||||||
// (double) ((float) super.xCoord + f),
|
this.conserve = false;
|
||||||
// (double) ((float) super.yCoord + f1),
|
this.focus = 0;
|
||||||
// (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
|
||||||
// if (this.boreItemStacks[0] != null
|
&& this.boreItemStacks[0].getItem() == TMItems.focus1) {
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
this.range = 40;
|
||||||
// == mod_ThaumCraft.itemFocus0.shiftedIndex) {
|
this.area = 3;
|
||||||
// this.range = 40;
|
this.delay = 2;
|
||||||
// this.area = 2;
|
this.conserve = false;
|
||||||
// this.delay = 4;
|
this.focus = 1;
|
||||||
// this.conserve = false;
|
}
|
||||||
// this.focus = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.boreItemStacks[0] != null
|
if (this.boreItemStacks[0] != null
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
&& this.boreItemStacks[0].getItem() == TMItems.focus2) {
|
||||||
// == mod_ThaumCraft.itemFocus1.shiftedIndex) {
|
this.range = 80;
|
||||||
// this.range = 40;
|
this.area = 3;
|
||||||
// this.area = 3;
|
this.delay = 4;
|
||||||
// this.delay = 2;
|
this.conserve = false;
|
||||||
// this.conserve = false;
|
this.focus = 2;
|
||||||
// this.focus = 1;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.boreItemStacks[0] != null
|
if (this.boreItemStacks[0] != null
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
&& this.boreItemStacks[0].getItem() == TMItems.focus3) {
|
||||||
// == mod_ThaumCraft.itemFocus2.shiftedIndex) {
|
this.range = 40;
|
||||||
// this.range = 80;
|
this.area = 5;
|
||||||
// this.area = 3;
|
this.delay = 4;
|
||||||
// this.delay = 4;
|
this.conserve = false;
|
||||||
// this.conserve = false;
|
this.focus = 3;
|
||||||
// this.focus = 2;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.boreItemStacks[0] != null
|
if (this.boreItemStacks[0] != null
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
&& this.boreItemStacks[0].getItem() == TMItems.focus4) {
|
||||||
// == mod_ThaumCraft.itemFocus3.shiftedIndex) {
|
this.range = 40;
|
||||||
// this.range = 40;
|
this.area = 3;
|
||||||
// this.area = 5;
|
this.delay = 4;
|
||||||
// this.delay = 4;
|
this.conserve = true;
|
||||||
// this.conserve = false;
|
this.focus = 4;
|
||||||
// this.focus = 3;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// if (this.boreItemStacks[0] != null
|
++this.minedelay;
|
||||||
// && this.boreItemStacks[0].getItem().shiftedIndex
|
if (this.minedelay > this.delay) {
|
||||||
// == mod_ThaumCraft.itemFocus4.shiftedIndex) {
|
this.minedelay = 0;
|
||||||
// this.range = 40;
|
}
|
||||||
// this.area = 3;
|
|
||||||
// this.delay = 4;
|
|
||||||
// this.conserve = true;
|
|
||||||
// this.focus = 4;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ++this.minedelay;
|
if (this.duration > 0 && this.gettingPower() && this.minedelay == 0
|
||||||
// if (this.minedelay > this.delay) {
|
&& this.boreItemStacks[0] != null) {
|
||||||
// this.minedelay = 0;
|
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
|
super.worldObj.playSoundEffect(
|
||||||
// && this.boreItemStacks[0] != null) {
|
(double) super.xCoord,
|
||||||
// for (a = 0; a < 4; ++a) {
|
(double) super.yCoord,
|
||||||
// if (this.minedBlock()) {
|
(double) super.zCoord,
|
||||||
// this.boreItemStacks[0].setItemDamage(
|
"mob.slimeattack",
|
||||||
// this.boreItemStacks[0].getItemDamage() + 1
|
0.3F,
|
||||||
// );
|
0.1F + super.worldObj.rand.nextFloat() * 0.3F
|
||||||
// if (this.boreItemStacks[0].getItemDamage()
|
);
|
||||||
// > this.boreItemStacks[0].getMaxDamage()) {
|
--this.duration;
|
||||||
// this.boreItemStacks[0] = null;
|
HelperLocation hl = new HelperLocation(this, this.orientation);
|
||||||
// }
|
HelperLocation hl2 = new HelperLocation(this, this.orientation);
|
||||||
// break;
|
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(
|
Collection<EntityItem> c = this.entities.values();
|
||||||
// (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 c = this.entities.values();
|
for (EntityItem ac : c) {
|
||||||
|
ac.noClip = false;
|
||||||
|
ac.fireResistance = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// EntityItem ac;
|
this.entities.clear();
|
||||||
// for (Iterator i$ = c.iterator(); i$.hasNext(); ac.fireResistance = 1) {
|
if (this.duration > 0 && this.gettingPower() && this.focus >= 0) {
|
||||||
// ac = (EntityItem) i$.next();
|
this.suckItems();
|
||||||
// ac.noClip = false;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// this.entities.clear();
|
if (this.duration == 0 && this.boreItemStacks[0] != null
|
||||||
// if (this.duration > 0 && this.gettingPower() && this.focus >= 0) {
|
&& this.boreItemStacks[1] != null && this.gettingPower()
|
||||||
// this.suckItems();
|
&& this.boreItemStacks[1].isItemEqual(new ItemStack(TMItems.singularity)
|
||||||
// }
|
)) {
|
||||||
|
this.maxDuration = 250;
|
||||||
// if (this.duration == 0 && this.boreItemStacks[0] != null
|
this.duration = this.maxDuration;
|
||||||
// && this.boreItemStacks[1] != null && this.gettingPower()
|
--this.boreItemStacks[1].stackSize;
|
||||||
// && this.boreItemStacks[1].isItemEqual(
|
if (this.boreItemStacks[1].stackSize == 0) {
|
||||||
// new ItemStack(mod_ThaumCraft.itemSingularity)
|
this.boreItemStacks[1] = null;
|
||||||
// )) {
|
}
|
||||||
// this.maxDuration = 250;
|
}
|
||||||
// this.duration = this.maxDuration;
|
}
|
||||||
// --this.boreItemStacks[1].stackSize;
|
|
||||||
// if (this.boreItemStacks[1].stackSize == 0) {
|
|
||||||
// this.boreItemStacks[1] = null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean gettingPower() {
|
public boolean gettingPower() {
|
||||||
|
@ -915,4 +884,26 @@ public class TileBore extends TileEntity implements ISidedInventory {
|
||||||
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
public boolean canExtractItem(int slot, ItemStack stack, int side) {
|
||||||
return false;
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
175
src/main/java/net/anvilcraft/thaummach/tiles/TileVoidChest.java
Normal file
175
src/main/java/net/anvilcraft/thaummach/tiles/TileVoidChest.java
Normal file
|
@ -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 a new issue