fancier glyphid hives, maggots

This commit is contained in:
Bob 2023-12-16 18:24:43 +01:00
parent 95520daebc
commit 3416dbe14f
23 changed files with 383 additions and 214 deletions

View File

@ -2935,8 +2935,8 @@ public class ModBlocks {
GameRegistry.registerBlock(mush, mush.getUnlocalizedName());
GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName());
GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName());
GameRegistry.registerBlock(glyphid_base, glyphid_base.getUnlocalizedName());
GameRegistry.registerBlock(glyphid_spawner, glyphid_spawner.getUnlocalizedName());
register(glyphid_base);
register(glyphid_spawner);
GameRegistry.registerBlock(moon_turf, moon_turf.getUnlocalizedName());
//Waste

View File

@ -1,22 +1,30 @@
package com.hbm.blocks.generic;
import java.util.List;
import com.hbm.blocks.IBlockMulti;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
public class BlockGlyphid extends Block {
public class BlockGlyphid extends Block implements IBlockMulti {
public IIcon[] iconsStandard = new IIcon[2];
public IIcon[] iconsInfested = new IIcon[2];
public BlockGlyphid(Material mat) {
super(mat);
this.setCreativeTab(MainRegistry.blockTab);
}
@Override
@ -49,4 +57,15 @@ public class BlockGlyphid extends Block {
if(meta == 1) return this.iconsInfested;
return this.iconsStandard;
}
@Override
public int getSubCount() {
return 2;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for(int i = 0; i < getSubCount(); ++i) list.add(new ItemStack(item, 1, i));
}
}

View File

@ -3,12 +3,14 @@ package com.hbm.blocks.generic;
import java.util.*;
import java.util.function.Function;
import com.hbm.blocks.IBlockMulti;
import com.hbm.config.MobConfig;
import com.hbm.entity.mob.*;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import com.hbm.items.ModItems;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.util.Tuple.Pair;
import cpw.mods.fml.relauncher.Side;
@ -16,7 +18,9 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
@ -24,12 +28,13 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
public class BlockGlyphidSpawner extends BlockContainer {
public class BlockGlyphidSpawner extends BlockContainer implements IBlockMulti {
public IIcon[] icons = new IIcon[2];
public BlockGlyphidSpawner(Material mat) {
super(mat);
this.setCreativeTab(MainRegistry.blockTab);
}
@Override
@ -50,6 +55,17 @@ public class BlockGlyphidSpawner extends BlockContainer {
icons[1] = reg.registerIcon(RefStrings.MODID + ":glyphid_eggs_infested");
}
@Override
public int getSubCount() {
return 2;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for(int i = 0; i < getSubCount(); ++i) list.add(new ItemStack(item, 1, i));
}
private static final ArrayList<Pair<Function<World, EntityGlyphid>, int[]>> spawnMap = new ArrayList<>();
static {
@ -90,8 +106,7 @@ public class BlockGlyphidSpawner extends BlockContainer {
for(Object e : worldObj.loadedEntityList) {
if(e instanceof EntityGlyphid) {
count++;
//if(count >= MobConfig.spawnMax)
// return;
if(count >= MobConfig.spawnMax) return;
}
}
@ -134,18 +149,21 @@ public class BlockGlyphidSpawner extends BlockContainer {
Random rand = new Random();
ArrayList<EntityGlyphid> currentSpawns = new ArrayList<>();
int swarmAmount = (int) Math.min(MobConfig.baseSwarmSize * Math.max(MobConfig.swarmScalingMult * (soot / MobConfig.sootStep), 1), 10);
while(currentSpawns.size() <= swarmAmount) {
int cap = 100;
while(currentSpawns.size() <= swarmAmount && cap >= 0) {
// (dys)functional programing
for(Pair<Function<World, EntityGlyphid>, int[]> glyphid : spawnMap) {
int[] chance = glyphid.getValue();
int adjustedChance = (int) (chance[0] + (chance[1] - chance[1] / Math.max(((soot + 1) / 3), 1)));
if(rand.nextInt(100) <= adjustedChance) {
if(soot >= chance[2] && rand.nextInt(100) <= adjustedChance) {
EntityGlyphid entity = glyphid.getKey().apply(worldObj);
if(meta == 1) entity.getDataWatcher().updateObject(EntityGlyphid.DW_SUBTYPE, (byte) EntityGlyphid.TYPE_INFECTED);
currentSpawns.add(entity);
}
}
cap--;
}
return currentSpawns;
}

View File

@ -51,14 +51,6 @@ public class BlockLoot extends BlockContainer {
@Override
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
/*TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z);
if(loot != null && loot.items.isEmpty()) {
loot.addItem(new ItemStack(ModItems.gun_lever_action), 0, 0, 0);
}*/
//LootGenerator.lootCapStash(world, x, y, z);
}
@Override

View File

@ -42,14 +42,14 @@ public class MobConfig {
public static double swarmScalingMult = 1.2;
public static int sootStep = 50;
public static int[] glyphidChance = {50, -40};
public static int[] brawlerChance = {5, 35};
public static int[] bombardierChance = {20, -15};
public static int[] blasterChance = {-15, 40};
public static int[] diggerChance = {-15, 25};
public static int[] behemothChance = {-30, 45};
public static int[] brendaChance = {-50, 60};
public static int[] johnsonChance = {-50, 60};
public static int[] glyphidChance = {50, -40, 0};
public static int[] brawlerChance = {5, 35, 1};
public static int[] bombardierChance = {20, -15, 1};
public static int[] blasterChance = {-15, 40, 5};
public static int[] diggerChance = {-15, 25, 5};
public static int[] behemothChance = {-30, 45, 10};
public static int[] brendaChance = {-50, 60, 20};
public static int[] johnsonChance = {-50, 60, 50};
public static double spawnMax = 50;
public static boolean enableInfestation = true;
@ -116,15 +116,11 @@ public class MobConfig {
config.addCustomCategoryComment(CATEGORY,
"General Glyphid spawn logic configuration\n"
+ "\n"
+ "The chances work in a simple way:\n"
+ "The base chance is the stock chance of the bug to spawn within a swarm, unaffected by soot\n"
+ "As soot increases, the spawn rate of the bug increases until it reaches a limit determined by the modifier\n"
+ "If the default chance is negative, the mob will not spawn by default, and the lower it is,\n"
+ "The longer it takes for the modifier to make it positive\n"
+ "If the Modifier is negative, the bug will spawn less often in swarms,\n"
+ "And its place will be taken over by another one.\n"
+ "\n"
+ "The formula for glyphid spawning chance is: (chance + (modifier - modifier / (soot/10)))"
+ "The first number is the base chance which applies at 0 soot,\n"
+ "the second number is the modifier that applies with soot based on the formular below,\n"
+ "the third number is a hard minimum of soot for this type to spawn.\n"
+ "Negative base chances mean that glyphids won't spawn outright, negative modifiers mean that the type becomes less likely with higher soot.\n"
+ "The formula for glyphid spawning chance is: (base chance + (modifier - modifier / max( (soot + 1)/3, 3 )))\n"
+ "The formula for glyphid swarm scaling is: (baseSwarmSize * Math.max(swarmScalingMult * soot/sootStep, 1))");
@ -133,14 +129,14 @@ public class MobConfig {
sootStep = CommonConfig.createConfigInt(config, CATEGORY, "12.GS03_sootStep", "The soot amount the above multiplier applies to the swarm size", 50);
swarmCooldown = CommonConfig.createConfigInt(config, CATEGORY, "12.GS04_swarmCooldown", "How often do glyphid swarms spawn, in seconds", 120) * 20;
glyphidChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC01_glyphidChance", "Base Spawn chance and soot modifier for a glyphid grunt", new int[]{50, -45});
brawlerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC02_brawlerChance", "Base Spawn chance and soot modifier for a glyphid brawler", new int[]{10, 30});
bombardierChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC03_bombardierChance", "Base Spawn chance and soot modifier for a glyphid bombardier", new int[]{20, -15});
blasterChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC04_blasterChance", "Base Spawn chance and soot modifier for a glyphid blaster", new int[]{-5, 40});
diggerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC05_diggerChance", "Base Spawn chance and soot modifier for a glyphid digger", new int[]{-15, 25});
behemothChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC06_behemothChance", "Base Spawn chance and soot modifier for a glyphid behemoth", new int[]{-30, 45});
brendaChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC07_brendaChance", "Base Spawn chance and soot modifier for a glyphid brenda", new int[]{-50, 60});
johnsonChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC08_johnsonChance", "Base Spawn chance and soot modifier for Big Man Johnson", new int[]{-50, 60});
glyphidChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC01_glyphidChance", "Base Spawn chance and soot modifier for a glyphid grunt", new int[]{50, -45, 0});
brawlerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC02_brawlerChance", "Base Spawn chance and soot modifier for a glyphid brawler", new int[]{10, 30, 1});
bombardierChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC03_bombardierChance", "Base Spawn chance and soot modifier for a glyphid bombardier", new int[]{20, -15, 1});
blasterChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC04_blasterChance", "Base Spawn chance and soot modifier for a glyphid blaster", new int[]{-5, 40, 5});
diggerChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC05_diggerChance", "Base Spawn chance and soot modifier for a glyphid digger", new int[]{-15, 25, 5});
behemothChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC06_behemothChance", "Base Spawn chance and soot modifier for a glyphid behemoth", new int[]{-30, 45, 10});
brendaChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC07_brendaChance", "Base Spawn chance and soot modifier for a glyphid brenda", new int[]{-50, 60, 20});
johnsonChance = CommonConfig.createConfigIntList(config, CATEGORY, "12.GC08_johnsonChance", "Base Spawn chance and soot modifier for Big Man Johnson", new int[]{-50, 60, 50});
String rampantDesc = "Rampant Mode changes glyphid behavior and spawning to be more aggressive, changes include:\n"
+ "\n"

View File

@ -267,6 +267,7 @@ public class EntityMappings {
addMob(EntityGlyphidNuclear.class, "entity_glyphid_nuclear", 0x267F00, 0xA0A0A0);
addMob(EntityGlyphidDigger.class, "entity_glyphid_digger", 0x273038, 0x724A21);
addMob(EntityPlasticBag.class, "entity_plastic_bag", 0xd0d0d0, 0x808080);
addMob(EntityParasiteMaggot.class, "entity_parasite_maggot", 0xd0d0d0, 0x808080);
addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());

View File

@ -174,8 +174,8 @@ public class EntityGlyphid extends EntityMob {
protected Entity findPlayerToAttack() {
if(this.isPotionActive(Potion.blindness)) return null;
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, useExtendedTargeting() && getCurrentTask() != 0 ? 128D : 16D);
return entityplayer != null && (MobConfig.rampantExtendedTargetting || canEntityBeSeen(entityplayer)) ? entityplayer : null;
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, useExtendedTargeting() ? 128D : 16D);
return entityplayer;
}
@Override
@ -193,7 +193,7 @@ public class EntityGlyphid extends EntityMob {
if (!this.hasPath()) {
// hell yeah!!
if (useExtendedTargeting() && this.entityToAttack != null) {
if(useExtendedTargeting() && this.entityToAttack != null) {
this.setPathToEntity(PathFinderUtils.getPathEntityToEntityPartial(worldObj, this, this.entityToAttack, 16F, true, false, true, true));
} else if (getCurrentTask() != TASK_IDLE) {
@ -281,11 +281,15 @@ public class EntityGlyphid extends EntityMob {
@Override
protected boolean canDespawn() {
return ticksExisted > 3500 && entityToAttack == null && getCurrentTask() == TASK_IDLE;
return entityToAttack == null && getCurrentTask() == TASK_IDLE && this.ticksExisted > 100;
}
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
if(source.getEntity() instanceof EntityGlyphid) {
return false;
}
if(!source.isDamageAbsolute() && !source.isUnblockable() && !worldObj.isRemote && !source.isFireDamage() && !source.getDamageType().equals(ModDamageSource.s_cryolator)) {
byte armor = this.dataWatcher.getWatchableObjectByte(DW_ARMOR);
@ -318,8 +322,29 @@ public class EntityGlyphid extends EntityMob {
if(this.isPotionActive(HbmPotion.phosphorus.getId())){
amount *= 1.5F;
}
boolean alive = this.getHealth() > 0;
boolean wasAttacked = super.attackEntityFrom(source, amount);
if(alive && this.getHealth() <= 0) {
if(this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) == TYPE_INFECTED) {
return super.attackEntityFrom(source, amount);
int j = 2 + this.rand.nextInt(3);
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);
}
}
}
return wasAttacked;
}
public boolean isArmorBroken(float amount) {
@ -437,16 +462,16 @@ public class EntityGlyphid extends EntityMob {
* @param waypoint The waypoint for the task, can be null
*/
public void setCurrentTask(int task, @Nullable EntityWaypoint waypoint){
this.currentTask = task;
this.currentTask = task;
this.taskWaypoint = waypoint;
this.hasWaypoint = waypoint != null;
if (taskWaypoint != null) {
if(taskWaypoint != null) {
taskX = (int) taskWaypoint.posX;
taskY = (int) taskWaypoint.posY;
taskZ = (int) taskWaypoint.posZ;
if (taskWaypoint.highPriority) {
if(taskWaypoint.highPriority) {
this.entityToAttack = null;
this.setPathToEntity(null);
}

View File

@ -85,7 +85,7 @@ public class EntityGlyphidBehemoth extends EntityGlyphid {
public void acidAttack(){
if (!worldObj.isRemote && entityToAttack instanceof EntityLivingBase) {
if(!worldObj.isRemote && entityToAttack instanceof EntityLivingBase && this.getDistanceToEntity(entityToAttack) < 20) {
this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 20, 6));
EntityChemical chem = new EntityChemical(worldObj, this);

View File

@ -65,7 +65,7 @@ public class EntityGlyphidBlaster extends EntityGlyphidBombardier {
@Override
public int getBombCount() {
return 20;
return 10;
}
@Override

View File

@ -44,7 +44,7 @@ public class EntityGlyphidBombardier extends EntityGlyphid {
this.lastZ = e.posZ;
}
if(this.ticksExisted % 20 == 1) {
if(this.ticksExisted % 60 == 1) {
boolean topAttack = rand.nextBoolean();
@ -95,7 +95,7 @@ public class EntityGlyphidBombardier extends EntityGlyphid {
}
public int getBombCount() {
return 10;
return 5;
}
public float getSpreadMult() {

View File

@ -12,6 +12,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.*;
@ -119,38 +120,35 @@ public class EntityGlyphidScout extends EntityGlyphid {
timer++;
if (!worldObj.isRemote && canBuildHiveHere()) {
if(timer == 1) {
if(timer == 1) {
EntityWaypoint additional = new EntityWaypoint(worldObj);
additional.setLocationAndAngles(posX, posY, posZ, 0, 0);
additional.setWaypointType(TASK_IDLE);
EntityWaypoint additional = new EntityWaypoint(worldObj);
additional.setLocationAndAngles(posX, posY, posZ, 0, 0);
additional.setWaypointType(TASK_IDLE);
//First, go home and get reinforcements
EntityWaypoint home = new EntityWaypoint(worldObj);
home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS);
home.setAdditionalWaypoint(additional);
home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0);
home.maxAge = 1200;
home.radius = 6;
// First, go home and get reinforcements
EntityWaypoint home = new EntityWaypoint(worldObj);
home.setWaypointType(TASK_RETREAT_FOR_REINFORCEMENTS);
home.setAdditionalWaypoint(additional);
home.setLocationAndAngles(homeX, homeY, homeZ, 0, 0);
home.maxAge = 1200;
home.radius = 6;
worldObj.spawnEntityInWorld(home);
worldObj.spawnEntityInWorld(home);
this.taskWaypoint = home;
this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10));
communicate(TASK_RETREAT_FOR_REINFORCEMENTS, taskWaypoint);
this.taskWaypoint = home;
this.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 40 * 20, 10));
communicate(TASK_RETREAT_FOR_REINFORCEMENTS, taskWaypoint);
} else if (timer >= 5) {
} else if(timer >= 5) {
worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false);
GlyphidHive.generateBigGround(worldObj,
(int) Math.floor(posX),
(int) Math.floor(posY),
(int) Math.floor(posZ), rand, true);
this.setDead();
worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false);
GlyphidHive.generateSmall(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rand, this.dataWatcher.getWatchableObjectByte(DW_SUBTYPE) != TYPE_NORMAL, false);
this.setDead();
} else {
communicate(TASK_FOLLOW, taskWaypoint);
}
} else {
communicate(TASK_FOLLOW, taskWaypoint);
}
}
}
}
@ -307,8 +305,11 @@ public class EntityGlyphidScout extends EntityGlyphid {
);
}
//TODO: replace that with some actual directions
protected Vec3 getPlayerTargetDirection() {
EntityPlayer player = worldObj.getClosestPlayerToEntity(this, 300);
if(player != null) {
return Vec3.createVectorHelper(player.posX, player.posY, player.posZ);
}
return PollutionHandler.targetCoords;
}
}

View File

@ -0,0 +1,49 @@
package com.hbm.entity.mob;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.world.World;
public class EntityParasiteMaggot extends EntityMob {
public EntityParasiteMaggot(World world) {
super(world);
this.setSize(0.3F, 0.7F);
}
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.0D);
}
@Override
protected boolean canTriggerWalking() {
return false;
}
@Override
protected Entity findPlayerToAttack() {
return this.worldObj.getClosestVulnerablePlayerToEntity(this, 16);
}
@Override
public void onUpdate() {
this.renderYawOffset = this.rotationYaw;
super.onUpdate();
}
@Override
protected boolean isValidLightLevel() {
return true;
}
@Override
public EnumCreatureAttribute getCreatureAttribute() {
return EnumCreatureAttribute.ARTHROPOD;
}
}

View File

@ -378,8 +378,8 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, living.posX, living.posY + living.height - head, living.posZ), new TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 50));
worldObj.playSoundEffect(victim.posX, victim.posY, victim.posZ, "mob.zombie.woodbreak", 1.0F, 0.95F + rand.nextFloat() * 0.2F);
}
}
}
}
}
}

View File

@ -18,59 +18,57 @@ import net.minecraft.world.World;
import java.util.List;
public class ItemDisperser extends ItemFluidTank {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (!player.capabilities.isCreativeMode) {
--stack.stackSize;
}
if(!player.capabilities.isCreativeMode) {
--stack.stackSize;
}
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!world.isRemote) {
if(!world.isRemote) {
EntityDisperserCanister canister = new EntityDisperserCanister(world, player);
EntityDisperserCanister canister = new EntityDisperserCanister(world, player);
canister.setType(Item.getIdFromItem(this));
canister.setFluid(stack.getItemDamage());
world.spawnEntityInWorld(canister);
}
return stack;
}
canister.setType(Item.getIdFromItem(this));
canister.setFluid(stack.getItemDamage());
world.spawnEntityInWorld(canister);
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List list) {
}
FluidType[] order = Fluids.getInNiceOrder();
return stack;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List list) {
for(int i = 1; i < order.length; ++i) {
FluidType type = order[i];
int id = type.getID();
if(type.isDispersable() && this == ModItems.disperser_canister) {
list.add(new ItemStack(item, 1, id));
} else if(type == Fluids.PHEROMONE || type == Fluids.SULFURIC_ACID && this == ModItems.glyphid_gland) {
list.add(new ItemStack(item, 1, id));
}
FluidType[] order = Fluids.getInNiceOrder();
}
}
for(int i = 1; i < order.length; ++i) {
FluidType type = order[i];
int id = type.getID();
if(type.isDispersable() && this == ModItems.disperser_canister) {
list.add(new ItemStack(item, 1, id));
} else if (type == Fluids.PHEROMONE || type == Fluids.SULFURIC_ACID && this == ModItems.glyphid_gland) {
list.add(new ItemStack(item, 1, id));
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
}
}
String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
String s1 = ("" + StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getUnlocalizedName())).trim();
@Override
public String getItemStackDisplayName(ItemStack stack) {
s = this == ModItems.glyphid_gland ? s1 + " " + s : s + " " + s1;
return s;
}
String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
String s1 = ("" + StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getUnlocalizedName())).trim();
s = this == ModItems.glyphid_gland ? s1 + " " + s : s + " " + s1 ;
return s;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister p_94581_1_) {
super.registerIcons(p_94581_1_);
this.overlayIcon = this == ModItems.disperser_canister ? p_94581_1_.registerIcon("hbm:disperser_canister_overlay") : p_94581_1_.registerIcon("hbm:fluid_identifier_overlay");
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister p_94581_1_) {
super.registerIcons(p_94581_1_);
this.overlayIcon = this == ModItems.disperser_canister ? p_94581_1_.registerIcon("hbm:disperser_canister_overlay") : p_94581_1_.registerIcon("hbm:fluid_identifier_overlay");
}
}

