diff --git a/src/main/java/net/anvilcraft/thaummach/ClientProxy.java b/src/main/java/net/anvilcraft/thaummach/ClientProxy.java index e3498c5..f6cc90e 100644 --- a/src/main/java/net/anvilcraft/thaummach/ClientProxy.java +++ b/src/main/java/net/anvilcraft/thaummach/ClientProxy.java @@ -28,8 +28,8 @@ import net.anvilcraft.thaummach.render.tile.TileEnchanterRenderer; import net.anvilcraft.thaummach.render.tile.TileGeneratorRenderer; import net.anvilcraft.thaummach.render.tile.TileRepairerRenderer; import net.anvilcraft.thaummach.render.tile.TileSealRenderer; -import net.anvilcraft.thaummach.render.tile.TileVoidChestRenderer; import net.anvilcraft.thaummach.render.tile.TileVoidInterfaceRenderer; +import net.anvilcraft.thaummach.render.tile.TileVoidRenderer; import net.anvilcraft.thaummach.tiles.TileArcaneFurnace; import net.anvilcraft.thaummach.tiles.TileBore; import net.anvilcraft.thaummach.tiles.TileCondenser; @@ -44,12 +44,15 @@ import net.anvilcraft.thaummach.tiles.TileDuplicator; import net.anvilcraft.thaummach.tiles.TileEnchanter; import net.anvilcraft.thaummach.tiles.TileFilter; import net.anvilcraft.thaummach.tiles.TileGenerator; +import net.anvilcraft.thaummach.tiles.TileMonolith; import net.anvilcraft.thaummach.tiles.TilePurifier; import net.anvilcraft.thaummach.tiles.TileRepairer; import net.anvilcraft.thaummach.tiles.TileSeal; import net.anvilcraft.thaummach.tiles.TileSoulBrazier; import net.anvilcraft.thaummach.tiles.TileVoidChest; +import net.anvilcraft.thaummach.tiles.TileVoidCube; import net.anvilcraft.thaummach.tiles.TileVoidInterface; +import net.anvilcraft.thaummach.tiles.TileVoidLock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -78,7 +81,7 @@ public class ClientProxy extends CommonProxy { GameRegistry.registerTileEntity(TileCrucible.class, "crucible"); GameRegistry.registerTileEntity(TileFilter.class, "filter"); GameRegistry.registerTileEntity(TilePurifier.class, "purifier"); - GameRegistry.registerTileEntity(TileSoulBrazier.class, "soulBrazier"); + GameRegistry.registerTileEntity(TileSoulBrazier.class, "soul_brazier"); ClientRegistry.registerTileEntity(TileBore.class, "bore", new TileBoreRenderer()); ClientRegistry.registerTileEntity(TileCondenser.class, "condenser", new TileCondenserRenderer()); @@ -87,10 +90,13 @@ public class ClientProxy extends CommonProxy { ClientRegistry.registerTileEntity(TileDuplicator.class, "duplicator", new TileDuplicatorRenderer()); ClientRegistry.registerTileEntity(TileEnchanter.class, "enchanter", new TileEnchanterRenderer()); ClientRegistry.registerTileEntity(TileGenerator.class, "generator", new TileGeneratorRenderer()); + ClientRegistry.registerTileEntity(TileMonolith.class, "monolith", new TileVoidRenderer()); ClientRegistry.registerTileEntity(TileRepairer.class, "repairer", new TileRepairerRenderer()); ClientRegistry.registerTileEntity(TileSeal.class, "seal", new TileSealRenderer()); - ClientRegistry.registerTileEntity(TileVoidChest.class, "voidChest", new TileVoidChestRenderer()); - ClientRegistry.registerTileEntity(TileVoidInterface.class, "voidInterface", new TileVoidInterfaceRenderer()); + ClientRegistry.registerTileEntity(TileVoidChest.class, "void_chest", new TileVoidRenderer()); + ClientRegistry.registerTileEntity(TileVoidCube.class, "void_cube", new TileVoidRenderer()); + ClientRegistry.registerTileEntity(TileVoidInterface.class, "void_interface", new TileVoidInterfaceRenderer()); + ClientRegistry.registerTileEntity(TileVoidLock.class, "void_lock", new TileVoidRenderer()); // clang-format on } diff --git a/src/main/java/net/anvilcraft/thaummach/CommonProxy.java b/src/main/java/net/anvilcraft/thaummach/CommonProxy.java index c1f8478..59018c5 100644 --- a/src/main/java/net/anvilcraft/thaummach/CommonProxy.java +++ b/src/main/java/net/anvilcraft/thaummach/CommonProxy.java @@ -27,12 +27,15 @@ import net.anvilcraft.thaummach.tiles.TileDuplicator; import net.anvilcraft.thaummach.tiles.TileEnchanter; import net.anvilcraft.thaummach.tiles.TileFilter; import net.anvilcraft.thaummach.tiles.TileGenerator; +import net.anvilcraft.thaummach.tiles.TileMonolith; import net.anvilcraft.thaummach.tiles.TilePurifier; import net.anvilcraft.thaummach.tiles.TileRepairer; import net.anvilcraft.thaummach.tiles.TileSeal; import net.anvilcraft.thaummach.tiles.TileSoulBrazier; import net.anvilcraft.thaummach.tiles.TileVoidChest; +import net.anvilcraft.thaummach.tiles.TileVoidCube; import net.anvilcraft.thaummach.tiles.TileVoidInterface; +import net.anvilcraft.thaummach.tiles.TileVoidLock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.tileentity.TileEntity; @@ -59,12 +62,15 @@ public class CommonProxy implements IGuiHandler { GameRegistry.registerTileEntity(TileEnchanter.class, "enchanter"); GameRegistry.registerTileEntity(TileFilter.class, "filter"); GameRegistry.registerTileEntity(TileGenerator.class, "generator"); + GameRegistry.registerTileEntity(TileMonolith.class, "monolith"); GameRegistry.registerTileEntity(TilePurifier.class, "purifier"); GameRegistry.registerTileEntity(TileRepairer.class, "repairer"); GameRegistry.registerTileEntity(TileSeal.class, "seal"); - GameRegistry.registerTileEntity(TileSoulBrazier.class, "soulBrazier"); - GameRegistry.registerTileEntity(TileVoidChest.class, "voidChest"); - GameRegistry.registerTileEntity(TileVoidInterface.class, "voidInterface"); + GameRegistry.registerTileEntity(TileSoulBrazier.class, "soul_brazier"); + GameRegistry.registerTileEntity(TileVoidChest.class, "void_chest"); + GameRegistry.registerTileEntity(TileVoidCube.class, "void_cube"); + GameRegistry.registerTileEntity(TileVoidInterface.class, "void_interface"); + GameRegistry.registerTileEntity(TileVoidLock.class, "void_lock"); // clang-format on } diff --git a/src/main/java/net/anvilcraft/thaummach/TMBlocks.java b/src/main/java/net/anvilcraft/thaummach/TMBlocks.java index 9858db0..aa3ad97 100644 --- a/src/main/java/net/anvilcraft/thaummach/TMBlocks.java +++ b/src/main/java/net/anvilcraft/thaummach/TMBlocks.java @@ -5,6 +5,7 @@ import net.anvilcraft.thaummach.blocks.BlockApparatusFragile; import net.anvilcraft.thaummach.blocks.BlockApparatusMetal; import net.anvilcraft.thaummach.blocks.BlockApparatusStone; import net.anvilcraft.thaummach.blocks.BlockApparatusWood; +import net.anvilcraft.thaummach.blocks.BlockHidden; import net.anvilcraft.thaummach.blocks.BlockSeal; import net.anvilcraft.thaummach.items.ItemBlockApparatusFragile; import net.anvilcraft.thaummach.items.ItemBlockApparatusMetal; @@ -18,21 +19,17 @@ public class TMBlocks { public static Block apparatusMetal; public static Block apparatusStone; public static Block apparatusWood; + public static Block hidden; public static Block seal; public static void init() { // clang-format off - apparatusFragile = new BlockApparatusFragile(); - apparatusMetal = new BlockApparatusMetal(); - apparatusStone = new BlockApparatusStone(); - apparatusWood = new BlockApparatusWood(); - seal = new BlockSeal(); - - GameRegistry.registerBlock(apparatusFragile, ItemBlockApparatusFragile.class, "apparatus_fragile"); - GameRegistry.registerBlock(apparatusMetal, ItemBlockApparatusMetal.class, "apparatus_metal"); - GameRegistry.registerBlock(apparatusStone, ItemBlockApparatusStone.class, "apparatus_stone"); - GameRegistry.registerBlock(apparatusWood, ItemBlockApparatusWood.class, "apparatus_wood"); - GameRegistry.registerBlock(seal, ItemSeal.class, "seal"); + GameRegistry.registerBlock(apparatusFragile = new BlockApparatusFragile(), ItemBlockApparatusFragile.class, "apparatus_fragile"); + GameRegistry.registerBlock(apparatusMetal = new BlockApparatusMetal(), ItemBlockApparatusMetal.class, "apparatus_metal"); + GameRegistry.registerBlock(apparatusStone = new BlockApparatusStone(), ItemBlockApparatusStone.class, "apparatus_stone"); + GameRegistry.registerBlock(apparatusWood = new BlockApparatusWood(), ItemBlockApparatusWood.class, "apparatus_wood"); + GameRegistry.registerBlock(hidden = new BlockHidden(), "hidden"); + GameRegistry.registerBlock(seal = new BlockSeal(), ItemSeal.class, "seal"); // clang-format on } } diff --git a/src/main/java/net/anvilcraft/thaummach/TMItems.java b/src/main/java/net/anvilcraft/thaummach/TMItems.java index 75ef321..bdfed0b 100644 --- a/src/main/java/net/anvilcraft/thaummach/TMItems.java +++ b/src/main/java/net/anvilcraft/thaummach/TMItems.java @@ -26,44 +26,24 @@ public class TMItems { public static Item voidBracelet; public static void init() { - crystallineBell = new ItemCrystallineBell(); + GameRegistry.registerItem(crystallineBell = new ItemCrystallineBell(), "crystalline_bell"); - detector = new ItemDetector(); + GameRegistry.registerItem(detector = new ItemDetector(), "detector"); - focus0 = new ItemFocus(0); - focus1 = new ItemFocus(1); - focus2 = new ItemFocus(2); - focus3 = new ItemFocus(3); - focus4 = new ItemFocus(4); + GameRegistry.registerItem(focus0 = new ItemFocus(0), "focus0"); + GameRegistry.registerItem(focus1 = new ItemFocus(1), "focus1"); + GameRegistry.registerItem(focus2 = new ItemFocus(2), "focus2"); + GameRegistry.registerItem(focus3 = new ItemFocus(3), "focus3"); + GameRegistry.registerItem(focus4 = new ItemFocus(4), "focus4"); - runicEssence = new ItemRunicEssence(); + GameRegistry.registerItem(runicEssence = new ItemRunicEssence(), "runic_essence"); - singularity = new ItemSingularity(); + GameRegistry.registerItem(singularity = new ItemSingularity(), "singularity"); - soulFragment = new ItemSoulFragment(); + GameRegistry.registerItem(soulFragment = new ItemSoulFragment(), "soul_fragment"); - upgrade = new ItemUpgrade(); + GameRegistry.registerItem(upgrade = new ItemUpgrade(), "upgrade"); - voidBracelet = new ItemVoidBracelet(); - - GameRegistry.registerItem(crystallineBell, "crystalline_bell"); - - GameRegistry.registerItem(detector, "detector"); - - GameRegistry.registerItem(focus0, "focus0"); - GameRegistry.registerItem(focus1, "focus1"); - GameRegistry.registerItem(focus2, "focus2"); - GameRegistry.registerItem(focus3, "focus3"); - GameRegistry.registerItem(focus4, "focus4"); - - GameRegistry.registerItem(runicEssence, "runic_essence"); - - GameRegistry.registerItem(singularity, "singularity"); - - GameRegistry.registerItem(soulFragment, "soul_fragment"); - - GameRegistry.registerItem(upgrade, "upgrade"); - - GameRegistry.registerItem(voidBracelet, "voidBracelet"); + GameRegistry.registerItem(voidBracelet = new ItemVoidBracelet(), "voidBracelet"); } } diff --git a/src/main/java/net/anvilcraft/thaummach/ThaumicMachinery.java b/src/main/java/net/anvilcraft/thaummach/ThaumicMachinery.java index 72ee272..d280fb0 100644 --- a/src/main/java/net/anvilcraft/thaummach/ThaumicMachinery.java +++ b/src/main/java/net/anvilcraft/thaummach/ThaumicMachinery.java @@ -9,6 +9,7 @@ import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import dev.tilera.auracore.api.HelperLocation; import net.anvilcraft.thaummach.entities.EntitySingularity; @@ -22,6 +23,7 @@ import net.anvilcraft.thaummach.packets.PacketFXSparkle; import net.anvilcraft.thaummach.packets.PacketFXWisp; import net.anvilcraft.thaummach.tiles.TileSeal; import net.anvilcraft.thaummach.tiles.TileVoidInterface; +import net.anvilcraft.thaummach.worldgen.TMWorldGenerator; import net.minecraft.world.World; @Mod(modid = "thaummach") @@ -53,6 +55,8 @@ public class ThaumicMachinery { // clang-format on NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy); + GameRegistry.registerWorldGenerator(new TMWorldGenerator(), 0); + proxy.registerTileEntities(); TMBlocks.init(); TMItems.init(); diff --git a/src/main/java/net/anvilcraft/thaummach/blocks/BlockApparatusMetal.java b/src/main/java/net/anvilcraft/thaummach/blocks/BlockApparatusMetal.java index 483dac5..5f3621d 100644 --- a/src/main/java/net/anvilcraft/thaummach/blocks/BlockApparatusMetal.java +++ b/src/main/java/net/anvilcraft/thaummach/blocks/BlockApparatusMetal.java @@ -123,7 +123,7 @@ public class BlockApparatusMetal extends BlockApparatus { this.iconSoulCrucibleTopInv = reg.registerIcon("thaummach:soul_crucible_top_inv"); this.iconTankBottom = reg.registerIcon("thaummach:reinforced_tank_bottom"); this.iconTankSide = reg.registerIcon("thaummach:reinforced_tank_side"); - this.iconVoidChestBottom = reg.registerIcon("thaummach:void_chest_bottom"); + this.iconVoidChestBottom = reg.registerIcon("thaummach:eldritch_stone"); this.iconVoidChestSide = reg.registerIcon("thaummach:void_chest_side"); this.iconVoidChestSideTransparent = reg.registerIcon("thaummach:void_chest_side_transparent"); diff --git a/src/main/java/net/anvilcraft/thaummach/blocks/BlockHidden.java b/src/main/java/net/anvilcraft/thaummach/blocks/BlockHidden.java new file mode 100644 index 0000000..e3c8532 --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/blocks/BlockHidden.java @@ -0,0 +1,375 @@ +package net.anvilcraft.thaummach.blocks; + +import java.util.List; +import java.util.Random; +import java.util.function.Function; + +import dev.tilera.auracore.aura.AuraManager; +import net.anvilcraft.thaummach.particles.FXWisp; +import net.anvilcraft.thaummach.tiles.TileMonolith; +import net.anvilcraft.thaummach.tiles.TileVoidCube; +import net.anvilcraft.thaummach.tiles.TileVoidLock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.client.fx.WRVector3; +import thaumcraft.client.fx.bolt.FXLightningBolt; + +public class BlockHidden extends BlockContainer { + public IIcon iconDefault; + public IIcon iconEmpty; + public IIcon iconMonolithBottom; + public IIcon iconMonolithEnd; + public IIcon iconMonolithMiddle; + public IIcon iconMonolithTop; + + public BlockHidden() { + super(Material.rock); + this.setBlockUnbreakable(); + this.setResistance(6000000.0F); + this.setStepSound(Block.soundTypeStone); + this.setBlockName("tcbhidden"); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + this.setTickRandomly(true); + } + + @Override + public void registerBlockIcons(IIconRegister register) { + Function reg = (n) -> register.registerIcon("thaummach:" + n); + + this.iconDefault = reg.apply("eldritch_stone"); + this.iconEmpty = reg.apply("empty"); + this.iconMonolithBottom = reg.apply("monolith_bottom"); + this.iconMonolithEnd = reg.apply("monolith_end"); + this.iconMonolithMiddle = reg.apply("monolith_middle"); + this.iconMonolithTop = reg.apply("monolith_top"); + } + + @Override + public int getLightValue() { + return 1; + } + + @Override + @SuppressWarnings("rawtypes") + public void getSubBlocks(Item arg0, CreativeTabs arg1, List arg2) {} + + @Override + public float getBlockHardness(World w, int x, int y, int z) { + int meta = w.getBlockMetadata(x, y, z); + return meta == 4 ? 10.0F : super.getBlockHardness(w, x, y, z); + } + + @Override + public TileEntity createNewTileEntity(World world, int md) { + switch (md) { + case 2: + return new TileMonolith(); + + case 3: + case 5: + return new TileVoidCube(); + + case 4: + return new TileVoidLock(); + } + return null; + //if (md != 3 && md != 5) { + // if (md == 1) { + // return new TileVoidHole(); + // } else if (md == 2) { + // return new TileMonolith(); + // } else { + // return (TileEntity) (md == 4 ? new TileVoidLock() : super.getBlockEntity(md)); + // } + //} else { + // return new TileVoidCube(); + //} + } + + @Override + public void breakBlock( + World world, + int x, + int y, + int z, + // useless parameters + Block alec1, + int alec2 + ) { + //if (md == 5) { + // SISpecialTile pd = new SISpecialTile( + // i, + // j, + // k, + // (byte) 0, + // (byte) ModLoader.getMinecraftInstance().thePlayer.dimension, + // (byte) 2 + // ); + // mod_ThaumCraft.DeleteSpecialTileFromList(pd); + //} + + super.breakBlock(world, x, y, z, alec1, alec2); + } + + @Override + public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { + switch (world.getBlockMetadata(x, y, z)) { + case 1: + case 2: + return false; + + default: + return true; + } + } + + @Override + public void onNeighborBlockChange(World world, int i, int j, int k, Block l) { + super.onNeighborBlockChange(world, i, j, k, l); + int md = world.getBlockMetadata(i, j, k); + if (md == 5) { + try { + TileVoidCube tvc = (TileVoidCube) world.getTileEntity(i, j, k); + boolean[] test = new boolean[] { false, false, false, false }; + + int a; + for (a = 0; a < 4; ++a) { + int xx = 0; + int zz = 0; + switch (a) { + case 0: + xx = 1; + break; + case 1: + xx = -1; + break; + case 2: + zz = 1; + break; + case 3: + zz = -1; + } + + TileEntity tvc0 = world.getTileEntity(i + xx, j, k + zz); + if (tvc0 != null && ((TileVoidCube) tvc0).placed != -1 + && ((TileVoidCube) tvc0).placed != tvc.runes[a]) { + ((TileVoidCube) tvc0).placed = -1; + world.newExplosion( + (Entity) null, + (double) ((float) tvc0.xCoord + 0.5F), + (double) ((float) tvc0.yCoord + 1.5F), + (double) ((float) tvc0.zCoord + 0.5F), + 1.0F, + false, + false + ); + } else if (tvc0 != null && ((TileVoidCube)tvc0).placed != -1 && + ((TileVoidCube)tvc0).placed == tvc.runes[a]) { + test[a] = true; + } + } + + if (test[0] && test[1] && test[2] && test[3]) { + world.playSoundEffect( + (double) ((float) i + 0.5F), + (double) ((float) j + 0.5F), + (double) ((float) k + 0.5F), + "thaummach:rumble", + 4.0F, + 1.0F + ); + + for (a = 0; a < 50; ++a) { + FXWisp ef = new FXWisp( + world, + (double) ((float) i + world.rand.nextFloat()), + (double) ((float) j - world.rand.nextFloat() * 2.0F), + (double) ((float) k + world.rand.nextFloat()), + (double) ((float) i + world.rand.nextFloat()), + (double) ((float) j + world.rand.nextFloat() * 2.0F + 4.0F), + (double) ((float) k + world.rand.nextFloat()), + 0.5F, + 5 + ); + ef.shrink = true; + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + tvc.generate(); + world.setBlockToAir(i, j, k); + } + } catch (Exception var13) { + var13.printStackTrace(); + } + } + } + + @Override + public void onBlockAdded(World world, int i, int j, int k) { + super.onBlockAdded(world, i, j, k); + int md = world.getBlockMetadata(i, j, k); + TileVoidCube tvc; + if (md == 3) { + try { + tvc = (TileVoidCube) world.getTileEntity(i, j, k); + tvc.runes[0] = (byte) world.rand.nextInt(6); + } catch (Exception var12) {} + } + + if (md == 5) { + try { + tvc = (TileVoidCube) world.getTileEntity(i, j, k); + TileVoidCube tvc0 = (TileVoidCube) world.getTileEntity(i + 1, j, k); + TileVoidCube tvc1 = (TileVoidCube) world.getTileEntity(i - 1, j, k); + TileVoidCube tvc2 = (TileVoidCube) world.getTileEntity(i, j, k + 1); + TileVoidCube tvc3 = (TileVoidCube) world.getTileEntity(i, j, k - 1); + tvc.runes[0] = tvc0.runes[0]; + tvc.runes[1] = tvc1.runes[0]; + tvc.runes[2] = tvc2.runes[0]; + tvc.runes[3] = tvc3.runes[0]; + } catch (Exception var11) {} + } + } + + @Override + public boolean onBlockActivated( + World world, + int i, + int j, + int k, + EntityPlayer entityplayer, + // useless parameters + int alec1, + float alec2, + float alec3, + float alec4 + ) { + return false; + } + + @Override + public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) { + int md = iblockaccess.getBlockMetadata(i, j, k); + if (md == 0) { + return this.iconDefault; + } else if (md == 3 && l != 1) { + return this.iconDefault; + } else { + return md == 4 && l < 2 ? this.iconDefault : this.iconEmpty; + } + } + + @Override + public IIcon getIcon(int side, int meta) { + if (meta == 0) { + return this.iconDefault; + } else if (meta == 3) { + return side != 1 ? this.iconDefault : this.iconEmpty; + } else if (meta == 4) { + return side < 2 ? this.iconDefault : this.iconEmpty; + } else { + return this.iconEmpty; + } + } + + @Override + @SuppressWarnings("rawtypes") + public void addCollisionBoxesToList( + World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List list, Entity alec + ) { + int md = world.getBlockMetadata(x, y, z); + if (md != 1) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, list, alec); + } + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k) { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + @Override + public AxisAlignedBB getSelectedBoundingBoxFromPool(World w, int i, int j, int k) { + return AxisAlignedBB.getBoundingBox(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); + } + + @Override + public void updateTick(World world, int x, int y, int z, Random random) { + if (!world.isRemote) { + int md = world.getBlockMetadata(x, y, z); + if (md == 1 || md == 2) { + AuraManager.addFluxToClosest(world, x, y, z, new AspectList().add(Aspect.TAINT, 1)); + } + } + } + + @Override + public void randomDisplayTick(World world, int i, int j, int k, Random random) { + int md = world.getBlockMetadata(i, j, k); + if (md == 2 && world.rand.nextInt(5) == 0) { + FXLightningBolt bolt; + if (world.getBlock(i, j - 1, k) != this) { + bolt = new FXLightningBolt( + world, + new WRVector3((double) i + 0.5, (double) j + 0.25, (double) k + 0.5), + new WRVector3( + (double) i + 0.5 + + (double) ((world.rand.nextFloat() - world.rand.nextFloat()) * 2.0F), + (double) (j - 2), + (double) k + 0.5 + + (double) ((world.rand.nextFloat() - world.rand.nextFloat()) * 2.0F) + ), + world.rand.nextLong() + ); + bolt.setMultiplier(4.0F); + bolt.defaultFractal(); + bolt.setType(5); + bolt.finalizeBolt(); + } + + if (world.getBlock(i, j + 1, k) != this) { + bolt = new FXLightningBolt( + world, + new WRVector3((double) i + 0.5, (double) j + 0.75, (double) k + 0.5), + new WRVector3( + (double) i + 0.5 + + (double) ((world.rand.nextFloat() - world.rand.nextFloat()) * 2.0F), + (double) (j + 3), + (double) k + 0.5 + + (double) ((world.rand.nextFloat() - world.rand.nextFloat()) * 2.0F) + ), + world.rand.nextLong() + ); + bolt.setMultiplier(4.0F); + bolt.defaultFractal(); + bolt.setType(5); + bolt.finalizeBolt(); + } + } + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public boolean isOpaqueCube() { + return false; + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/render/tile/TileVoidChestRenderer.java b/src/main/java/net/anvilcraft/thaummach/render/tile/TileVoidRenderer.java similarity index 81% rename from src/main/java/net/anvilcraft/thaummach/render/tile/TileVoidChestRenderer.java rename to src/main/java/net/anvilcraft/thaummach/render/tile/TileVoidRenderer.java index d8e93dd..ede6ade 100644 --- a/src/main/java/net/anvilcraft/thaummach/render/tile/TileVoidChestRenderer.java +++ b/src/main/java/net/anvilcraft/thaummach/render/tile/TileVoidRenderer.java @@ -4,16 +4,27 @@ import java.nio.FloatBuffer; import java.util.Random; import cpw.mods.fml.client.FMLClientHandler; +import net.anvilcraft.alec.jalec.factories.AlecUnexpectedRuntimeErrorExceptionFactory; +import net.anvilcraft.thaummach.TMBlocks; +import net.anvilcraft.thaummach.blocks.BlockHidden; +import net.anvilcraft.thaummach.tiles.TileMonolith; +import net.anvilcraft.thaummach.tiles.TileVoidChest; +import net.anvilcraft.thaummach.tiles.TileVoidCube; +import net.anvilcraft.thaummach.tiles.TileVoidLock; +import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.GLAllocation; +import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -public class TileVoidChestRenderer extends TileEntitySpecialRenderer { +public class TileVoidRenderer extends TileEntitySpecialRenderer { FloatBuffer fBuffer = GLAllocation.createDirectFloatBuffer(16); private FloatBuffer calcFloatBuffer(float f, float f1, float f2, float f3) { @@ -43,9 +54,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { float f6 = 0.0625F; float f7 = 1.0F / (f5 + 1.0F); if (i == 0) { - this.bindTexture( - new ResourceLocation("thaummach", "textures/misc/tunnel.png") - ); + this.bindTexture(new ResourceLocation("thaummach", "textures/misc/tunnel.png")); f7 = 0.1F; f5 = 65.0F; f6 = 0.125F; @@ -93,9 +102,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef(-0.5F, -0.5F, 0.0F); GL11.glTranslatef(-px, -pz, -py); GL11.glTranslatef( - ActiveRenderInfo.objectX * f5 / f9, - ActiveRenderInfo.objectZ * f5 / f9, - -py + ActiveRenderInfo.objectX * f5 / f9, ActiveRenderInfo.objectZ * f5 / f9, -py ); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); @@ -141,9 +148,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { float f6 = 0.0625F; float f7 = 1.0F / (f5 + 1.0F); if (i == 0) { - this.bindTexture( - new ResourceLocation("thaummach", "textures/misc/tunnel.png") - ); + this.bindTexture(new ResourceLocation("thaummach", "textures/misc/tunnel.png")); f7 = 0.1F; f5 = 65.0F; f6 = 0.125F; @@ -191,9 +196,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef(-0.5F, -0.5F, 0.0F); GL11.glTranslatef(-f1, -f3, -f2); GL11.glTranslatef( - ActiveRenderInfo.objectX * f5 / f9, - ActiveRenderInfo.objectZ * f5 / f9, - -f2 + ActiveRenderInfo.objectX * f5 / f9, ActiveRenderInfo.objectZ * f5 / f9, -f2 ); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); @@ -239,9 +242,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { float f6 = 0.0625F; float f7 = 1.0F / (f5 + 1.0F); if (i == 0) { - this.bindTexture( - new ResourceLocation("thaummach", "textures/misc/tunnel.png") - ); + this.bindTexture(new ResourceLocation("thaummach", "textures/misc/tunnel.png")); f7 = 0.1F; f5 = 65.0F; f6 = 0.125F; @@ -289,9 +290,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef(-0.5F, -0.5F, 0.0F); GL11.glTranslatef(-px, -py, -pz); GL11.glTranslatef( - ActiveRenderInfo.objectX * f5 / f9, - ActiveRenderInfo.objectY * f5 / f9, - -pz + ActiveRenderInfo.objectX * f5 / f9, ActiveRenderInfo.objectY * f5 / f9, -pz ); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); @@ -337,9 +336,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { float f6 = 0.0625F; float f7 = 1.0F / (f5 + 1.0F); if (i == 0) { - this.bindTexture( - new ResourceLocation("thaummach", "textures/misc/tunnel.png") - ); + this.bindTexture(new ResourceLocation("thaummach", "textures/misc/tunnel.png")); f7 = 0.1F; f5 = 65.0F; f6 = 0.125F; @@ -387,9 +384,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef(-0.5F, -0.5F, 0.0F); GL11.glTranslatef(-px, -py, -pz); GL11.glTranslatef( - ActiveRenderInfo.objectX * f5 / f9, - ActiveRenderInfo.objectY * f5 / f9, - -pz + ActiveRenderInfo.objectX * f5 / f9, ActiveRenderInfo.objectY * f5 / f9, -pz ); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); @@ -435,9 +430,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { float f6 = 0.0625F; float f7 = 1.0F / (f5 + 1.0F); if (i == 0) { - this.bindTexture( - new ResourceLocation("thaummach", "textures/misc/tunnel.png") - ); + this.bindTexture(new ResourceLocation("thaummach", "textures/misc/tunnel.png")); f7 = 0.1F; f5 = 65.0F; f6 = 0.125F; @@ -485,9 +478,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef(-0.5F, -0.5F, 0.0F); GL11.glTranslatef(-pz, -py, -px); GL11.glTranslatef( - ActiveRenderInfo.objectZ * f5 / f9, - ActiveRenderInfo.objectY * f5 / f9, - -px + ActiveRenderInfo.objectZ * f5 / f9, ActiveRenderInfo.objectY * f5 / f9, -px ); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); @@ -533,9 +524,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { float f6 = 0.0625F; float f7 = 1.0F / (f5 + 1.0F); if (i == 0) { - this.bindTexture( - new ResourceLocation("thaummach", "textures/misc/tunnel.png") - ); + this.bindTexture(new ResourceLocation("thaummach", "textures/misc/tunnel.png")); f7 = 0.1F; f5 = 65.0F; f6 = 0.125F; @@ -583,9 +572,7 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { GL11.glTranslatef(-0.5F, -0.5F, 0.0F); GL11.glTranslatef(-pz, -py, -px); GL11.glTranslatef( - ActiveRenderInfo.objectZ * f5 / f9, - ActiveRenderInfo.objectY * f5 / f9, - -px + ActiveRenderInfo.objectZ * f5 / f9, ActiveRenderInfo.objectY * f5 / f9, -px ); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); @@ -619,9 +606,72 @@ public class TileVoidChestRenderer extends TileEntitySpecialRenderer { @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { - this.drawPlaneZNeg(x, y, z, f); - this.drawPlaneZPos(x, y, z, f); - this.drawPlaneXNeg(x, y, z, f); - this.drawPlaneXPos(x, y, z, f); + if (te instanceof TileVoidChest) { + this.drawPlaneZNeg(x, y, z, f); + this.drawPlaneZPos(x, y, z, f); + this.drawPlaneXNeg(x, y, z, f); + this.drawPlaneXPos(x, y, z, f); + } else if (te instanceof TileVoidCube || te instanceof TileVoidLock) { + this.drawPlaneYNeg(x, y, z, f); + this.drawPlaneYPos(x, y, z, f); + this.drawPlaneZNeg(x, y, z, f); + this.drawPlaneZPos(x, y, z, f); + this.drawPlaneXNeg(x, y, z, f); + this.drawPlaneXPos(x, y, z, f); + } else if (te instanceof TileMonolith) { + BlockHidden block = (BlockHidden) TMBlocks.hidden; + int b = Minecraft.getMinecraft().thePlayer.ticksExisted; + float bob = MathHelper.sin((float) b / 10.0F) * 0.1F + 0.1F; + GL11.glPushMatrix(); + GL11.glTranslatef((float) x, (float) (y + bob), (float) z); + RenderBlocks rb = RenderBlocks.getInstance(); + rb.setRenderBounds(0, 0, 0, 1, 1, 1); + this.bindTexture(TextureMap.locationBlocksTexture); + if (!(te.getWorldObj().getTileEntity(te.xCoord, te.yCoord + 1, te.zCoord) + instanceof TileMonolith)) { + Tessellator.instance.startDrawingQuads(); + rb.renderFaceYPos(block, 0, 0, 0, block.iconMonolithEnd); + rb.renderFaceXPos(block, 0, 0, 0, block.iconMonolithTop); + rb.renderFaceXNeg(block, 0, 0, 0, block.iconMonolithTop); + rb.renderFaceZPos(block, 0, 0, 0, block.iconMonolithTop); + rb.renderFaceZNeg(block, 0, 0, 0, block.iconMonolithTop); + Tessellator.instance.draw(); + this.drawPlaneYPos(0, 0, 0, f); + this.drawPlaneXPos(0, 0, 0, f); + this.drawPlaneXNeg(0, 0, 0, f); + this.drawPlaneZPos(0, 0, 0, f); + this.drawPlaneZNeg(0, 0, 0, f); + } else if (!(te.getWorldObj().getTileEntity(te.xCoord, te.yCoord - 1, te.zCoord) + instanceof TileMonolith)) { + Tessellator.instance.startDrawingQuads(); + rb.renderFaceYNeg(block, 0, 0, 0, block.iconMonolithEnd); + rb.renderFaceXPos(block, 0, 0, 0, block.iconMonolithBottom); + rb.renderFaceXNeg(block, 0, 0, 0, block.iconMonolithBottom); + rb.renderFaceZPos(block, 0, 0, 0, block.iconMonolithBottom); + rb.renderFaceZNeg(block, 0, 0, 0, block.iconMonolithBottom); + Tessellator.instance.draw(); + this.drawPlaneYNeg(0, 0, 0, f); + this.drawPlaneXPos(0, 0, 0, f); + this.drawPlaneXNeg(0, 0, 0, f); + this.drawPlaneZPos(0, 0, 0, f); + this.drawPlaneZNeg(0, 0, 0, f); + } else { + Tessellator.instance.startDrawingQuads(); + rb.renderFaceXPos(block, 0, 0, 0, block.iconMonolithMiddle); + rb.renderFaceXNeg(block, 0, 0, 0, block.iconMonolithMiddle); + rb.renderFaceZPos(block, 0, 0, 0, block.iconMonolithMiddle); + rb.renderFaceZNeg(block, 0, 0, 0, block.iconMonolithMiddle); + Tessellator.instance.draw(); + this.drawPlaneXPos(0, 0, 0, f); + this.drawPlaneXNeg(0, 0, 0, f); + this.drawPlaneZPos(0, 0, 0, f); + this.drawPlaneZNeg(0, 0, 0, f); + } + GL11.glPopMatrix(); + } else { + throw AlecUnexpectedRuntimeErrorExceptionFactory.PLAIN.createAlecException( + "Invalid TileEntity!" + ); + } } } diff --git a/src/main/java/net/anvilcraft/thaummach/tiles/TileMonolith.java b/src/main/java/net/anvilcraft/thaummach/tiles/TileMonolith.java new file mode 100644 index 0000000..4f1e03d --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/tiles/TileMonolith.java @@ -0,0 +1,28 @@ +package net.anvilcraft.thaummach.tiles; + +import net.minecraft.tileentity.TileEntity; + +public class TileMonolith extends TileEntity { + int soundDelay = 0; + + public void updateEntity() { + super.updateEntity(); + if (this.soundDelay > 0) { + --this.soundDelay; + } + + if (this.soundDelay == 0 + /* && super.worldObj.getBlockId(super.xCoord, super.yCoord - 1, super.zCoord) + != mod_ThaumCraft.blockHidden.blockID */) { + super.worldObj.playSoundEffect( + (double) ((float) super.xCoord + 0.5F), + (double) ((float) super.yCoord + 0.5F), + (double) ((float) super.zCoord + 0.5F), + "thaummach:monolith", + 0.4F, + 1.0F + ); + this.soundDelay = 450 + super.worldObj.rand.nextInt(150); + } + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/tiles/TileVoidCube.java b/src/main/java/net/anvilcraft/thaummach/tiles/TileVoidCube.java new file mode 100644 index 0000000..7a29056 --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/tiles/TileVoidCube.java @@ -0,0 +1,241 @@ +package net.anvilcraft.thaummach.tiles; + +import net.anvilcraft.thaummach.TMBlocks; +import net.anvilcraft.thaummach.blocks.BlockApparatusMetal; +import net.anvilcraft.thaummach.blocks.BlockApparatusStone; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class TileVoidCube extends TileEntity { + public byte[] runes = new byte[] { -1, -1, -1, -1 }; + public byte placed = -1; + private int v = 1; + private int u = 2; + private int q = 4; + private int r = 3; + private int i = -1; + private int[][][] BP; + + public TileVoidCube() { + // _____ ___ ____ ___ __ _______ _____ + //|_ _/ _ \| _ \ / _ \ _ \ \ / /_ _| ___| + // | || | | | | | | | | (_) \ \ /\ / / | | | |_ + // | || |_| | |_| | |_| |_ \ V V / | | | _| + // |_| \___/|____/ \___/(_) \_/\_/ |_| |_| + + // clang-format off + this.BP = new int[][][] { { { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i }, { this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i }, { this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i }, { this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i }, { this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i }, { this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i }, { this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i }, { this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i }, { this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i } }, { { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.v, this.v, this.v, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i }, { this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i }, { this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i }, { this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i }, { this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i }, { this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i }, { this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.v, this.v, this.v, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i } }, { { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.r, this.v, this.v, this.v, this.r, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.v, 0, 0, 0, this.v, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, 0, 0, 0, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i, this.i }, { this.i, this.r, this.v, this.v, 0, this.u, 0, 0, 0, this.u, 0, this.v, this.v, this.r, this.i }, { this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r }, { this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r }, { this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r }, { this.i, this.r, this.v, this.v, 0, this.u, 0, 0, 0, this.u, 0, this.v, this.v, this.r, this.i }, { this.i, this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, 0, 0, 0, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.v, 0, 0, 0, this.v, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.r, this.v, this.v, this.v, this.r, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i } }, { { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.v, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.v, 5, this.v, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, 0, 0, 0, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, this.q, 0, 0, 0, this.q, 0, 0, this.v, this.r, this.i }, { this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r }, { this.v, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, this.v }, { this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r }, { this.i, this.r, this.v, 0, 0, this.q, 0, 0, 0, this.q, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, 0, 0, 0, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.v, 6, this.v, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.v, this.r, this.i, this.i, this.i, this.i, this.i, this.i } }, { { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.v, this.v, this.v, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, 0, 0, 0, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r }, { this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r }, { this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, 0, 0, 0, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.v, this.v, this.v, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i } }, { { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i }, { this.i, this.i, this.r, this.v, 0, 0, 0, 0, 0, 0, 0, this.v, this.r, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i } }, { { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.v, this.v, this.v, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i }, { this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i }, { this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i }, { this.i, this.r, this.v, this.v, this.v, this.v, this.v, 0, this.v, this.v, this.v, this.v, this.v, this.r, this.i }, { this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i }, { this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i }, { this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i }, { this.i, this.i, this.i, this.r, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.r, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.v, this.v, this.v, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i } }, { { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i }, { this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i }, { this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i }, { this.i, this.r, this.r, this.r, this.r, this.r, this.v, this.v, this.v, this.r, this.r, this.r, this.r, this.r, this.i }, { this.i, this.r, this.r, this.r, this.r, this.r, this.v, 0, this.v, this.r, this.r, this.r, this.r, this.r, this.i }, { this.i, this.r, this.r, this.r, this.r, this.r, this.v, this.v, this.v, this.r, this.r, this.r, this.r, this.r, this.i }, { this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i }, { this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i }, { this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.r, this.r, this.r, this.r, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.r, this.r, this.r, this.i, this.i, this.i, this.i, this.i, this.i }, { this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i } } }; + // clang-format on + } + + @Override + public boolean canUpdate() { + return false; + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + this.runes = nbttagcompound.getByteArray("runes"); + this.placed = nbttagcompound.getByte("placed"); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + nbttagcompound.setByteArray("runes", this.runes); + nbttagcompound.setByte("placed", this.placed); + } + + public void generate() { + int x = super.xCoord; + int y = super.yCoord; + int z = super.zCoord; + + int a; + int b; + int c; + for (a = -1; a <= 1; ++a) { + for (b = y - 1; b >= 14; --b) { + for (c = -1; c <= 1; ++c) { + if (a == 0 && c == 0) { + super.worldObj.setBlockToAir(x + a, b, z + c); + } else if (Math.abs(a) == 1 || Math.abs(c) == 1) { + super.worldObj.setBlock( + x + a, + b, + z + c, + TMBlocks.apparatusStone, + BlockApparatusStone.MetaVals.ELDRITCH_STONE.ordinal(), + 3 + ); + } + } + } + } + + for (a = -7; a <= 7; ++a) { + for (b = 0; b <= 7; ++b) { + for (c = -7; c <= 7; ++c) { + switch (this.BP[b][a + 7][c + 7]) { + case 0: + super.worldObj.setBlockToAir(x + a, b + 6, z + c); + break; + case 1: + super.worldObj.setBlock( + x + a, + b + 6, + z + c, + TMBlocks.apparatusStone, + BlockApparatusStone.MetaVals.ELDRITCH_STONE.ordinal(), + 3 + ); + break; + case 2: + if (super.worldObj.rand.nextInt(4) != 0) { + super.worldObj.setBlock( + x + a, + b + 6, + z + c, + TMBlocks.apparatusMetal, + BlockApparatusMetal.MetaVals.VOID_CHEST.ordinal(), + 3 + ); + generateEldritchChestContents(super.worldObj, x + a, b + 6, z + c); + } else { + super.worldObj.setBlockToAir(x + a, b + 6, z + c); + } + case 3: + break; + case 4: + if (!super.worldObj.isAirBlock(x + a, b + 5, z + c) + && super.worldObj.rand.nextInt(8) == 0) { + super.worldObj.setBlock( + x + a, + b + 6, + z + c, + TMBlocks.apparatusMetal, + BlockApparatusMetal.MetaVals.VOID_INTERFACE.ordinal(), + 3 + ); + //TileVoidInterface tvi = (TileVoidInterface + //) super.worldObj.getTileEntity(x + a, b + 6, z + c); + //if (tvi != null) { + // tvi.network = (byte) super.worldObj.rand.nextInt(6); + // SISpecialTile pd = new SISpecialTile( + // x + a, + // b + 6, + // z + c, + // tvi.network, + // (byte) + // ModLoader.getMinecraftInstance().thePlayer.dimension, + // (byte) 1 + // ); + // mod_ThaumCraft.AddSpecialTileToList(pd); + // tvi.invalidateLinks(); + // tvi.establishLinks(); + //} + break; + } + + super.worldObj.setBlockToAir(x + a, b + 6, z + c); + break; + case 5: + case 6: + case 7: + case 8: + super.worldObj.setBlock( + x + a, b + 6, z + c, TMBlocks.hidden, 4, 3 // TODO: MetaVals + ); + //TileVoidLock tvl = (TileVoidLock + //) super.worldObj.getBlockTileEntity(x + a, b + 6, z + c); + //tvl.orientation = (byte) (this.BP[b][a + 7][c + 7] - 5); + } + } + } + } + + for (a = -1; a <= 1; ++a) { + for (b = -1; b <= 1; ++b) { + if (super.worldObj.getBlock(x + a, y, z + b) == TMBlocks.hidden) { + // TODO: WTF + super.worldObj.setBlockMetadataWithNotify(x + a, y, z + b, 14, 3); + } + + if (a != 0 || b != 0) { + super.worldObj.setBlock( + x + a, + y, + z + b, + TMBlocks.apparatusStone, + BlockApparatusStone.MetaVals.ELDRITCH_STONE.ordinal(), + 3 + ); + } + } + } + } + + public static void generateEldritchChestContents(World w, int x, int y, int z) { + // TODO: loot + //Map loot = new HashMap(); + //int count = 0; + //boolean added = false; + + //int a; + //int b; + //for (a = 0; a < 100; ++a) { + // for (b = 0; b < 2; ++b) { + // loot.put(count, new ItemStack(mod_ThaumCraft.itemArtifactEldritch, 1, b)); + // ++count; + // } + //} + + //for (a = 0; a < 33; ++a) { + // for (b = 2; b < 4; ++b) { + // loot.put(count, new ItemStack(mod_ThaumCraft.itemArtifactEldritch, 1, b)); + // ++count; + // } + //} + + //for (a = 0; a < 11; ++a) { + // loot.put(count, new ItemStack(mod_ThaumCraft.itemArtifactEldritch, 1, 4)); + // ++count; + //} + + //for (a = 0; a < 5; ++a) { + // loot.put(count, new ItemStack(mod_ThaumCraft.itemArtifactEldritch, 1, 5)); + // ++count; + //} + + //for (a = 0; a < 17; ++a) { + // loot.put(count, new ItemStack(mod_ThaumCraft.itemComponents, 1 + w.rand.nextInt(2), 8)); + // ++count; + //} + + //for (a = 0; a < 17; ++a) { + // loot.put( + // count, new ItemStack(mod_ThaumCraft.itemComponents, 1 + w.rand.nextInt(2), 11) + // ); + // ++count; + //} + + //for (a = 0; a < 25; ++a) { + // loot.put(count, new ItemStack(mod_ThaumCraft.blockAppStone, 1 + w.rand.nextInt(4), 5)); + // ++count; + //} + + //TileEntity te = w.getBlockTileEntity(x, y, z); + //if (te != null && te instanceof TileVoidChest) { + // TileVoidChest tec = (TileVoidChest) te; + + // for (int a = 0; a < tec.getSizeInventory(); ++a) { + // if (tec.getStackInSlot(a) == null) { + // int chance = w.rand.nextInt(count * 6); + // tec.setInventorySlotContents(a, (ItemStack) loot.get(chance)); + // } + // } + //} + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/tiles/TileVoidLock.java b/src/main/java/net/anvilcraft/thaummach/tiles/TileVoidLock.java new file mode 100644 index 0000000..2a3abfb --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/tiles/TileVoidLock.java @@ -0,0 +1,205 @@ +package net.anvilcraft.thaummach.tiles; + +import net.anvilcraft.thaummach.TMBlocks; +import net.anvilcraft.thaummach.blocks.BlockApparatusMetal; +import net.anvilcraft.thaummach.blocks.BlockApparatusStone; +import net.anvilcraft.thaummach.utils.UtilsFX; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +public class TileVoidLock extends TileEntity { + public byte orientation = -1; + public int unlocked = -1; + private int v = 1; + private int u = 2; + private int m = 3; + private int i = -1; + private int[][][] BP; + + public TileVoidLock() { + // _____ ___ ____ ___ __ _______ _____ + //|_ _/ _ \| _ \ / _ \ _ \ \ / /_ _| ___| + // | || | | | | | | | | (_) \ \ /\ / / | | | |_ + // | || |_| | |_| | |_| |_ \ V V / | | | _| + // |_| \___/|____/ \___/(_) \_/\_/ |_| |_| + + // clang-format off + this.BP = new int[][][]{{{this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}}, {{this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, 0, 0, 0, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, this.u, 0, 0, 0, 0, 0, this.u, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, this.u, 0, 0, 0, 0, 0, this.u, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, 0, 0, 0, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}}, {{this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, this.m, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}}, {{this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, this.m, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}}, {{this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, this.m, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}}, {{this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, 0, 0, 0, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, 0, 0, 0, 0, 0, 0, 0, 0, 0, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, 0, 0, 0, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}}, {{this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.v, this.i}, {this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i, this.i}}}; + // clang-format on + } + + @Override + public void updateEntity() { + if (this.unlocked > 0) { + int x = super.xCoord; + int y = super.yCoord; + int z = super.zCoord; + switch (this.orientation) { + case 0: + x -= 7; + break; + case 1: + x += 7; + break; + case 2: + z -= 7; + break; + case 3: + z += 7; + } + + super.worldObj.playSoundEffect( + (double) x, (double) y, (double) z, "thaummach:rumble", 4.0F, 1.0F + ); + + int b; + int alec; + for (int a = -7; a <= 7; ++a) { + for (alec = 0; alec <= 6; ++alec) { + for (b = -7; b <= 7; ++b) { + if (super.worldObj.getBlock(x + a, alec + 6, z + b) == TMBlocks.hidden) { + super.worldObj.setBlockMetadataWithNotify( + x + a, alec + 6, z + b, 14, 3 + ); + } + + switch (this.BP[a][alec + 7][b + 7]) { + case 0: + super.worldObj.setBlockToAir(x + a, alec + 6, z + b); + break; + case 1: + super.worldObj.setBlock( + x + a, + alec + 6, + z + b, + TMBlocks.apparatusStone, + BlockApparatusStone.MetaVals.ELDRITCH_STONE.ordinal(), + 3 + ); + break; + case 2: + if (super.worldObj.rand.nextInt(3) == 0) { + super.worldObj.setBlock( + x + a, + alec + 6, + z + b, + TMBlocks.apparatusMetal, + BlockApparatusMetal.MetaVals.VOID_CHEST.ordinal(), + 3 + ); + TileVoidCube.generateEldritchChestContents( + super.worldObj, x + a, alec + 6, z + b + ); + // TODO: LOOT + //TileEntity te + // = super.worldObj.getTileEntity(x + a, alec + 6, z + b); + //if (te != null && te instanceof TileVoidChest) { + // TileVoidChest tec = (TileVoidChest) te; + // if (super.worldObj.rand.nextInt(4) == 0) { + // tec.setInventorySlotContents( + // 2 + tec.getSizeInventory() / 2, + // new ItemStack(mod_ThaumCraft.itemVoidCompass) + // ); + // } + + // if (super.worldObj.rand.nextInt(4) == 0) { + // tec.setInventorySlotContents( + // 4 + tec.getSizeInventory() / 2, + // new ItemStack(mod_ThaumCraft.itemVoidCrusher) + // ); + // } + + // if (super.worldObj.rand.nextInt(4) == 0) { + // tec.setInventorySlotContents( + // 6 + tec.getSizeInventory() / 2, + // new ItemStack(mod_ThaumCraft.itemVoidCutter) + // ); + // } + //} + } else { + super.worldObj.setBlockToAir(x + a, alec + 6, z + b); + } + break; + case 3: + super.worldObj.setBlock( + x + a, alec + 6, z + b, TMBlocks.hidden, 2, 3 + ); + } + } + } + } + + x = super.xCoord; + y = super.yCoord; + z = super.zCoord; + boolean tt = false; + switch (this.orientation) { + case 0: + --x; + tt = true; + break; + case 1: + ++x; + tt = true; + break; + case 2: + --z; + break; + case 3: + ++z; + } + + int c; + for (alec = -2; alec <= 2; ++alec) { + for (b = -2; b <= 2; ++b) { + c = 0; + int zs = 0; + if (tt) { + zs = alec; + } else { + c = alec; + } + + if (super.worldObj.getBlock(super.xCoord + c, y + b, super.zCoord + zs) + == TMBlocks.hidden) { + super.worldObj.setBlockMetadataWithNotify( + super.xCoord + c, y + b, super.zCoord + zs, 14, 3 + ); + } + + super.worldObj.setBlock( + super.xCoord + c, y + b, super.zCoord + zs, TMBlocks.apparatusStone, 5, 3 + ); + } + } + + for (alec = -1; alec <= 1; ++alec) { + for (b = -1; b <= 1; ++b) { + for (c = -1; c <= 1; ++c) { + if (super.worldObj.getBlock(x + alec, y + b, z + c) + == TMBlocks.hidden) { + super.worldObj.setBlockMetadataWithNotify(x + alec, y + b, z + c, 14, 3); + } + + super.worldObj.setBlockToAir(x + alec, y + b, z + c); + UtilsFX.poofBad( + super.worldObj, (float) (x + alec), (float) (y + b), (float) (z + c) + ); + } + } + } + } + } + + @Override + public void readFromNBT(NBTTagCompound nbttagcompound) { + super.readFromNBT(nbttagcompound); + this.orientation = nbttagcompound.getByte("orientation"); + } + + @Override + public void writeToNBT(NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + nbttagcompound.setByte("orientation", this.orientation); + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/utils/UtilsFX.java b/src/main/java/net/anvilcraft/thaummach/utils/UtilsFX.java index fbe8b74..3ec1724 100644 --- a/src/main/java/net/anvilcraft/thaummach/utils/UtilsFX.java +++ b/src/main/java/net/anvilcraft/thaummach/utils/UtilsFX.java @@ -2,11 +2,11 @@ package net.anvilcraft.thaummach.utils; import dev.tilera.auracore.client.FXSparkle; import net.anvilcraft.thaummach.TMItems; +import net.anvilcraft.thaummach.particles.FXWisp; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.World; -import thaumcraft.client.fx.particles.FXWisp; public class UtilsFX { public static void poof(World worldObj, float x, float y, float z) { @@ -48,6 +48,38 @@ public class UtilsFX { } } + public static void poofBad(World w, float x, float y, float z) { + poofBad(w, x, y, z, false); + } + + public static void poofBad(World w, float x, float y, float z, boolean sound) { + int puffs = 10; + + if (sound) { + w.playSoundEffect( + (double) (x + 0.5F), + (double) (y + 0.5F), + (double) (z + 0.5F), + "thaummach:roots", + 0.05F, + 1.1F + w.rand.nextFloat() * 0.2F + ); + } + + for (int a = 0; a < puffs; ++a) { + FXWisp ef = new FXWisp( + w, + (double) (x + 0.5F + w.rand.nextFloat() - w.rand.nextFloat()), + (double) (y + 0.5F + w.rand.nextFloat() - w.rand.nextFloat()), + (double) (z + 0.5F + w.rand.nextFloat() - w.rand.nextFloat()), + 0.3F, + 5 + ); + ef.tinkle = false; + Minecraft.getMinecraft().effectRenderer.addEffect(ef); + } + } + public static void sparkleDown(World w, int x, int y, int z, int color) { int puffs = 16; @@ -117,32 +149,16 @@ public class UtilsFX { tes.setBrightness(brightness); tes.setNormal(0.0F, 0.0F, -1.0F); tes.addVertexWithUV( - 0.0D, - 1.0D, - (double) (0.0F - p_78439_7_), - (double) p_78439_1_, - (double) p_78439_2_ + 0.0D, 1.0D, (double) (0.0F - p_78439_7_), (double) p_78439_1_, (double) p_78439_2_ ); tes.addVertexWithUV( - 1.0D, - 1.0D, - (double) (0.0F - p_78439_7_), - (double) p_78439_3_, - (double) p_78439_2_ + 1.0D, 1.0D, (double) (0.0F - p_78439_7_), (double) p_78439_3_, (double) p_78439_2_ ); tes.addVertexWithUV( - 1.0D, - 0.0D, - (double) (0.0F - p_78439_7_), - (double) p_78439_3_, - (double) p_78439_4_ + 1.0D, 0.0D, (double) (0.0F - p_78439_7_), (double) p_78439_3_, (double) p_78439_4_ ); tes.addVertexWithUV( - 0.0D, - 0.0D, - (double) (0.0F - p_78439_7_), - (double) p_78439_1_, - (double) p_78439_4_ + 0.0D, 0.0D, (double) (0.0F - p_78439_7_), (double) p_78439_1_, (double) p_78439_4_ ); tes.draw(); float f5 = 0.5F * (p_78439_1_ - p_78439_3_) / (float) p_78439_5_; @@ -158,24 +174,12 @@ public class UtilsFX { f7 = (float) k / (float) p_78439_5_; f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5; tes.addVertexWithUV( - (double) f7, - 0.0D, - (double) (0.0F - p_78439_7_), - (double) f8, - (double) p_78439_4_ + (double) f7, 0.0D, (double) (0.0F - p_78439_7_), (double) f8, (double) p_78439_4_ ); + tes.addVertexWithUV((double) f7, 0.0D, 0.0D, (double) f8, (double) p_78439_4_); + tes.addVertexWithUV((double) f7, 1.0D, 0.0D, (double) f8, (double) p_78439_2_); tes.addVertexWithUV( - (double) f7, 0.0D, 0.0D, (double) f8, (double) p_78439_4_ - ); - tes.addVertexWithUV( - (double) f7, 1.0D, 0.0D, (double) f8, (double) p_78439_2_ - ); - tes.addVertexWithUV( - (double) f7, - 1.0D, - (double) (0.0F - p_78439_7_), - (double) f8, - (double) p_78439_2_ + (double) f7, 1.0D, (double) (0.0F - p_78439_7_), (double) f8, (double) p_78439_2_ ); } @@ -190,24 +194,12 @@ public class UtilsFX { f8 = p_78439_1_ + (p_78439_3_ - p_78439_1_) * f7 - f5; f9 = f7 + 1.0F / (float) p_78439_5_; tes.addVertexWithUV( - (double) f9, - 1.0D, - (double) (0.0F - p_78439_7_), - (double) f8, - (double) p_78439_2_ + (double) f9, 1.0D, (double) (0.0F - p_78439_7_), (double) f8, (double) p_78439_2_ ); + tes.addVertexWithUV((double) f9, 1.0D, 0.0D, (double) f8, (double) p_78439_2_); + tes.addVertexWithUV((double) f9, 0.0D, 0.0D, (double) f8, (double) p_78439_4_); tes.addVertexWithUV( - (double) f9, 1.0D, 0.0D, (double) f8, (double) p_78439_2_ - ); - tes.addVertexWithUV( - (double) f9, 0.0D, 0.0D, (double) f8, (double) p_78439_4_ - ); - tes.addVertexWithUV( - (double) f9, - 0.0D, - (double) (0.0F - p_78439_7_), - (double) f8, - (double) p_78439_4_ + (double) f9, 0.0D, (double) (0.0F - p_78439_7_), (double) f8, (double) p_78439_4_ ); } @@ -220,25 +212,13 @@ public class UtilsFX { f7 = (float) k / (float) p_78439_6_; f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6; f9 = f7 + 1.0F / (float) p_78439_6_; + tes.addVertexWithUV(0.0D, (double) f9, 0.0D, (double) p_78439_1_, (double) f8); + tes.addVertexWithUV(1.0D, (double) f9, 0.0D, (double) p_78439_3_, (double) f8); tes.addVertexWithUV( - 0.0D, (double) f9, 0.0D, (double) p_78439_1_, (double) f8 + 1.0D, (double) f9, (double) (0.0F - p_78439_7_), (double) p_78439_3_, (double) f8 ); tes.addVertexWithUV( - 1.0D, (double) f9, 0.0D, (double) p_78439_3_, (double) f8 - ); - tes.addVertexWithUV( - 1.0D, - (double) f9, - (double) (0.0F - p_78439_7_), - (double) p_78439_3_, - (double) f8 - ); - tes.addVertexWithUV( - 0.0D, - (double) f9, - (double) (0.0F - p_78439_7_), - (double) p_78439_1_, - (double) f8 + 0.0D, (double) f9, (double) (0.0F - p_78439_7_), (double) p_78439_1_, (double) f8 ); } @@ -250,25 +230,13 @@ public class UtilsFX { for (k = 0; k < p_78439_6_; ++k) { f7 = (float) k / (float) p_78439_6_; f8 = p_78439_4_ + (p_78439_2_ - p_78439_4_) * f7 - f6; + tes.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) p_78439_3_, (double) f8); + tes.addVertexWithUV(0.0D, (double) f7, 0.0D, (double) p_78439_1_, (double) f8); tes.addVertexWithUV( - 1.0D, (double) f7, 0.0D, (double) p_78439_3_, (double) f8 + 0.0D, (double) f7, (double) (0.0F - p_78439_7_), (double) p_78439_1_, (double) f8 ); tes.addVertexWithUV( - 0.0D, (double) f7, 0.0D, (double) p_78439_1_, (double) f8 - ); - tes.addVertexWithUV( - 0.0D, - (double) f7, - (double) (0.0F - p_78439_7_), - (double) p_78439_1_, - (double) f8 - ); - tes.addVertexWithUV( - 1.0D, - (double) f7, - (double) (0.0F - p_78439_7_), - (double) p_78439_3_, - (double) f8 + 1.0D, (double) f7, (double) (0.0F - p_78439_7_), (double) p_78439_3_, (double) f8 ); } @@ -278,13 +246,10 @@ public class UtilsFX { /** * Draws an upgrade into the GuiContainer. */ - public static void - renderUpgradeIntoGUI(Gui gui, int upgrade, int x, int y) { + public static void renderUpgradeIntoGUI(Gui gui, int upgrade, int x, int y) { if (upgrade < 0) return; - gui.drawTexturedModelRectFromIcon( - x, y, TMItems.upgrade.getIconFromDamage(upgrade), 16, 16 - ); + gui.drawTexturedModelRectFromIcon(x, y, TMItems.upgrade.getIconFromDamage(upgrade), 16, 16); } } diff --git a/src/main/java/net/anvilcraft/thaummach/worldgen/TMWorldGenerator.java b/src/main/java/net/anvilcraft/thaummach/worldgen/TMWorldGenerator.java new file mode 100644 index 0000000..3e08bfc --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/worldgen/TMWorldGenerator.java @@ -0,0 +1,34 @@ +package net.anvilcraft.thaummach.worldgen; + +import java.util.Random; + +import cpw.mods.fml.common.IWorldGenerator; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; + +public class TMWorldGenerator implements IWorldGenerator { + @Override + public void generate( + Random rand, + int chunkX, + int chunkZ, + World world, + IChunkProvider chunkGenerator, + IChunkProvider chunkProvider + ) { + // TODO: generate in other overworld-y dimensions + if (world.provider.dimensionId != 0) + return; + + if (rand.nextInt(66) != 42) + return; + + WorldGenMonolith wgm = new WorldGenMonolith(); + + int xPos = (chunkX << 4) + rand.nextInt(16); + int zPos = (chunkZ << 4) + rand.nextInt(16); + int yPos = world.getHeightValue(xPos, zPos); + + wgm.generate(world, rand, xPos, yPos, zPos); + } +} diff --git a/src/main/java/net/anvilcraft/thaummach/worldgen/WorldGenMonolith.java b/src/main/java/net/anvilcraft/thaummach/worldgen/WorldGenMonolith.java new file mode 100644 index 0000000..5d302a2 --- /dev/null +++ b/src/main/java/net/anvilcraft/thaummach/worldgen/WorldGenMonolith.java @@ -0,0 +1,295 @@ +package net.anvilcraft.thaummach.worldgen; + +import java.util.Random; + +import dev.tilera.auracore.api.EnumNodeType; +import dev.tilera.auracore.aura.AuraManager; +import net.anvilcraft.alec.jalec.AlecLogger; +import net.anvilcraft.thaummach.TMBlocks; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class WorldGenMonolith extends WorldGenerator { + private boolean isValidLocation(World world, int x, int y, int z) { + for (int a = -3; a <= 3; ++a) { + for (int c = -3; c <= 3; ++c) { + if (world.getBlock(x + a, y, z + c) != Blocks.dirt + && world.getBlock(x + a, y, z + c) != Blocks.stone + && world.getBlock(x + a, y, z + c) != Blocks.grass + && world.getBlock(x + a, y, z + c) != Blocks.sand) { + return false; + } + } + } + + return true; + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) { + AlecLogger.FMT.alec("generate %d %d %d", x, y, z); + if (world.getBlock(x, y, z) == Blocks.tallgrass + || world.getBlock(x, y, z) == Blocks.snow_layer) { + --y; + } + + if (!this.isValidLocation(world, x, y, z)) { + AlecLogger.PLAIN.alec("invalid location"); + return false; + } + + int bio; + for (bio = 2; bio < 7; ++bio) { + world.setBlock(x, y + 1 + bio, z, TMBlocks.hidden, 2, 3); + } + + bio = world.getWorldChunkManager().getBiomeGenAt(x, z).biomeID; + if (bio != BiomeGenBase.desert.biomeID && bio != BiomeGenBase.desertHills.biomeID + && bio != BiomeGenBase.beach.biomeID) { + if (bio == BiomeGenBase.swampland.biomeID) { + this.genMossyStoneSurroundings(world, random, x, y, z); + } else { + this.genStoneSurroundings(world, random, x, y, z); + } + } else { + this.genSandStoneSurroundings(world, random, x, y, z); + } + + int b; + int c; + for (int a = -1; a <= 1; ++a) { + for (b = y; b >= y - 1; --b) { + for (c = -1; c <= 1; ++c) { + if (Math.abs(a) != 1 && Math.abs(c) != 1 && b != y - 1) { + if (a == 0 && c == 0) { + world.setBlockToAir(x + a, b, z + c); + } + } else { + world.setBlock(x + a, b, z + c, TMBlocks.hidden, 0, 3); + } + } + } + } + + world.setBlock(x + 1, y, z, TMBlocks.hidden, 3, 3); + world.setBlock(x - 1, y, z, TMBlocks.hidden, 0, 3); + world.setBlock(x, y, z + 1, TMBlocks.hidden, 0, 3); + world.setBlock(x, y, z - 1, TMBlocks.hidden, 0, 3); + world.setBlock(x, y, z, TMBlocks.hidden, 5, 3); + + AuraManager.registerAuraNode( + world, + (short) (random.nextInt(300) + 500), + EnumNodeType.DARK, + world.provider.dimensionId, + x, + y, + z + ); + + return true; + } + + private void genSandStoneSurroundings(World world, Random random, int x, int y, int z) { + int side; + for (side = 0; side < 75; ++side) { + world.setBlock( + x + random.nextInt(4) - random.nextInt(4), + y, + z + random.nextInt(4) - random.nextInt(4), + Blocks.sandstone + ); + } + + for (side = 0; side < 4; ++side) { + int mx = 0; + int mz = 0; + switch (side) { + case 0: + mz = 2; + mx = 2; + break; + case 1: + mx = 2; + mz = -2; + break; + case 2: + mz = -2; + mx = -2; + break; + case 3: + mx = -2; + mz = 2; + } + + for (int a = 0; a < random.nextInt(5); ++a) { + int md = 0; + switch (a) { + case 1: + case 3: + md = 1; + break; + case 2: + case 4: + md = 2; + } + + world.setBlock(x + mx, y + a + 1, z + mz, Blocks.sandstone, md, 3); + } + } + } + + private void genStoneSurroundings(World world, Random random, int x, int y, int z) { + int bio = world.getWorldChunkManager().getBiomeGenAt(x, z).biomeID; + boolean vines = false; + if (bio == BiomeGenBase.jungle.biomeID || bio == BiomeGenBase.jungleHills.biomeID + || bio == BiomeGenBase.forest.biomeID) { + vines = true; + } + + int side; + for (side = 0; side < 75; ++side) { + world.setBlock( + x + random.nextInt(4) - random.nextInt(4), + y, + z + random.nextInt(4) - random.nextInt(4), + Blocks.stonebrick, + random.nextInt(3), + 3 + ); + } + + for (side = 0; side < 4; ++side) { + int mx = 0; + int mz = 0; + switch (side) { + case 0: + mz = 2; + mx = 2; + break; + case 1: + mx = 2; + mz = -2; + break; + case 2: + mz = -2; + mx = -2; + break; + case 3: + mx = -2; + mz = 2; + } + + for (int a = 0; a < random.nextInt(5); ++a) { + world.setBlock(x + mx, y + a + 1, z + mz, Blocks.stonebrick, 3, 3); + if (a > 1) { + if (vines && random.nextBoolean()) { + world.setBlock(x + mx + 1, y + a + 1, z + mz, Blocks.vine, 2, 3); + } + + if (vines && random.nextBoolean()) { + world.setBlock(x + mx - 1, y + a + 1, z + mz, Blocks.vine, 8, 3); + } + + if (vines && random.nextBoolean()) { + world.setBlock(x + mx, y + a + 1, z + mz + 1, Blocks.vine, 4, 3); + } + + if (vines && random.nextBoolean()) { + world.setBlock(x + mx, y + a + 1, z + mz - 1, Blocks.vine, 1, 3); + } + } + + if (a == 3) { + if (random.nextBoolean()) { + world.setBlock( + x + mx + mx / 2 * -1, y + a + 1, z + mz, Blocks.stonebrick, 3, 3 + ); + } + + if (random.nextBoolean()) { + world.setBlock( + x + mx, y + a + 1, z + mz + mz / 2 * -1, Blocks.stonebrick, 3, 3 + ); + } + } + } + } + } + + private void genMossyStoneSurroundings(World world, Random random, int x, int y, int z) { + int side; + for (side = 0; side < 75; ++side) { + world.setBlock( + x + random.nextInt(4) - random.nextInt(4), + y, + z + random.nextInt(4) - random.nextInt(4), + Blocks.mossy_cobblestone + ); + } + + for (side = 0; side < 4; ++side) { + int mx = 0; + int mz = 0; + switch (side) { + case 0: + mz = 2; + mx = 2; + break; + case 1: + mx = 2; + mz = -2; + break; + case 2: + mz = -2; + mx = -2; + break; + case 3: + mx = -2; + mz = 2; + } + + for (int a = 0; a < random.nextInt(5); ++a) { + if (a < 3) { + world.setBlock(x + mx, y + a + 1, z + mz, Blocks.mossy_cobblestone); + } else { + world.setBlock(x + mx, y + a + 1, z + mz, Blocks.stonebrick, 3, 3); + } + + if (a > 1) { + if (random.nextBoolean()) { + world.setBlock(x + mx + 1, y + a + 1, z + mz, Blocks.vine, 2, 3); + } + + if (random.nextBoolean()) { + world.setBlock(x + mx - 1, y + a + 1, z + mz, Blocks.vine, 8, 3); + } + + if (random.nextBoolean()) { + world.setBlock(x + mx, y + a + 1, z + mz + 1, Blocks.vine, 4, 3); + } + + if (random.nextBoolean()) { + world.setBlock(x + mx, y + a + 1, z + mz - 1, Blocks.vine, 1, 3); + } + } + + if (a == 3) { + if (random.nextBoolean()) { + world.setBlock( + x + mx + mx / 2 * -1, y + a + 1, z + mz, Blocks.mossy_cobblestone + ); + } + + if (random.nextBoolean()) { + world.setBlock( + x + mx, y + a + 1, z + mz + mz / 2 * -1, Blocks.mossy_cobblestone + ); + } + } + } + } + } +} diff --git a/src/main/resources/assets/thaummach/sounds.json b/src/main/resources/assets/thaummach/sounds.json index 1ae0d93..8ac4b5e 100644 --- a/src/main/resources/assets/thaummach/sounds.json +++ b/src/main/resources/assets/thaummach/sounds.json @@ -75,6 +75,24 @@ } ] }, + "monolith": { + "category": "block", + "sounds": [ + { + "name": "monolith", + "stream": false + } + ] + }, + "rumble": { + "category": "block", + "sounds": [ + { + "name": "rumble", + "stream": false + } + ] + }, "upgrade": { "category": "master", "sounds": [ diff --git a/src/main/resources/assets/thaummach/sounds/monolith.ogg b/src/main/resources/assets/thaummach/sounds/monolith.ogg new file mode 100644 index 0000000..32955e4 Binary files /dev/null and b/src/main/resources/assets/thaummach/sounds/monolith.ogg differ diff --git a/src/main/resources/assets/thaummach/sounds/roots.ogg b/src/main/resources/assets/thaummach/sounds/roots.ogg new file mode 100644 index 0000000..e7e0e48 Binary files /dev/null and b/src/main/resources/assets/thaummach/sounds/roots.ogg differ diff --git a/src/main/resources/assets/thaummach/sounds/rumble.ogg b/src/main/resources/assets/thaummach/sounds/rumble.ogg new file mode 100644 index 0000000..0f0611a Binary files /dev/null and b/src/main/resources/assets/thaummach/sounds/rumble.ogg differ diff --git a/src/main/resources/assets/thaummach/textures/blocks/empty.png b/src/main/resources/assets/thaummach/textures/blocks/empty.png new file mode 100644 index 0000000..07ccff7 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/blocks/empty.png differ diff --git a/src/main/resources/assets/thaummach/textures/blocks/monolith_bottom.png b/src/main/resources/assets/thaummach/textures/blocks/monolith_bottom.png new file mode 100644 index 0000000..88123db Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/blocks/monolith_bottom.png differ diff --git a/src/main/resources/assets/thaummach/textures/blocks/monolith_end.png b/src/main/resources/assets/thaummach/textures/blocks/monolith_end.png new file mode 100644 index 0000000..4a9d525 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/blocks/monolith_end.png differ diff --git a/src/main/resources/assets/thaummach/textures/blocks/monolith_middle.png b/src/main/resources/assets/thaummach/textures/blocks/monolith_middle.png new file mode 100644 index 0000000..4ebfd2a Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/blocks/monolith_middle.png differ diff --git a/src/main/resources/assets/thaummach/textures/blocks/monolith_top.png b/src/main/resources/assets/thaummach/textures/blocks/monolith_top.png new file mode 100644 index 0000000..de00012 Binary files /dev/null and b/src/main/resources/assets/thaummach/textures/blocks/monolith_top.png differ diff --git a/src/main/resources/assets/thaummach/textures/blocks/void_chest_bottom.png b/src/main/resources/assets/thaummach/textures/blocks/void_chest_bottom.png deleted file mode 100644 index 5574d96..0000000 Binary files a/src/main/resources/assets/thaummach/textures/blocks/void_chest_bottom.png and /dev/null differ