mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Joe: YEAH, ARE YOU READY TEAM JOE?
Joe: We're gonna become the BEST detectives! Quagmire: Giggity, let's do this! Peter: All Right!
This commit is contained in:
parent
0b0c5bc043
commit
1fa4dca870
@ -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<Integer, List<WeightedRandomObject>> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<WeightedRandomObject> 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<Integer, List<WeightedRandomObject>> e : slotPools.entrySet()) {
|
||||
int slot = e.getKey();
|
||||
List<WeightedRandomObject> 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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user