View File

@ -229,7 +229,13 @@ public class HbmWorldGen implements IWorldGenerator {
int x = i + rand.nextInt(16) + 8;
int z = j + rand.nextInt(16) + 8;
int y = world.getHeightValue(x, z);
if(world.getBlock(x, y - 1, z).isNormalCube()) GlyphidHive.generateBigGround(world, x, y, z, rand, false);
for(int k = 3; k >= -1; k--) {
if(world.getBlock(x, y - 1 + k, z).isNormalCube()) {
GlyphidHive.generateSmall(world, x, y + k, z, rand, rand.nextInt(10) == 0, true);
break;
}
}
}
if(biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) {

View File

@ -764,6 +764,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBlaster.class, new RenderGlyphid());
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidScout.class, new RenderGlyphid());
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidNuclear.class, new RenderGlyphidNuclear());
RenderingRegistry.registerEntityRenderingHandler(EntityParasiteMaggot.class, new RenderMaggot());
RenderingRegistry.registerEntityRenderingHandler(EntityFBIDrone.class, new RenderDrone());
RenderingRegistry.registerEntityRenderingHandler(EntityPlasticBag.class, new RenderPlasticBag());
RenderingRegistry.registerEntityRenderingHandler(EntityPigeon.class, new RenderPigeon(new ModelPigeon(), 0.3F));

