-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thks Ropeca's People! Add Tinker Modifiers. version 1.09
- Loading branch information
Showing
51 changed files
with
296 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
package ExAstris.Bridge; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
|
||
import cpw.mods.fml.common.Loader; | ||
import cpw.mods.fml.common.registry.GameRegistry; | ||
import exnihilo.data.ModData; | ||
import exnihilo.registries.HammerRegistry; | ||
import exnihilo.registries.helpers.Smashable; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.enchantment.EnchantmentHelper; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.item.EntityItem; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.world.World; | ||
import tconstruct.library.ActiveToolMod; | ||
import tconstruct.library.tools.AbilityHelper; | ||
import tconstruct.library.tools.ToolCore; | ||
|
||
public class TConstructModifier extends ActiveToolMod { | ||
|
||
@Override | ||
public boolean beforeBlockBreak (ToolCore tool, ItemStack item, int X, int Y, int Z, EntityLivingBase player) | ||
{ | ||
NBTTagCompound tags = item.getTagCompound().getCompoundTag("InfiTool"); | ||
if (tags.getBoolean("Crooked")) | ||
{ | ||
World world = player.worldObj; | ||
Block block = world.getBlock(X,Y,Z); | ||
int meta = world.getBlockMetadata(X, Y, Z); | ||
boolean validTarget = false; | ||
boolean extraDropped = false; | ||
|
||
|
||
if (!world.isRemote && block != null && block.isLeaves(world, X, Y, Z)) | ||
{ | ||
|
||
if (ModData.ALLOW_SILKWORMS && world.rand.nextInt(130) == 0) | ||
{ | ||
world.spawnEntityInWorld(new EntityItem(world, X + 0.5D, Y + 0.5D, Z + 0.5D, new ItemStack(GameRegistry.findItem("exnihilo", "silkworm"), 1, 0))); | ||
} | ||
|
||
if (block.equals(GameRegistry.findBlock("exnihilo", "infested_leaves"))) | ||
{ | ||
if (ModData.ALLOW_SILKWORMS && world.rand.nextInt(20) == 0) | ||
{ | ||
world.spawnEntityInWorld(new EntityItem(world, X + 0.5D, Y + 0.5D, Z + 0.5D, new ItemStack(GameRegistry.findItem("exnihilo", "silkworm"), 1, 0))); | ||
} | ||
} | ||
|
||
AbilityHelper.damageTool(item, 1, player, false); | ||
} | ||
return false; | ||
} | ||
if (tags.getBoolean("Hammered")) | ||
{ | ||
World world = player.worldObj; | ||
Block block = world.getBlock(X,Y,Z); | ||
int blockMeta = world.getBlockMetadata(X,Y,Z); | ||
int fortune = EnchantmentHelper.getFortuneModifier(player); | ||
|
||
ArrayList<Smashable> rewards = HammerRegistry.getRewards(block, blockMeta); | ||
boolean validTarget = false; | ||
|
||
if (!rewards.isEmpty()) | ||
{ | ||
Iterator<Smashable> it = rewards.iterator(); | ||
while(it.hasNext()) | ||
{ | ||
Smashable reward = it.next(); | ||
|
||
if (!world.isRemote && world.rand.nextFloat() <= reward.chance + (reward.luckMultiplier * fortune)) | ||
{ | ||
EntityItem entityitem = new EntityItem(world, (double)X + 0.5D, (double)Y + 0.5D, (double)Z + 0.5D, new ItemStack(reward.item, 1, reward.meta)); | ||
|
||
double f3 = 0.05F; | ||
entityitem.motionX = world.rand.nextGaussian() * f3; | ||
entityitem.motionY = (0.2d); | ||
entityitem.motionZ = world.rand.nextGaussian() * f3; | ||
|
||
world.spawnEntityInWorld(entityitem); | ||
} | ||
|
||
validTarget = true; | ||
} | ||
|
||
if (validTarget) | ||
{ | ||
AbilityHelper.damageTool(item, 1, player, false); | ||
|
||
if (!world.isRemote) | ||
{ | ||
world.setBlockToAir(X, Y, Z); | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int attackDamage (int modDamage, int currentDamage, ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, EntityLivingBase player, Entity entity) | ||
{ | ||
if (toolTags.hasKey("Crooked")) | ||
{ | ||
return 0; | ||
} | ||
else return currentDamage; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package ExAstris.Modifier; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import tconstruct.library.tools.ToolCore; | ||
import tconstruct.modifiers.tools.ModBoolean; | ||
|
||
public class ModCrooked extends ModBoolean { | ||
|
||
static String name = "Crooked"; | ||
static String color = "\u00a77"; | ||
static String tooltip = "Crooked"; | ||
|
||
public ModCrooked(ItemStack[] items, int effect) { | ||
super(items, effect, name, color, tooltip); | ||
} | ||
|
||
@Override | ||
protected boolean canModify(ItemStack tool, ItemStack[] input) | ||
{ | ||
ToolCore toolitem = (ToolCore) tool.getItem(); | ||
if (!validType(toolitem)) return false; | ||
|
||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); | ||
if (!tags.getBoolean("Lava") && !tags.hasKey("Lapis") && !tags.hasKey("Silk Touch") && !tags.hasKey("Hammered")) | ||
{ | ||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public void modify(ItemStack[] input, ItemStack tool) | ||
{ | ||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); | ||
tags.setBoolean(name, true); | ||
|
||
int modifiers = tags.getInteger("Modifiers"); | ||
modifiers -= 1; | ||
tags.setInteger("Modifiers", modifiers); | ||
|
||
int attack = tags.getInteger("Attack"); | ||
attack = 0; | ||
tags.setInteger("Attack", attack); | ||
|
||
int miningSpeed = tags.getInteger("MiningSpeed"); | ||
miningSpeed -= 300; | ||
if (miningSpeed < 0) | ||
miningSpeed = 0; | ||
tags.setInteger("MiningSpeed", miningSpeed); | ||
|
||
if (tags.hasKey("MiningSpeed2")) | ||
{ | ||
int miningSpeed2 = tags.getInteger("MiningSpeed2"); | ||
miningSpeed2 -= 300; | ||
if (miningSpeed2 < 0) | ||
miningSpeed2 = 0; | ||
tags.setInteger("MiningSpeed2", miningSpeed2); | ||
} | ||
|
||
float knockback = tags.getFloat("Knockback"); | ||
|
||
knockback *= 1.5F; | ||
|
||
addToolTip(tool, color + tooltip, color + key); | ||
} | ||
|
||
public boolean validType (ToolCore tool) | ||
{ | ||
if(tool.getToolName().equals("Mattock") || | ||
tool.getToolName().equals("Hatchet") || | ||
tool.getToolName().equals("Broadsword") || | ||
tool.getToolName().equals("Longsword") || | ||
tool.getToolName().equals("Rapier") || | ||
tool.getToolName().equals("Cutlass") || | ||
tool.getToolName().equals("Cleaver") || | ||
tool.getToolName().equals("Lumber Axe") || | ||
tool.getToolName().equals("Scythe") ) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package ExAstris.Modifier; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import tconstruct.library.tools.ToolCore; | ||
import tconstruct.modifiers.tools.ModBoolean; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
|
||
public class ModHammered extends ModBoolean { | ||
|
||
static String name = "Hammered"; | ||
static String color = "\u00a79"; | ||
static String tooltip = "Smashing"; | ||
|
||
public ModHammered(ItemStack[] items, int i) | ||
{ | ||
super(items, i, name, color, tooltip); | ||
} | ||
|
||
@Override | ||
protected boolean canModify(ItemStack tool, ItemStack[] input) | ||
{ | ||
ToolCore toolitem = (ToolCore) tool.getItem(); | ||
if (!validType(toolitem)) return false; | ||
|
||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); | ||
|
||
if (!tags.getBoolean("Lava") && !tags.hasKey("Lapis") && !tags.hasKey("Silk Touch") && !tags.hasKey("Crooked")) | ||
{ | ||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); | ||
} | ||
return false; | ||
} | ||
|
||
public void modify(ItemStack[] input, ItemStack tool) | ||
{ | ||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool"); | ||
tags.setBoolean(name, true); | ||
|
||
int modifiers = tags.getInteger("Modifiers"); | ||
modifiers -= 1; | ||
tags.setInteger("Modifiers", modifiers); | ||
|
||
int miningSpeed = tags.getInteger("MiningSpeed"); | ||
miningSpeed -= 400; | ||
if (miningSpeed < 0) | ||
miningSpeed = 0; | ||
tags.setInteger("MiningSpeed", miningSpeed); | ||
|
||
int attack = tags.getInteger("Attack"); | ||
attack += 3; | ||
tags.setInteger("Attack", attack); | ||
|
||
addToolTip(tool, color + tooltip, color + key); | ||
} | ||
|
||
public boolean validType (ToolCore tool) | ||
{ | ||
if(tool.getToolName().equals("Pickaxe") || | ||
tool.getToolName().equals("Hammer") ) | ||
{ | ||
return true; | ||
} | ||
return false; | ||
|
||
} | ||
} |
Binary file added
BIN
+2.78 KB
src/main/resources/assets/exastris/textures/items/arrow/crook_arrow_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+238 Bytes
src/main/resources/assets/exastris/textures/items/arrow/hammer_arrow_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.81 KB
src/main/resources/assets/exastris/textures/items/axe/crook_axe_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+147 Bytes
src/main/resources/assets/exastris/textures/items/axe/hammer_axe_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.89 KB
...n/resources/assets/exastris/textures/items/battleaxe/crook_battleaxe_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+174 Bytes
.../resources/assets/exastris/textures/items/battleaxe/hammer_battleaxe_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.82 KB
...resources/assets/exastris/textures/items/battlesign/crook_battlesign_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+234 Bytes
...esources/assets/exastris/textures/items/battlesign/hammer_battlesign_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.81 KB
...main/resources/assets/exastris/textures/items/broadsword/crook_sword_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+283 Bytes
...ain/resources/assets/exastris/textures/items/broadsword/hammer_sword_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.81 KB
src/main/resources/assets/exastris/textures/items/chisel/crook_chisel_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+334 Bytes
src/main/resources/assets/exastris/textures/items/chisel/hammer_chisel_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.8 KB
src/main/resources/assets/exastris/textures/items/cleaver/crook_cleaver_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+280 Bytes
...main/resources/assets/exastris/textures/items/cleaver/hammer_cleaver_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.86 KB
src/main/resources/assets/exastris/textures/items/cutlass/crook_cutlass_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+337 Bytes
...main/resources/assets/exastris/textures/items/cutlass/hammer_cutlass_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.83 KB
src/main/resources/assets/exastris/textures/items/dagger/crook_dagger_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+270 Bytes
src/main/resources/assets/exastris/textures/items/dagger/hammer_dagger_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.8 KB
...n/resources/assets/exastris/textures/items/excavator/crook_excavator_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+171 Bytes
.../resources/assets/exastris/textures/items/excavator/hammer_excavator_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.81 KB
src/main/resources/assets/exastris/textures/items/frypan/crook_frypan_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+275 Bytes
src/main/resources/assets/exastris/textures/items/frypan/hammer_frypan_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.84 KB
src/main/resources/assets/exastris/textures/items/hammer/crook_hammer_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+120 Bytes
src/main/resources/assets/exastris/textures/items/hammer/hammer_hammer_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.8 KB
...n/resources/assets/exastris/textures/items/longsword/crook_longsword_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+275 Bytes
.../resources/assets/exastris/textures/items/longsword/hammer_longsword_effect.png
Oops, something went wrong.
Binary file added
BIN
+2.82 KB
...n/resources/assets/exastris/textures/items/lumberaxe/crook_lumberaxe_effect.png
Oops, something went wrong.
Binary file added
BIN
+150 Bytes
.../resources/assets/exastris/textures/items/lumberaxe/hammer_lumberaxe_effect.png
Oops, something went wrong.
Binary file added
BIN
+2.81 KB
src/main/resources/assets/exastris/textures/items/mattock/crook_mattock_effect.png
Oops, something went wrong.
Binary file added
BIN
+138 Bytes
...main/resources/assets/exastris/textures/items/mattock/hammer_mattock_effect.png
Oops, something went wrong.
Binary file added
BIN
+2.8 KB
src/main/resources/assets/exastris/textures/items/pickaxe/crook_pickaxe_effect.png
Oops, something went wrong.
Binary file added
BIN
+2.83 KB
...main/resources/assets/exastris/textures/items/pickaxe/hammer_pickaxe_effect.png
Oops, something went wrong.
Binary file added
BIN
+2.78 KB
src/main/resources/assets/exastris/textures/items/rapier/crook_rapier_effect.png
Oops, something went wrong.
Binary file added
BIN
+282 Bytes
src/main/resources/assets/exastris/textures/items/rapier/hammer_rapier_effect.png
Oops, something went wrong.
Binary file added
BIN
+2.79 KB
src/main/resources/assets/exastris/textures/items/scythe/crook_scythe_effect.png
Oops, something went wrong.
Binary file added
BIN
+150 Bytes
src/main/resources/assets/exastris/textures/items/scythe/hammer_scythe_effect.png
Oops, something went wrong.
Binary file added
BIN
+2.78 KB
src/main/resources/assets/exastris/textures/items/shortbow/crook_bow_effect.png
Oops, something went wrong.
Binary file added
BIN
+2.78 KB
src/main/resources/assets/exastris/textures/items/shortbow/crook_bow_effect_1.png
Oops, something went wrong.
Binary file added
BIN
+2.78 KB
src/main/resources/assets/exastris/textures/items/shortbow/crook_bow_effect_2.png
Oops, something went wrong.
Binary file added
BIN
+2.78 KB
src/main/resources/assets/exastris/textures/items/shortbow/crook_bow_effect_3.png
Oops, something went wrong.
Binary file added
BIN
+251 Bytes
src/main/resources/assets/exastris/textures/items/shortbow/hammer_bow_effect.png
Oops, something went wrong.
Binary file added
BIN
+251 Bytes
src/main/resources/assets/exastris/textures/items/shortbow/hammer_bow_effect_1.png
Oops, something went wrong.
Binary file added
BIN
+251 Bytes
src/main/resources/assets/exastris/textures/items/shortbow/hammer_bow_effect_2.png
Oops, something went wrong.
Binary file added
BIN
+251 Bytes
src/main/resources/assets/exastris/textures/items/shortbow/hammer_bow_effect_3.png
Oops, something went wrong.
Binary file added
BIN
+2.82 KB
src/main/resources/assets/exastris/textures/items/shovel/crook_shovel_effect.png
Oops, something went wrong.
Binary file added
BIN
+180 Bytes
src/main/resources/assets/exastris/textures/items/shovel/hammer_shovel_effect.png
Oops, something went wrong.