Added a config option to make worms die after a certain amout of time

This commit is contained in:
Ellpeck 2016-08-07 13:09:44 +02:00
parent b0eb83f45f
commit 8910b91f02
3 changed files with 12 additions and 3 deletions

View file

@ -22,6 +22,7 @@ public enum ConfigIntValues{
COFFEE_AMOUNT("Coffee: Amount", ConfigCategories.WORLD_GEN, 6, 1, 50, "The Amount of Coffee generating"), COFFEE_AMOUNT("Coffee: Amount", ConfigCategories.WORLD_GEN, 6, 1, 50, "The Amount of Coffee generating"),
BLACK_LOTUS_AMOUNT("Black Lotus: Amount", ConfigCategories.WORLD_GEN, 14, 1, 50, "The Amount of Black Lotus generating"), BLACK_LOTUS_AMOUNT("Black Lotus: Amount", ConfigCategories.WORLD_GEN, 14, 1, 50, "The Amount of Black Lotus generating"),
LUSH_CAVE_CHANCE("Lush Caves: Chance", ConfigCategories.WORLD_GEN, 20, 1, 100, "The chance for lush caves to generate. The lower the number, the likelier."), LUSH_CAVE_CHANCE("Lush Caves: Chance", ConfigCategories.WORLD_GEN, 20, 1, 100, "The chance for lush caves to generate. The lower the number, the likelier."),
WORMS_DIE_TIME("Worm Death Time", ConfigCategories.OTHER, 0, 0, 10000000, "The amount of ticks it takes for a worm to die. Set it to zero to make worms not die at all."),
TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 5, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client"), TILE_ENTITY_UPDATE_INTERVAL("Tile Entities: Update Interval", ConfigCategories.OTHER, 5, 1, 100, "The amount of ticks waited before a TileEntity sends an additional Update to the Client"),
CTRL_INFO_NBT_CHAR_LIMIT("Advanced Info NBT Character Limit", ConfigCategories.OTHER, 1000, 0, 100000000, "The maximum amount of characters that is displayed by the NBT view of the CTRL Advanced Info. Set to a zero to have no limit"); CTRL_INFO_NBT_CHAR_LIMIT("Advanced Info NBT Character Limit", ConfigCategories.OTHER, 1000, 0, 100000000, "The maximum amount of characters that is displayed by the NBT view of the CTRL Advanced Info. Set to a zero to have no limit");

View file

@ -10,6 +10,7 @@
package de.ellpeck.actuallyadditions.mod.entity; package de.ellpeck.actuallyadditions.mod.entity;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
@ -50,9 +51,9 @@ public class EntityWorm extends Entity{
@Override @Override
public void onEntityUpdate(){ public void onEntityUpdate(){
this.timer++;
if(!this.worldObj.isRemote){ if(!this.worldObj.isRemote){
this.timer++;
if(this.timer%50 == 0){ if(this.timer%50 == 0){
for(int x = -1; x <= 1; x++){ for(int x = -1; x <= 1; x++){
for(int z = -1; z <= 1; z++){ for(int z = -1; z <= 1; z++){
@ -98,6 +99,11 @@ public class EntityWorm extends Entity{
} }
} }
} }
int dieTime = ConfigIntValues.WORMS_DIE_TIME.getValue();
if(dieTime > 0 && this.timer >= dieTime){
this.setDead();
}
} }
} }

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.entity;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
@ -47,7 +48,8 @@ public class RenderWorm extends Render<EntityWorm>{
public void doRender(EntityWorm entity, double x, double y, double z, float entityYaw, float partialTicks){ public void doRender(EntityWorm entity, double x, double y, double z, float entityYaw, float partialTicks){
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(x, y+0.7F, z); GlStateManager.translate(x, y+0.7F, z);
GlStateManager.rotate((float)(((entity.timer)%360)), 0, 1, 0); double boop = Minecraft.getSystemTime()/70D;
GlStateManager.rotate((float)((boop%360)), 0, 1, 0);
GlStateManager.translate(0, 0, 0.4); GlStateManager.translate(0, 0, 0.4);
AssetUtil.renderItemInWorld(STACK); AssetUtil.renderItemInWorld(STACK);
GlStateManager.popMatrix(); GlStateManager.popMatrix();