Unmerged 1.6.4 commit: Fix King Slime #931

This commit is contained in:
Bernhard Bonigl committed 2014-08-28 17:16:10 +02:00
1 parent 409c4ae59e
commit cada291012
3 files changed
+55 -14

No files matched your search

@@ -66,6 +66,8 @@ public class PHConstruct
denyMattock = config.get("Difficulty Changes", "Deny creation of non-metal mattocks", false).getBoolean(false);
craftEndstone = config.get("Difficulty Changes", "Allow creation of endstone", true).getBoolean(true);
naturalSlimeSpawn = config.get("Mobs", "Blue Slime spawn chance", 1, "Set to 0 to disable").getInt(1);
ingotsPerOre = config.get("Smeltery Output Modification", "Ingots per ore", 2, "Number of ingots returned from smelting ores in the smeltery").getDouble(2);
ingotsBronzeAlloy = config.get("Smeltery Output Modification", "Bronze ingot return", 4, "Number of ingots returned from smelting Bronze in the smeltery").getDouble(4);
ingotsAluminumBrassAlloy = config.get("Smeltery Output Modification", "Aluminum Brass ingot return", 4, "Number of ingots returned from smelting Aluminum Brass in the smeltery").getDouble(4);
@@ -276,6 +278,7 @@ public class PHConstruct
public static boolean tconComesFirst;
// Mobs
public static int naturalSlimeSpawn;
// Difficulty modifiers
public static boolean keepHunger;
@@ -9,6 +9,7 @@ import net.minecraft.block.Block.SoundType;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@@ -16,6 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.potion.Potion;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.Fluid;
@@ -51,6 +53,7 @@ import tconstruct.tools.entity.FancyEntityItem;
import tconstruct.tools.entity.LaunchedPotion;
import tconstruct.tools.itemblocks.MultiBrickFancyItem;
import tconstruct.tools.itemblocks.MultiBrickItem;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.blocks.ConveyorBase;
import tconstruct.world.blocks.GravelOre;
import tconstruct.world.blocks.MeatBlock;
@@ -308,8 +311,7 @@ public class TinkerWorld
}
public void createEntities ()
{
public void createEntities () {
EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(DaggerEntity.class, "Dagger", 1, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 3, true);
@@ -321,6 +323,16 @@ public class TinkerWorld
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
// EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13,
// TConstruct.instance, 64, 5, true);
if (PHConstruct.naturalSlimeSpawn > 0) {
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.FOREST));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.PLAINS));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.MOUNTAIN));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.HILLS));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.SWAMP));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.JUNGLE));
EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.WASTELAND));
}
}
private void craftingTableRecipes()
@@ -39,7 +39,11 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
public BlueSlime(World world)
{
super(world);
// this.texture = "/mods/tinker/textures/mob/slimeedible.png";
initializeSlime();
}
protected void initializeSlime ()
{
int offset = this.rand.nextInt(299);
if (offset < 149)
offset = 1;
@@ -52,7 +56,6 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
this.slimeJumpDelay = this.rand.nextInt(120) + 40;
this.setSlimeSize(size);
this.jumpMovementFactor = 0.004F * size + 0.01F;
this.setHealth(getMaxHealthForSize());
}
protected void damageEntity (DamageSource damageSource, int damage)
@@ -186,6 +189,28 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
int y = MathHelper.floor_double(this.boundingBox.minY);
int z = MathHelper.floor_double(this.posZ);
if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) > this.rand.nextInt(32))
{
return false;
}
else
{
int light = this.worldObj.getBlockLightValue(x, y, z);
if (this.worldObj.isThundering())
{
int i1 = this.worldObj.skylightSubtracted;
this.worldObj.skylightSubtracted = 10;
light = this.worldObj.getBlockLightValue(x, y, z);
this.worldObj.skylightSubtracted = i1;
}
return light <= this.rand.nextInt(8);
}
/*int x = MathHelper.floor_double(this.posX);
int y = MathHelper.floor_double(this.boundingBox.minY);
int z = MathHelper.floor_double(this.posZ);
if (y < 60 && rand.nextInt(5) != 0)
{
return false;
@@ -208,7 +233,7 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
}
return light <= this.rand.nextInt(8);
}
}*/
}
@Override
@@ -223,8 +248,8 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
this.dataWatcher.updateObject(16, new Byte((byte) size));
this.setSize(0.6F * (float) size, 0.6F * (float) size);
this.setPosition(this.posX, this.posY, this.posZ);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.getMaxHealth());
this.setHealth(this.getMaxHealth());
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.getMaxHealthForSize());
this.setHealth(this.getMaxHealthForSize());
this.experienceValue = size + 2 ^ (size);
if (size >= 8)
@@ -334,7 +359,8 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
protected void updateEntityActionState ()
{
// Minecraft.getMinecraft().getLogAgent().logInfo("Collided with "+entity.getEntityName());
this.despawnEntity();
if (this.getSlimeSize() < 8)
this.despawnEntity();
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
if (entityplayer != null)
@@ -450,13 +476,13 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
{
ToolCore tool = getValidTool();
Item accessory = tool.getAccessoryItem();
ItemStack accessoryStack = accessory != null ? new ItemStack(tool.getAccessoryItem(), 1, 17) : null;
ItemStack toolStack = ToolBuilder.instance.buildTool(new ItemStack(tool.getHeadItem(), 1, 17), new ItemStack(tool.getHandleItem(), 1, 17), accessoryStack,
ItemStack accessoryStack = tool.getAccessoryItem() != null ? new ItemStack(tool.getAccessoryItem(), 1, 17) : null;
ItemStack extraStack = tool.getExtraItem() != null ? new ItemStack(tool.getExtraItem(), 1, 17) : null;
ItemStack toolStack = ToolBuilder.instance.buildTool(new ItemStack(tool.getHeadItem(), 1, 17), new ItemStack(tool.getHandleItem(), 1, 17), accessoryStack, extraStack,
"King Slime " + tool.getToolName());
NBTTagCompound tags = toolStack.getTagCompound().getCompoundTag("InfiTool");
tags.setInteger("Attack", 3 + tool.getDamageVsEntity(null));
tags.setInteger("Attack", 5 + tool.getDamageVsEntity(null));
tags.setInteger("TotalDurability", 2500);
tags.setInteger("BaseDurability", 2500);
tags.setInteger("MiningSpeed", 1400);
@@ -473,8 +499,8 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData
ToolCore getValidTool ()
{
ToolCore tool = TConstructRegistry.tools.get(rand.nextInt(TConstructRegistry.tools.size()));
if (tool.getAccessoryItem() != null)
tool = getValidTool();
/*if (tool.getExtraItem() != null)
tool = getValidTool();*/
return tool;
}