Lapis Change
This commit is contained in:
parent
d54db4d18a
commit
4fb70de8a8
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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));
|
||||
|
@ -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)
|
||||
|
@ -6,114 +6,119 @@ import net.minecraft.world.World;
|
||||
|
||||
public class UnstableCreeper extends EntityCreeper
|
||||
{
|
||||
protected int fuseTime = 12;
|
||||
protected int timeSinceIgnited;
|
||||
protected int lastActiveTime;
|
||||
protected int fuseTime = 12;
|
||||
protected int timeSinceIgnited;
|
||||
protected int lastActiveTime;
|
||||
|
||||
protected float explosionRadius = 1.5f;
|
||||
public float explosionRadius = 1f;
|
||||
|
||||
public UnstableCreeper(World world)
|
||||
{
|
||||
super(world);
|
||||
public UnstableCreeper(World world)
|
||||
{
|
||||
super(world);
|
||||
this.texture = "/mods/tinker/textures/mob/creeperunstable.png";
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxHealth()
|
||||
public int getMaxHealth ()
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
protected void fall (float distance)
|
||||
{
|
||||
if (!this.worldObj.isRemote && distance > 3)
|
||||
{
|
||||
boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
protected void fall (float distance)
|
||||
{
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1)), false);
|
||||
}
|
||||
if (this.getPowered())
|
||||
{
|
||||
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) (0.75f * (worldObj.difficultySetting - 1)), false);
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
else
|
||||
super.fall(distance);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setShort("Fuse", (short) this.fuseTime);
|
||||
}
|
||||
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeEntityToNBT(par1NBTTagCompound);
|
||||
par1NBTTagCompound.setShort("Fuse", (short) this.fuseTime);
|
||||
}
|
||||
|
||||
public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readEntityFromNBT(par1NBTTagCompound);
|
||||
|
||||
if (par1NBTTagCompound.hasKey("Fuse"))
|
||||
{
|
||||
this.fuseTime = par1NBTTagCompound.getShort("Fuse");
|
||||
}
|
||||
}
|
||||
if (par1NBTTagCompound.hasKey("Fuse"))
|
||||
{
|
||||
this.fuseTime = par1NBTTagCompound.getShort("Fuse");
|
||||
}
|
||||
}
|
||||
|
||||
public void onUpdate ()
|
||||
{
|
||||
if (this.isEntityAlive())
|
||||
{
|
||||
this.lastActiveTime = this.timeSinceIgnited;
|
||||
int i = this.getCreeperState();
|
||||
public void onUpdate ()
|
||||
{
|
||||
if (this.isEntityAlive())
|
||||
{
|
||||
this.lastActiveTime = this.timeSinceIgnited;
|
||||
int i = this.getCreeperState();
|
||||
|
||||
if (i > 0 && this.timeSinceIgnited == 0)
|
||||
{
|
||||
this.playSound("random.fuse", 1.0F, 0.5F);
|
||||
}
|
||||
if (i > 0 && this.timeSinceIgnited == 0)
|
||||
{
|
||||
this.playSound("random.fuse", 1.0F, 0.5F);
|
||||
}
|
||||
|
||||
this.timeSinceIgnited += i;
|
||||
this.timeSinceIgnited += i;
|
||||
|
||||
if (this.timeSinceIgnited < 0)
|
||||
{
|
||||
this.timeSinceIgnited = 0;
|
||||
}
|
||||
if (this.timeSinceIgnited < 0)
|
||||
{
|
||||
this.timeSinceIgnited = 0;
|
||||
}
|
||||
|
||||
if (this.timeSinceIgnited >= this.fuseTime)
|
||||
{
|
||||
this.timeSinceIgnited = this.fuseTime;
|
||||
if (this.timeSinceIgnited >= this.fuseTime)
|
||||
{
|
||||
this.timeSinceIgnited = this.fuseTime;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
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, flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (this.explosionRadius + 0.75f * (worldObj.difficultySetting-1)), flag);
|
||||
}
|
||||
if (this.getPowered())
|
||||
{
|
||||
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 + 1f * (worldObj.difficultySetting - 1)), flag);
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onUpdate();
|
||||
}
|
||||
super.onUpdate();
|
||||
}
|
||||
|
||||
public float getCreeperFlashIntensity (float par1)
|
||||
{
|
||||
return ((float) this.lastActiveTime + (float) (this.timeSinceIgnited - this.lastActiveTime) * par1) / (float) (this.fuseTime - 2);
|
||||
}
|
||||
public float getCreeperFlashIntensity (float par1)
|
||||
{
|
||||
return ((float) this.lastActiveTime + (float) (this.timeSinceIgnited - this.lastActiveTime) * par1) / (float) (this.fuseTime - 2);
|
||||
}
|
||||
|
||||
protected void dropFewItems(boolean par1, int par2)
|
||||
protected void dropFewItems (boolean par1, int par2)
|
||||
{
|
||||
int j = this.getDropItemId();
|
||||
|
||||
if (j > 0)
|
||||
{
|
||||
int k = this.rand.nextInt(3)+3;
|
||||
int k = this.rand.nextInt(3) + 3;
|
||||
|
||||
if (par2 > 0)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -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,27 +61,88 @@ 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 addEnchantment(ItemStack tool, Enchantment enchant, int level)
|
||||
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");
|
||||
Map enchantMap = EnchantmentHelper.getEnchantments(tool);
|
||||
@ -93,27 +153,27 @@ public class ModLapis extends ToolMod
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
NBTTagCompound enchantTag = new NBTTagCompound();
|
||||
index = ((Integer)iterator.next()).intValue();
|
||||
index = ((Integer) iterator.next()).intValue();
|
||||
lvl = (Integer) enchantMap.get(index);
|
||||
if (index == enchant.effectId)
|
||||
{
|
||||
hasEnchant = true;
|
||||
enchantTag.setShort("id", (short)index);
|
||||
enchantTag.setShort("lvl", (short)((byte)level));
|
||||
enchantTag.setShort("id", (short) index);
|
||||
enchantTag.setShort("lvl", (short) ((byte) level));
|
||||
tags.appendTag(enchantTag);
|
||||
}
|
||||
else
|
||||
{
|
||||
enchantTag.setShort("id", (short)index);
|
||||
enchantTag.setShort("lvl", (short)((byte)lvl));
|
||||
enchantTag.setShort("id", (short) index);
|
||||
enchantTag.setShort("lvl", (short) ((byte) lvl));
|
||||
tags.appendTag(enchantTag);
|
||||
}
|
||||
}
|
||||
if (!hasEnchant)
|
||||
{
|
||||
NBTTagCompound enchantTag = new NBTTagCompound();
|
||||
enchantTag.setShort("id", (short)enchant.effectId);
|
||||
enchantTag.setShort("lvl", (short)((byte)level));
|
||||
enchantTag.setShort("id", (short) enchant.effectId);
|
||||
enchantTag.setShort("lvl", (short) ((byte) level));
|
||||
tags.appendTag(enchantTag);
|
||||
}
|
||||
tool.stackTagCompound.setTag("ench", tags);
|
||||
@ -122,8 +182,8 @@ public class ModLapis extends ToolMod
|
||||
void updateModTag (ItemStack tool, int[] keys)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
String tip = "ModifierTip"+keys[1];
|
||||
String modName = "\u00a79Lapis ("+keys[0]+"/100)";
|
||||
String tip = "ModifierTip" + keys[1];
|
||||
String modName = "\u00a79Lapis (" + keys[0] + "/" + max + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user