improved nature documentaries

This commit is contained in:
Bob 2023-10-18 22:25:19 +02:00
parent 0563ef2560
commit d2e94af59d
8 changed files with 221 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
import net.minecraft.world.biome.BiomeGenBase.TempCategory;
public class EntityMappings {
@ -252,10 +253,12 @@ public class EntityMappings {
addMob(EntityGlyphidBlaster.class, "entity_glyphid_blaster", 0xD83737, 0xDBB79D);
addMob(EntityGlyphidScout.class, "entity_glyphid_scout", 0x273038, 0xB9E36B);
addMob(EntityGlyphidNuclear.class, "entity_glyphid_nuclear", 0x267F00, 0xA0A0A0);
addMob(EntityPlasticBag.class, "entity_plastic_bag", 0xd0d0d0, 0x808080);
addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
addSpawn(EntityCreeperGold.class, 1, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray());
addSpawn(EntityPlasticBag.class, 1, 1, 3, EnumCreatureType.waterCreature, getOceanBiomes());
int id = 0;
for(Quartet<Class<? extends Entity>, String, Integer, Boolean> entry : entityMappings) {
@ -300,4 +303,15 @@ public class EntityMappings {
spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max));
}
}
public static BiomeGenBase[] getOceanBiomes() {
List<BiomeGenBase> biomes = new ArrayList();
for(BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
if(biome != null && biome.getTempCategory() == TempCategory.OCEAN) {
biomes.add(biome);
}
}
return biomes.toArray(new BiomeGenBase[0]);
}
}

View File

@ -0,0 +1,160 @@
package com.hbm.entity.mob;
import com.hbm.entity.item.EntityItemBuoyant;
import com.hbm.items.ModItems;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
/**
* Copy-pasted shit from the squid class
* Mojang-certified
*
* @author hbm
*/
public class EntityPlasticBag extends EntityWaterMob {
public float rotation;
public float prevRotation;
private float randomMotionSpeed;
private float rotationVelocity;
private float randomMotionVecX;
private float randomMotionVecY;
private float randomMotionVecZ;
public EntityPlasticBag(World world) {
super(world);
this.setSize(0.45F, 0.45F);
this.rotationVelocity = 1.0F / (this.rand.nextFloat() + 1.0F) * 0.2F;
}
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
if(!worldObj.isRemote) {
this.setDead();
this.dropItem(ModItems.plastic_bag, 1);
}
return true;
}
@Override
public EntityItem entityDropItem(ItemStack stack, float offset) {
if(stack.stackSize != 0 && stack.getItem() != null) {
EntityItemBuoyant entityitem = new EntityItemBuoyant(this.worldObj, this.posX, this.posY + (double) offset, this.posZ, stack);
entityitem.delayBeforeCanPickup = 10;
if(captureDrops) {
capturedDrops.add(entityitem);
} else {
this.worldObj.spawnEntityInWorld(entityitem);
}
return entityitem;
} else {
return null;
}
}
@Override
protected String getLivingSound() {
return null;
}
@Override
protected String getHurtSound() {
return null;
}
@Override
protected String getDeathSound() {
return null;
}
@Override
protected boolean canTriggerWalking() {
return false;
}
@Override
public boolean isInWater() {
return this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.6D, 0.0D), Material.water, this);
}
@Override
public void onLivingUpdate() {
super.onLivingUpdate();
this.prevRotation = this.rotation;
this.rotation += this.rotationVelocity;
if(this.rotation > ((float) Math.PI * 2F)) {
this.rotation -= ((float) Math.PI * 2F);
if(this.rand.nextInt(10) == 0) {
this.rotationVelocity = 1.0F / (this.rand.nextFloat() + 1.0F) * 0.2F;
}
}
if(this.isInWater()) {
float f;
if(this.rotation < (float) Math.PI) {
f = this.rotation / (float) Math.PI;
if((double) f > 0.75D) {
this.randomMotionSpeed = 0.1F;
}
} else {
this.randomMotionSpeed *= 0.999F;
}
if(!this.worldObj.isRemote) {
this.motionX = (double) (this.randomMotionVecX * this.randomMotionSpeed);
this.motionY = (double) (this.randomMotionVecY * this.randomMotionSpeed);
this.motionZ = (double) (this.randomMotionVecZ * this.randomMotionSpeed);
}
f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.renderYawOffset += (-((float) Math.atan2(this.motionX, this.motionZ)) * 180.0F / (float) Math.PI - this.renderYawOffset) * 0.1F;
this.rotationYaw = this.renderYawOffset;
this.rotationPitch = (float)(Math.atan2(this.motionY, (double)f) * 180.0D / Math.PI);
} else {
if(!this.worldObj.isRemote) {
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.98D;
this.motionZ = 0.0D;
}
}
}
@Override
public void moveEntityWithHeading(float forward, float strafe) {
this.moveEntity(this.motionX, this.motionY, this.motionZ);
}
@Override
protected void updateEntityActionState() {
++this.entityAge;
if(this.entityAge > 100) {
this.randomMotionVecX = this.randomMotionVecY = this.randomMotionVecZ = 0.0F;
} else if(this.rand.nextInt(50) == 0 || !this.inWater || this.randomMotionVecX == 0.0F && this.randomMotionVecY == 0.0F && this.randomMotionVecZ == 0.0F) {
float f = this.rand.nextFloat() * (float) Math.PI * 2.0F;
this.randomMotionVecX = MathHelper.cos(f) * 0.2F;
this.randomMotionVecY = -0.1F + this.rand.nextFloat() * 0.2F;
this.randomMotionVecZ = MathHelper.sin(f) * 0.2F;
}
this.despawnEntity();
}
@Override
public boolean getCanSpawnHere() {
return this.posY > 45.0D && this.posY < 63.0D && super.getCanSpawnHere();
}
}

