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.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@ -11,7 +12,8 @@ public abstract class ToolMod
|
|||||||
{
|
{
|
||||||
public final String key;
|
public final String key;
|
||||||
public final List stacks;
|
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)
|
public ToolMod(ItemStack[] items, int effect, String dataKey)
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
|
|||||||
* @author: mDiyo
|
* @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)
|
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class)
|
||||||
public class TConstruct
|
public class TConstruct
|
||||||
{
|
{
|
||||||
|
@ -173,6 +173,7 @@ public class TContent implements IFuelHandler
|
|||||||
|
|
||||||
//Tool modifiers
|
//Tool modifiers
|
||||||
public static ModElectric modE;
|
public static ModElectric modE;
|
||||||
|
public static ModLapis modL;
|
||||||
|
|
||||||
//Golems
|
//Golems
|
||||||
public static Block glowSapling;
|
public static Block glowSapling;
|
||||||
@ -533,7 +534,8 @@ public class TContent implements IFuelHandler
|
|||||||
|
|
||||||
ItemStack lapisItem = new ItemStack(Item.dyePowder, 1, 4);
|
ItemStack lapisItem = new ItemStack(Item.dyePowder, 1, 4);
|
||||||
ItemStack lapisBlock = new ItemStack(Block.blockLapis);
|
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[] { lapisItem, lapisItem }, 10, 2));
|
||||||
tb.registerToolMod(new ModLapis(new ItemStack[] { lapisBlock }, 10, 9));
|
tb.registerToolMod(new ModLapis(new ItemStack[] { lapisBlock }, 10, 9));
|
||||||
tb.registerToolMod(new ModLapis(new ItemStack[] { lapisItem, lapisBlock }, 10, 10));
|
tb.registerToolMod(new ModLapis(new ItemStack[] { lapisItem, lapisBlock }, 10, 10));
|
||||||
|
@ -26,8 +26,8 @@ public class SlotTool extends Slot
|
|||||||
*/
|
*/
|
||||||
public boolean isItemValid(ItemStack stack)
|
public boolean isItemValid(ItemStack stack)
|
||||||
{
|
{
|
||||||
//return false;
|
return false;
|
||||||
return stack.getItem() instanceof ToolCore;
|
//return stack.getItem() instanceof ToolCore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack stack)
|
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack stack)
|
||||||
|
@ -10,7 +10,7 @@ public class UnstableCreeper extends EntityCreeper
|
|||||||
protected int timeSinceIgnited;
|
protected int timeSinceIgnited;
|
||||||
protected int lastActiveTime;
|
protected int lastActiveTime;
|
||||||
|
|
||||||
protected float explosionRadius = 1.5f;
|
public float explosionRadius = 1f;
|
||||||
|
|
||||||
public UnstableCreeper(World world)
|
public UnstableCreeper(World world)
|
||||||
{
|
{
|
||||||
@ -25,21 +25,26 @@ public class UnstableCreeper extends EntityCreeper
|
|||||||
|
|
||||||
protected void fall (float distance)
|
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");
|
boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||||
|
|
||||||
if (this.getPowered())
|
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
|
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();
|
this.setDead();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
super.fall(distance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
|
public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound)
|
||||||
@ -87,11 +92,11 @@ public class UnstableCreeper extends EntityCreeper
|
|||||||
|
|
||||||
if (this.getPowered())
|
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
|
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();
|
this.setDead();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mods.tinker.tconstruct.library;
|
package mods.tinker.tconstruct.library;
|
||||||
|
|
||||||
|
import mods.tinker.tconstruct.TContent;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
@ -23,6 +24,7 @@ public abstract class HarvestTool extends ToolCore
|
|||||||
@Override
|
@Override
|
||||||
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player)
|
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player)
|
||||||
{
|
{
|
||||||
|
TContent.modL.midStreamModify(stack);
|
||||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||||
World world = player.worldObj;
|
World world = player.worldObj;
|
||||||
int bID = player.worldObj.getBlockId(x, y, z);
|
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
|
* Every tool can be an electric tool if you modify it right
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canBeStoredInToolbox (ItemStack itemstack)
|
public boolean canBeStoredInToolbox (ItemStack stack)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy (ItemStack itemStack)
|
public boolean canProvideEnergy (ItemStack stack)
|
||||||
{
|
{
|
||||||
|
NBTTagCompound tags = stack.getTagCompound();
|
||||||
|
if (!tags.hasKey("charge"))
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getChargedItemId (ItemStack itemStack)
|
public int getChargedItemId (ItemStack stack)
|
||||||
{
|
{
|
||||||
return this.itemID;
|
return this.itemID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEmptyItemId (ItemStack itemStack)
|
public int getEmptyItemId (ItemStack stack)
|
||||||
{
|
{
|
||||||
return this.itemID;
|
return this.itemID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxCharge (ItemStack itemStack)
|
public int getMaxCharge (ItemStack stack)
|
||||||
{
|
{
|
||||||
|
NBTTagCompound tags = stack.getTagCompound();
|
||||||
|
if (!tags.hasKey("charge"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
return 10000;
|
return 10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,8 +613,12 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTransferLimit (ItemStack itemStack)
|
public int getTransferLimit (ItemStack stack)
|
||||||
{
|
{
|
||||||
|
NBTTagCompound tags = stack.getTagCompound();
|
||||||
|
if (!tags.hasKey("charge"))
|
||||||
|
return 0;
|
||||||
|
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package mods.tinker.tconstruct.library;
|
package mods.tinker.tconstruct.library;
|
||||||
|
|
||||||
|
import mods.tinker.tconstruct.TContent;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumAction;
|
import net.minecraft.item.EnumAction;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -90,6 +92,12 @@ public abstract class Weapon extends ToolCore
|
|||||||
return 1;
|
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[] web = new Material[] { Material.web };
|
||||||
public static Material[] none = new Material[0];
|
public static Material[] none = new Material[0];
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,13 @@ public class ModLapis extends ToolMod
|
|||||||
{
|
{
|
||||||
String tooltipName;
|
String tooltipName;
|
||||||
int increase;
|
int increase;
|
||||||
int max;
|
int max = 450;
|
||||||
|
|
||||||
public ModLapis(ItemStack[] items, int effect, int inc)
|
public ModLapis(ItemStack[] items, int effect, int inc)
|
||||||
{
|
{
|
||||||
super(items, effect, "Lapis");
|
super(items, effect, "Lapis");
|
||||||
tooltipName = "\u00a79Luck";
|
tooltipName = "\u00a79Luck";
|
||||||
increase = inc;
|
increase = inc;
|
||||||
max = 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -33,7 +32,7 @@ public class ModLapis extends ToolMod
|
|||||||
return tags.getInteger("Modifiers") > 0;
|
return tags.getInteger("Modifiers") > 0;
|
||||||
|
|
||||||
int keyPair[] = tags.getIntArray(key);
|
int keyPair[] = tags.getIntArray(key);
|
||||||
if (keyPair[0] + increase <= 100)
|
if (keyPair[0] + increase <= max)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -47,7 +46,7 @@ public class ModLapis extends ToolMod
|
|||||||
{
|
{
|
||||||
tags.setBoolean(key, true);
|
tags.setBoolean(key, true);
|
||||||
|
|
||||||
String modName = "\u00a79Lapis (0/100)";
|
String modName = "\u00a79Lapis (0/450)";
|
||||||
int tooltipIndex = addToolTip(tool, "\u00a79Luck", modName);
|
int tooltipIndex = addToolTip(tool, "\u00a79Luck", modName);
|
||||||
int[] keyPair = new int[] { 0, tooltipIndex };
|
int[] keyPair = new int[] { 0, tooltipIndex };
|
||||||
tags.setIntArray(key, keyPair);
|
tags.setIntArray(key, keyPair);
|
||||||
@ -62,26 +61,87 @@ public class ModLapis extends ToolMod
|
|||||||
tags.setIntArray(key, keyPair);
|
tags.setIntArray(key, keyPair);
|
||||||
if (tool.getItem() instanceof Weapon)
|
if (tool.getItem() instanceof Weapon)
|
||||||
{
|
{
|
||||||
if (keyPair[0] >= 100)
|
if (keyPair[0] >= 450)
|
||||||
addEnchantment(tool, Enchantment.looting, 3);
|
addEnchantment(tool, Enchantment.looting, 3);
|
||||||
else if (keyPair[0] >= 50)
|
else if (keyPair[0] >= 300)
|
||||||
addEnchantment(tool, Enchantment.looting, 2);
|
addEnchantment(tool, Enchantment.looting, 2);
|
||||||
else if (keyPair[0] >= 20)
|
else if (keyPair[0] >= 100)
|
||||||
addEnchantment(tool, Enchantment.looting, 1);
|
addEnchantment(tool, Enchantment.looting, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (keyPair[0] >= 100)
|
if (keyPair[0] >= 450)
|
||||||
addEnchantment(tool, Enchantment.fortune, 3);
|
addEnchantment(tool, Enchantment.fortune, 3);
|
||||||
else if (keyPair[0] >= 50)
|
else if (keyPair[0] >= 300)
|
||||||
addEnchantment(tool, Enchantment.fortune, 2);
|
addEnchantment(tool, Enchantment.fortune, 2);
|
||||||
else if (keyPair[0] >= 20)
|
else if (keyPair[0] >= 100)
|
||||||
addEnchantment(tool, Enchantment.fortune, 1);
|
addEnchantment(tool, Enchantment.fortune, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateModTag(tool, keyPair);
|
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)
|
public void addEnchantment (ItemStack tool, Enchantment enchant, int level)
|
||||||
{
|
{
|
||||||
NBTTagList tags = new NBTTagList("ench");
|
NBTTagList tags = new NBTTagList("ench");
|
||||||
@ -123,7 +183,7 @@ public class ModLapis extends ToolMod
|
|||||||
{
|
{
|
||||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||||
String tip = "ModifierTip" + keys[1];
|
String tip = "ModifierTip" + keys[1];
|
||||||
String modName = "\u00a79Lapis ("+keys[0]+"/100)";
|
String modName = "\u00a79Lapis (" + keys[0] + "/" + max + ")";
|
||||||
tags.setString(tip, modName);
|
tags.setString(tip, modName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class Rapier extends Weapon
|
|||||||
{
|
{
|
||||||
if (player.onGround)
|
if (player.onGround)
|
||||||
{
|
{
|
||||||
player.addExhaustion(0.2f);
|
player.addExhaustion(0.1f);
|
||||||
player.motionY += 0.32;
|
player.motionY += 0.32;
|
||||||
float f = 0.5F;
|
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);
|
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