better pathfinding, BDCL, nuclear glyphid improvements

This commit is contained in:
Bob 2023-06-20 20:28:00 +02:00
parent 0a341411c8
commit 2ef47c8604
11 changed files with 133 additions and 25 deletions

View File

@ -4,6 +4,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.hbm.entity.pathfinder.PathFinderUtils;
import com.hbm.main.ResourceManager;
import net.minecraft.entity.Entity;
@ -64,8 +65,9 @@ public class EntityGlyphid extends EntityMob {
protected void updateEntityActionState() {
super.updateEntityActionState();
if(this.entityToAttack != null) {
this.setPathToEntity(this.worldObj.getPathEntityToEntity(this, this.entityToAttack, 128F, true, false, false, true));
// hell yeah!!
if(this.entityToAttack != null && !this.hasPath()) {
this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, false, true));
}
}
@ -73,11 +75,6 @@ public class EntityGlyphid extends EntityMob {
protected boolean canDespawn() {
return entityToAttack == null;
}
@Override
public int getMaxSafePointTries() {
return 10;
}
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {

View File

@ -79,22 +79,30 @@ public class EntityGlyphidNuclear extends EntityGlyphid {
if(this.deathTicks == 100) {
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 25, this);
vnt.setBlockAllocator(new BlockAllocatorStandard(24));
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorDebris(ModBlocks.volcanic_lava_block, 0)).setNoDrop());
vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(1.5F));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.explode();
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke");
// if the FX type is "muke", apply random BF effect
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) {
data.setBoolean("balefire", true);
if(!worldObj.isRemote) {
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 25, this);
vnt.setBlockAllocator(new BlockAllocatorStandard(24));
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorDebris(ModBlocks.volcanic_lava_block, 0)).setNoDrop());
vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(1.5F));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
vnt.explode();
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.mukeExplosion", 15.0F, 1.0F);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "muke");
// if the FX type is "muke", apply random BF effect
if(MainRegistry.polaroidID == 11 || rand.nextInt(100) == 0) {
data.setBoolean("balefire", true);
}
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
}
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY + 0.5, posZ), new TargetPoint(dimension, posX, posY, posZ, 250));
this.setDead();
} else {
if(!worldObj.isRemote && this.deathTicks % 10 == 0) {
worldObj.playSoundEffect(posX, posY, posZ, "hbm:weapon.fstbmbPing", 5.0F, 1.0F);
}
}
}
}

View File

@ -0,0 +1,62 @@
package com.hbm.entity.pathfinder;
import net.minecraft.entity.Entity;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.pathfinding.PathFinder;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.World;
public class PathFinderUtils {
public static PathEntity getPathEntityToEntityPartial(World world, Entity fromEntity, Entity toEntity, float maxDist, boolean allowDoors, boolean allowBlocked, boolean allowWater, boolean canDrown) {
world.theProfiler.startSection("pathfind");
int startX = MathHelper.floor_double(fromEntity.posX);
int startY = MathHelper.floor_double(fromEntity.posY + 1.0D);
int startZ = MathHelper.floor_double(fromEntity.posZ);
int maxDistEff = (int) (maxDist + 16.0F);
int minX = startX - maxDistEff;
int minY = startY - maxDistEff;
int minZ = startZ - maxDistEff;
int maxX = startX + maxDistEff;
int maxY = startY + maxDistEff;
int maxZ = startZ + maxDistEff;
ChunkCache chunkcache = new ChunkCache(world, minX, minY, minZ, maxX, maxY, maxZ, 0);
Vec3 vec = Vec3.createVectorHelper(toEntity.posX - fromEntity.posX, toEntity.posY - fromEntity.posY, toEntity.posZ - fromEntity.posZ);
vec = vec.normalize();
vec.xCoord *= maxDist;
vec.yCoord *= maxDist;
vec.zCoord *= maxDist;
int x = (int) Math.floor(fromEntity.posX + vec.xCoord);
int y = (int) Math.floor(fromEntity.posY + vec.yCoord);
int z = (int) Math.floor(fromEntity.posZ + vec.zCoord);
//this part will adjust the end of the path so it's actually on the ground, it being unreachable causes mobs to slow down
boolean solid = false;
for(int i = y; i > y - 10; i--) {
if(!world.getBlock(x, i, z).getMaterial().blocksMovement() && world.getBlock(x, i - 1, z).isNormalCube()) {
solid = true;
y = i;
break;
}
}
if(!solid) for(int i = y + 10; i > y; i--) {
if(!world.getBlock(x, i, z).getMaterial().blocksMovement() && world.getBlock(x, i - 1, z).isNormalCube()) {
solid = true;
y = i;
break;
}
}
//PathEntity pathentity = (new PathFinder(chunkcache, allowDoors, allowBlocked, allowWater, canDrown)).createEntityPathTo(fromEntity, toEntity, maxDist);
PathEntity pathentity = (new PathFinder(chunkcache, allowDoors, allowBlocked, allowWater, canDrown)).createEntityPathTo(fromEntity, x, y, z, maxDist);
world.theProfiler.endSection();
return pathentity;
}
}

