more shit to clean up

This commit is contained in:
Bob 2023-12-17 17:42:42 +01:00
parent 3416dbe14f
commit 5af5c6c861
16 changed files with 173 additions and 124 deletions

View File

@ -1,6 +1,7 @@
package com.hbm.blocks.generic;
import java.util.List;
import java.util.Random;
import com.hbm.blocks.IBlockMulti;
import com.hbm.lib.RefStrings;
@ -27,6 +28,11 @@ public class BlockGlyphid extends Block implements IBlockMulti {
this.setCreativeTab(MainRegistry.blockTab);
}
@Override
public Item getItemDropped(int meta, Random rand, int fortune) {
return null;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {

View File

@ -110,7 +110,7 @@ public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti {
}
}
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 9, yCoord + 1, zCoord - 9, xCoord + 10, yCoord + 8, zCoord + 10));
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 5, yCoord + 1, zCoord - 5, xCoord + 6, yCoord + 7, zCoord + 6));
float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT);
if(list.size() <= 3) {
@ -122,7 +122,9 @@ public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti {
}
if(!initialSpawn && worldObj.rand.nextInt(MobConfig.scoutSwarmSpawnChance + 1) == 0 && soot >= MobConfig.scoutThreshold) {
trySpawnEntity(new EntityGlyphidScout(worldObj));
EntityGlyphidScout scout = new EntityGlyphidScout(worldObj);
if(this.getBlockMetadata() == 1) scout.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_INFECTED);
trySpawnEntity(scout);
}
initialSpawn = false;

View File

@ -170,14 +170,10 @@ public class MobConfig {
rampantGlyphidGuidance = true;
scoutSwarmSpawnChance = 1;
scoutThreshold = 0.1;
RadiationConfig.pollutionSpreadThreshold = 25;
if(pollutionMult == 1) {
pollutionMult = 2;
RadiationConfig.pollutionSpreadEfficiency = 0.2 / pollutionMult;
}
else RadiationConfig.pollutionSpreadEfficiency = 0.1 / pollutionMult;
RadiationConfig.sootFogThreshold *= pollutionMult;
}
}
}

View File