View File

@ -0,0 +1,28 @@
package com.hbm.render.entity.mob;
import com.hbm.lib.RefStrings;
import net.minecraft.client.model.ModelSilverfish;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
public class RenderMaggot extends RenderLiving {
public static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "textures/entity/parasite_maggot.png");
public RenderMaggot() {
super(new ModelSilverfish(), 0.3F);
}
@Override
protected float getDeathMaxRotation(EntityLivingBase entity) {
return 180.0F;
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return texture;
}
}

View File

@ -1,6 +1,7 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
import com.hbm.items.ModItems;
@ -82,16 +83,20 @@ public class RenderLoot extends TileEntitySpecialRenderer {
protected ModelLeverAction shotgun;
private void renderShotgun() {
if(shotgun == null)
shotgun = new ModelLeverAction();
GL11.glScaled(0.25, 0.25, 0.25);
GL11.glTranslated(3, 0.0625, 2);
GL11.glRotated(-25, 0, 1, 0);
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glTranslated(1, 0, 0);
GL11.glRotated(25, 0, 1, 0);
GL11.glRotated(90, 1, 0, 0);
bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelLeverAction.png"));
shotgun.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F);
GL11.glRotated(90, 0, 1, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
bindTexture(ResourceManager.ff_wood);
ResourceManager.ff_maresleg.renderPart("Grip");
bindTexture(ResourceManager.ff_gun_bright);
ResourceManager.ff_maresleg.renderPart("Gun");
ResourceManager.ff_maresleg.renderPart("Lever");
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
private void renderStandardItem(ItemStack stack) {

View File

@ -44,7 +44,7 @@ public class RenderInfoSystem {
}
}
@SubscribeEvent
@SubscribeEvent(receiveCanceled = true)
public void onOverlayRender(RenderGameOverlayEvent.Pre event) {
if(event.type != ElementType.CROSSHAIRS)
@ -80,7 +80,7 @@ public class RenderInfoSystem {
int side = pX + 5 + longest;
int height = messages.size() * 10 + pZ + 2;
int z = 0;
GL11.glDisable(GL11.GL_TEXTURE_2D);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();

View File

@ -8,6 +8,7 @@ import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBookLore;
import com.hbm.items.ItemAmmoEnums.AmmoFatman;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -140,4 +141,46 @@ public class LootGenerator {
}
}
}
public static void lootBones(World world, int x, int y, int z) {
TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z);
if(loot != null && loot.items.isEmpty()) {
int limit = world.rand.nextInt(3) + 3;
for(int i = 0; i < limit; i++) {
addItemWithDeviation(loot, world.rand, new ItemStack(Items.bone), world.rand.nextDouble() - 0.5, i * 0.03125, world.rand.nextDouble() - 0.5);
}
}
}
public static void lootGlyphidHive(World world, int x, int y, int z) {
TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z);
if(loot != null && loot.items.isEmpty()) {
int limit = world.rand.nextInt(3) + 3;
for(int i = 0; i < limit; i++) {
ItemStack stack = new ItemStack(ModItems.ammo_12gauge, 4);
switch(world.rand.nextInt(11)) {
case 0: stack = new ItemStack(ModItems.steel_plate); break;
case 1: stack = new ItemStack(ModItems.gun_lever_action); break;
case 2: stack = new ItemStack(ModItems.grenade_if_generic); break;
case 3:
case 4: stack = new ItemStack(ModItems.bottle_nuka, 1 + world.rand.nextInt(2)); break;
case 5:
case 6: stack = new ItemStack(ModItems.ingot_steel, 3 + world.rand.nextInt(10)); break;
case 7: stack = new ItemStack(ModItems.steel_pickaxe); break;
case 8: stack = new ItemStack(ModItems.gas_mask_m65); break;
case 9: stack = new ItemStack(ModItems.ammo_20gauge, 8); break;
}
addItemWithDeviation(loot, world.rand, stack, world.rand.nextDouble() - 0.5, i * 0.03125, world.rand.nextDouble() - 0.5);
}
}
}
}