View File

@ -574,6 +574,8 @@ public class OreDictManager {
OreDictionary.registerOre("blockGlassLime", glass_trinitite);
OreDictionary.registerOre("blockGlassRed", glass_polonium);
OreDictionary.registerOre("blockGlassBlack", glass_ash);
OreDictionary.registerOre("container1000lubricant", bdcl);
MaterialShapes.registerCompatShapes();
}

View File

@ -281,7 +281,7 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModBlocks.machine_flare, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 12), new OreDictStack(IRON.ingot(), 12), new OreDictStack(CU.plate528(), 4), new ComparableStack(ModItems.tank_steel, 1), new ComparableStack(ModBlocks.deco_pipe_quad, 8), new ComparableStack(ModItems.hull_small_steel, 4), new ComparableStack(ModItems.thermo_element, 3), },200);
makeRecipe(new ComparableStack(ModBlocks.machine_coker, 1), new AStack[] {new OreDictStack(STEEL.plate(), 24), new OreDictStack(IRON.ingot(), 12), new OreDictStack(CU.plate528(), 8), new OreDictStack(RUBBER.ingot(), 4), new ComparableStack(ModItems.tank_steel, 2), new ComparableStack(ModBlocks.steel_grate, 4) },200);
makeRecipe(new ComparableStack(ModBlocks.machine_refinery, 1), new AStack[] {new OreDictStack(STEEL.plate528(), 16), new OreDictStack(CU.plate(), 16), new ComparableStack(ModItems.hull_big_steel, 6), new ComparableStack(ModItems.pipes_steel, 2), new ComparableStack(ModItems.plate_polymer, 8), new ComparableStack(ModItems.circuit_red_copper, 1) },350);
makeRecipe(new ComparableStack(ModBlocks.machine_epress, 1), new AStack[] {new OreDictStack(STEEL.plate(), 8), new ComparableStack(ModItems.plate_polymer, 4), new ComparableStack(ModItems.bolt_tungsten, 4), new ComparableStack(ModItems.coil_copper, 2), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.circuit_copper, 1), new ComparableStack(ModItems.canister_full, 1, Fluids.LUBRICANT.getID()), },160);
makeRecipe(new ComparableStack(ModBlocks.machine_epress, 1), new AStack[] {new OreDictStack(STEEL.plate(), 8), new ComparableStack(ModItems.plate_polymer, 4), new ComparableStack(ModItems.bolt_tungsten, 4), new ComparableStack(ModItems.coil_copper, 2), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.circuit_copper, 1), new OreDictStack(Fluids.LUBRICANT.getDict(1000)), },160);
makeRecipe(new ComparableStack(ModBlocks.machine_chemplant, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 8), new OreDictStack(CU.plate528(), 6), new ComparableStack(ModItems.tank_steel, 4), new ComparableStack(ModItems.hull_big_steel, 1), new ComparableStack(ModItems.coil_tungsten, 3), new ComparableStack(ModItems.circuit_copper, 2), new ComparableStack(ModItems.circuit_red_copper, 1), new ComparableStack(ModItems.plate_polymer, 8), },200);
makeRecipe(new ComparableStack(ModBlocks.machine_crystallizer, 1), new AStack[] {new ComparableStack(ModItems.hull_big_steel, 4), new ComparableStack(ModItems.pipes_steel, 1), new OreDictStack(DESH.ingot(), 4), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModItems.blades_advanced_alloy, 2), new OreDictStack(STEEL.ingot(), 16), new OreDictStack(TI.plate(), 16), new ComparableStack(Blocks.glass, 4), new ComparableStack(ModItems.circuit_gold, 1), },400);
makeRecipe(new ComparableStack(ModBlocks.machine_fluidtank, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 2), new OreDictStack(STEEL.plate528(), 6), new ComparableStack(ModItems.hull_big_steel, 4), new OreDictStack(ANY_TAR.any(), 4), },150);