@ -32,8 +32,6 @@ public class RadiationConfig {
public static double sootFogThreshold = 35D;
public static double sootFogDivisor = 120D;
public static double smokeStackSootMult = 0.8;
public static int pollutionSpreadThreshold = 15;
public static double pollutionSpreadEfficiency = 0.05D;
public static void loadFromConfig(Configuration config) {
@ -72,7 +70,5 @@ public class RadiationConfig {
sootFogThreshold = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_06_sootFogThreshold", "How much soot is required for smog to become visible", 35D);
sootFogDivisor = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_07_sootFogDivisor", "The divisor for smog, higher numbers will require more soot for the same smog density", 120D);
smokeStackSootMult = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_08_smokeStackSootMult", "How much does smokestack multiply soot by, with decimal values reducing the soot", 0.8);
pollutionSpreadThreshold = CommonConfig.createConfigInt(config, CATEGORY_POL, "POL_09_pollutionSpreadThreshold", "The amount of soot required for it to be spread to nearby chunks, causes it to concentrate more", 15);
pollutionSpreadEfficiency = CommonConfig.createConfigDouble(config, CATEGORY_POL, "POL_10_pollutionSpreadEfficiency", "How much soot will be spread to nearby chunks at once (percentage), values higher than 0.05 may cause infinite feedback loop of soot", 0.05);
}
}

View File

@ -234,7 +234,7 @@ public class EntityMappings {
addEntity(TrainCargoTramTrailer.class, "entity_ntm_cargo_tram_trailer", 250, false);
addEntity(TrainTunnelBore.class, "entity_ntm_tunnel_bore", 250, false);
addEntity(EntityDisperserCanister.class, "entity_disperser", 250, false);
addEntity(EntityDisperserCanister.class, "entity_disperser", 250);
addEntity(EntityWaypoint.class, "entity_waypoint", 250, false);
addMob(EntityCreeperNuclear.class, "entity_mob_nuclear_creeper", 0x204131, 0x75CE00);

View File

@ -3,14 +3,13 @@ package com.hbm.entity.grenade;
import com.hbm.entity.effect.EntityMist;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.weapon.ItemDisperser;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class EntityDisperserCanister extends EntityGrenadeBase {
public EntityDisperserCanister(World p_i1773_1_) {
super(p_i1773_1_);
}
@ -18,6 +17,7 @@ public class EntityDisperserCanister extends EntityGrenadeBase {
public EntityDisperserCanister(World p_i1774_1_, EntityLivingBase p_i1774_2_) {
super(p_i1774_1_, p_i1774_2_);
}
public EntityDisperserCanister(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_) {
super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
}
@ -26,11 +26,13 @@ public class EntityDisperserCanister extends EntityGrenadeBase {
this.dataWatcher.updateObject(12, id);
return this;
}
@Override
protected void entityInit() {
this.dataWatcher.addObject(12, 0);
this.dataWatcher.addObject(13, 0);
}
public EntityDisperserCanister setType(int id) {
this.dataWatcher.updateObject(13, id);
return this;
@ -39,9 +41,11 @@ public class EntityDisperserCanister extends EntityGrenadeBase {
public FluidType getFluid() {
return Fluids.fromID(this.dataWatcher.getWatchableObjectInt(12));
}
public Item getType() {
return Item.getItemById(this.dataWatcher.getWatchableObjectInt(13));
}
@Override
public void explode() {
if(!worldObj.isRemote) {
@ -68,9 +72,4 @@ public class EntityDisperserCanister extends EntityGrenadeBase {
this.dataWatcher.updateObject(13, nbt.getInteger("item"));
}
}

View File

@ -13,6 +13,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@Deprecated
public abstract class EntityGrenadeBase extends EntityThrowable {
public EntityGrenadeBase(World p_i1773_1_) {
@ -33,18 +34,14 @@ public abstract class EntityGrenadeBase extends EntityThrowable {
super.onUpdate();
this.prevRotationPitch = this.rotationPitch;
this.rotationPitch -= Vec3.createVectorHelper(motionX, motionY, motionZ).lengthVector() * 25;
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
while (this.rotationYaw - this.prevRotationYaw < -180.0F)
{
while(this.rotationYaw - this.prevRotationYaw < -180.0F) {
this.prevRotationYaw -= 360.0F;
}
while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
{
while(this.rotationYaw - this.prevRotationYaw >= 180.0F) {
this.prevRotationYaw += 360.0F;
}

View File

@ -19,6 +19,7 @@ import com.hbm.main.ResourceManager;
import com.hbm.potion.HbmPotion;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityMob;
@ -30,6 +31,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.EnumDifficulty;
@ -317,6 +319,8 @@ public class EntityGlyphid extends EntityMob {
amount *= 1.5F;
} else if(source == ModDamageSource.acid || source.equals(new DamageSource(ModDamageSource.s_acid))){
amount = 0;
} else if(source == DamageSource.inWall) {
amount *= 15F;
}
if(this.isPotionActive(HbmPotion.phosphorus.getId())){
@ -327,7 +331,7 @@ public class EntityGlyphid extends EntityMob {
boolean wasAttacked = super.attackEntityFrom(source, amount);
if(alive && this.getHealth() <= 0) {
if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) {
if(doesInfectedSpawnMaggots() && this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) {
int j = 2 + this.rand.nextInt(3);
@ -347,6 +351,10 @@ public class EntityGlyphid extends EntityMob {
return wasAttacked;
}
public boolean doesInfectedSpawnMaggots() {
return true;
}
public boolean isArmorBroken(float amount) {
return this.rand.nextInt(100) <= Math.min(Math.pow(amount * 0.6, 2), 100);
}
@ -435,10 +443,16 @@ public class EntityGlyphid extends EntityMob {
}
@Override
public boolean attackEntityAsMob(Entity victum) {
public boolean attackEntityAsMob(Entity victim) {
if(this.isSwingInProgress) return false;
this.swingItem();
return super.attackEntityAsMob(victum);
if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED && victim instanceof EntityLivingBase) {
((EntityLivingBase) victim).addPotionEffect(new PotionEffect(Potion.poison.id, 100, 2));
((EntityLivingBase) victim).addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0));
}
return super.attackEntityAsMob(victim);
}

View File

@ -122,6 +122,11 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
return 10F;
}
@Override
public boolean doesInfectedSpawnMaggots() {
return false;
}
public boolean hasWaypoint = false;
@Override
protected void onDeathUpdate() {
@ -148,10 +153,25 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
if(this.deathTicks == 100) {
if(!worldObj.isRemote) {
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 25, this);
if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) {
int j = 15 + this.rand.nextInt(6);
for(int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * 0.5F;
float f1 = ((float) (k / 2) - 0.5F) * 0.5F;
EntityParasiteMaggot maggot = new EntityParasiteMaggot(worldObj);
maggot.setLocationAndAngles(this.posX + (double) f, this.posY + 0.5D, this.posZ + (double) f1, this.rand.nextFloat() * 360.0F, 0.0F);
maggot.motionX = f;
maggot.motionZ = f1;
maggot.velocityChanged = true;
this.worldObj.spawnEntityInWorld(maggot);
}
} else {
vnt.setBlockAllocator(new BlockAllocatorStandard(24));
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorDebris(ModBlocks.volcanic_lava_block, 0)).setNoDrop());
}
vnt.setEntityProcessor(new EntityProcessorStandard());
vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.explode();

View File

@ -180,8 +180,6 @@ public class PollutionHandler {
if(event.side == Side.SERVER && event.phase == Phase.END) {
int spreadThreshold = RadiationConfig.pollutionSpreadThreshold;
double spreadEff = RadiationConfig.pollutionSpreadEfficiency;
eggTimer++;
if(eggTimer < 60) return;
eggTimer = 0;
@ -200,11 +198,11 @@ public class PollutionHandler {
int P = PollutionType.POISON.ordinal();
/* CALCULATION */
if(data.pollution[S] > spreadThreshold) {
pollutionForNeightbors[S] = (float) (data.pollution[S] * spreadEff);
data.pollution[S] *= 1-spreadEff*4;
if(data.pollution[S] > 15) {
pollutionForNeightbors[S] = (float) (data.pollution[S] * 0.05F);
data.pollution[S] *= 0.8F;
} else {
data.pollution[S] *= 0.8;
data.pollution[S] *= 0.99F;
}
data.pollution[H] *= 0.9995F;

View File

@ -325,12 +325,12 @@ public class Fluids {
SMOKE_LEADED = new FluidType("SMOKE_LEADED", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON);
SMOKE_POISON = new FluidType("SMOKE_POISON", 0x808080, 0, 0, 0, EnumSymbol.NONE).addTraits(GASEOUS, NOID, NOCON);
HELIUM4 = new FluidType("HELIUM4", 0xE54B0A, 0, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS);
HEAVYWATER_HOT = new FluidType("HEAVYWATER_HOT", 0x4D007B, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID);
SODIUM = new FluidType("SODIUM", 0xCCD4D5, 1, 2, 3, EnumSymbol.NONE).setTemp(400).addTraits(LIQUID);
SODIUM_HOT = new FluidType("SODIUM_HOT", 0xE2ADC1, 1, 2, 3, EnumSymbol.NONE).setTemp(1200).addTraits(LIQUID);
THORIUM_SALT = new FluidType("THORIUM_SALT", 0x7A5542, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, new FT_Corrosive(65));
THORIUM_SALT_HOT = new FluidType("THORIUM_SALT_HOT", 0x3E3627, 2, 0, 3, EnumSymbol.NONE).setTemp(1600).addTraits(LIQUID, new FT_Corrosive(65));
THORIUM_SALT_DEPLETED = new FluidType("THORIUM_SALT_DEPLETED", 0x302D1C, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, new FT_Corrosive(65));
HEAVYWATER_HOT = new FluidType("HEAVYWATER_HOT", 0x4D007B, 1, 0, 0, EnumSymbol.NONE).setTemp(600).addTraits(LIQUID, VISCOUS);
SODIUM = new FluidType("SODIUM", 0xCCD4D5, 1, 2, 3, EnumSymbol.NONE).setTemp(400).addTraits(LIQUID, VISCOUS);
SODIUM_HOT = new FluidType("SODIUM_HOT", 0xE2ADC1, 1, 2, 3, EnumSymbol.NONE).setTemp(1200).addTraits(LIQUID, VISCOUS);
THORIUM_SALT = new FluidType("THORIUM_SALT", 0x7A5542, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, VISCOUS, new FT_Corrosive(65));
THORIUM_SALT_HOT = new FluidType("THORIUM_SALT_HOT", 0x3E3627, 2, 0, 3, EnumSymbol.NONE).setTemp(1600).addTraits(LIQUID, VISCOUS, new FT_Corrosive(65));
THORIUM_SALT_DEPLETED = new FluidType("THORIUM_SALT_DEPLETED", 0x302D1C, 2, 0, 3, EnumSymbol.NONE).setTemp(800).addTraits(LIQUID, VISCOUS, new FT_Corrosive(65));
FULLERENE = new FluidType("FULLERENE", 0xFF7FED, 3, 3, 3, EnumSymbol.NONE).addTraits(LIQUID, new FT_Corrosive(65));
PHEROMONE = new FluidType("PHEROMONE", 0x5FA6E8, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(1));
PHEROMONE_M = new FluidType(132, "PHEROMONE_M", 0x48C9B0 , 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID, VISCOUS, new FT_Pheromone(2));

View File

@ -936,8 +936,8 @@ public class ModItems {
public static Item fluid_barrel_empty;
public static Item fluid_barrel_infinite;
public static Item disperser_canister;
public static Item disperser_canister_empty;
public static Item disperser_canister;
public static Item glyphid_gland;
public static Item glyphid_gland_empty;
@ -4650,8 +4650,8 @@ public class ModItems {
fluid_barrel_empty = new Item().setUnlocalizedName("fluid_barrel_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel");
fluid_barrel_infinite = new ItemInfiniteFluid(null, 1_000_000_000).setUnlocalizedName("fluid_barrel_infinite").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel_infinite");
disperser_canister_empty = new Item().setUnlocalizedName("disperser_canister_empty").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":disperser_canister");
disperser_canister = new ItemDisperser().setUnlocalizedName("disperser_canister").setContainerItem(ModItems.disperser_canister_empty).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":disperser_canister");
disperser_canister_empty = new Item().setUnlocalizedName("disperser_canister_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":disperser_canister");
glyphid_gland = new ItemDisperser().setUnlocalizedName("glyphid_gland").setContainerItem(ModItems.glyphid_gland_empty).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":glyphid_gland");
glyphid_gland_empty = new Item().setUnlocalizedName("glyphid_gland_empty").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":glyphid_gland");

View File

@ -18,6 +18,7 @@ import net.minecraft.world.World;
import java.util.List;
public class ItemDisperser extends ItemFluidTank {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
@ -59,7 +60,7 @@ public class ItemDisperser extends ItemFluidTank {
public String getItemStackDisplayName(ItemStack stack) {
String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
String s1 = ("" + StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getUnlocalizedName())).trim();
String s1 = ("" + StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getConditionalName())).trim();
s = this == ModItems.glyphid_gland ? s1 + " " + s : s + " " + s1;
return s;

View File

@ -1,11 +1,11 @@
package com.hbm.render.entity.projectile;
import com.hbm.entity.grenade.EntityDisperserCanister;
import net.minecraft.item.Item;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.entity.grenade.IGenericGrenade;
import com.hbm.inventory.fluid.FluidType;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
@ -18,13 +18,28 @@ public class RenderGenericGrenade extends Render {
@Override
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
boolean disperser = entity instanceof EntityDisperserCanister;
for(int i = 0; i < (disperser ? 2 : 1); i++) {
IIcon iicon;
if(entity instanceof EntityDisperserCanister){
if(disperser){
EntityDisperserCanister canister = (EntityDisperserCanister) entity;
iicon = canister.getType().getIconFromDamage(canister.getFluid().getID());
FluidType fluid = canister.getFluid();
iicon = canister.getType().getIconFromDamageForRenderPass(fluid.getID(), i);
if(i == 1) {
int hex = fluid.getColor();
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = (hex & 0xFF);
GL11.glColor3b((byte) (r / 2), (byte) (g / 2), (byte) (b / 2));
}
} else {
IGenericGrenade grenade = (IGenericGrenade) entity;
iicon = grenade.getGrenade().getIconFromDamage(0);
iicon = grenade.getGrenade().getIconFromDamage(i);
}
if(iicon != null) {
@ -39,6 +54,9 @@ public class RenderGenericGrenade extends Render {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
GL11.glColor3f(1F, 1F, 1F);
}
}
@Override

View File

@ -541,6 +541,7 @@ entity.entity_mob_nuclear_creeper.name=Nuklearer Creeper
entity.entity_mob_phosgene_creeper.name=Phosgen-Creeper
entity.entity_mob_tainted_creeper.name=Verseuchter Creeper
entity.entity_mob_volatile_creeper.name=Instabiler Creeper
entity.entity_parasite_maggot.name=Parasitische Made
entity.entity_pigeon.name=Taube
entity.entity_plastic_bag.name=Plastiktüte
entity.entity_taint_crab.name=Verseuchte Krabbe

View File

@ -1050,6 +1050,7 @@ entity.entity_mob_nuclear_creeper.name=Nuclear Creeper
entity.entity_mob_phosgene_creeper.name=Phosgene Creeper
entity.entity_mob_tainted_creeper.name=Tainted Creeper
entity.entity_mob_volatile_creeper.name=Volatile Creeper
entity.entity_parasite_maggot.name=Parasitic Maggot
entity.entity_pigeon.name=Pigeon
entity.entity_plastic_bag.name=Plastic Bag
entity.entity_taint_crab.name=Taint Crab