From f3837beb70e0bd9330760f610c81dc1734b3e4f1 Mon Sep 17 00:00:00 2001 From: Bob Date: Thu, 5 May 2022 23:06:44 +0200 Subject: [PATCH] bugfixes --- .../grenade/EntityGrenadeBouncyGeneric.java | 4 +- .../grenade/EntityGrenadeImpactGeneric.java | 6 ++- .../java/com/hbm/main/CraftingManager.java | 2 +- src/main/java/com/hbm/main/MainRegistry.java | 4 +- .../world/worldgen/ComponentNTMFeatures.java | 40 +++++++++++++++++++ 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/hbm/entity/grenade/EntityGrenadeBouncyGeneric.java b/src/main/java/com/hbm/entity/grenade/EntityGrenadeBouncyGeneric.java index b4322fb38..cc440ec35 100644 --- a/src/main/java/com/hbm/entity/grenade/EntityGrenadeBouncyGeneric.java +++ b/src/main/java/com/hbm/entity/grenade/EntityGrenadeBouncyGeneric.java @@ -1,5 +1,6 @@ package com.hbm.entity.grenade; +import com.hbm.items.ModItems; import com.hbm.items.weapon.ItemGenericGrenade; import net.minecraft.entity.EntityLivingBase; @@ -28,7 +29,8 @@ public class EntityGrenadeBouncyGeneric extends EntityGrenadeBouncyBase implemen @Override public ItemGenericGrenade getGrenade() { - return (ItemGenericGrenade) Item.getItemById(this.dataWatcher.getWatchableObjectInt(12)); + ItemGenericGrenade gren = (ItemGenericGrenade) Item.getItemById(this.dataWatcher.getWatchableObjectInt(12)); + return gren != null ? gren : (ItemGenericGrenade) ModItems.grenade_kyiv; } @Override diff --git a/src/main/java/com/hbm/entity/grenade/EntityGrenadeImpactGeneric.java b/src/main/java/com/hbm/entity/grenade/EntityGrenadeImpactGeneric.java index 7a871b7a2..febe81373 100644 --- a/src/main/java/com/hbm/entity/grenade/EntityGrenadeImpactGeneric.java +++ b/src/main/java/com/hbm/entity/grenade/EntityGrenadeImpactGeneric.java @@ -1,5 +1,6 @@ package com.hbm.entity.grenade; +import com.hbm.items.ModItems; import com.hbm.items.weapon.ItemGenericGrenade; import net.minecraft.entity.EntityLivingBase; @@ -28,7 +29,8 @@ public class EntityGrenadeImpactGeneric extends EntityGrenadeBase implements IGe @Override public ItemGenericGrenade getGrenade() { - return (ItemGenericGrenade) Item.getItemById(this.dataWatcher.getWatchableObjectInt(12)); + ItemGenericGrenade gren = (ItemGenericGrenade) Item.getItemById(this.dataWatcher.getWatchableObjectInt(12)); + return gren != null ? gren : (ItemGenericGrenade) ModItems.grenade_kyiv; } @Override @@ -39,7 +41,7 @@ public class EntityGrenadeImpactGeneric extends EntityGrenadeBase implements IGe @Override public void explode() { - if(!this.worldObj.isRemote) { + if(!this.worldObj.isRemote && getGrenade() != null) { getGrenade().explode(worldObj, posX, posY, posZ); this.setDead(); } diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index f143f248e..715faea01 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -453,7 +453,7 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.sat_dock, 1), new Object[] { "SSS", "PCP", 'S', STEEL.ingot(), 'P', ANY_PLASTIC.ingot(), 'C', ModBlocks.crate_iron }); addRecipeAuto(new ItemStack(ModBlocks.book_guide, 1), new Object[] { "IBI", "LBL", "IBI", 'B', Items.book, 'I', KEY_BLACK, 'L', KEY_BLUE }); - addRecipeAuto(new ItemStack(ModBlocks.rail_wood, 16), new Object[] { "S S", "SRS", "S S", 'S', ModBlocks.steel_beam, 'R', DictFrame.fromOne(ModItems.plant_item, EnumPlantType.ROPE) }); + addRecipeAuto(new ItemStack(ModBlocks.rail_wood, 16), new Object[] { "S S", "SRS", "S S", 'S', Items.stick, 'R', DictFrame.fromOne(ModItems.plant_item, EnumPlantType.ROPE) }); addRecipeAuto(new ItemStack(ModBlocks.rail_narrow, 64), new Object[] { "S S", "S S", "S S", 'S', ModBlocks.steel_beam }); addRecipeAuto(new ItemStack(ModBlocks.rail_highspeed, 16), new Object[] { "S S", "SIS", "S S", 'S', STEEL.ingot(), 'I', IRON.plate() }); addRecipeAuto(new ItemStack(ModBlocks.rail_booster, 6), new Object[] { "S S", "CIC", "SRS", 'S', STEEL.ingot(), 'I', IRON.plate(), 'R', MINGRADE.ingot(), 'C', ModItems.coil_copper }); diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index c7f99f089..046ee640e 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -489,8 +489,8 @@ public class MainRegistry { EntityRegistry.registerModEntity(EntitySiegeLaser.class, "entity_ntm_siege_laser", 164, this, 1000, 1, true); EntityRegistry.registerModEntity(EntitySiegeDropship.class, "entity_ntm_siege_dropship", 165, this, 1000, 1, true); EntityRegistry.registerModEntity(EntityTNTPrimedBase.class, "entity_ntm_tnt_primed", 166, this, 1000, 1, true); - EntityRegistry.registerModEntity(EntityGrenadeBouncyGeneric.class, "entity_grenade_generic", 168, this, 250, 1, true); - EntityRegistry.registerModEntity(EntityGrenadeImpactGeneric.class, "entity_grenade_generic", 169, this, 250, 1, true); + EntityRegistry.registerModEntity(EntityGrenadeBouncyGeneric.class, "entity_grenade_bouncy_generic", 168, this, 250, 1, true); + EntityRegistry.registerModEntity(EntityGrenadeImpactGeneric.class, "entity_grenade_impact_generic", 169, this, 250, 1, true); EntityRegistry.registerModEntity(EntityMinecartCrate.class, "entity_ntm_cart_crate", 170, this, 250, 1, true); EntityRegistry.registerGlobalEntityID(EntityNuclearCreeper.class, "entity_mob_nuclear_creeper", EntityRegistry.findGlobalUniqueEntityId(), 0x204131, 0x75CE00); diff --git a/src/main/java/com/hbm/world/worldgen/ComponentNTMFeatures.java b/src/main/java/com/hbm/world/worldgen/ComponentNTMFeatures.java index 7c6e83576..650c5c3b2 100644 --- a/src/main/java/com/hbm/world/worldgen/ComponentNTMFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/ComponentNTMFeatures.java @@ -47,6 +47,10 @@ public class ComponentNTMFeatures { private static ComponentNTMFeatures.Sandstone RandomSandstone = new ComponentNTMFeatures.Sandstone(); + public NTMHouse1() { + super(); + } + /** Constructor for this feature; takes coordinates for bounding box */ protected NTMHouse1(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 9, 4, 6); @@ -145,6 +149,10 @@ public class ComponentNTMFeatures { private boolean[] hasPlacedLoot = new boolean[2]; + public NTMHouse2() { + super(); + } + protected NTMHouse2(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 15, 5, 9); this.hasPlacedLoot[0] = false; @@ -295,6 +303,10 @@ public class ComponentNTMFeatures { private boolean[] hasPlacedLoot = new boolean[2]; + public NTMLab1() { + super(); + } + /** Constructor for this feature; takes coordinates for bounding box */ protected NTMLab1(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 9, 4, 7); @@ -428,6 +440,10 @@ public class ComponentNTMFeatures { private static ComponentNTMFeatures.LabTiles RandomLabTiles = new ComponentNTMFeatures.LabTiles(); private boolean[] hasPlacedLoot = new boolean[2]; + + public NTMLab2() { + super(); + } protected NTMLab2(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 12, 11, 8); @@ -607,6 +623,10 @@ public class ComponentNTMFeatures { private boolean hasPlacedLoot; + public NTMWorkshop1() { + super(); + } + protected NTMWorkshop1(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 10, 6, 8); this.hasPlacedLoot = false; @@ -761,6 +781,10 @@ public class ComponentNTMFeatures { private static ComponentNTMFeatures.ConcreteBricks RandomConcreteBricks = new ComponentNTMFeatures.ConcreteBricks(); + public NTMRuin1() { + super(); + } + protected NTMRuin1(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 8, 6, 10); } @@ -833,6 +857,10 @@ public class ComponentNTMFeatures { private static ComponentNTMFeatures.ConcreteBricks RandomConcreteBricks = new ComponentNTMFeatures.ConcreteBricks(); + public NTMRuin2() { + super(); + } + protected NTMRuin2(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 7, 5, 10); } @@ -896,6 +924,10 @@ public class ComponentNTMFeatures { private static ComponentNTMFeatures.ConcreteBricks RandomConcreteBricks = new ComponentNTMFeatures.ConcreteBricks(); + public NTMRuin3() { + super(); + } + protected NTMRuin3(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 8, 3, 10); } @@ -953,6 +985,10 @@ public class ComponentNTMFeatures { private static ComponentNTMFeatures.ConcreteBricks RandomConcreteBricks = new ComponentNTMFeatures.ConcreteBricks(); + public NTMRuin4() { + super(); + } + protected NTMRuin4(Random rand, int minX, int minY, int minZ) { super(rand, minX, minY, minZ, 10, 2, 11); } @@ -1018,6 +1054,10 @@ public class ComponentNTMFeatures { protected int hpos = -1; + protected Feature() { + super(0); + } + protected Feature(Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ ) { super(0); this.featureSizeX = maxX;