Lapis Change

This commit is contained in:
mDiyo 2013-04-13 08:48:19 -07:00
parent d54db4d18a
commit 4fb70de8a8
10 changed files with 210 additions and 119 deletions

View File

@ -3,6 +3,7 @@ package mods.tinker.common;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -11,7 +12,8 @@ public abstract class ToolMod
{
public final String key;
public final List stacks;
public final int effectIndex; //255 is always blank
public final int effectIndex;
public static Random random = new Random();
public ToolMod(ItemStack[] items, int effect, String dataKey)
{

View File

@ -23,7 +23,7 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
* @author: mDiyo
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.28.7")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.28.9")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class)
public class TConstruct
{

View File

@ -173,6 +173,7 @@ public class TContent implements IFuelHandler
//Tool modifiers
public static ModElectric modE;
public static ModLapis modL;
//Golems
public static Block glowSapling;
@ -533,7 +534,8 @@ public class TContent implements IFuelHandler
ItemStack lapisItem = new ItemStack(Item.dyePowder, 1, 4);
ItemStack lapisBlock = new ItemStack(Block.blockLapis);
tb.registerToolMod(new ModLapis(new ItemStack[] { lapisItem }, 10, 1));
modL = new ModLapis(new ItemStack[] { lapisItem }, 10, 1);
tb.registerToolMod(modL);
tb.registerToolMod(new ModLapis(new ItemStack[] { lapisItem, lapisItem }, 10, 2));
tb.registerToolMod(new ModLapis(new ItemStack[] { lapisBlock }, 10, 9));
tb.registerToolMod(new ModLapis(new ItemStack[] { lapisItem, lapisBlock }, 10, 10));

View File

@ -26,8 +26,8 @@ public class SlotTool extends Slot
*/
public boolean isItemValid(ItemStack stack)
{
//return false;
return stack.getItem() instanceof ToolCore;
return false;
//return stack.getItem() instanceof ToolCore;
}
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack stack)

View File

@ -10,7 +10,7 @@ public class UnstableCreeper extends EntityCreeper
protected int timeSinceIgnited;
protected int lastActiveTime;
protected float explosionRadius = 1.5f;
public float explosionRadius = 1f;
public UnstableCreeper(World world)
{
@ -25,21 +25,26 @@ public class UnstableCreeper extends EntityCreeper
protected void fall (float distance)
{
if (!this.worldObj.isRemote && distance > 3)
if (!this.worldObj.isRemote)
{
if (distance > 5)
{
boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
if (this.getPowered())
{
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1))* 2, false);
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (0.75f * (worldObj.difficultySetting - 1)) * 2, false);
}
else
{
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1)), false);
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (0.75f * (worldObj.difficultySetting - 1)), false);
}
this.setDead();
}
else
super.fall(distance);
}
}
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
@ -87,11 +92,11 @@ public class UnstableCreeper extends EntityCreeper
if (this.getPowered())
{
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1))* 2, flag);
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 1f * (worldObj.difficultySetting - 1)) * 2, flag);
}
else
{
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1)), flag);
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 1f * (worldObj.difficultySetting - 1)), flag);
}
this.setDead();

View File

@ -1,5 +1,6 @@
package mods.tinker.tconstruct.library;
import mods.tinker.tconstruct.TContent;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
@ -23,6 +24,7 @@ public abstract class HarvestTool extends ToolCore
@Override
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player)
{
TContent.modL.midStreamModify(stack);
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
World world = player.worldObj;
int bID = player.worldObj.getBlockId(x, y, z);

View File

@ -569,32 +569,40 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
* Every tool can be an electric tool if you modify it right
*/
@Override
public boolean canBeStoredInToolbox (ItemStack itemstack)
public boolean canBeStoredInToolbox (ItemStack stack)
{
return true;
}
@Override
public boolean canProvideEnergy (ItemStack itemStack)
public boolean canProvideEnergy (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (!tags.hasKey("charge"))
return false;
return true;
}
@Override
public int getChargedItemId (ItemStack itemStack)
public int getChargedItemId (ItemStack stack)
{
return this.itemID;
}
@Override
public int getEmptyItemId (ItemStack itemStack)
public int getEmptyItemId (ItemStack stack)
{
return this.itemID;
}
@Override
public int getMaxCharge (ItemStack itemStack)
public int getMaxCharge (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (!tags.hasKey("charge"))
return 0;
return 10000;
}
@ -605,8 +613,12 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
}
@Override
public int getTransferLimit (ItemStack itemStack)
public int getTransferLimit (ItemStack stack)
{
NBTTagCompound tags = stack.getTagCompound();
if (!tags.hasKey("charge"))
return 0;
return 32;
}

View File

