From b3bb02526d893f8d657e10ba4d06db7348e380fb Mon Sep 17 00:00:00 2001 From: Bob Date: Thu, 20 Aug 2020 22:32:26 +0200 Subject: [PATCH] repairable shredder blades, timed generator tweaks, more dungeon stuff --- src/main/java/assets/hbm/lang/de_DE.lang | 7 + src/main/java/assets/hbm/lang/en_US.lang | 15 +- .../textures/blocks/brick_jungle_mystic.png | Bin 0 -> 1402 bytes .../hbm/textures/blocks/brick_jungle_ooze.png | Bin 0 -> 1455 bytes .../hbm/blocks/generic/BlockJungleCrate.java | 13 +- src/main/java/com/hbm/items/ModItems.java | 2 +- .../com/hbm/items/block/ItemGlyphBlock.java | 2 - .../java/com/hbm/main/CraftingManager.java | 9 ++ .../machine/TileEntityMachineMiningDrill.java | 12 +- .../hbm/world/generator/DungeonToolbox.java | 36 ----- .../hbm/world/generator/JungleDungeon.java | 19 +++ .../hbm/world/generator/TimedGenerator.java | 27 ++-- .../generator/room/JungleDungeonRoom.java | 135 +++++++++++++----- 13 files changed, 173 insertions(+), 104 deletions(-) create mode 100644 src/main/java/assets/hbm/textures/blocks/brick_jungle_mystic.png create mode 100644 src/main/java/assets/hbm/textures/blocks/brick_jungle_ooze.png diff --git a/src/main/java/assets/hbm/lang/de_DE.lang b/src/main/java/assets/hbm/lang/de_DE.lang index 4dcd51225..5532414d4 100644 --- a/src/main/java/assets/hbm/lang/de_DE.lang +++ b/src/main/java/assets/hbm/lang/de_DE.lang @@ -511,6 +511,7 @@ item.blade_tungsten.name=Wolframverstärktes Turbinenblatt item.blades_advanced_alloy.name=Fortgeschrittenes Sägeblatt item.blades_aluminium.name=Aluminiumsägeblatt item.blades_combine_steel.name=CMB-Sägeblatt +item.blades_desh.name=Desh-Sägeblatt item.blades_gold.name=Goldenes Sägeblatt item.blades_iron.name=Eisensägeblatt item.blades_schrabidium.name=Schrabidiumsägeblatt @@ -2023,6 +2024,11 @@ tile.brick_concrete.name=Betonziegel tile.brick_concrete_broken.name=Gebrochene Betonziegel tile.brick_concrete_cracked.name=Rissige Betonziegel tile.brick_concrete_mossy.name=Bemooste Betonziegel +tile.brick_jungle.name=Enargitziegel +tile.brick_jungle_cracked.name=Rissige Enargitziegel +tile.brick_jungle_glyph.name=Enargit-Glyphenziegel +tile.brick_jungle_lava.name=Magmatische Enargitziegel +tile.brick_jungle_trap.name=Enargit-Falle tile.brick_light.name=Helle Ziegel tile.brick_obsidian.name=Obsidianziegel tile.broadcaster_pc.name=Korrupter Sender @@ -2041,6 +2047,7 @@ tile.crate.name=Vorratskiste tile.crate_ammo.name=Sternenmetallkiste tile.crate_can.name=Konservenkiste tile.crate_iron.name=Eisenkiste +tile.crate_jungle.name=Enargitkiste tile.crate_lead.name=Gefahrenstoffkiste tile.crate_metal.name=Maschinenkiste tile.crate_red.name=Rote Kiste diff --git a/src/main/java/assets/hbm/lang/en_US.lang b/src/main/java/assets/hbm/lang/en_US.lang index 67f942387..9d731c046 100644 --- a/src/main/java/assets/hbm/lang/en_US.lang +++ b/src/main/java/assets/hbm/lang/en_US.lang @@ -511,6 +511,7 @@ item.blade_tungsten.name=Tungsten Reinforced Blade item.blades_advanced_alloy.name=Advanced Shredder Blades item.blades_aluminium.name=Aluminium Shredder Blades item.blades_combine_steel.name=CMB Shredder Blades +item.blades_desh.name=Desh Shredder Blades item.blades_gold.name=Golden Shredder Blades item.blades_iron.name=Iron Shredder Blades item.blades_schrabidium.name=Schrabidium Shredder Blades @@ -2023,6 +2024,11 @@ tile.brick_concrete.name=Concrete Bricks tile.brick_concrete_broken.name=Broken Concrete Bricks tile.brick_concrete_cracked.name=Cracked Concrete Bricks tile.brick_concrete_mossy.name=Mossy Concrete Bricks +tile.brick_jungle.name=Enargite Bricks +tile.brick_jungle_cracked.name=Cracked Enargite Bricks +tile.brick_jungle_glyph.name=Enargite Glyph Bricks +tile.brick_jungle_lava.name=Magmatic Enargite Bricks +tile.brick_jungle_trap.name=Trapped Enargite Bricks tile.brick_light.name=Light Bricks tile.brick_obsidian.name=Obsidian Bricks tile.broadcaster_pc.name=Corrupted Broadcaster @@ -2041,6 +2047,7 @@ tile.crate.name=Supply Crate tile.crate_ammo.name=Starmetal Crate tile.crate_can.name=Conserve Crate tile.crate_iron.name=Iron Crate +tile.crate_jungle.name=Enargite Crate tile.crate_lead.name=Hazmat Crate tile.crate_metal.name=Machine Crate tile.crate_red.name=Red Crate @@ -2198,10 +2205,10 @@ tile.machine_waste_drum.name=Spent Fuel Pool Drum tile.machine_well.name=Oil Derrick tile.marker_structure.name=Multiblock Structure Marker tile.meteor_battery.name=Starmetal Static Electricity Generator -tile.meteor_brick.name=Meteor Brick -tile.meteor_brick_chiseled.name=Chiseled Meteor Brick -tile.meteor_brick_cracked.name=Cracked Meteor Brick -tile.meteor_brick_mossy.name=Mossy Meteor Brick +tile.meteor_brick.name=Meteor Bricks +tile.meteor_brick_chiseled.name=Chiseled Meteor Bricks +tile.meteor_brick_cracked.name=Cracked Meteor Bricks +tile.meteor_brick_mossy.name=Mossy Meteor Bricks tile.meteor_pillar.name=Meteor Pillar tile.meteor_polished.name=Polished Meteor Block tile.meteor_spawner.name=Cyber Crab Assembler diff --git a/src/main/java/assets/hbm/textures/blocks/brick_jungle_mystic.png b/src/main/java/assets/hbm/textures/blocks/brick_jungle_mystic.png new file mode 100644 index 0000000000000000000000000000000000000000..333382ebda81f152ceeed2c90154b703e0c270fd GIT binary patch literal 1402 zcmV-=1%>*FP)`P!$qQ5P1@Xz>AR>cey3R8cV@0v^zVy-96Lp9v@Ci z+3a$Qx=)kYbH17H|NYNz{$kr0bVI`sgb+B6Lnss?m&*~4cTrbYix7fDB0+6!Em~`m z$t1nKdD3aPc@unneUL~bXm9Vr^K!Jc#nD<52>5x~{+sL9ySa5sbLmny?d=I#CTEzC zR)j(pT7%EB0HFD4h2Ib5<9pq5jVk6&Rdlq19R@cBr>i9k!U{VA!HD4UCXLo`?OL9LafxMt1yEHb=<4b#*!*)) zl1anSixMt^{1#?~71?v#`Q`KAi^n0A(gcHWrluS_0>_jjod&HTn}x0}a2(k8i{#Cv zieM0=G({{Spr;2aD*6jWME^DT{owPNC%G;RA8uNiRi?0;z-|UBl`>DdeS5I#;%0># zHP;`XmS_!SWw7v7#pO+!!;a*&m}1vY60v`Joeuxe0Sxwkrly>}KFx%*!VbfM3zGR` z6>bcEZyZipSsC$ooKPr)*fs_|FvhPgODZZLlY#1L!IdkT#lsc#bD*Qu2rGo3rlyA5 zw-X2fz5%i92#g#VGH+u0(AtdbxF>O=@Y~2?1cN~U9LK@$H`@8?>Ocr1&ZKcS$Yelk z&CQ!e#Gyk40PXD#$z+mTPSew)Nu`YNmSy?K=kx5@5g?O+IZdV&VfK;BY3vA8{b^k3 zx=>wh#_RKex#I z_4UxuFodWWL8IgU|9LRAA;Zj3C3vuUvsb`_=1D!+kwPBKX;K`xAUSz`kO$&}7tlRD z5DZ$(o|vYi6-I9}BJSN8V0@}j;9UnLsT2f*=7bjU03aFF96c$?WZ;D8=YfQkb3L-z zLLP{XPogU;p{fdm5KMa_%l=;_m6c`+nT)Y)Wu@7$YJuXDFC|hM5sP?WPl1X{_vV2c zh1Z`ors`+~Un*r5U%hIW0LIP>pHr-yr${7>5Bz?Z(r1Rh_nagc5$wO!&x4828y>jP zLLRKxXdJbDLx2Ido=ZI<58hohNT(Bj-G>KmtTYdHA2Pl_n|uHd>@Y;yO7p;t-J1tK z!vpxPP4c}@(lT0+O6dX~7_S&tc6J(3vsrVXe2$Z6?N$%ZGYjm9S>$z0)HZ)pwj|hfSgPcF7_hZ28dRot1%N9;}=BFz4m%P%OkqA40O#F2m^sR1g5#cK_7 z=Y!Zo@BrY&s?t2L!w@a-vV=)ibE>i5=TOuE9S)+LW^GD~wKTyKhUa>j*f&c&j07*qo IM6N<$g4u|eWB>pF literal 0 HcmV?d00001 diff --git a/src/main/java/assets/hbm/textures/blocks/brick_jungle_ooze.png b/src/main/java/assets/hbm/textures/blocks/brick_jungle_ooze.png new file mode 100644 index 0000000000000000000000000000000000000000..5245f92604feeceee5ce2c6bfac19f2fd0248a75 GIT binary patch literal 1455 zcmV;g1yK5lP)?h2cbgW7g}0N+p~*fiwwl+ zcG>guJ(AuCLW(5mn$$fmOv>*MTLve3qhVfP4euS;@-U^@wiRX)uUXx0fB%UrND5z z0U#SSak-$f5|YUzi7T6lB1xyAScG8E;6!YY+iel{?>3ma+>Q|7_W2;4Ry6JzVZ(Kc zGeihs5=HV+FW3)FLYQ>X!2n@86+C)W#NRG)yFr}Vh0^a=+`3D7^WHwnw*z>+kh*1( zZkFWp;P*o^2}U9Tsg%O+hkgBm5GI|idb3iH&BDwKI1VhlC+Uw{`2G4o07D3vpVv1z zj-rbWs;VHB(whxK&&|!jnl;cx2g4(fi<#_ASh!Ouebe;x;;CC>7EvSs$wrA%;PJrb zsKo$bTALvnm)Pqi;-^FPDspZbSbYD!enCF3xO7907271n13h>2;95K$4~ayAKp=oP zxgAxq(YswzRRx(0)YJ&>-&Z`HhR@LM?Ck>~1huubOi$Yg0Y*uz5GE}x0RYylF;GgO z6l`mQD3T)wYVrI10630=%cZq5>gz!WEl&0MePlAAlwxucTrOy65CFvE4zshf6bg#@ zc||G(RaM}2yA6uPB4>NTWHMS^wo8QGN1>nyVKQE=t8#7*YHAi8G90JK%^2iz+IxVh zDgC=p0DDMRp*>`>W!U12$AjFAfo<#B5Z|<-Vh^+iB`3P*0N{s)FpZ7+iP||L&?@oyvHo>7zcA6VG7 zt^=0~hN5~t-7M*%gN^IaJn)^{3+U5d=E0F0TFldJVM^7y>EOhh@nHY-BAo(#^3^}u1GisvR<=gWhgvsy-+>AjWVJ^=HQ6$kAWd^>S4~|E5dtYmgP#rh1 z*Gr5YJL(ym)P+<#xtI?=?9qq(IR$lf@WEde09OwF$c`P2)c4<`ySx71<%5z7tMcG; zj;)#xUdsc3hv(l}kq05n*Yn_PPne2rk}bp5G9H95SLZ=4W|nynMXs0+4i62oW!R$P zvB` ret = new ArrayList(); - ret.add(new ItemStack(ModItems.cap_nuka, 12 + rand.nextInt(21))); - ret.add(new ItemStack(ModItems.syringe_metal_stimpak, 1 + rand.nextInt(3))); + ret.add(new ItemStack(Items.gold_ingot, 4 + rand.nextInt(4))); + ret.add(new ItemStack(Items.gold_nugget, 8 + rand.nextInt(10))); + ret.add(new ItemStack(ModItems.powder_gold, 2 + rand.nextInt(3))); + ret.add(new ItemStack(ModItems.wire_gold, 2 + rand.nextInt(2))); + + if(rand.nextInt(2) == 0) + ret.add(new ItemStack(ModItems.plate_gold, 1 + rand.nextInt(2))); + + if(rand.nextInt(3) == 0) + ret.add(new ItemStack(ModItems.crystal_gold)); return ret; } diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index f82217616..4b0cb3d9c 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -2444,7 +2444,7 @@ public class ModItems { blades_advanced_alloy = new ItemBlades(85).setUnlocalizedName("blades_advanced_alloy").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":blades_advanced_alloy"); blades_combine_steel = new ItemBlades(150).setUnlocalizedName("blades_combine_steel").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":blades_combine_steel"); blades_schrabidium = new ItemBlades(250).setUnlocalizedName("blades_schrabidium").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":blades_schrabidium"); - blades_desh = new ItemBlades(250).setUnlocalizedName("blades_desh").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":blades_desh"); + blades_desh = new ItemBlades(0).setUnlocalizedName("blades_desh").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":blades_desh"); part_lithium = new Item().setUnlocalizedName("part_lithium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":part_lithium"); part_beryllium = new Item().setUnlocalizedName("part_beryllium").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":part_beryllium"); diff --git a/src/main/java/com/hbm/items/block/ItemGlyphBlock.java b/src/main/java/com/hbm/items/block/ItemGlyphBlock.java index 9aac47956..20fd5c4d1 100644 --- a/src/main/java/com/hbm/items/block/ItemGlyphBlock.java +++ b/src/main/java/com/hbm/items/block/ItemGlyphBlock.java @@ -2,8 +2,6 @@ package com.hbm.items.block; import java.util.List; -import com.hbm.blocks.generic.RedBarrel; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 71aae5287..d492896d3 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -639,6 +639,15 @@ public class CraftingManager { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_advanced_alloy, 1), new Object[] { " P ", "PIP", " P ", 'P', "plateAdvanced", 'I', "ingotAdvanced" })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_combine_steel, 1), new Object[] { " P ", "PIP", " P ", 'P', "plateCMBSteel", 'I', "ingotCMBSteel" })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_schrabidium, 1), new Object[] { " P ", "PIP", " P ", 'P', "plateSchrabidium", 'I', "ingotSchrabidium" })); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_aluminium, 1), new Object[] { "PIP", 'P', "plateAluminum", 'I', new ItemStack(ModItems.blades_aluminium, 1, OreDictionary.WILDCARD_VALUE) })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_gold, 1), new Object[] { "PIP", 'P', "plateGold", 'I', new ItemStack(ModItems.blades_gold, 1, OreDictionary.WILDCARD_VALUE) })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_iron, 1), new Object[] { "PIP", 'P', "plateIron", 'I', new ItemStack(ModItems.blades_iron, 1, OreDictionary.WILDCARD_VALUE) })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_steel, 1), new Object[] { "PIP", 'P', "plateSteel", 'I', new ItemStack(ModItems.blades_steel, 1, OreDictionary.WILDCARD_VALUE) })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_titanium, 1), new Object[] { "PIP", 'P', "plateTitanium", 'I', new ItemStack(ModItems.blades_titanium, 1, OreDictionary.WILDCARD_VALUE) })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_advanced_alloy, 1), new Object[] { "PIP", 'P', "plateAdvanced", 'I', new ItemStack(ModItems.blades_advanced_alloy, 1, OreDictionary.WILDCARD_VALUE) })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_combine_steel, 1), new Object[] { "PIP", 'P', "plateCMBSteel", 'I', new ItemStack(ModItems.blades_combine_steel, 1, OreDictionary.WILDCARD_VALUE) })); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.blades_schrabidium, 1), new Object[] { "PIP", 'P', "plateSchrabidium", 'I', new ItemStack(ModItems.blades_schrabidium, 1, OreDictionary.WILDCARD_VALUE) })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.stamp_stone_flat, 1), new Object[] { " R ", "III", "SSS", 'R', "dustRedstone", 'I', "ingotBrick", 'S', "stone" })); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.stamp_iron_flat, 1), new Object[] { " R ", "III", "SSS", 'R', "dustRedstone", 'I', "ingotBrick", 'S', "ingotIron" })); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningDrill.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningDrill.java index c2fe62e01..c0a60a5d8 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningDrill.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningDrill.java @@ -4,7 +4,6 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.interfaces.IConsumer; -import com.hbm.interfaces.Untested; import com.hbm.items.ModItems; import com.hbm.lib.Library; import com.hbm.packet.AuxElectricityPacket; @@ -19,13 +18,10 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityHopper; @@ -52,8 +48,6 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen private static final int[] slots_side = new int[] {0}; Random rand = new Random(); - private String customName; - public TileEntityMachineMiningDrill() { super(13); } @@ -99,7 +93,6 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen return (power * i) / maxPower; } - @Untested @Override public void updateEntity() { @@ -404,8 +397,9 @@ public class TileEntityMachineMiningDrill extends TileEntityMachineBase implemen for(int ix = x - rad; ix <= x + rad; ix++) { for(int iz = z - rad; iz <= z + rad; iz++) { - if(tryDrill(ix, y, iz)) - return true; + if(ix != x || iz != z) + if(tryDrill(ix, y, iz)) + return true; } } diff --git a/src/main/java/com/hbm/world/generator/DungeonToolbox.java b/src/main/java/com/hbm/world/generator/DungeonToolbox.java index 0cb035189..1c5094542 100644 --- a/src/main/java/com/hbm/world/generator/DungeonToolbox.java +++ b/src/main/java/com/hbm/world/generator/DungeonToolbox.java @@ -11,24 +11,6 @@ import net.minecraft.world.World; public class DungeonToolbox { - public static void generateBoxTimed(World world, int x, int y, int z, int sx, int sy, int sz, List blocks) { - - if(blocks.isEmpty()) - return; - - for(int i = x; i < x + sx; i++) { - - for(int j = y; j < y + sy; j++) { - - for(int k = z; k < z + sz; k++) { - - MetaBlock b = getRandom(blocks, world.rand); - TimedGenerator.addOp(world, i, j, k, b.block, b.meta, 2); - } - } - } - } - public static void generateBox(World world, int x, int y, int z, int sx, int sy, int sz, List blocks) { if(blocks.isEmpty()) @@ -65,24 +47,6 @@ public class DungeonToolbox { } } } - - public static void generateBoxTimed(World world, int x, int y, int z, int sx, int sy, int sz, Block block) { - generateBoxTimed(world, x, y, z, sx, sy, sz, new MetaBlock(block)); - } - - public static void generateBoxTimed(World world, int x, int y, int z, int sx, int sy, int sz, MetaBlock block) { - - for(int i = x; i < x + sx; i++) { - - for(int j = y; j < y + sy; j++) { - - for(int k = z; k < z + sz; k++) { - - TimedGenerator.addOp(world, i, j, k, block.block, block.meta, 2); - } - } - } - } //now with vectors to provide handy rotations public static void generateBox(World world, int x, int y, int z, Vec3 size, List blocks) { diff --git a/src/main/java/com/hbm/world/generator/JungleDungeon.java b/src/main/java/com/hbm/world/generator/JungleDungeon.java index d3c8694d6..029def790 100644 --- a/src/main/java/com/hbm/world/generator/JungleDungeon.java +++ b/src/main/java/com/hbm/world/generator/JungleDungeon.java @@ -1,9 +1,16 @@ package com.hbm.world.generator; +import java.util.Random; + import com.hbm.blocks.ModBlocks; import com.hbm.inventory.RecipesCommon.MetaBlock; +import com.hbm.world.generator.TimedGenerator.ITimedJob; + +import net.minecraft.world.World; public class JungleDungeon extends CellularDungeon { + + public boolean hasHole = false; public JungleDungeon(int width, int height, int dimX, int dimZ, int tries, int branches) { super(width, height, dimX, dimZ, tries, branches); @@ -22,5 +29,17 @@ public class JungleDungeon extends CellularDungeon { this.ceiling.add(new MetaBlock(ModBlocks.brick_jungle)); this.ceiling.add(new MetaBlock(ModBlocks.brick_jungle_cracked)); } + + public void generate(World world, int x, int y, int z, Random rand) { + super.generate(world, x, y, z, rand); + + TimedGenerator.addOp(world, new ITimedJob() { + @Override + public void work() { JungleDungeon.this.hasHole = false; } + } ); + + //since all the building is timed jobs, this has to be as well. timed jobs are ordered so this works! + //is it shitty coding? is it not? who knows? + } } diff --git a/src/main/java/com/hbm/world/generator/TimedGenerator.java b/src/main/java/com/hbm/world/generator/TimedGenerator.java index 9c5509614..1ff879682 100644 --- a/src/main/java/com/hbm/world/generator/TimedGenerator.java +++ b/src/main/java/com/hbm/world/generator/TimedGenerator.java @@ -3,46 +3,49 @@ package com.hbm.world.generator; import java.util.ArrayList; import java.util.HashMap; -import net.minecraft.block.Block; import net.minecraft.world.World; public class TimedGenerator { - //TODO: replace with timed operations, allows not only for direct block placements but also snazzy conditioned stuff - private static final HashMap> operations = new HashMap(); + private static final HashMap> operations = new HashMap(); public static void automaton(World world, int amount) { - ArrayList list = operations.get(world.provider.dimensionId); + ArrayList list = operations.get(world.provider.dimensionId); if(list == null) return; long start = System.currentTimeMillis(); - while(start + 15 > System.currentTimeMillis()) { + while(start + 10 > System.currentTimeMillis()) { if(list.isEmpty()) return; - Object[] entry = list.get(0); + ITimedJob entry = list.get(0); list.remove(0); - world.setBlock((Integer)entry[0], (Integer)entry[1], (Integer)entry[2], (Block)entry[3], (Integer)entry[4], (Integer)entry[5]); - - //amount --; + entry.work(); } } - public static void addOp(World world, int x, int y, int z, Block b, int meta, int flags) { + public static void addOp(World world, ITimedJob job) { - ArrayList list = operations.get(world.provider.dimensionId); + ArrayList list = operations.get(world.provider.dimensionId); if(list == null) { list = new ArrayList(); operations.put(world.provider.dimensionId, list); } - list.add(new Object[] {x, y, z, b, meta, flags}); + list.add(job); + } + + //should i be doing this? probably not, but watch me go + public interface ITimedJob { + + public void work(); + } } diff --git a/src/main/java/com/hbm/world/generator/room/JungleDungeonRoom.java b/src/main/java/com/hbm/world/generator/room/JungleDungeonRoom.java index 97e90d151..92a9c35d6 100644 --- a/src/main/java/com/hbm/world/generator/room/JungleDungeonRoom.java +++ b/src/main/java/com/hbm/world/generator/room/JungleDungeonRoom.java @@ -1,13 +1,18 @@ package com.hbm.world.generator.room; import java.util.ArrayList; +import java.util.List; import com.hbm.blocks.ModBlocks; +import com.hbm.inventory.RecipesCommon.MetaBlock; import com.hbm.world.generator.CellularDungeon; import com.hbm.world.generator.CellularDungeonRoom; import com.hbm.world.generator.DungeonToolbox; +import com.hbm.world.generator.JungleDungeon; import com.hbm.world.generator.TimedGenerator; +import com.hbm.world.generator.TimedGenerator.ITimedJob; +import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -18,50 +23,104 @@ public class JungleDungeonRoom extends CellularDungeonRoom { super(parent); } - public void generateMain(World world, int x, int y, int z) { + public void generateMain(final World world, final int x, final int y, final int z) { - DungeonToolbox.generateBoxTimed(world, x, y, z, parent.width, 1, parent.width, parent.floor); - DungeonToolbox.generateBoxTimed(world, x, y + 1, z, parent.width, parent.height - 1, parent.width, Blocks.air); - DungeonToolbox.generateBoxTimed(world, x, y + parent.height - 1, z, parent.width, 1, parent.width, parent.ceiling); + if(!(this.parent instanceof JungleDungeon)) + return; //just to be safe - int rtd = world.rand.nextInt(10); + ITimedJob job = new ITimedJob() { + + @Override + public void work() { + + DungeonToolbox.generateBox(world, x, y, z, parent.width, 1, parent.width, parent.floor); + DungeonToolbox.generateBox(world, x, y + 1, z, parent.width, parent.height - 1, parent.width, Blocks.air); + DungeonToolbox.generateBox(world, x, y + parent.height - 1, z, parent.width, 1, parent.width, parent.ceiling); + + int rtd = world.rand.nextInt(50); + + // 1:10 chance to have a lava floor + if(rtd < 5) { + List metas = new ArrayList() {{ + add(new MetaBlock(ModBlocks.brick_jungle_cracked)); + add(new MetaBlock(ModBlocks.brick_jungle_lava)); + add(new MetaBlock(ModBlocks.brick_jungle_lava)); + }}; + + DungeonToolbox.generateBox(world, x + parent.width / 2 - 1, y, z + parent.width / 2 - 1, 3, 1, 3, metas ); + + // 1:5 chance to have a jungle crate + } else if(rtd < 10) { + world.setBlock(x + 1 + world.rand.nextInt(parent.width - 1), y + 1, z + world.rand.nextInt(parent.width - 1), ModBlocks.crate_jungle, 0, 2); + + // 1:5 chance to try for making a hole + } else if(rtd < 20) { + + if(!((JungleDungeon)JungleDungeonRoom.this.parent).hasHole) { + + boolean punched = false; + + for(int a = 0; a < 3; a++) { + for(int b = 0; b < 3; b++) { + + Block bl = world.getBlock(x + 1 + a, y - 4, z + 1 + b); + + if(world.getBlock(x + 1 + a, y - 1, z + 1 + b) == Blocks.air) { + if(bl == ModBlocks.brick_jungle || bl == ModBlocks.brick_jungle_cracked || bl == ModBlocks.brick_jungle_lava || bl == ModBlocks.brick_jungle_trap) { + world.setBlockToAir(x + 1 + a, y, z + 1 + b); + punched = true; + } + } + } + } + + if(punched) + ((JungleDungeon)JungleDungeonRoom.this.parent).hasHole = true; + } + } + } + }; - if(rtd == 0) { - DungeonToolbox.generateBoxTimed(world, x + parent.width / 2 - 1, y, z + parent.width / 2 - 1, 3, 1, 3, new ArrayList() {{ add(ModBlocks.brick_jungle_cracked); add(ModBlocks.brick_jungle_lava); }}); - - } else if(rtd == 1) { - TimedGenerator.addOp(world, x + 1 + world.rand.nextInt(parent.width - 1), y + 1, z + world.rand.nextInt(parent.width - 1), ModBlocks.crate_jungle, 0, 2); - } + TimedGenerator.addOp(world, job); } - public void generateWall(World world, int x, int y, int z, ForgeDirection wall, boolean door) { + public void generateWall(final World world, final int x, final int y, final int z, final ForgeDirection wall, final boolean door) { - if(wall == ForgeDirection.NORTH) { - DungeonToolbox.generateBoxTimed(world, x, y + 1, z, parent.width, parent.height - 2, 1, parent.wall); - - if(door) - DungeonToolbox.generateBoxTimed(world, x + parent.width / 2 - 1, y + 1, z, 3, 3, 1, Blocks.air); - } + ITimedJob job = new ITimedJob() { + + @Override + public void work() { + + if(wall == ForgeDirection.NORTH) { + DungeonToolbox.generateBox(world, x, y + 1, z, parent.width, parent.height - 2, 1, parent.wall); + + if(door) + DungeonToolbox.generateBox(world, x + parent.width / 2 - 1, y + 1, z, 3, 3, 1, Blocks.air); + } + + if(wall == ForgeDirection.SOUTH) { + DungeonToolbox.generateBox(world, x, y + 1, z + parent.width - 1, parent.width, parent.height - 2, 1, parent.wall); + + if(door) + DungeonToolbox.generateBox(world, x + parent.width / 2 - 1, y + 1, z + parent.width - 1, 3, 3, 1, Blocks.air); + } + + if(wall == ForgeDirection.WEST) { + DungeonToolbox.generateBox(world, x, y + 1, z, 1, parent.height - 2, parent.width, parent.wall); + + if(door) + DungeonToolbox.generateBox(world, x, y + 1, z + parent.width / 2 - 1, 1, 3, 3, Blocks.air); + } + + if(wall == ForgeDirection.EAST) { + DungeonToolbox.generateBox(world, x + parent.width - 1, y + 1, z, 1, parent.height - 2, parent.width, parent.wall); + + if(door) + DungeonToolbox.generateBox(world, x + parent.width - 1, y + 1, z + parent.width / 2 - 1, 1, 3, 3, Blocks.air); + } + } + }; - if(wall == ForgeDirection.SOUTH) { - DungeonToolbox.generateBoxTimed(world, x, y + 1, z + parent.width - 1, parent.width, parent.height - 2, 1, parent.wall); - - if(door) - DungeonToolbox.generateBoxTimed(world, x + parent.width / 2 - 1, y + 1, z + parent.width - 1, 3, 3, 1, Blocks.air); - } - - if(wall == ForgeDirection.WEST) { - DungeonToolbox.generateBoxTimed(world, x, y + 1, z, 1, parent.height - 2, parent.width, parent.wall); - - if(door) - DungeonToolbox.generateBoxTimed(world, x, y + 1, z + parent.width / 2 - 1, 1, 3, 3, Blocks.air); - } - - if(wall == ForgeDirection.EAST) { - DungeonToolbox.generateBoxTimed(world, x + parent.width - 1, y + 1, z, 1, parent.height - 2, parent.width, parent.wall); - - if(door) - DungeonToolbox.generateBoxTimed(world, x + parent.width - 1, y + 1, z + parent.width / 2 - 1, 1, 3, 3, Blocks.air); - } + TimedGenerator.addOp(world, job); } }