View File

@ -3,130 +3,117 @@ package com.hbm.world.feature;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.util.LootGenerator;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.world.World;
public class GlyphidHive {
public static final int[][][] schematicBigGround = new int[][][] {
public static final int[][][] schematicSmall = new int[][][] {
{
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
},
{
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,1,1,9,1,1,0,0,0},
{0,0,1,1,9,9,9,1,1,0,0},
{0,0,1,9,9,9,9,9,1,0,0},
{0,0,1,1,9,9,9,1,1,0,0},
{0,0,0,1,1,9,1,1,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
},
{
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,3,3,3,0,0,0,0},
{0,0,0,1,1,9,1,1,0,0,0},
{0,0,1,1,9,9,9,1,1,0,0},
{0,3,1,9,9,9,9,9,1,2,0},
{0,3,9,9,9,9,9,9,9,2,0},
{0,3,1,9,9,9,9,9,1,2,0},
{0,0,1,1,9,9,9,1,1,0,0},
{0,0,0,1,1,9,1,1,0,0,0},
{0,0,0,0,2,2,2,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
},
{
{0,0,0,0,0,3,0,0,0,0,0},
{0,0,0,0,3,3,3,0,0,0,0},
{0,0,0,1,3,9,3,1,0,0,0},
{0,0,1,1,9,9,9,1,1,0,0},
{0,3,3,9,9,9,9,9,2,2,0},
{3,3,9,9,9,9,9,9,9,2,2},
{0,3,3,9,9,9,9,9,2,2,0},
{0,0,1,1,9,9,9,1,1,0,0},
{0,0,0,1,2,9,2,1,0,0,0},
{0,0,0,0,2,2,2,0,0,0,0},
{0,0,0,0,0,2,0,0,0,0,0},
},
{
{0,0,0,0,3,3,3,0,0,0,0},
{0,0,0,1,3,3,3,1,0,0,0},
{0,0,1,1,3,9,3,1,1,0,0},
{0,1,1,1,9,9,0,1,1,1,0},
{3,3,3,9,9,9,9,9,2,2,2},
{3,3,9,9,9,9,9,9,9,2,2},
{3,3,3,9,9,9,9,9,2,2,2},
{0,1,1,1,9,9,9,1,1,1,0},
{0,0,1,1,2,9,2,1,1,0,0},
{0,0,0,1,2,2,2,1,0,0,0},
{0,0,0,0,2,2,2,0,0,0,0},
},
{
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,1,1,1,1,1,1,1,1,1,0},
{1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1},
{0,1,1,1,1,1,1,1,1,1,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
},
{
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,1,1,1,3,3,3,1,1,1,0},
{0,1,1,1,3,3,3,1,1,1,0},
{0,1,1,1,3,3,3,1,1,1,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
},
{
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,1,1,2,2,2,1,1,0,0},
{0,1,1,2,2,2,2,2,1,1,0},
{0,1,1,2,2,2,2,2,1,1,0},
{0,1,1,2,2,2,2,2,1,1,0},
{0,0,1,1,2,2,2,1,1,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
},
{
{0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,1,1,1,0},
{0,1,1,1,1,1,1,1,1,1,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,0,1,1,1,1,1,0,0,0},
{0,0,1,1,1,1,1,1,1,0,0},
{0,0,0,0,1,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0},
}
};
public static void generateBigGround(World world, int x, int y, int z, Random rand, boolean openDesign) {
int orientation = rand.nextInt(2) + 2;
int overrideMeta = 0;
public static void generateSmall(World world, int x, int y, int z, Random rand, boolean infected, boolean loot) {
int overrideMeta = infected ? 1 : 0;
for(int i = 0; i < 11; i++) {
for(int j = 0; j < 7; j++) {
for(int j = 0; j < 5; j++) {
for(int k = 0; k < 11; k++) {
int block = schematicBigGround[6 - j][i][k];
boolean hasWall = !openDesign && (block != orientation && block > 1 && block < 6);
if(block == 1 || hasWall) {
world.setBlock(x + i - 5, y + j - 2, z + k - 5, ModBlocks.glyphid_base, overrideMeta, 2);
} else if (block != 0) {
world.setBlock(x + i - 5, y + j - 2, z + k - 5, Blocks.air);
int block = schematicSmall[4 - j][i][k];
int iX = x + i - 5;
int iY = y + j - 2;
int iZ = z + k - 5;
switch(block) {
case 1: world.setBlock(iX, iY, iZ, ModBlocks.glyphid_base, overrideMeta, 2); break;
case 2: world.setBlock(iX, iY, iZ, rand.nextInt(3) == 0 ? ModBlocks.glyphid_spawner : ModBlocks.glyphid_base, overrideMeta, 2); break;
case 3:
int r = rand.nextInt(3);
if(r == 0) {
world.setBlock(iX, iY, iZ, Blocks.skull, 1, 3);
TileEntitySkull skull = (TileEntitySkull) world.getTileEntity(iX, iY, iZ);
if(skull != null) skull.func_145903_a(rand.nextInt(16));
} else if(r == 1) {
world.setBlock(iX, iY, z + k - 5, ModBlocks.deco_loot, 0, 2);
LootGenerator.lootBones(world, iX, iY, iZ);
} else if(r == 2) {
if(loot) {
world.setBlock(iX, iY, iZ, ModBlocks.deco_loot, 0, 2);
LootGenerator.lootGlyphidHive(world, iX, iY, iZ);
} else {
world.setBlock(iX, iY, iZ, ModBlocks.glyphid_base, overrideMeta, 2);
}
}
break;
}
}
}
}
world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner, overrideMeta, 2);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 154 B