@ -1,7 +1,9 @@
package mods.tinker.tconstruct.library;
import mods.tinker.tconstruct.TContent;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
@ -90,6 +92,12 @@ public abstract class Weapon extends ToolCore
return 1;
}
public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity entity)
{
TContent.modL.midStreamModify(stack);
return super.onLeftClickEntity(stack, player, entity);
}
public static Material[] web = new Material[] { Material.web };
public static Material[] none = new Material[0];
}

View File

@ -15,14 +15,13 @@ public class ModLapis extends ToolMod
{
String tooltipName;
int increase;
int max;
int max = 450;
public ModLapis(ItemStack[] items, int effect, int inc)
{
super(items, effect, "Lapis");
tooltipName = "\u00a79Luck";
increase = inc;
max = 100;
}
@Override
@ -33,7 +32,7 @@ public class ModLapis extends ToolMod
return tags.getInteger("Modifiers") > 0;
int keyPair[] = tags.getIntArray(key);
if (keyPair[0] + increase <= 100)
if (keyPair[0] + increase <= max)
return true;
else
return false;
@ -47,7 +46,7 @@ public class ModLapis extends ToolMod
{
tags.setBoolean(key, true);
String modName = "\u00a79Lapis (0/100)";
String modName = "\u00a79Lapis (0/450)";
int tooltipIndex = addToolTip(tool, "\u00a79Luck", modName);
int[] keyPair = new int[] { 0, tooltipIndex };
tags.setIntArray(key, keyPair);
@ -62,26 +61,87 @@ public class ModLapis extends ToolMod
tags.setIntArray(key, keyPair);
if (tool.getItem() instanceof Weapon)
{
if (keyPair[0] >= 100)
if (keyPair[0] >= 450)
addEnchantment(tool, Enchantment.looting, 3);
else if (keyPair[0] >= 50)
else if (keyPair[0] >= 300)
addEnchantment(tool, Enchantment.looting, 2);
else if (keyPair[0] >= 20)
else if (keyPair[0] >= 100)
addEnchantment(tool, Enchantment.looting, 1);
}
else
{
if (keyPair[0] >= 100)
if (keyPair[0] >= 450)
addEnchantment(tool, Enchantment.fortune, 3);
else if (keyPair[0] >= 50)
else if (keyPair[0] >= 300)
addEnchantment(tool, Enchantment.fortune, 2);
else if (keyPair[0] >= 20)
else if (keyPair[0] >= 100)
addEnchantment(tool, Enchantment.fortune, 1);
}
updateModTag(tool, keyPair);
}
public void midStreamModify (ItemStack tool)
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
if (!tags.hasKey(key))
return;
int keyPair[] = tags.getIntArray(key);
if (keyPair[0] == max)
return;
if (random.nextInt(50) == 0)
{
keyPair[0] += 1;
tags.setIntArray(key, keyPair);
updateModTag(tool, keyPair);
}
if (tool.getItem() instanceof Weapon)
{
if (keyPair[0] >= 350)
{
int chance = keyPair[0] - 300;
if (random.nextInt(1000 - chance) == 0)
addEnchantment(tool, Enchantment.looting, 3);
}
else if (keyPair[0] >= 125)
{
int chance = keyPair[0] - 175;
if (random.nextInt(600 - chance) == 0)
addEnchantment(tool, Enchantment.looting, 2);
}
else if (keyPair[0] >= 10)
{
int chance = keyPair[0] - 25;
if (random.nextInt(250 - chance) == 0)
addEnchantment(tool, Enchantment.looting, 1);
}
}
else
{
if (keyPair[0] >= 350)
{
int chance = keyPair[0] - 300;
if (random.nextInt(1000 - chance) == 0)
addEnchantment(tool, Enchantment.fortune, 3);
}
else if (keyPair[0] >= 125)
{
int chance = keyPair[0] - 175;
if (random.nextInt(600 - chance) == 0)
addEnchantment(tool, Enchantment.fortune, 2);
}
else if (keyPair[0] >= 10)
{
int chance = keyPair[0] - 25;
if (random.nextInt(250 - chance) == 0)
addEnchantment(tool, Enchantment.fortune, 1);
}
}
}
public void addEnchantment (ItemStack tool, Enchantment enchant, int level)
{
NBTTagList tags = new NBTTagList("ench");
@ -123,7 +183,7 @@ public class ModLapis extends ToolMod
{
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
String tip = "ModifierTip" + keys[1];
String modName = "\u00a79Lapis ("+keys[0]+"/100)";
String modName = "\u00a79Lapis (" + keys[0] + "/" + max + ")";
tags.setString(tip, modName);
}
}

View File

@ -29,7 +29,7 @@ public class Rapier extends Weapon
{
if (player.onGround)
{
player.addExhaustion(0.2f);
player.addExhaustion(0.1f);
player.motionY += 0.32;
float f = 0.5F;
player.motionX = (double) (MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * f);