From 1fa4dca8703380c0865a5b9d9d723e999b4b5cf3 Mon Sep 17 00:00:00 2001 From: Lazzzycatwastaken Date: Sun, 20 Apr 2025 14:48:05 +0200 Subject: [PATCH 1/3] Joe: YEAH, ARE YOU READY TEAM JOE? Joe: We're gonna become the BEST detectives! Quagmire: Giggity, let's do this! Peter: All Right! --- .../java/com/hbm/main/ModEventHandler.java | 228 ++++++++++++++---- 1 file changed, 180 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index 75180df27..0cc6d8dd7 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -53,6 +53,7 @@ import com.hbm.uninos.UniNodespace; import com.hbm.util.*; import com.hbm.util.ArmorRegistry.HazardClass; import com.hbm.world.generator.TimedGenerator; +import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; @@ -351,55 +352,186 @@ public class ModEventHandler { EntityLivingBase entity = event.entityLiving; World world = event.world; - if(!MobConfig.enableMobGear || entity.isChild() || world.isRemote) + if (!MobConfig.enableMobGear || entity.isChild() || world.isRemote) { return; - - if(entity instanceof EntityZombie) { - if(rand.nextInt(64) == 0) { - ItemStack mask = new ItemStack(ModItems.gas_mask_m65); - ArmorUtil.installGasMaskFilter(mask, new ItemStack(ModItems.gas_mask_filter)); - entity.setCurrentItemOrArmor(4, mask); - } - if(rand.nextInt(128) == 0) { - ItemStack mask = new ItemStack(ModItems.gas_mask_olde); - ArmorUtil.installGasMaskFilter(mask, new ItemStack(ModItems.gas_mask_filter)); - entity.setCurrentItemOrArmor(4, mask); - } - if(rand.nextInt(256) == 0) - entity.setCurrentItemOrArmor(4, new ItemStack(ModItems.mask_of_infamy, 1, world.rand.nextInt(100))); - if(rand.nextInt(1024) == 0) - entity.setCurrentItemOrArmor(3, new ItemStack(ModItems.starmetal_plate, 1, world.rand.nextInt(ModItems.starmetal_plate.getMaxDamage()))); - - if(rand.nextInt(64) == 0) - entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.pipe_lead, 1, world.rand.nextInt(100))); - if(rand.nextInt(128) == 0) - entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.reer_graar, 1, world.rand.nextInt(100))); - if(rand.nextInt(128) == 0) - entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.crowbar, 1, world.rand.nextInt(100))); - if(rand.nextInt(128) == 0) - entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.geiger_counter, 1)); - if(rand.nextInt(128) == 0) - entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.steel_pickaxe, 1, world.rand.nextInt(300))); - if(rand.nextInt(512) == 0) - entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.stopsign)); - if(rand.nextInt(512) == 0) - entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.sopsign)); - if(rand.nextInt(512) == 0) - entity.setCurrentItemOrArmor(0, new ItemStack(ModItems.chernobylsign)); } - if(entity instanceof EntitySkeleton) { - if(rand.nextInt(16) == 0) { - ItemStack mask = new ItemStack(ModItems.gas_mask_m65); - ArmorUtil.installGasMaskFilter(mask, new ItemStack(ModItems.gas_mask_filter)); - entity.setCurrentItemOrArmor(4, mask); - } - if(rand.nextInt(64) == 0) - entity.setCurrentItemOrArmor(3, new ItemStack(ModItems.steel_plate, 1, world.rand.nextInt(ModItems.steel_plate.getMaxDamage()))); - float soot = PollutionHandler.getPollution(entity.worldObj, MathHelper.floor_double(event.x), MathHelper.floor_double(event.y), MathHelper.floor_double(event.z), PollutionType.SOOT); - ItemStack bowReplacement = getSkelegun(soot, entity.worldObj.rand); - if(bowReplacement != null) { - entity.setCurrentItemOrArmor(0, bowReplacement); + Map> slotPools = new HashMap<>(); + + + if (entity instanceof EntityZombie) { + //bleh i dont like how this is done but whatever + if (world.rand.nextFloat() < 0.005F) { // full hazmat zombine + entity.setCurrentItemOrArmor(4, new ItemStack(ModItems.hazmat_helmet)); + entity.setCurrentItemOrArmor(3, new ItemStack(ModItems.hazmat_plate)); + entity.setCurrentItemOrArmor(2, new ItemStack(ModItems.hazmat_legs)); + entity.setCurrentItemOrArmor(1, new ItemStack(ModItems.hazmat_boots)); + return; + } + + if (world.rand.nextFloat() < 0.005F) { // full security zombine + entity.setCurrentItemOrArmor(4, new ItemStack(ModItems.security_helmet)); + entity.setCurrentItemOrArmor(3, new ItemStack(ModItems.security_plate)); + entity.setCurrentItemOrArmor(2, new ItemStack(ModItems.security_legs)); + entity.setCurrentItemOrArmor(1, new ItemStack(ModItems.security_boots)); + return; + } + + //helms + ArrayList helmetPool = new ArrayList<>(); + helmetPool.add(new WeightedRandomObject(null, 8000)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_m65), 16)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_olde), 12)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.mask_of_infamy), 8)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_mono), 8)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_helmet), 32)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.no9), 16)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_helmet), 2)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.rag_piss), 1)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.hat), 1)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_helmet), 2)); + + slotPools.put(4, helmetPool); + //chest + + ArrayList chestPool = new ArrayList<>(); + chestPool.add(new WeightedRandomObject(null, 7000)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.starmetal_plate), 1)); //lol + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_plate), 2)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_plate), 32)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.jackt), 32)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.jackt2), 32)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_plate), 2)); + + + slotPools.put(3, chestPool); + //legs + + ArrayList LegsPool = new ArrayList<>(); + LegsPool.add(new WeightedRandomObject(null, 7000)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.zirconium_legs), 1)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_legs), 2)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_legs), 16)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.titanium_legs), 8)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_legs), 32)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_legs), 2)); + slotPools.put(2, LegsPool); + //boots + + ArrayList BootPool = new ArrayList<>(); + BootPool.add(new WeightedRandomObject(null, 7000)); + BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_boots), 32)); + BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_boots), 16)); + BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_boots), 2)); + BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_boots), 2)); + slotPools.put(1, BootPool); + + //weapons + ArrayList handPool = new ArrayList<>(); + handPool.add(new WeightedRandomObject(null, 10000)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.pipe_lead), 30)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.crowbar), 25)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.geiger_counter), 20)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.reer_graar), 16)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_pickaxe), 12)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.stopsign), 10)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.sopsign), 8)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.chernobylsign), 6)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_sword), 15)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_axe), 5)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.titanium_sword), 8)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.lead_gavel), 4)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.wrench), 20)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_decorated_sword), 2)); + handPool.add(new WeightedRandomObject(new ItemStack(ModItems.detonator_de), 1)); // me when + slotPools.put(0, handPool); + } + else if (entity instanceof EntitySkeleton) { + float soot = PollutionHandler.getPollution(entity.worldObj, + MathHelper.floor_double(event.x), MathHelper.floor_double(event.y), MathHelper.floor_double(event.z), PollutionType.SOOT); + + //helms + ArrayList helmetPool = new ArrayList<>(); + helmetPool.add(new WeightedRandomObject(null, 12000)); //why more then zombies? because it would be annoying asf otherwise + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_m65), 16)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_olde), 12)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.mask_of_infamy), 8)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_mono), 8)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_helmet), 32)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.no9), 16)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_helmet), 2)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.rag_piss), 1)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.hat), 1)); + helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_helmet), 2)); + + slotPools.put(4, helmetPool); + //chest + + ArrayList chestPool = new ArrayList<>(); + chestPool.add(new WeightedRandomObject(null, 10000)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.starmetal_plate), 1)); //lol + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_plate), 2)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_plate), 32)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.jackt), 32)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.jackt2), 32)); + chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_plate), 2)); + + slotPools.put(3, chestPool); + //legs + + ArrayList LegsPool = new ArrayList<>(); + LegsPool.add(new WeightedRandomObject(null, 10000)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.zirconium_legs), 1)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_legs), 2)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_legs), 16)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.titanium_legs), 8)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_legs), 32)); + LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_legs), 2)); + slotPools.put(2, LegsPool); + //boots + + ArrayList BootPool = new ArrayList<>(); + BootPool.add(new WeightedRandomObject(null, 10000)); + BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_boots), 32)); + BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_boots), 16)); + BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_boots), 2)); + BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_boots), 2)); + slotPools.put(1, BootPool); + + ItemStack bowReplacement = getSkelegun(soot, world.rand); + ArrayList handPool = new ArrayList<>(); + handPool.add(new WeightedRandomObject(null, 100)); //should work ig + if (bowReplacement != null) { + handPool.add(new WeightedRandomObject(bowReplacement, 1)); + } + slotPools.put(0, handPool); + } + + for (Map.Entry> e : slotPools.entrySet()) { + int slot = e.getKey(); + List pool = e.getValue(); + + WeightedRandomObject choice = (WeightedRandomObject) WeightedRandom.getRandomItem(rand, pool); + if (choice == null) { + continue; + } + + ItemStack stack = choice.asStack(); + if (stack == null || stack.getItem() == null) { + // If the selected item is null skip item assignment + continue; + } + + if (stack.getItem() == ModItems.gas_mask_m65 || //please do it like this when adding more so i can actually see it not go off the screen + stack.getItem() == ModItems.gas_mask_olde || + stack.getItem() == ModItems.gas_mask_mono) { + ArmorUtil.installGasMaskFilter(stack, new ItemStack(ModItems.gas_mask_filter)); + } + + entity.setCurrentItemOrArmor(slot, stack); + + // If skeleton got a gun, add AI + if (slot == 0 && entity instanceof EntitySkeleton && pool == slotPools.get(0)) { addFireTask((EntityLiving) entity); } } @@ -1235,9 +1367,9 @@ public class ModEventHandler { @SubscribeEvent public void onChunkLoad(ChunkEvent.Load event) { - + //test for automatic in-world block replacement - + /*for(int x = 0; x < 16; x++) for(int y = 0; y < 255; y++) for(int z = 0; z < 16; z++) { if(event.getChunk().getBlock(x, y, z) instanceof MachineArcFurnace) { event.getChunk().func_150807_a(x, y, z, Blocks.air, 0); From 0907997bec44711a6b9dee2dc42238b5bc1ba066 Mon Sep 17 00:00:00 2001 From: Lazzzycatwastaken Date: Sun, 20 Apr 2025 15:46:36 +0200 Subject: [PATCH 2/3] 1.1k elo boosted twisted - puppet mage gets mled to death by my 112 yo 430 hp deto katana. --- .../java/com/hbm/main/ModEventHandler.java | 218 ++++++------------ 1 file changed, 75 insertions(+), 143 deletions(-) diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index 0cc6d8dd7..c5ea27488 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -358,179 +358,111 @@ public class ModEventHandler { Map> slotPools = new HashMap<>(); - if (entity instanceof EntityZombie) { - //bleh i dont like how this is done but whatever if (world.rand.nextFloat() < 0.005F) { // full hazmat zombine - entity.setCurrentItemOrArmor(4, new ItemStack(ModItems.hazmat_helmet)); - entity.setCurrentItemOrArmor(3, new ItemStack(ModItems.hazmat_plate)); - entity.setCurrentItemOrArmor(2, new ItemStack(ModItems.hazmat_legs)); - entity.setCurrentItemOrArmor(1, new ItemStack(ModItems.hazmat_boots)); + equipFullSet(entity, ModItems.hazmat_helmet, ModItems.hazmat_plate, ModItems.hazmat_legs, ModItems.hazmat_boots); return; } if (world.rand.nextFloat() < 0.005F) { // full security zombine - entity.setCurrentItemOrArmor(4, new ItemStack(ModItems.security_helmet)); - entity.setCurrentItemOrArmor(3, new ItemStack(ModItems.security_plate)); - entity.setCurrentItemOrArmor(2, new ItemStack(ModItems.security_legs)); - entity.setCurrentItemOrArmor(1, new ItemStack(ModItems.security_boots)); + equipFullSet(entity, ModItems.security_helmet, ModItems.security_plate, ModItems.security_legs, ModItems.security_boots); return; } - //helms - ArrayList helmetPool = new ArrayList<>(); - helmetPool.add(new WeightedRandomObject(null, 8000)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_m65), 16)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_olde), 12)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.mask_of_infamy), 8)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_mono), 8)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_helmet), 32)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.no9), 16)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_helmet), 2)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.rag_piss), 1)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.hat), 1)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_helmet), 2)); - - slotPools.put(4, helmetPool); - //chest - - ArrayList chestPool = new ArrayList<>(); - chestPool.add(new WeightedRandomObject(null, 7000)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.starmetal_plate), 1)); //lol - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_plate), 2)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_plate), 32)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.jackt), 32)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.jackt2), 32)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_plate), 2)); - - - slotPools.put(3, chestPool); - //legs - - ArrayList LegsPool = new ArrayList<>(); - LegsPool.add(new WeightedRandomObject(null, 7000)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.zirconium_legs), 1)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_legs), 2)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_legs), 16)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.titanium_legs), 8)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_legs), 32)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_legs), 2)); - slotPools.put(2, LegsPool); - //boots - - ArrayList BootPool = new ArrayList<>(); - BootPool.add(new WeightedRandomObject(null, 7000)); - BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_boots), 32)); - BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_boots), 16)); - BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_boots), 2)); - BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_boots), 2)); - slotPools.put(1, BootPool); - - //weapons - ArrayList handPool = new ArrayList<>(); - handPool.add(new WeightedRandomObject(null, 10000)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.pipe_lead), 30)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.crowbar), 25)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.geiger_counter), 20)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.reer_graar), 16)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_pickaxe), 12)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.stopsign), 10)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.sopsign), 8)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.chernobylsign), 6)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_sword), 15)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_axe), 5)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.titanium_sword), 8)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.lead_gavel), 4)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.wrench), 20)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_decorated_sword), 2)); - handPool.add(new WeightedRandomObject(new ItemStack(ModItems.detonator_de), 1)); // me when - slotPools.put(0, handPool); - } - else if (entity instanceof EntitySkeleton) { + slotPools.put(4, createSlotPool(8000, new Object[][]{ //new slots, smooth, brushed, no wrinkles // old slots, wrinkled, rusty, not smooth + {ModItems.gas_mask_m65, 16}, {ModItems.gas_mask_olde, 12}, {ModItems.mask_of_infamy, 8}, + {ModItems.gas_mask_mono, 8}, {ModItems.robes_helmet, 32}, {ModItems.no9, 16}, + {ModItems.cobalt_helmet, 2}, {ModItems.rag_piss, 1}, {ModItems.hat, 1}, {ModItems.alloy_helmet, 2}, + {ModItems.titanium_helmet, 4}, {ModItems.steel_helmet, 8} + })); + slotPools.put(3, createSlotPool(7000, new Object[][]{ + {ModItems.starmetal_plate, 1}, {ModItems.cobalt_plate, 2}, {ModItems.robes_plate, 32}, + {ModItems.jackt, 32}, {ModItems.jackt2, 32}, {ModItems.alloy_plate, 2}, + {ModItems.steel_plate, 2} + })); + slotPools.put(2, createSlotPool(7000, new Object[][]{ + {ModItems.zirconium_legs, 1}, {ModItems.cobalt_legs, 2}, {ModItems.steel_legs, 16}, + {ModItems.titanium_legs, 8}, {ModItems.robes_legs, 32}, {ModItems.alloy_legs, 2} + })); + slotPools.put(1, createSlotPool(7000, new Object[][]{ + {ModItems.robes_boots, 32}, {ModItems.steel_boots, 16}, {ModItems.cobalt_boots, 2}, {ModItems.alloy_boots, 2} + })); + slotPools.put(0, createSlotPool(10000, new Object[][]{ + {ModItems.pipe_lead, 30}, {ModItems.crowbar, 25}, {ModItems.geiger_counter, 20}, + {ModItems.reer_graar, 16}, {ModItems.steel_pickaxe, 12}, {ModItems.stopsign, 10}, + {ModItems.sopsign, 8}, {ModItems.chernobylsign, 6}, {ModItems.steel_sword, 15}, + {ModItems.alloy_axe, 5}, {ModItems.titanium_sword, 8}, {ModItems.lead_gavel, 4}, + {ModItems.wrench, 20}, {ModItems.cobalt_decorated_sword, 2}, {ModItems.detonator_de, 1} + })); + } else if (entity instanceof EntitySkeleton) { float soot = PollutionHandler.getPollution(entity.worldObj, - MathHelper.floor_double(event.x), MathHelper.floor_double(event.y), MathHelper.floor_double(event.z), PollutionType.SOOT); + MathHelper.floor_double(event.x), MathHelper.floor_double(event.y), MathHelper.floor_double(event.z), PollutionType.SOOT); //uhfgfg - //helms - ArrayList helmetPool = new ArrayList<>(); - helmetPool.add(new WeightedRandomObject(null, 12000)); //why more then zombies? because it would be annoying asf otherwise - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_m65), 16)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_olde), 12)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.mask_of_infamy), 8)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.gas_mask_mono), 8)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_helmet), 32)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.no9), 16)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_helmet), 2)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.rag_piss), 1)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.hat), 1)); - helmetPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_helmet), 2)); - - slotPools.put(4, helmetPool); - //chest - - ArrayList chestPool = new ArrayList<>(); - chestPool.add(new WeightedRandomObject(null, 10000)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.starmetal_plate), 1)); //lol - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_plate), 2)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_plate), 32)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.jackt), 32)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.jackt2), 32)); - chestPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_plate), 2)); - - slotPools.put(3, chestPool); - //legs - - ArrayList LegsPool = new ArrayList<>(); - LegsPool.add(new WeightedRandomObject(null, 10000)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.zirconium_legs), 1)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_legs), 2)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_legs), 16)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.titanium_legs), 8)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_legs), 32)); - LegsPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_legs), 2)); - slotPools.put(2, LegsPool); - //boots - - ArrayList BootPool = new ArrayList<>(); - BootPool.add(new WeightedRandomObject(null, 10000)); - BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.robes_boots), 32)); - BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.steel_boots), 16)); - BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.cobalt_boots), 2)); - BootPool.add(new WeightedRandomObject(new ItemStack(ModItems.alloy_boots), 2)); - slotPools.put(1, BootPool); + slotPools.put(4, createSlotPool(12000, new Object[][]{ + {ModItems.gas_mask_m65, 16}, {ModItems.gas_mask_olde, 12}, {ModItems.mask_of_infamy, 8}, + {ModItems.gas_mask_mono, 8}, {ModItems.robes_helmet, 32}, {ModItems.no9, 16}, + {ModItems.cobalt_helmet, 2}, {ModItems.rag_piss, 1}, {ModItems.hat, 1}, {ModItems.alloy_helmet, 2}, + {ModItems.titanium_helmet, 4}, {ModItems.steel_helmet, 8} + })); + slotPools.put(3, createSlotPool(10000, new Object[][]{ + {ModItems.starmetal_plate, 1}, {ModItems.cobalt_plate, 2}, {ModItems.alloy_plate, 2}, //sadly they cant wear jackets bc it breaks it + {ModItems.steel_plate, 8}, {ModItems.titanium_plate, 4} + })); + slotPools.put(2, createSlotPool(10000, new Object[][]{ + {ModItems.zirconium_legs, 1}, {ModItems.cobalt_legs, 2}, {ModItems.steel_legs, 16}, + {ModItems.titanium_legs, 8}, {ModItems.robes_legs, 32}, {ModItems.alloy_legs, 2}, + })); + slotPools.put(1, createSlotPool(10000, new Object[][]{ + {ModItems.robes_boots, 32}, {ModItems.steel_boots, 16}, {ModItems.cobalt_boots, 2}, {ModItems.alloy_boots, 2}, + {ModItems.titanium_boots, 6} + })); ItemStack bowReplacement = getSkelegun(soot, world.rand); - ArrayList handPool = new ArrayList<>(); - handPool.add(new WeightedRandomObject(null, 100)); //should work ig - if (bowReplacement != null) { - handPool.add(new WeightedRandomObject(bowReplacement, 1)); - } - slotPools.put(0, handPool); + slotPools.put(0, createSlotPool(100, bowReplacement != null ? new Object[][]{{bowReplacement, 1}} : new Object[][]{})); } + assignItemsToEntity(entity, slotPools); + } - for (Map.Entry> e : slotPools.entrySet()) { - int slot = e.getKey(); - List pool = e.getValue(); + private void equipFullSet(EntityLivingBase entity, Item helmet, Item chest, Item legs, Item boots) { //for brainlets (me) to add more armorsets later when i forget about how this works + entity.setCurrentItemOrArmor(4, new ItemStack(helmet)); //p_70062_1_ is the slot number + entity.setCurrentItemOrArmor(3, new ItemStack(chest)); + entity.setCurrentItemOrArmor(2, new ItemStack(legs)); + entity.setCurrentItemOrArmor(1, new ItemStack(boots)); + } - WeightedRandomObject choice = (WeightedRandomObject) WeightedRandom.getRandomItem(rand, pool); + private List createSlotPool(int nullWeight, Object[][] items) { // nullWeight is the weight of the empty slot (no shit) + List pool = new ArrayList<>(); + pool.add(new WeightedRandomObject(null, nullWeight)); + for (Object[] item : items) { + pool.add(new WeightedRandomObject(new ItemStack((Item) item[0]), (int) item[1])); + } + return pool; + } + + private void assignItemsToEntity(EntityLivingBase entity, Map> slotPools) { + for (Map.Entry> entry : slotPools.entrySet()) { + int slot = entry.getKey(); + List pool = entry.getValue(); + + WeightedRandomObject choice = (WeightedRandomObject) WeightedRandom.getRandomItem(rand, pool); //NullPointerException sludge fix if (choice == null) { continue; } ItemStack stack = choice.asStack(); if (stack == null || stack.getItem() == null) { - // If the selected item is null skip item assignment continue; } - if (stack.getItem() == ModItems.gas_mask_m65 || //please do it like this when adding more so i can actually see it not go off the screen - stack.getItem() == ModItems.gas_mask_olde || - stack.getItem() == ModItems.gas_mask_mono) { + if (stack.getItem() == ModItems.gas_mask_m65 //eyesore + || stack.getItem() == ModItems.gas_mask_olde + || stack.getItem() == ModItems.gas_mask_mono) { ArmorUtil.installGasMaskFilter(stack, new ItemStack(ModItems.gas_mask_filter)); } entity.setCurrentItemOrArmor(slot, stack); - // If skeleton got a gun, add AI + //Give skeleton AI if it has a gun if (slot == 0 && entity instanceof EntitySkeleton && pool == slotPools.get(0)) { addFireTask((EntityLiving) entity); } From 03a6af791f5271075e245380f27990dc5f7dc336 Mon Sep 17 00:00:00 2001 From: Lazzzycatwastaken Date: Sun, 20 Apr 2025 18:20:09 +0200 Subject: [PATCH 3/3] what --- src/main/java/com/hbm/main/ModEventHandler.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index c5ea27488..c88cfc44b 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -53,7 +53,6 @@ import com.hbm.uninos.UniNodespace; import com.hbm.util.*; import com.hbm.util.ArmorRegistry.HazardClass; import com.hbm.world.generator.TimedGenerator; -import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent;