diff --git a/build.gradle b/build.gradle index 2b55a12..ded67b0 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ repositories { dependencies { implementation "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:deobf" - implementation "dev.tilera:auracore:0.1.0:deobf" + implementation "dev.tilera:auracore:1.0.0-SNAPSHOT:deobf" implementation "com.github.tox1cozZ:mixin-booter-legacy:1.1.2" } diff --git a/src/main/java/net/anvilcraft/classiccasting/CCBlocks.java b/src/main/java/net/anvilcraft/classiccasting/CCBlocks.java new file mode 100644 index 0000000..5fbf340 --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/CCBlocks.java @@ -0,0 +1,20 @@ +package net.anvilcraft.classiccasting; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.anvilcraft.classiccasting.blocks.BlockAlembic; +import net.anvilcraft.classiccasting.blocks.BlockInfusionWorkbench; +import net.anvilcraft.classiccasting.items.ItemBlockAlembic; +import net.minecraft.block.Block; + +public class CCBlocks { + public static Block alembic; + public static Block infusionWorkbench; + + public static void init() { + alembic = new BlockAlembic(); + infusionWorkbench = new BlockInfusionWorkbench(); + + GameRegistry.registerBlock(alembic, ItemBlockAlembic.class, "alembic"); + GameRegistry.registerBlock(infusionWorkbench, "infusionWorkbench"); + } +} diff --git a/src/main/java/net/anvilcraft/classiccasting/Items.java b/src/main/java/net/anvilcraft/classiccasting/CCItems.java similarity index 99% rename from src/main/java/net/anvilcraft/classiccasting/Items.java rename to src/main/java/net/anvilcraft/classiccasting/CCItems.java index a4c5084..754e319 100644 --- a/src/main/java/net/anvilcraft/classiccasting/Items.java +++ b/src/main/java/net/anvilcraft/classiccasting/CCItems.java @@ -13,7 +13,7 @@ import net.anvilcraft.classiccasting.items.wands.ItemWandLightning; import net.anvilcraft.classiccasting.items.wands.ItemWandTrade; import net.minecraft.item.Item; -public class Items { +public class CCItems { public static Item portableHole; public static Item wandCastingApprentice; diff --git a/src/main/java/net/anvilcraft/classiccasting/ClassicCasting.java b/src/main/java/net/anvilcraft/classiccasting/ClassicCasting.java index 964c346..728a684 100644 --- a/src/main/java/net/anvilcraft/classiccasting/ClassicCasting.java +++ b/src/main/java/net/anvilcraft/classiccasting/ClassicCasting.java @@ -21,7 +21,11 @@ public class ClassicCasting { @Mod.EventHandler public void preInit(FMLPreInitializationEvent ev) { ClassicCastingTab.INSTANCE = new ClassicCastingTab(); - Items.init(); + + CCBlocks.init(); + CCItems.init(); + proxy.registerTileEntities(); + proxy.preInit(); } } diff --git a/src/main/java/net/anvilcraft/classiccasting/ClassicCastingTab.java b/src/main/java/net/anvilcraft/classiccasting/ClassicCastingTab.java index e2f3039..50e6781 100644 --- a/src/main/java/net/anvilcraft/classiccasting/ClassicCastingTab.java +++ b/src/main/java/net/anvilcraft/classiccasting/ClassicCastingTab.java @@ -12,6 +12,6 @@ public class ClassicCastingTab extends CreativeTabs { @Override public Item getTabIconItem() { - return Items.wandExcavation; + return CCItems.wandExcavation; } } diff --git a/src/main/java/net/anvilcraft/classiccasting/ClientProxy.java b/src/main/java/net/anvilcraft/classiccasting/ClientProxy.java index 46a5757..19f7394 100644 --- a/src/main/java/net/anvilcraft/classiccasting/ClientProxy.java +++ b/src/main/java/net/anvilcraft/classiccasting/ClientProxy.java @@ -1,6 +1,9 @@ package net.anvilcraft.classiccasting; +import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.FMLCommonHandler; +import net.anvilcraft.classiccasting.render.TileAlembicRenderer; +import net.anvilcraft.classiccasting.tiles.TileAlembic; public class ClientProxy extends CommonProxy { @Override @@ -9,4 +12,11 @@ public class ClientProxy extends CommonProxy { FMLCommonHandler.instance().bus().register(new GuiTicker()); } + + @Override + public void registerTileEntities() { + ClientRegistry.registerTileEntity( + TileAlembic.class, "alembic", new TileAlembicRenderer() + ); + } } diff --git a/src/main/java/net/anvilcraft/classiccasting/CommonProxy.java b/src/main/java/net/anvilcraft/classiccasting/CommonProxy.java index e763a2f..4333001 100644 --- a/src/main/java/net/anvilcraft/classiccasting/CommonProxy.java +++ b/src/main/java/net/anvilcraft/classiccasting/CommonProxy.java @@ -1,9 +1,19 @@ package net.anvilcraft.classiccasting; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.registry.GameRegistry; +import net.anvilcraft.classiccasting.tiles.TileAlembic; public class CommonProxy { public void preInit() { FMLCommonHandler.instance().bus().register(new WorldTicker()); } + + public void alembicSpill(TileAlembic a) { + // TODO + } + + public void registerTileEntities() { + GameRegistry.registerTileEntity(TileAlembic.class, "alembic"); + } } diff --git a/src/main/java/net/anvilcraft/classiccasting/WorldTicker.java b/src/main/java/net/anvilcraft/classiccasting/WorldTicker.java index 273df94..aad5365 100644 --- a/src/main/java/net/anvilcraft/classiccasting/WorldTicker.java +++ b/src/main/java/net/anvilcraft/classiccasting/WorldTicker.java @@ -29,11 +29,7 @@ public class WorldTicker { @SubscribeEvent public void onWorldTick(WorldTickEvent ev) { if (ev.phase == TickEvent.Phase.END && ev.side == Side.SERVER) - this.tickEnd(ev.world); - } - - private void tickEnd(World world) { - this.swapTicks(world); + this.swapTicks(ev.world); } private void swapTicks(World world) { @@ -60,7 +56,9 @@ public class WorldTicker { final int slot = Utils.isPlayerCarrying( vs.player, new ItemStack(vs.bTarget, 1, vs.mTarget) ); - if (vs.bSource != bi || vs.mSource != md || slot < 0) { + if (vs.bSource != bi || vs.mSource != md + || !vs.bTarget.canBlockStay(world, vs.x, vs.y, vs.z) + || slot < 0) { continue; } didSomething = true; diff --git a/src/main/java/net/anvilcraft/classiccasting/blocks/BlockAlembic.java b/src/main/java/net/anvilcraft/classiccasting/blocks/BlockAlembic.java new file mode 100644 index 0000000..499f074 --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/blocks/BlockAlembic.java @@ -0,0 +1,130 @@ +package net.anvilcraft.classiccasting.blocks; + +import java.util.List; + +import dev.tilera.auracore.aura.AuraManager; +import net.anvilcraft.classiccasting.ClassicCastingTab; +import net.anvilcraft.classiccasting.tiles.TileAlembic; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.tiles.TileCrucible; + +public class BlockAlembic extends BlockContainer { + public BlockAlembic() { + super(Material.iron); + this.setHardness(3.0f); + this.setResistance(17.0f); + this.setStepSound(Block.soundTypeMetal); + this.setBlockName("classiccasting:alembic"); + this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f); + this.setCreativeTab(ClassicCastingTab.INSTANCE); + } + + @Override + public int getRenderType() { + // TODO: WTF + //return Config.blockCrucibleRI; + return 0; + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public void setBlockBoundsBasedOnState( + final IBlockAccess world, final int i, final int j, final int k + ) { + this.setBlockBounds(0.25f, 0.0f, 0.25f, 0.75f, 0.875f, 0.75f); + } + + @Override + public void addCollisionBoxesToList( + final World world, + final int i, + final int j, + final int k, + final AxisAlignedBB axisalignedbb, + final List arraylist, + final Entity par7Entity + ) { + this.setBlockBounds(0.25f, 0.0f, 0.25f, 0.75f, 0.875f, 0.75f); + super.addCollisionBoxesToList( + world, i, j, k, axisalignedbb, arraylist, par7Entity + ); + } + + @Override + public boolean isBlockSolid( + final IBlockAccess world, final int i, final int j, final int k, final int side + ) { + return side != ForgeDirection.DOWN.ordinal() + && side != ForgeDirection.UP.ordinal(); + } + + @Override + public int damageDropped(final int metadata) { + return 0; + } + + @Override + public TileEntity createTileEntity(final World world, final int metadata) { + return new TileAlembic(); + } + + @Override + public TileEntity createNewTileEntity(final World var1, int meta) { + return this.createNewTileEntity(var1, meta); + } + + @Override + public void onNeighborBlockChange( + final World par1World, + final int par2, + final int par3, + final int par4, + final Block par5 + ) { + final TileEntity te = par1World.getTileEntity(par2, par3, par4); + if (te != null && te instanceof TileCrucible) { + ((TileCrucible) te).getBellows(); + } + super.onNeighborBlockChange(par1World, par2, par3, par4, par5); + } + + @Override + public void breakBlock( + final World par1World, + final int par2, + final int par3, + final int par4, + final Block par5, + final int par6 + ) { + final TileEntity te = par1World.getTileEntity(par2, par3, par4); + if (te != null && ((TileAlembic) te).amount > 0) { + AuraManager.addFluxToClosest( + par1World, + par2 + 0.5f, + par3 + 0.5f, + par4 + 0.5f, + new AspectList().add(((TileAlembic) te).tag, ((TileAlembic) te).amount) + ); + } + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } +} diff --git a/src/main/java/net/anvilcraft/classiccasting/blocks/BlockInfusionWorkbench.java b/src/main/java/net/anvilcraft/classiccasting/blocks/BlockInfusionWorkbench.java new file mode 100644 index 0000000..0593219 --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/blocks/BlockInfusionWorkbench.java @@ -0,0 +1,408 @@ +package net.anvilcraft.classiccasting.blocks; + +import java.util.List; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.anvilcraft.classiccasting.tiles.TileInfusionWorkbench; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import thaumcraft.common.Thaumcraft; + +public class BlockInfusionWorkbench extends BlockContainer { + public IIcon[] icon; + + public BlockInfusionWorkbench() { + super(Material.rock); + this.icon = new IIcon[7]; + this.setHardness(4.0f); + this.setResistance(100.0f); + this.setStepSound(BlockInfusionWorkbench.soundTypeStone); + this.setBlockName("blockInfusionWorkbench"); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(final IIconRegister ir) { + this.icon[0] = ir.registerIcon("thaumcraft:infusionbase"); + for (int a = 1; a <= 6; ++a) { + this.icon[a] = ir.registerIcon("thaumcraft:infusion" + a); + } + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks( + final Item par1, final CreativeTabs par2CreativeTabs, final List par3List + ) { + par3List.add(new ItemStack(par1, 1, 0)); + } + + @Override + public IIcon getIcon(final int side, final int md) { + Label_0214: { + switch (md) { + case 1: { + switch (side) { + case 0: + case 1: { + return this.icon[1]; + } + case 2: + case 5: { + return this.icon[6]; + } + case 3: + case 4: { + return this.icon[5]; + } + default: { + break Label_0214; + } + } + } + case 2: { + switch (side) { + case 0: + case 1: { + return this.icon[2]; + } + case 2: + case 3: { + return this.icon[5]; + } + case 4: + case 5: { + return this.icon[6]; + } + default: { + break Label_0214; + } + } + } + case 3: { + switch (side) { + case 0: + case 1: { + return this.icon[3]; + } + case 2: + case 3: { + return this.icon[5]; + } + case 4: + case 5: { + return this.icon[6]; + } + default: { + break Label_0214; + } + } + } + case 4: { + switch (side) { + case 0: + case 1: { + return this.icon[4]; + } + case 2: + case 5: { + return this.icon[5]; + } + case 3: + case 4: { + return this.icon[6]; + } + default: { + break Label_0214; + } + } + } + } + } + return this.icon[0]; + } + + @Override + public TileEntity createTileEntity(final World world, final int metadata) { + if (metadata == 1) { + return new TileInfusionWorkbench(); + } + return null; + } + + @Override + public boolean isOpaqueCube() { + return true; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public int getRenderType() { + // TODO: WTF + //return Config.blockInfusionWorkbenchRI; + return 0; + } + + @Override + public boolean isBlockSolid( + final IBlockAccess world, final int x, final int y, final int z, final int side + ) { + return true; + } + + @Override + public void breakBlock( + final World par1World, + final int par2, + final int par3, + final int par4, + final Block par5, + final int par6 + ) { + this.dropItems(par1World, par2, par3, par4); + super.breakBlock(par1World, par2, par3, par4, par5, par6); + } + + private void dropItems(final World world, final int x, final int y, final int z) { + final Random rand = new Random(); + final TileEntity tileEntity = world.getTileEntity(x, y, z); + if (!(tileEntity instanceof IInventory)) { + return; + } + final IInventory inventory = (IInventory) tileEntity; + for (int i = 0; i < inventory.getSizeInventory(); ++i) { + if (i != 9) { + final ItemStack item = inventory.getStackInSlot(i); + if (item != null && item.stackSize > 0) { + final float rx = rand.nextFloat() * 0.8f + 0.1f; + final float ry = rand.nextFloat() * 0.8f + 0.1f; + final float rz = rand.nextFloat() * 0.8f + 0.1f; + final EntityItem entityItem = new EntityItem( + world, + (double) (x + rx + 0.5f), + (double) (y + ry), + (double) (z + rz + 0.5f), + item.copy() + ); + if (item.hasTagCompound()) { + entityItem.getEntityItem().setTagCompound( + (NBTTagCompound) item.getTagCompound().copy() + ); + } + final float factor = 0.05f; + ((Entity) entityItem).motionX = rand.nextGaussian() * factor; + ((Entity) entityItem).motionY + = rand.nextGaussian() * factor + 0.20000000298023224; + ((Entity) entityItem).motionZ = rand.nextGaussian() * factor; + world.spawnEntityInWorld((Entity) entityItem); + item.stackSize = 0; + } + } + } + } + + @Override + public int damageDropped(final int par1) { + return 0; + } + + @Override + public void onNeighborBlockChange( + final World world, final int x, final int y, final int z, final Block par5 + ) { + final TileEntity tile = world.getTileEntity(x, y, z); + final int md = world.getBlockMetadata(x, y, z); + switch (md) { + case 1: { + if (world.getBlock(x + 1, y, z) != this + || world.getBlockMetadata(x + 1, y, z) != 2 + || world.getBlock(x, y, z + 1) != this + || world.getBlockMetadata(x, y, z + 1) != 3 + || world.getBlock(x + 1, y, z + 1) != this + || world.getBlockMetadata(x + 1, y, z + 1) != 4) { + this.dropItems(world, x, y, z); + world.setBlock(x, y, z, this, 0, 3); + world.addBlockEvent(x, y, z, this, 2, 6); + break; + } + break; + } + case 2: { + if (world.getBlock(x - 1, y, z) != this + || world.getBlockMetadata(x - 1, y, z) != 1 + || world.getBlock(x - 1, y, z + 1) != this + || world.getBlockMetadata(x - 1, y, z + 1) != 3 + || world.getBlock(x, y, z + 1) != this + || world.getBlockMetadata(x, y, z + 1) != 4) { + world.setBlock(x, y, z, this, 0, 3); + world.addBlockEvent(x, y, z, this, 2, 6); + break; + } + break; + } + case 3: { + if (world.getBlock(x, y, z - 1) != this + || world.getBlockMetadata(x, y, z - 1) != 1 + || world.getBlock(x + 1, y, z - 1) != this + || world.getBlockMetadata(x + 1, y, z - 1) != 2 + || world.getBlock(x + 1, y, z) != this + || world.getBlockMetadata(x + 1, y, z) != 4) { + world.setBlock(x, y, z, this, 0, 3); + world.addBlockEvent(x, y, z, this, 2, 6); + break; + } + break; + } + case 4: { + if (world.getBlock(x - 1, y, z - 1) != this + || world.getBlockMetadata(x - 1, y, z - 1) != 1 + || world.getBlock(x, y, z - 1) != this + || world.getBlockMetadata(x, y, z - 1) != 2 + || world.getBlock(x - 1, y, z) != this + || world.getBlockMetadata(x - 1, y, z) != 3) { + world.setBlock(x, y, z, this, 0, 3); + world.addBlockEvent(x, y, z, this, 2, 6); + break; + } + break; + } + } + super.onNeighborBlockChange(world, x, y, z, par5); + } + + @Override + public boolean onBlockActivated( + final World world, + final int x, + final int y, + final int z, + final EntityPlayer player, + final int idk, + final float what, + final float these, + final float are + ) { + TileEntity tileEntity = world.getTileEntity(x, y, z); + final int md = world.getBlockMetadata(x, y, z); + if (md == 0 || player.isSneaking()) { + return false; + } + if (world.isRemote) { + return true; + } + if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) { + player.openGui((Object) Thaumcraft.instance, 14, world, x, y, z); + return true; + } + switch (md) { + case 2: { + tileEntity = world.getTileEntity(x - 1, y, z); + if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) { + player.openGui((Object) Thaumcraft.instance, 14, world, x - 1, y, z); + return true; + } + return false; + } + case 3: { + tileEntity = world.getTileEntity(x, y, z - 1); + if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) { + player.openGui((Object) Thaumcraft.instance, 14, world, x, y, z - 1); + return true; + } + return false; + } + case 4: { + tileEntity = world.getTileEntity(x - 1, y, z - 1); + if (tileEntity != null && tileEntity instanceof TileInfusionWorkbench) { + player.openGui( + (Object) Thaumcraft.instance, 14, world, x - 1, y, z - 1 + ); + return true; + } + return false; + } + default: { + return false; + } + } + } + + @Override + public TileEntity createNewTileEntity(final World var1, int meta) { + return null; + } + + @Override + public boolean isBeaconBase( + final IBlockAccess world, + final int x, + final int y, + final int z, + final int beaconX, + final int beaconY, + final int beaconZ + ) { + final int md = world.getBlockMetadata(x, y, z); + return md == 0; + } + + @Override + public boolean onBlockEventReceived( + final World par1World, + final int par2, + final int par3, + final int par4, + final int par5, + final int par6 + ) { + if (par5 == 1) { + if (par1World.isRemote) { + Thaumcraft.proxy.blockSparkle(par1World, par2, par3, par4, par6, 5); + } + return true; + } + if (par5 == 2) { + for (int var5 = 0; var5 < 8; ++var5) { + par1World.spawnParticle( + "largesmoke", + par2 + Math.random(), + par3 + Math.random(), + par4 + Math.random(), + 0.0, + 0.0, + 0.0 + ); + } + par1World.playSoundEffect( + (double) par2, + (double) par3, + (double) par4, + "random.fizz", + 0.5f, + 2.6f + (par1World.rand.nextFloat() - par1World.rand.nextFloat()) * 0.8f + ); + return true; + } + return super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6); + } +} diff --git a/src/main/java/net/anvilcraft/classiccasting/items/ItemBlockAlembic.java b/src/main/java/net/anvilcraft/classiccasting/items/ItemBlockAlembic.java new file mode 100644 index 0000000..2f249c5 --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/items/ItemBlockAlembic.java @@ -0,0 +1,115 @@ +package net.anvilcraft.classiccasting.items; + +import net.anvilcraft.classiccasting.CCBlocks; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.common.config.ConfigBlocks; + +public class ItemBlockAlembic extends ItemBlock { + public ItemBlockAlembic(final Block par1) { + super(par1); + this.setMaxDamage(0); + this.setHasSubtypes(true); + } + + @Override + public int getMetadata(final int par1) { + return par1; + } + + @Override + public boolean onItemUse( + final ItemStack stack, + final EntityPlayer player, + final World world, + int x, + final int y, + int z, + final int side, + final float par8, + final float par9, + final float par10 + ) { + final Block bi = world.getBlock(x, y, z); + final int md = world.getBlockMetadata(x, y, z); + if (bi == ConfigBlocks.blockMetalDevice && md == 0) { + if (side == 0 || side == 1) { + return false; + } + if (side == 2) { + --z; + } + if (side == 3) { + ++z; + } + if (side == 4) { + --x; + } + if (side == 5) { + ++x; + } + } + if (stack.stackSize == 0) { + return false; + } + if (!player.canPlayerEdit(x, y, z, side, stack)) { + return false; + } + if (y == 255 && this.field_150939_a.getMaterial().isSolid()) { + return false; + } + final Block var11 = world.getBlock(x, y, z); + if (world.isAirBlock(x, y, z) || var11.isReplaceable(world, x, y, z) + || var11 == Blocks.vine || var11 == Blocks.tallgrass + || var11 == Blocks.deadbush || var11 == Blocks.snow) { + for (int a = 2; a < 6; ++a) { + final ForgeDirection dir = ForgeDirection.getOrientation(a); + final int xx = x + dir.offsetX; + final int yy = y + dir.offsetY; + final int zz = z + dir.offsetZ; + final Block bid = world.getBlock(xx, yy, zz); + final int meta = world.getBlockMetadata(xx, yy, zz); + if (bid == ConfigBlocks.blockMetalDevice && meta == 0 + && this.placeBlockAt( + stack, + player, + world, + x, + y, + z, + side, + par8, + par9, + par10, + stack.getItemDamage() + )) { + final Block var12 = this.field_150939_a; + world.playSoundEffect( + (double) (x + 0.5f), + (double) (y + 0.5f), + (double) (z + 0.5f), + var12.stepSound.func_150496_b(), + (var12.stepSound.getVolume() + 1.0f) / 2.0f, + var12.stepSound.getPitch() * 0.8f + ); + --stack.stackSize; + world.setBlock( + x, + y, + z, + CCBlocks.alembic, + dir.getOpposite().ordinal() - 2, + 3 + ); + return true; + } + } + } + return false; + } +} diff --git a/src/main/java/net/anvilcraft/classiccasting/items/wands/ItemWandCasting.java b/src/main/java/net/anvilcraft/classiccasting/items/wands/ItemWandCasting.java index ad7d236..72089ca 100644 --- a/src/main/java/net/anvilcraft/classiccasting/items/wands/ItemWandCasting.java +++ b/src/main/java/net/anvilcraft/classiccasting/items/wands/ItemWandCasting.java @@ -182,7 +182,6 @@ public abstract class ItemWandCasting extends Item implements IWand { boolean result = false; final ForgeDirection direction = ForgeDirection.getOrientation(side); if (bi == ConfigBlocks.blockTable && md <= 1) { - // TODO: don't use original workbench here or mixinate it HARD world.setBlock(x, y, z, bi, 15, 3); world.setTileEntity(x, y, z, (TileEntity) new TileArcaneWorkbench()); final TileArcaneWorkbench tawb diff --git a/src/main/java/net/anvilcraft/classiccasting/items/wands/ItemWandTrade.java b/src/main/java/net/anvilcraft/classiccasting/items/wands/ItemWandTrade.java index 47e298a..bc796e7 100644 --- a/src/main/java/net/anvilcraft/classiccasting/items/wands/ItemWandTrade.java +++ b/src/main/java/net/anvilcraft/classiccasting/items/wands/ItemWandTrade.java @@ -7,7 +7,6 @@ import net.anvilcraft.classiccasting.WorldTicker; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -82,9 +81,9 @@ public class ItemWandTrade extends ItemWandBasic { player.swingItem(); } else { final ItemStack pb = this.getPickedBlock(itemstack); - if (pb != null && world.isRemote) { + if (pb != null && pb.getItem() != null && world.isRemote) { player.swingItem(); - } else if (pb != null && world.getTileEntity(x, y, z) == null) { + } else if (pb != null && pb.getItem() != null && world.getTileEntity(x, y, z) == null) { WorldTicker.addSwapper( world, x, diff --git a/src/main/java/net/anvilcraft/classiccasting/render/TileAlembicRenderer.java b/src/main/java/net/anvilcraft/classiccasting/render/TileAlembicRenderer.java new file mode 100644 index 0000000..0ba8980 --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/render/TileAlembicRenderer.java @@ -0,0 +1,66 @@ +package net.anvilcraft.classiccasting.render; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.anvilcraft.classiccasting.render.models.ModelAlembic; +import net.anvilcraft.classiccasting.tiles.TileAlembic; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class TileAlembicRenderer extends TileEntitySpecialRenderer { + private ModelAlembic model; + + public TileAlembicRenderer() { + this.model = new ModelAlembic(); + } + + public void renderTileEntityAt( + final TileAlembic tile, + final double par2, + final double par4, + final double par6, + final float par8 + ) { + int md = 0; + if (tile.getWorldObj() != null) { + md = tile.getBlockMetadata(); + } + GL11.glPushMatrix(); + this.bindTexture( + new ResourceLocation("classiccasting", "textures/models/alembic.png") + ); + GL11.glTranslatef((float) par2 + 0.5f, (float) par4 + 1.5f, (float) par6 + 0.5f); + GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f); + switch (md) { + case 0: { + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + break; + } + case 2: { + GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f); + break; + } + case 3: { + GL11.glRotatef(270.0f, 0.0f, 1.0f, 0.0f); + break; + } + } + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.model.renderAll(); + GL11.glPopMatrix(); + } + + @Override + public void renderTileEntityAt( + final TileEntity par1TileEntity, + final double par2, + final double par4, + final double par6, + final float par8 + ) { + this.renderTileEntityAt((TileAlembic) par1TileEntity, par2, par4, par6, par8); + } +} diff --git a/src/main/java/net/anvilcraft/classiccasting/render/models/ModelAlembic.java b/src/main/java/net/anvilcraft/classiccasting/render/models/ModelAlembic.java new file mode 100644 index 0000000..9224068 --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/render/models/ModelAlembic.java @@ -0,0 +1,66 @@ +package net.anvilcraft.classiccasting.render.models; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import org.lwjgl.opengl.GL11; + +public class ModelAlembic extends ModelBase { + ModelRenderer Core; + ModelRenderer Filter; + ModelRenderer Base; + ModelRenderer Shape1; + ModelRenderer Shape2; + + public ModelAlembic() { + super.textureWidth = 64; + super.textureHeight = 32; + (this.Core = new ModelRenderer((ModelBase) this, 0, 0)) + .addBox(0.0f, 0.0f, 0.0f, 8, 10, 8); + this.Core.setRotationPoint(-4.0f, 10.0f, -4.0f); + this.Core.setTextureSize(64, 32); + this.Core.mirror = true; + this.setRotation(this.Core, 0.0f, 0.0f, 0.0f); + (this.Shape1 = new ModelRenderer((ModelBase) this, 56, 0)) + .addBox(0.0f, 0.0f, 0.0f, 2, 13, 2); + this.Shape1.setRotationPoint(-1.0f, 5.0f, 11.0f); + this.Shape1.setTextureSize(64, 32); + this.Shape1.mirror = true; + this.setRotation(this.Shape1, 0.0f, 0.0f, 0.0f); + (this.Shape2 = new ModelRenderer((ModelBase) this, 56, 0)) + .addBox(0.0f, 0.0f, 0.0f, 2, 15, 2); + this.Shape2.setRotationPoint(-1.0f, 5.0f, -1.0f); + this.Shape2.setTextureSize(64, 32); + this.Shape2.mirror = true; + this.setRotation(this.Shape2, 0.0f, 0.0f, 0.0f); + (this.Filter = new ModelRenderer((ModelBase) this, 36, 24)) + .addBox(0.0f, 0.0f, 0.0f, 10, 4, 4); + this.Filter.setRotationPoint(-2.0f, 4.0f, 11.0f); + this.Filter.setTextureSize(64, 32); + this.Filter.mirror = true; + this.setRotation(this.Filter, 0.0f, 1.570796f, 0.0f); + (this.Base = new ModelRenderer((ModelBase) this, 0, 20)) + .addBox(0.0f, 0.0f, 0.0f, 8, 4, 8); + this.Base.setRotationPoint(-4.0f, 20.0f, -4.0f); + this.Base.setTextureSize(64, 32); + this.Base.mirror = true; + this.setRotation(this.Base, 0.0f, 0.0f, 0.0f); + } + + public void renderAll() { + this.Shape1.render(0.0625f); + this.Shape2.render(0.0625f); + this.Base.render(0.0625f); + this.Filter.render(0.0625f); + GL11.glEnable(3042); + GL11.glBlendFunc(770, 771); + this.Core.render(0.0625f); + GL11.glDisable(3042); + } + + private void + setRotation(final ModelRenderer model, final float x, final float y, final float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } +} diff --git a/src/main/java/net/anvilcraft/classiccasting/tiles/TileAlembic.java b/src/main/java/net/anvilcraft/classiccasting/tiles/TileAlembic.java new file mode 100644 index 0000000..247aabf --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/tiles/TileAlembic.java @@ -0,0 +1,152 @@ +package net.anvilcraft.classiccasting.tiles; + +import dev.tilera.auracore.aura.AuraManager; +import net.anvilcraft.classiccasting.ClassicCasting; +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 thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.aspects.IAspectSource; + +public class TileAlembic extends TileEntity implements IAspectSource { + public Aspect tag; + public int amount; + public int maxAmount; + + public TileAlembic() { + this.tag = null; + this.amount = 0; + this.maxAmount = 16; + } + + @Override + public void readFromNBT(final NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + if (nbttagcompound.hasKey("tag")) + this.tag = Aspect.getAspect(nbttagcompound.getString("tag")); + this.amount = nbttagcompound.getShort("amount"); + } + + @Override + public void writeToNBT(final NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + if (this.tag != null) + nbttagcompound.setString("tag", this.tag.getTag()); + nbttagcompound.setShort("amount", (short) this.amount); + } + + @Override + public boolean canUpdate() { + return false; + } + + @Override + public int addToContainer(final Aspect tt, int am) { + if ((this.amount < this.maxAmount && tt == this.tag) || this.amount == 0) { + this.tag = tt; + final int added = Math.min(am, this.maxAmount - this.amount); + this.amount += added; + am -= added; + } + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + return am; + } + + @Override + public boolean takeFromContainer(final Aspect tt, final int am) { + if (this.amount >= am && tt == this.tag) { + this.amount -= am; + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + return true; + } + return false; + } + + @Override + public boolean doesContainerContain(final AspectList ot) { + for (final Aspect tt : ot.getAspects()) { + if (this.amount > 0 && tt == this.tag) { + return true; + } + } + return false; + } + + @Override + public boolean doesContainerContainAmount(final Aspect tt, final int am) { + return this.amount >= am && tt == this.tag; + } + + @Override + public int containerContains(final Aspect tt) { + return (tt == this.tag) ? this.amount : 0; + } + + @Override + public AspectList getAspects() { + return new AspectList().add(this.tag, this.amount); + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + if (this.tag != null) + nbt.setString("tag", this.tag.getTag()); + + nbt.setInteger("amount", this.amount); + + 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(); + + if (nbt.hasKey("tag")) + this.tag = Aspect.getAspect(nbt.getString("tag")); + + this.amount = nbt.getInteger("amount"); + } + + @Override + public boolean takeFromContainer(AspectList arg0) { + return false; + } + + public void spillRemnants() { + AuraManager.addFluxToClosest( + this.worldObj, + this.xCoord + 0.5f, + this.yCoord + 0.5f, + this.zCoord + 0.5f, + new AspectList().add(this.tag, this.amount) + ); + this.takeFromContainer(this.tag, this.amount); + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + + @Override + public boolean receiveClientEvent(final int i, final int j) { + if (i == 0 && this.amount > 0) { + if (this.worldObj.isRemote) { + ClassicCasting.proxy.alembicSpill(this); + } + return true; + } + return super.receiveClientEvent(i, j); + } + + @Override + public boolean doesContainerAccept(Aspect arg0) { + return false; + } + + @Override + public void setAspects(AspectList arg0) {} +} diff --git a/src/main/java/net/anvilcraft/classiccasting/tiles/TileInfusionWorkbench.java b/src/main/java/net/anvilcraft/classiccasting/tiles/TileInfusionWorkbench.java new file mode 100644 index 0000000..4bc0cd9 --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/tiles/TileInfusionWorkbench.java @@ -0,0 +1,246 @@ +package net.anvilcraft.classiccasting.tiles; + +import java.util.HashMap; +import java.util.Map; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +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 thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.aspects.IAspectSource; +import thaumcraft.common.Thaumcraft; + +public class TileInfusionWorkbench extends TileMagicWorkbench { + public InfuserAspectList foundAspects; + public AspectList dispTags; + public AspectList partTags; + + public TileInfusionWorkbench() { + this.foundAspects = new InfuserAspectList(); + this.dispTags = new AspectList(); + this.partTags = new AspectList(); + } + + public boolean canUpdate() { + return true; + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.worldObj.isRemote) { + if (super.count % 20 == 0 && this.crafting()) { + this.findSources(true); + } + } + else if (this.foundAspects != null && this.foundAspects.size() > 0 && this.partTags != null && this.partTags.size() > 0) { + for (final Aspect tag : this.foundAspects.getAspects()) { + if (this.worldObj.rand.nextInt(10) == 0 + && this.partTags.getAmount(tag) > 0 + && this.foundAspects.getAmount(tag) >= this.partTags.getAmount(tag)) { + final TileEntity ts = (TileEntity) this.foundAspects.getSource(tag); + Thaumcraft.proxy.sourceStreamFX( + this.worldObj, + ts.xCoord + 0.1f + this.worldObj.rand.nextFloat() * 0.8f, + ts.yCoord + 0.5f + this.worldObj.rand.nextFloat() * 0.5f, + ts.zCoord + 0.1f + this.worldObj.rand.nextFloat() * 0.8f, + this.xCoord + 1 + this.worldObj.rand.nextFloat() + - this.worldObj.rand.nextFloat(), + (float) (this.yCoord + 1), + this.zCoord + 1 + this.worldObj.rand.nextFloat() + - this.worldObj.rand.nextFloat(), + tag.getColor() + ); + } + } + } + } + + public boolean doSourcesMatch(final AspectList requiredTags) { + this.findSources(false); + this.partTags = new AspectList(); + boolean wrong = true; + if (requiredTags != null && requiredTags.size() > 0) { + for (final Aspect tag : requiredTags.getAspects()) { + if (this.foundAspects.getAmount(tag) < requiredTags.getAmount(tag)) { + wrong = false; + } else { + this.partTags.merge(tag, this.foundAspects.getAmount(tag)); + } + } + } + this.dispTags = requiredTags; + return wrong; + } + + private boolean crafting() { + if (this.getStackInSlot(10) != null) { + for (int a = 0; a < 9; ++a) { + if (this.getStackInSlot(a) != null) { + return true; + } + } + } + return false; + } + + public void findSources(final boolean transmit) { + final int t = this.foundAspects.getAspects().length; + int a = 0; + for (final Aspect tag : this.foundAspects.getAspects()) { + a += this.foundAspects.getAmount(tag); + } + this.foundAspects = new InfuserAspectList(); + for (int x = -12; x <= 12; ++x) { + for (int z = -12; z <= 12; ++z) { + for (int y = -5; y <= 5; ++y) { + if (y + this.yCoord > 0 + && y + this.yCoord < this.worldObj.getActualHeight()) { + final TileEntity te = this.worldObj.getTileEntity( + x + this.xCoord, y + this.yCoord, z + this.zCoord + ); + if (te != null && te instanceof IAspectSource) { + final IAspectSource ts = (IAspectSource) te; + for (final Aspect tag2 : ts.getAspects().getAspects()) { + if (ts.containerContains(tag2) + > this.foundAspects.getAmount(tag2)) { + this.foundAspects.merge( + tag2, ts.containerContains(tag2) + ); + this.foundAspects.linkSource(tag2, ts); + } + } + } + } + } + } + } + int b = 0; + for (final Aspect tag3 : this.foundAspects.getAspects()) { + b += this.foundAspects.getAmount(tag3); + } + if (t != this.foundAspects.getAspects().length || a != b) { + if (super.eventHandler != null) { + super.eventHandler.onCraftMatrixChanged((IInventory) this); + } + if (!this.worldObj.isRemote && transmit) { + this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + } + } + } + + @Override + public String getInventoryName() { + return "container.infusionworkbench"; + } + + @Override + public Packet getDescriptionPacket() { + NBTTagCompound nbt = new NBTTagCompound(); + + if (this.getStackInSlot(10) != null) { + nbt.setTag("wand", this.getStackInSlot(10).writeToNBT(new NBTTagCompound())); + } + + NBTTagCompound aspects = new NBTTagCompound(); + this.foundAspects.writeToNBT(aspects); + nbt.setTag("aspects", aspects); + + 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(); + + if (nbt.hasKey("wand")) { + this.setInventorySlotContents( + 10, ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("wand")) + ); + } + + this.foundAspects.readFromNBT(nbt.getCompoundTag("aspects")); + } + + //public static void handlePacket(final ByteArrayDataInput dat) { + // final World world = Thaumcraft.proxy.getClientWorld(); + // final int x = dat.readInt(); + // final int y = dat.readInt(); + // final int z = dat.readInt(); + // final short id = dat.readShort(); + // final short dmg = dat.readShort(); + // final InfuserAspectList ot = new InfuserAspectList(); + // try { + // while (true) { + // final int tid = dat.readByte(); + // final int tam = dat.readShort(); + // final int sx = dat.readInt(); + // final int sy = dat.readInt(); + // final int sz = dat.readInt(); + // final TileEntity te = world.getTileEntity(sx, sy, sz); + // if (te != null && te instanceof IAspectSource) { + // ot.merge(Aspect.get(tid), tam); + // ot.linkSource(Aspect.get(tid), (IAspectSource) te); + // } + // } + // } catch (final Exception e) { + // final TileEntity te2 = world.getTileEntity(x, y, z); + // if (te2 instanceof TileInfusionWorkbench && id != 0) { + // ((TileInfusionWorkbench) te2) + // .setInventorySlotContentsSoftly(10, new ItemStack(id, 1, (int) + // dmg)); + // ((TileInfusionWorkbench) te2).foundAspects = ot; + // if (((TileInfusionWorkbench) te2).eventHandler != null) { + // ((TileInfusionWorkbench) te2) + // .eventHandler.onCraftMatrixChanged((IInventory) te2); + // } + // } + // } + //} + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + public static class InfuserAspectList extends AspectList { + public Map linkedSource; + + public InfuserAspectList() { + this.linkedSource = new HashMap<>(); + } + + public void linkSource(final Aspect key, final IAspectSource te) { + this.linkedSource.put(key, te); + } + + public IAspectSource getSource(final Aspect key) { + return this.linkedSource.get(key); + } + } + + @Override + public int[] getAccessibleSlotsFromSide(int p_94128_1_) { + return new int[] {}; + } + + @Override + public boolean + canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { + return false; + } + + @Override + public boolean + canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { + return false; + } +} diff --git a/src/main/java/net/anvilcraft/classiccasting/tiles/TileMagicWorkbench.java b/src/main/java/net/anvilcraft/classiccasting/tiles/TileMagicWorkbench.java new file mode 100644 index 0000000..50be837 --- /dev/null +++ b/src/main/java/net/anvilcraft/classiccasting/tiles/TileMagicWorkbench.java @@ -0,0 +1,167 @@ +package net.anvilcraft.classiccasting.tiles; + +import net.anvilcraft.classiccasting.items.wands.ItemWandCasting; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; + +public abstract class TileMagicWorkbench extends TileEntity implements ISidedInventory { + public ItemStack[] stackList; + public Container eventHandler; + protected int count; + + public TileMagicWorkbench() { + this.stackList = new ItemStack[11]; + } + + @Override + public int getSizeInventory() { + return this.stackList.length; + } + + @Override + public ItemStack getStackInSlot(final int par1) { + return (par1 >= this.getSizeInventory()) ? null : this.stackList[par1]; + } + + // TODO: WTF + //@Override + //public ItemStack getStackInRowAndColumn(final int par1, final int par2) { + // if (par1 >= 0 && par1 < 3) { + // final int var3 = par1 + par2 * 3; + // return this.getStackInSlot(var3); + // } + // return null; + //} + + @Override + public ItemStack getStackInSlotOnClosing(final int par1) { + if (this.stackList[par1] != null) { + final ItemStack var2 = this.stackList[par1]; + this.stackList[par1] = null; + return var2; + } + return null; + } + + @Override + public ItemStack decrStackSize(final int par1, final int par2) { + if (this.stackList[par1] == null) { + return null; + } + if (this.stackList[par1].stackSize <= par2) { + final ItemStack var3 = this.stackList[par1]; + this.stackList[par1] = null; + if (this.eventHandler != null) { + this.eventHandler.onCraftMatrixChanged((IInventory) this); + } + return var3; + } + final ItemStack var3 = this.stackList[par1].splitStack(par2); + if (this.stackList[par1].stackSize == 0) { + this.stackList[par1] = null; + } + if (this.eventHandler != null) { + this.eventHandler.onCraftMatrixChanged((IInventory) this); + } + return var3; + } + + @Override + public void setInventorySlotContents(final int par1, final ItemStack par2ItemStack) { + this.stackList[par1] = par2ItemStack; + if (this.eventHandler != null) { + this.eventHandler.onCraftMatrixChanged((IInventory) this); + } + } + + public void + setInventorySlotContentsSoftly(final int par1, final ItemStack par2ItemStack) { + this.stackList[par1] = par2ItemStack; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public void markDirty() { + super.markDirty(); + } + + @Override + public boolean isUseableByPlayer(final EntityPlayer par1EntityPlayer) { + return true; + } + + @Override + public void readFromNBT(final NBTTagCompound par1NBTTagCompound) { + super.readFromNBT(par1NBTTagCompound); + final NBTTagList var2 = par1NBTTagCompound.getTagList("inventory", 10); + this.stackList = new ItemStack[this.getSizeInventory()]; + for (int var3 = 0; var3 < var2.tagCount(); ++var3) { + final NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3); + final int var5 = var4.getByte("slot") & 0xFF; + if (var5 >= 0 && var5 < this.stackList.length) { + this.stackList[var5] = ItemStack.loadItemStackFromNBT(var4); + } + } + } + + @Override + public void writeToNBT(final NBTTagCompound par1NBTTagCompound) { + super.writeToNBT(par1NBTTagCompound); + final NBTTagList var2 = new NBTTagList(); + for (int var3 = 0; var3 < this.stackList.length; ++var3) { + if (this.stackList[var3] != null) { + final NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("slot", (byte) var3); + this.stackList[var3].writeToNBT(var4); + var2.appendTag((NBTBase) var4); + } + } + par1NBTTagCompound.setTag("inventory", (NBTBase) var2); + } + + @Override + public void updateEntity() { + super.updateEntity(); + if (!this.worldObj.isRemote) { + ++this.count; + if (this.getStackInSlot(10) != null + && this.getStackInSlot(10).getItem() instanceof ItemWandCasting + && this.count + % ((ItemWandCasting) this.getStackInSlot(10).getItem()) + .getRechargeInterval() + == 0 + && ((ItemWandCasting) this.getStackInSlot(10).getItem()) + .recharge( + this.getStackInSlot(10), + this.worldObj, + this.count, + this.xCoord, + this.yCoord, + this.zCoord + )) { + this.setInventorySlotContents(10, this.getStackInSlot(10)); + } + } + } + + @Override + public boolean hasCustomInventoryName() { + return false; + } + + @Override + public boolean isItemValidForSlot(final int i, final ItemStack itemstack) { + return true; + } +} diff --git a/src/main/resources/assets/classiccasting/lang/en_US.lang b/src/main/resources/assets/classiccasting/lang/en_US.lang index d8b6aa7..cd11e76 100644 --- a/src/main/resources/assets/classiccasting/lang/en_US.lang +++ b/src/main/resources/assets/classiccasting/lang/en_US.lang @@ -1,3 +1,5 @@ +# ---- ITEMS ---- + itemGroup.classiccasting=Classic Casting item.classiccasting:portableHole.name=Portable Hole @@ -12,3 +14,7 @@ item.classiccasting:wandFrost.name=Wand of Frost item.classiccasting:hellrod.name=Rod of Hell item.classiccasting:wandLightning.name=Wand of Lightning item.classiccasting:wandTrade.name=Wand of Equal Trade + +# ---- BLOCKS ---- + +tile.classiccasting:alembic.name=Arcane Alembic diff --git a/src/main/resources/assets/classiccasting/textures/models/alembic.png b/src/main/resources/assets/classiccasting/textures/models/alembic.png new file mode 100644 index 0000000..b9412ed Binary files /dev/null and b/src/main/resources/assets/classiccasting/textures/models/alembic.png differ