View File

@ -1007,6 +1007,7 @@ public class ModItems {
public static Item cap_sunset;
public static Item cap_star;
public static Item ring_pull;
public static Item bdcl;
//public static Item canned_beef;
//public static Item canned_tuna;
//public static Item canned_mystery;
@ -3341,6 +3342,7 @@ public class ModItems {
cbt_device = new ItemSyringe().setUnlocalizedName("cbt_device").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":cbt_device");
cigarette = new ItemCigarette().setUnlocalizedName("cigarette").setFull3D().setMaxStackSize(16).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":cigarette");
crackpipe = new ItemCigarette().setUnlocalizedName("crackpipe").setFull3D().setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":crackpipe");
bdcl = new ItemBDCL().setUnlocalizedName("bdcl").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":bdcl");
attachment_mask = new ItemModGasmask().setUnlocalizedName("attachment_mask").setTextureName(RefStrings.MODID + ":attachment_mask");
attachment_mask_mono = new ItemModGasmask().setUnlocalizedName("attachment_mask_mono").setTextureName(RefStrings.MODID + ":attachment_mask_mono");
@ -7618,6 +7620,7 @@ public class ModItems {
GameRegistry.registerItem(cbt_device, cbt_device.getUnlocalizedName());
GameRegistry.registerItem(cigarette, cigarette.getUnlocalizedName());
GameRegistry.registerItem(crackpipe, crackpipe.getUnlocalizedName());
GameRegistry.registerItem(bdcl, bdcl.getUnlocalizedName());
//Armor mods
GameRegistry.registerItem(attachment_mask, attachment_mask.getUnlocalizedName());

View File

@ -0,0 +1,34 @@
package com.hbm.items.food;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemBDCL extends Item {
@Override
public int getMaxItemUseDuration(ItemStack p_77626_1_) {
return 32;
}
@Override
public EnumAction getItemUseAction(ItemStack p_77661_1_) {
return EnumAction.drink;
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
return stack;
}
@Override
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
if(!player.capabilities.isCreativeMode) {
--stack.stackSize;
}
return stack;
}
}

View File

@ -29,10 +29,10 @@ public class ItemPollutionDetector extends Item {
float heavymetal = data.pollution[PollutionType.HEAVYMETAL.ordinal()];
float fallout = data.pollution[PollutionType.FALLOUT.ordinal()];
soot = ((int) soot * 100) / 100F;
poison = ((int) poison * 100) / 100F;
heavymetal = ((int) heavymetal * 100) / 100F;
fallout = ((int) fallout * 100) / 100F;
soot = ((int) (soot * 100)) / 100F;
poison = ((int) (poison * 100)) / 100F;
heavymetal = ((int) (heavymetal * 100)) / 100F;
fallout = ((int) (fallout * 100)) / 100F;
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Soot: " + soot).color(EnumChatFormatting.YELLOW).flush(), 100, 2000), (EntityPlayerMP) entity);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("Poison: " + poison).color(EnumChatFormatting.YELLOW).flush(), 101, 2000), (EntityPlayerMP) entity);

View File

@ -1160,6 +1160,7 @@ item.battery_steam_large.name=Großer dampfbetriebener Energiespeichertank
item.battery_su.name=Einwegbatterie
item.battery_su_l.name=Große Einwegbatterie
item.battery_trixite.name=Billige Spark-Batterie-Nachmache
item.bdcl.name=BDCL
item.beta.name=Beta-Features
item.big_sword.name=Großes Schwert
item.billet_am_mix.name=Reaktorfähiges Americiumbillet

View File

@ -1743,6 +1743,7 @@ item.battery_steam_large.name=Large Steam Powered Energy Storage Tank
item.battery_su.name=SU-Battery
item.battery_su_l.name=Large SU-Battery
item.battery_trixite.name=Off-Brand Spark Battery
item.bdcl.name=BDCL
item.beta.name=Beta Features
item.big_sword.name=Great Sword
item.billet_actinium.name=Actinium-227 Billet

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B