View File

@ -63,7 +63,7 @@ public class ContainerPlasticBag extends Container {
public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) {
// prevents the player from moving around the currently open box
if(mode == 2 && button == player.inventory.currentItem) return null;
if(index == player.inventory.currentItem + 47) return null;
if(index == player.inventory.currentItem + 28) return null;
return super.slotClick(index, button, mode, player);
}

View File

@ -752,6 +752,7 @@ public class ClientProxy extends ServerProxy {
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidScout.class, new RenderGlyphid());
RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidNuclear.class, new RenderGlyphidNuclear());
RenderingRegistry.registerEntityRenderingHandler(EntityFBIDrone.class, new RenderDrone());
RenderingRegistry.registerEntityRenderingHandler(EntityPlasticBag.class, new RenderPlasticBag());
//"particles"
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.smoke1, ModItems.smoke2, ModItems.smoke3, ModItems.smoke4, ModItems.smoke5, ModItems.smoke6, ModItems.smoke7, ModItems.smoke8 }));
RenderingRegistry.registerEntityRenderingHandler(EntityBSmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.b_smoke1, ModItems.b_smoke2, ModItems.b_smoke3, ModItems.b_smoke4, ModItems.b_smoke5, ModItems.b_smoke6, ModItems.b_smoke7, ModItems.b_smoke8 }));

View File

@ -37,5 +37,4 @@ public class RenderBalls extends Render {
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
return ResourceManager.universal_bright;
}
}

View File

@ -0,0 +1,41 @@
package com.hbm.render.entity.mob;
import org.lwjgl.opengl.GL11;
import com.hbm.lib.RefStrings;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
public class RenderPlasticBag extends Render {
private static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/mobs/plasticbag.obj"));
private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "textures/entity/plasticbag.png");
public RenderPlasticBag() {
this.shadowOpaque = 0.0F;
}
@Override
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * f1 + 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * f1 - 90, 0.0F, 0.0F, 1.0F);
this.bindEntityTexture(entity);
model.renderAll();
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return texture;
}
}

View File

@ -537,6 +537,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_plastic_bag.name=Plastiktüte
entity.entity_taint_crab.name=Verseuchte Krabbe
entity.entity_tesla_crab.name=Tesla-Krabbe
entity.hbm.entity_balls_o_tron.name=Balls-O-Tron Prime
@ -2672,6 +2673,7 @@ item.plan_c.name=Plan C
item.plant_item.mustardwillow.name=Senf-Weidenblatt
item.plant_item.rope.name=Seil
item.plant_item.tobacco.name=Tabak
item.plastic_bag.name=Plastiktüte
item.plate_advanced_alloy.name=Fortgeschrittene Legierungsplatte
item.plate_aluminium.name=Aluminiumplatte
item.plate_armor_ajr.name=Eisenbeschlagene Panzerplatte

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_plastic_bag.name=Plastic Bag
entity.entity_taint_crab.name=Taint Crab
entity.entity_tesla_crab.name=Tesla Crab
entity.hbm.entity_balls_o_tron.name=Balls-O-Tron Prime
@ -3467,6 +3468,7 @@ item.plan_c.desc=Deadly
item.plant_item.mustardwillow.name=Mustard Willow Leaf
item.plant_item.rope.name=Rope
item.plant_item.tobacco.name=Tobacco
item.plastic_bag.name=Plastic Bag
item.plate_advanced_alloy.name=Advanced Alloy Plate
item.plate_aluminium.name=Aluminium Plate
item.plate_armor_ajr.name=Iron-Shod Armor Plating