mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-26 06:52:58 +00:00
Update modifiers, start travellers gear
This commit is contained in:
1 parent
0230307f0a
commit
c525493545
96 files changed
+2827
-1573
No files matched your search
@@ -114,6 +114,7 @@ public class TConstruct
|
||||
TConstructRegistry.toolTab = new TabTools("TConstructTools");
|
||||
TConstructRegistry.partTab = new TabTools("TConstructParts");
|
||||
TConstructRegistry.blockTab = new TabTools("TConstructBlocks");
|
||||
TConstructRegistry.equipableTab = new TabTools("TConstructEquipables");
|
||||
|
||||
tableCasting = new LiquidCasting();
|
||||
basinCasting = new LiquidCasting();
|
||||
@@ -129,15 +130,8 @@ public class TConstruct
|
||||
VillagerRegistry.instance().registerVillageTradeHandler(78943, new TVillageTrades());
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillageToolStationHandler());
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillageSmelteryHandler());
|
||||
try
|
||||
{
|
||||
MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure");
|
||||
MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure");
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
logger.error("Error registering TConstruct Structures with Vanilla Minecraft: this is expected in versions earlier than 1.6.4");
|
||||
}
|
||||
MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure");
|
||||
MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure");
|
||||
}
|
||||
|
||||
playerTracker = new TPlayerHandler();
|
||||
|
||||
@@ -3,21 +3,18 @@ package tconstruct.armor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.MathHelper;
|
||||
@@ -26,47 +23,40 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.GuiIngameForge;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.model.BeltModel;
|
||||
import tconstruct.armor.model.BootBump;
|
||||
import tconstruct.armor.model.HiddenPlayerModel;
|
||||
import tconstruct.armor.model.WingModel;
|
||||
import tconstruct.client.TControls;
|
||||
import tconstruct.client.TKeyHandler;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.client.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.client.gui.ArmorExtendedGui;
|
||||
import tconstruct.client.gui.CraftingStationGui;
|
||||
import tconstruct.client.gui.FrypanGui;
|
||||
import tconstruct.client.gui.FurnaceGui;
|
||||
import tconstruct.client.gui.GuiLandmine;
|
||||
import tconstruct.client.gui.KnapsackGui;
|
||||
import tconstruct.client.gui.PartCrafterGui;
|
||||
import tconstruct.client.gui.PatternChestGui;
|
||||
import tconstruct.client.gui.SmelteryGui;
|
||||
import tconstruct.client.gui.StencilTableGui;
|
||||
import tconstruct.client.gui.ToolForgeGui;
|
||||
import tconstruct.client.gui.ToolStationGui;
|
||||
import tconstruct.client.tabs.InventoryTabArmorExtended;
|
||||
import tconstruct.client.tabs.InventoryTabKnapsack;
|
||||
import tconstruct.client.tabs.InventoryTabVanilla;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
import tconstruct.mechworks.MechworksProxyCommon;
|
||||
import tconstruct.mechworks.inventory.ContainerLandmine;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
import tconstruct.smeltery.SmelteryProxyCommon;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import tconstruct.tools.ToolProxyCommon;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
import tconstruct.tools.logic.FrypanLogic;
|
||||
import tconstruct.tools.logic.FurnaceLogic;
|
||||
import tconstruct.tools.logic.PartBuilderLogic;
|
||||
import tconstruct.tools.logic.PatternChestLogic;
|
||||
import tconstruct.tools.logic.StencilTableLogic;
|
||||
import tconstruct.tools.logic.ToolForgeLogic;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.library.accessory.IAccessoryModel;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ArmorProxyClient extends ArmorProxyCommon
|
||||
{
|
||||
public static WingModel wings = new WingModel();
|
||||
public static BootBump bootbump = new BootBump();
|
||||
public static HiddenPlayerModel glove = new HiddenPlayerModel(0.25F, 4);
|
||||
public static HiddenPlayerModel vest = new HiddenPlayerModel(0.25f, 1);
|
||||
public static BeltModel belt = new BeltModel();
|
||||
|
||||
public ArmorProxyClient()
|
||||
{
|
||||
registerGuiHandler();
|
||||
@@ -301,4 +291,136 @@ public class ArmorProxyClient extends ArmorProxyCommon
|
||||
}
|
||||
|
||||
double zLevel = 0;
|
||||
|
||||
@SubscribeEvent
|
||||
public void adjustArmor (RenderPlayerEvent.SetArmorModel event)
|
||||
{
|
||||
switch (event.slot)
|
||||
{
|
||||
case 1:
|
||||
ArmorProxyClient.vest.onGround = event.renderer.modelBipedMain.onGround;
|
||||
ArmorProxyClient.vest.isRiding = event.renderer.modelBipedMain.isRiding;
|
||||
ArmorProxyClient.vest.isChild = event.renderer.modelBipedMain.isChild;
|
||||
ArmorProxyClient.vest.isSneak = event.renderer.modelBipedMain.isSneak;
|
||||
case 2:
|
||||
ArmorProxyClient.wings.onGround = event.renderer.modelBipedMain.onGround;
|
||||
ArmorProxyClient.wings.isRiding = event.renderer.modelBipedMain.isRiding;
|
||||
ArmorProxyClient.wings.isChild = event.renderer.modelBipedMain.isChild;
|
||||
ArmorProxyClient.wings.isSneak = event.renderer.modelBipedMain.isSneak;
|
||||
|
||||
ArmorProxyClient.glove.onGround = event.renderer.modelBipedMain.onGround;
|
||||
ArmorProxyClient.glove.isRiding = event.renderer.modelBipedMain.isRiding;
|
||||
ArmorProxyClient.glove.isChild = event.renderer.modelBipedMain.isChild;
|
||||
ArmorProxyClient.glove.isSneak = event.renderer.modelBipedMain.isSneak;
|
||||
ArmorProxyClient.glove.heldItemLeft = event.renderer.modelBipedMain.heldItemLeft;
|
||||
ArmorProxyClient.glove.heldItemRight = event.renderer.modelBipedMain.heldItemRight;
|
||||
|
||||
ArmorProxyClient.belt.onGround = event.renderer.modelBipedMain.onGround;
|
||||
ArmorProxyClient.belt.isRiding = event.renderer.modelBipedMain.isRiding;
|
||||
ArmorProxyClient.belt.isChild = event.renderer.modelBipedMain.isChild;
|
||||
ArmorProxyClient.belt.isSneak = event.renderer.modelBipedMain.isSneak;
|
||||
|
||||
renderArmorExtras(event);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
ArmorProxyClient.bootbump.onGround = event.renderer.modelBipedMain.onGround;
|
||||
ArmorProxyClient.bootbump.isRiding = event.renderer.modelBipedMain.isRiding;
|
||||
ArmorProxyClient.bootbump.isChild = event.renderer.modelBipedMain.isChild;
|
||||
ArmorProxyClient.bootbump.isSneak = event.renderer.modelBipedMain.isSneak;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void renderArmorExtras(RenderPlayerEvent.SetArmorModel event)
|
||||
{
|
||||
float partialTick = event.partialRenderTick;
|
||||
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
float posX = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTick);
|
||||
float posY = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTick);
|
||||
float posZ = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTick);
|
||||
|
||||
float yawOffset = this.interpolateRotation(player.prevRenderYawOffset, player.renderYawOffset, partialTick);
|
||||
float yawRotation = this.interpolateRotation(player.prevRotationYawHead, player.rotationYawHead, partialTick);
|
||||
float pitch;
|
||||
final float zeropointsixtwofive = 0.0625F;
|
||||
|
||||
if (player.isRiding() && player.ridingEntity instanceof EntityLivingBase)
|
||||
{
|
||||
EntityLivingBase entitylivingbase1 = (EntityLivingBase) player.ridingEntity;
|
||||
yawOffset = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset, partialTick);
|
||||
pitch = MathHelper.wrapAngleTo180_float(yawRotation - yawOffset);
|
||||
|
||||
if (pitch < -85.0F)
|
||||
{
|
||||
pitch = -85.0F;
|
||||
}
|
||||
|
||||
if (pitch >= 85.0F)
|
||||
{
|
||||
pitch = 85.0F;
|
||||
}
|
||||
|
||||
yawOffset = yawRotation - pitch;
|
||||
|
||||
if (pitch * pitch > 2500.0F)
|
||||
{
|
||||
yawOffset += pitch * 0.2F;
|
||||
}
|
||||
}
|
||||
|
||||
pitch = this.handleRotationFloat(player, partialTick);
|
||||
float bodyRotation = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTick;
|
||||
float limbSwing = player.prevLimbSwingAmount + (player.limbSwingAmount - player.prevLimbSwingAmount) * partialTick;
|
||||
float limbSwingMod = player.limbSwing - player.limbSwingAmount * (1.0F - partialTick);
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.getPersistentID());
|
||||
if (stats.armor.inventory[1] != null)
|
||||
{
|
||||
Item item = stats.armor.inventory[1].getItem();
|
||||
ModelBiped model = item.getArmorModel(player, stats.armor.inventory[1], 4);
|
||||
|
||||
if (item instanceof IAccessoryModel)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(((IAccessoryModel) item).getWearbleTexture(player, stats.armor.inventory[1], 1));
|
||||
model.setLivingAnimations(player, limbSwingMod, limbSwing, partialTick);
|
||||
model.render(player, limbSwingMod, limbSwing, pitch, yawRotation - yawOffset, bodyRotation, zeropointsixtwofive);
|
||||
}
|
||||
}
|
||||
|
||||
if (stats.armor.inventory[3] != null)
|
||||
{
|
||||
Item item = stats.armor.inventory[3].getItem();
|
||||
ModelBiped model = item.getArmorModel(player, stats.armor.inventory[3], 5);
|
||||
|
||||
if (item instanceof IAccessoryModel)
|
||||
{
|
||||
this.mc.getTextureManager().bindTexture(((IAccessoryModel) item).getWearbleTexture(player, stats.armor.inventory[1], 1));
|
||||
model.setLivingAnimations(player, limbSwingMod, limbSwing, partialTick);
|
||||
model.render(player, limbSwingMod, limbSwing, pitch, yawRotation - yawOffset, bodyRotation, zeropointsixtwofive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float interpolateRotation (float par1, float par2, float par3)
|
||||
{
|
||||
float f3;
|
||||
|
||||
for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
while (f3 >= 180.0F)
|
||||
{
|
||||
f3 -= 360.0F;
|
||||
}
|
||||
|
||||
return par1 + par3 * f3;
|
||||
}
|
||||
|
||||
protected float handleRotationFloat (EntityLivingBase par1EntityLivingBase, float par2)
|
||||
{
|
||||
return (float) par1EntityLivingBase.ticksExisted + par2;
|
||||
}
|
||||
}
|
||||
@@ -16,37 +16,34 @@ import tconstruct.TConstruct;
|
||||
import tconstruct.armor.blocks.DryingRack;
|
||||
import tconstruct.armor.items.ArmorBasic;
|
||||
import tconstruct.armor.items.DiamondApple;
|
||||
import tconstruct.armor.items.ExoArmor;
|
||||
import tconstruct.armor.items.HeartCanister;
|
||||
import tconstruct.armor.items.Jerky;
|
||||
import tconstruct.armor.items.Knapsack;
|
||||
import tconstruct.armor.items.TravelBelt;
|
||||
import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.armor.items.TravelGlove;
|
||||
import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import tconstruct.library.crafting.DryingRackRecipes;
|
||||
import tconstruct.library.crafting.LiquidCasting;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.items.GoldenHead;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
@ObjectHolder(TConstruct.modID)
|
||||
@Pulse(id = "TinkerArmor", description = "Modifyable armors, such as the traveller's gear.")
|
||||
@Pulse(id = "Tinkers' Armor", description = "Modifyable armors, such as the traveller's gear.")
|
||||
public class TinkerArmor implements IPulse //TODO: Remove IPulse implementation, keep annotation
|
||||
{
|
||||
@Instance("TinkerArmor")
|
||||
public static TinkerArmor instance;
|
||||
@PulseProxy(client = "tconstruct.armor.ArmorProxyClient", server = "tconstruct.armor.ArmorProxyCommon")
|
||||
public static ArmorProxyCommon proxy;
|
||||
|
||||
@@ -67,14 +64,17 @@ public class TinkerArmor implements IPulse //TODO: Remove IPulse implementation,
|
||||
public static Item helmetWood;
|
||||
public static Item chestplateWood;
|
||||
public static Item leggingsWood;
|
||||
// Armor - exosuit
|
||||
public static Item exoGoggles;
|
||||
public static Item exoChest;
|
||||
public static Item exoPants;
|
||||
public static Item exoShoes;
|
||||
public static Item bootsWood;
|
||||
public static ArmorMaterial materialWood;
|
||||
|
||||
//Clothing - Travel Gear
|
||||
public static TravelGear travelGoggles;
|
||||
public static TravelGear travelWings;
|
||||
public static TravelGear travelVest;
|
||||
public static TravelGear travelBoots;
|
||||
public static AccessoryCore travelGlove;
|
||||
public static AccessoryCore travelBelt;
|
||||
|
||||
public TinkerArmor()
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(new TinkerArmorEvents());
|
||||
@@ -123,22 +123,24 @@ public class TinkerArmor implements IPulse //TODO: Remove IPulse implementation,
|
||||
GameRegistry.registerItem(TinkerArmor.chestplateWood, "chestplateWood");
|
||||
GameRegistry.registerItem(TinkerArmor.leggingsWood, "leggingsWood");
|
||||
GameRegistry.registerItem(TinkerArmor.bootsWood, "bootsWood");
|
||||
|
||||
TinkerArmor.exoGoggles = new ExoArmor(EnumArmorPart.HELMET, "exosuit").setUnlocalizedName("tconstruct.exoGoggles");
|
||||
TinkerArmor.exoChest = new ExoArmor(EnumArmorPart.CHEST, "exosuit").setUnlocalizedName("tconstruct.exoChest");
|
||||
TinkerArmor.exoPants = new ExoArmor(EnumArmorPart.PANTS, "exosuit").setUnlocalizedName("tconstruct.exoPants");
|
||||
TinkerArmor.exoShoes = new ExoArmor(EnumArmorPart.SHOES, "exosuit").setUnlocalizedName("tconstruct.exoShoes");
|
||||
|
||||
GameRegistry.registerItem(TinkerArmor.exoGoggles, "helmetExo");
|
||||
GameRegistry.registerItem(TinkerArmor.exoChest, "chestplateExo");
|
||||
GameRegistry.registerItem(TinkerArmor.exoPants, "leggingsExo");
|
||||
GameRegistry.registerItem(TinkerArmor.exoShoes, "bootsExo");
|
||||
|
||||
TConstructRegistry.addItemStackToDirectory("diamondApple", new ItemStack(TinkerArmor.diamondApple, 1, 0));
|
||||
|
||||
TConstructRegistry.addItemStackToDirectory("canisterEmpty", new ItemStack(TinkerArmor.heartCanister, 1, 0));
|
||||
TConstructRegistry.addItemStackToDirectory("miniRedHeart", new ItemStack(TinkerArmor.heartCanister, 1, 1));
|
||||
TConstructRegistry.addItemStackToDirectory("canisterRedHeart", new ItemStack(TinkerArmor.heartCanister, 1, 2));
|
||||
|
||||
travelGoggles = (TravelGear) new TravelGear(ArmorPart.Head).setUnlocalizedName("tconstruct.travelgoggles");
|
||||
travelVest = (TravelGear) new TravelGear(ArmorPart.Chest).setUnlocalizedName("tconstruct.travelvest");
|
||||
travelWings = (TravelGear) new TravelWings().setUnlocalizedName("tconstruct.travelwings");
|
||||
travelBoots = (TravelGear) new TravelGear(ArmorPart.Feet).setUnlocalizedName("tconstruct.travelboots");
|
||||
travelGlove = (AccessoryCore) new TravelGlove().setUnlocalizedName("tconstruct.travelgloves");
|
||||
travelBelt = (AccessoryCore) new TravelBelt().setUnlocalizedName("tconstruct.travelbelt");
|
||||
GameRegistry.registerItem(travelGoggles, "travelGoggles");
|
||||
GameRegistry.registerItem(travelVest, "travelVest");
|
||||
GameRegistry.registerItem(travelWings, "travelWings");
|
||||
GameRegistry.registerItem(travelBoots, "travelBoots");
|
||||
GameRegistry.registerItem(travelGlove, "travelGlove");
|
||||
GameRegistry.registerItem(travelBelt, "travelBelt");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -146,6 +148,7 @@ public class TinkerArmor implements IPulse //TODO: Remove IPulse implementation,
|
||||
{
|
||||
craftingTableRecipes();
|
||||
addRecipesForDryingRack();
|
||||
TConstructRegistry.equipableTab.init(travelGoggles.getDefaultItem());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -167,22 +170,6 @@ public class TinkerArmor implements IPulse //TODO: Remove IPulse implementation,
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.leggingsWood, pants, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.bootsWood, shoes, 'w', "logWood"));
|
||||
|
||||
ItemStack exoGoggleStack = new ItemStack(TinkerArmor.exoGoggles);
|
||||
ItemStack exoChestStack = new ItemStack(TinkerArmor.exoChest);
|
||||
ItemStack exoPantsStack = new ItemStack(TinkerArmor.exoPants);
|
||||
ItemStack exoShoesStack = new ItemStack(TinkerArmor.exoShoes);
|
||||
if (PHConstruct.exoCraftingEnabled)
|
||||
{
|
||||
ToolBuilder.instance.addArmorTag(exoGoggleStack);
|
||||
ToolBuilder.instance.addArmorTag(exoChestStack);
|
||||
ToolBuilder.instance.addArmorTag(exoPantsStack);
|
||||
ToolBuilder.instance.addArmorTag(exoShoesStack);
|
||||
GameRegistry.addShapedRecipe(exoGoggleStack, helm, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoChestStack, chest, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoPantsStack, pants, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoShoesStack, shoes, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
|
||||
}
|
||||
|
||||
// Accessories
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
|
||||
|
||||
@@ -17,13 +17,13 @@ public class ArmorExtendedContainer extends ActiveContainer
|
||||
invPlayer = inventoryplayer;
|
||||
this.armor = armor;
|
||||
|
||||
this.addSlotToContainer(new SlotUnused(armor, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotUnused(armor, 1, 80, 35));
|
||||
this.addSlotToContainer(new SlotKnapsack(armor, 2, 116, 17));
|
||||
this.addSlotToContainer(new SlotUnused(armor, 3, 116, 35));
|
||||
this.addSlotToContainer(new SlotCanister(armor, 4, 152, 53));
|
||||
this.addSlotToContainer(new SlotCanister(armor, 5, 152, 35));
|
||||
this.addSlotToContainer(new SlotCanister(armor, 6, 152, 17)); /* Player inventory */
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 1, 80, 35));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 2, 116, 17));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 3, 116, 35));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 4, 152, 53));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 5, 152, 35));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 6, 152, 17));
|
||||
for (int playerArmor = 0; playerArmor < 4; ++playerArmor)
|
||||
{
|
||||
this.addSlotToContainer(new SlotArmorCopy(this, inventoryplayer, inventoryplayer.getSizeInventory() - 1 - playerArmor, 98, 8 + playerArmor * 18, playerArmor));
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.accessory.IAccessory;
|
||||
|
||||
public class SlotAccessory extends Slot
|
||||
{
|
||||
private final int slotID;
|
||||
|
||||
public SlotAccessory(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.slotID = par3;
|
||||
//this.parent = container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case
|
||||
* of armor slots)
|
||||
*/
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof IAccessory) && ((IAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.armor.IHealthAccessory;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
|
||||
public class SlotCanister extends Slot
|
||||
{
|
||||
@@ -34,7 +34,7 @@ public class SlotCanister extends Slot
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof IHealthAccessory) && ((IHealthAccessory) item).canEquipItem(par1ItemStack, this.slotID);
|
||||
return item != null && (item instanceof IHealthAccessory) && ((IHealthAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class ArmorStandard extends ArmorCore
|
||||
{
|
||||
|
||||
public ArmorStandard(int baseProtection, EnumArmorPart armorPart)
|
||||
{
|
||||
super(baseProtection, armorPart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/wood_helmet");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "tinker:textures/armor/wood_" + suffix + ".png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ExoArmor extends ArmorCore
|
||||
{
|
||||
String textureName;
|
||||
|
||||
public ExoArmor(EnumArmorPart part, String texture)
|
||||
{
|
||||
super(0, part);
|
||||
this.textureName = texture;
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_"
|
||||
+ (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "tinker:textures/armor/" + textureName + "_" + suffix + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot)
|
||||
{
|
||||
// Deimplemented for now
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems (Item b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
ItemStack armor = new ItemStack(b, 1, 0);
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
NBTTagCompound armorTag = new NBTTagCompound();
|
||||
armorTag.setInteger("Modifiers", 30);
|
||||
baseTag.setTag(SET_NAME, armorTag);
|
||||
|
||||
armor.setTagCompound(baseTag);
|
||||
par3List.add(armor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(SET_NAME);
|
||||
double protection = tags.getDouble("protection");
|
||||
if (protection > 0)
|
||||
list.add("\u00a7aProtection: " + protection + "%");
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,8 @@ import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.IHealthAccessory;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
import tconstruct.util.player.ArmorExtended;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -105,7 +104,7 @@ public class HeartCanister extends CraftingItem implements IHealthAccessory
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipItem (ItemStack item, int slot)
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
int type = item.getItemDamage();
|
||||
return ((type == 2 && slot == 6) || (type == 4 && slot == 5) || (type == 6 && slot == 4));
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.client.TControls;
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.accessory.IAccessoryModel;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TravelBelt extends AccessoryCore implements IAccessoryModel
|
||||
{
|
||||
public TravelBelt()
|
||||
{
|
||||
super("travelgear/travel_belt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
return slot == 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
return ArmorProxyClient.belt;
|
||||
}
|
||||
|
||||
ResourceLocation texture = new ResourceLocation("tinker", "textures/armor/travel_2.png");
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
list.add("\u00a76Ability: Swap Hotbar");
|
||||
list.add("\u00a76Control: "+GameSettings.getKeyDisplayString(TControls.beltSwap.getKeyCode()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TravelGear extends ArmorCore
|
||||
{
|
||||
|
||||
public TravelGear(ArmorPart part)
|
||||
{
|
||||
super(0, part, "Clothing", "travelgear", "travel");
|
||||
this.setMaxDamage(1035);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
super.onArmorTick(world, player, itemStack);
|
||||
if (armorPart == ArmorPart.Chest)
|
||||
{
|
||||
if (player.isInWater())
|
||||
{
|
||||
player.motionX *= 1.2D;
|
||||
if (player.motionY > 0.0D)
|
||||
{
|
||||
player.motionY *= 1.2D;
|
||||
}
|
||||
player.motionZ *= 1.2D;
|
||||
double maxSpeed = 0.2D;
|
||||
if (player.motionX > maxSpeed)
|
||||
{
|
||||
player.motionX = maxSpeed;
|
||||
}
|
||||
else if (player.motionX < -maxSpeed)
|
||||
{
|
||||
player.motionX = -maxSpeed;
|
||||
}
|
||||
if (player.motionY > maxSpeed)
|
||||
{
|
||||
player.motionY = maxSpeed;
|
||||
}
|
||||
if (player.motionZ > maxSpeed)
|
||||
{
|
||||
player.motionZ = maxSpeed;
|
||||
}
|
||||
else if (player.motionZ < -maxSpeed)
|
||||
{
|
||||
player.motionZ = -maxSpeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getBaseDefense ()
|
||||
{
|
||||
switch (armorPart)
|
||||
{
|
||||
case Head:
|
||||
return 0;
|
||||
case Chest:
|
||||
return 4;
|
||||
case Legs:
|
||||
return 2;
|
||||
case Feet:
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getMaxDefense ()
|
||||
{
|
||||
switch (armorPart)
|
||||
{
|
||||
case Head:
|
||||
return 4;
|
||||
case Chest:
|
||||
return 10;
|
||||
case Legs:
|
||||
return 8;
|
||||
case Feet:
|
||||
return 6;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDurability ()
|
||||
{
|
||||
return 1035;
|
||||
}
|
||||
|
||||
//Temporary?
|
||||
public ItemStack getRepairMaterial (ItemStack input)
|
||||
{
|
||||
return new ItemStack(Items.leather);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:" + textureFolder + "/" + textureName + "_"
|
||||
+ (this.armorType == 0 ? "goggles" : this.armorType == 1 ? "vest" : this.armorType == 2 ? "wings" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
registerModifiers(iconRegister);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
if (armorSlot == 1)
|
||||
return ArmorProxyClient.vest;
|
||||
if (armorSlot == 2)
|
||||
return ArmorProxyClient.wings;
|
||||
if (armorSlot == 3)
|
||||
return ArmorProxyClient.bootbump;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister) //temporary
|
||||
{
|
||||
switch (armorType)
|
||||
{
|
||||
case 0:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_"+"nightvision");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_"+"moss");
|
||||
break;
|
||||
case 1:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_"+"dodge");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_"+"stealth");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_"+"moss");
|
||||
break;
|
||||
case 2:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_"+"doublejump");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_"+"featherfall");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_"+"moss");
|
||||
break;
|
||||
case 3:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_"+"doublejump");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_"+"waterwalk");
|
||||
modifiers[2] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_"+"leadweight");
|
||||
modifiers[3] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_"+"slimysole");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_"+"moss");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
|
||||
switch (armorPart)
|
||||
{
|
||||
case Head:
|
||||
list.add("\u00a76Ability: Zoom with");
|
||||
list.add("\u00a76Toggle Abilities: " + GameSettings.getKeyDisplayString(tconstruct.client.TControls.toggleGoggles.getKeyCode()));
|
||||
break;
|
||||
case Chest:
|
||||
list.add("\u00a76Ability: Swift Swim");
|
||||
break;
|
||||
case Legs:
|
||||
list.add("\u00a76Ability: Featherfall");
|
||||
break;
|
||||
case Feet:
|
||||
list.add("\u00a76Ability: High Step");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
super.addInformation(stack, player, list, par4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.accessory.IAccessoryModel;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TravelGlove extends AccessoryCore implements IAccessoryModel
|
||||
{
|
||||
public TravelGlove()
|
||||
{
|
||||
super("travelgear/travel_glove");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister)
|
||||
{
|
||||
this.modifiers = new IIcon[4];
|
||||
this.modifiers[0] = iconRegister.registerIcon("tinker:travelgear/glove_guard");
|
||||
this.modifiers[1] = iconRegister.registerIcon("tinker:travelgear/glove_speedaura");
|
||||
this.modifiers[2] = iconRegister.registerIcon("tinker:travelgear/glove_spines");
|
||||
this.modifiers[3] = iconRegister.registerIcon("tinker:travelgear/glove_sticky");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
return ArmorProxyClient.glove;
|
||||
}
|
||||
|
||||
ResourceLocation texture = new ResourceLocation("tinker", "textures/armor/travel_1.png");
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TravelWings extends TravelGear
|
||||
{
|
||||
|
||||
public TravelWings()
|
||||
{
|
||||
super(ArmorPart.Legs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister IIconRegister)
|
||||
{
|
||||
String base = "tinker:armor/travel_wings_";
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = IIconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_"+"doublejump");
|
||||
modifiers[1] = IIconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_"+"featherfall");
|
||||
modifiers[4] = IIconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_"+"moss");
|
||||
/*modifiers = new IIcon[3];
|
||||
modifiers[0] = IIconRegister.registerIcon(base + "slimewings");
|
||||
modifiers[1] = IIconRegister.registerIcon(base + "piston");
|
||||
modifiers[2] = IIconRegister.registerIcon(base + "pearl");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
NBTTagCompound tag = itemStack.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
int feather = tag.getInteger("Feather Fall");
|
||||
if (feather > 0)
|
||||
{
|
||||
if (player.fallDistance > 2.5)
|
||||
player.fallDistance = 2.5f;
|
||||
float terminalVelocity = -0.4f + (feather * 0.08f);
|
||||
if (terminalVelocity > -0.05f)
|
||||
terminalVelocity = - 0.05f;
|
||||
if (player.isSneaking() && terminalVelocity > -0.8f)
|
||||
terminalVelocity = -0.8F;
|
||||
boolean flying = false;
|
||||
flying = player.capabilities.isFlying;
|
||||
if (!flying && player.motionY < terminalVelocity)
|
||||
{
|
||||
player.motionY = terminalVelocity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
return "tinker:textures/armor/travel_wings.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRepairMaterial (ItemStack input)
|
||||
{
|
||||
return new ItemStack(TinkerTools.materials, 1, 13);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class BeltModel extends ModelBiped
|
||||
{
|
||||
ModelRenderer Buckle;
|
||||
ModelRenderer FrontRight;
|
||||
ModelRenderer FrontLeft;
|
||||
ModelRenderer SideRight;
|
||||
ModelRenderer SideLeft;
|
||||
ModelRenderer Back;
|
||||
|
||||
public BeltModel()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
Buckle = new ModelRenderer(this, 8, 9);
|
||||
Buckle.addBox(-2F, -2F, 0F, 4, 4, 1);
|
||||
Buckle.setRotationPoint(0F, 10F, -2.75F);
|
||||
setRotation(Buckle, 0F, 0F, 0F);
|
||||
bipedBody.addChild(Buckle);
|
||||
|
||||
FrontRight = new ModelRenderer(this, 0, 9);
|
||||
FrontRight.addBox(-3F, -1F, 0F, 3, 2, 1);
|
||||
FrontRight.setRotationPoint(-1.75F, 10F, -2.5F);
|
||||
setRotation(FrontRight, 0F, 0F, 0F);
|
||||
bipedBody.addChild(FrontRight);
|
||||
|
||||
FrontLeft = new ModelRenderer(this, 18, 9);
|
||||
FrontLeft.addBox(0F, -1F, 0F, 3, 2, 1);
|
||||
FrontLeft.setRotationPoint(1.75F, 10F, -2.5F);
|
||||
setRotation(FrontLeft, 0F, 0F, 0F);
|
||||
bipedBody.addChild(FrontLeft);
|
||||
|
||||
SideRight = new ModelRenderer(this, 0, 3);
|
||||
SideRight.addBox(-1F, -1F, 0F, 1, 2, 4);
|
||||
SideRight.setRotationPoint(-3.75F, 10F, -2F);
|
||||
setRotation(SideRight, 0F, 0F, 0F);
|
||||
bipedBody.addChild(SideRight);
|
||||
|
||||
SideLeft = new ModelRenderer(this, 16, 3);
|
||||
SideLeft.addBox(0F, -1F, 0F, 1, 2, 4);
|
||||
SideLeft.setRotationPoint(3.75F, 10F, -2F);
|
||||
setRotation(SideLeft, 0F, 0F, 0F);
|
||||
bipedBody.addChild(SideLeft);
|
||||
|
||||
Back = new ModelRenderer(this, 2, 0);
|
||||
Back.addBox(-4.5F, -1F, 0F, 9, 2, 1);
|
||||
Back.setRotationPoint(0F, 10F, 1.5F);
|
||||
setRotation(Back, 0F, 0F, 0F);
|
||||
bipedBody.addChild(Back);
|
||||
}
|
||||
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
//super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
bipedBody.render(f5);
|
||||
//Buckle.render(f5);
|
||||
/*FrontRight.render(f5);
|
||||
FrontLeft.render(f5);
|
||||
SideRight.render(f5);
|
||||
SideLeft.render(f5);
|
||||
Back.render(f5);*/
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float f, float f1, float partialTick, float f3, float f4, float f5, Entity player)
|
||||
{
|
||||
super.setRotationAngles(f, f1, partialTick, f3, f4, f5, player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class BootBump extends ModelBiped
|
||||
{
|
||||
ModelRenderer rightBump;
|
||||
ModelRenderer leftBump;
|
||||
|
||||
public BootBump()
|
||||
{
|
||||
super(0.5f, 0, 64, 32);
|
||||
|
||||
rightBump = new ModelRenderer(this, 24, 0);
|
||||
rightBump.addBox(-0.5F, -1F, 0F, 4, 3, 1, 0.5f);
|
||||
rightBump.setRotationPoint(-1.5F, 10F, -3.75F);
|
||||
bipedRightLeg.addChild(rightBump);
|
||||
leftBump = new ModelRenderer(this, 24, 0);
|
||||
leftBump.addBox(-0.5F, -1F, 0F, 4, 3, 1, 0.5f);
|
||||
leftBump.setRotationPoint(-1.5F, 10F, -3.75F);
|
||||
bipedLeftLeg.addChild(leftBump);
|
||||
|
||||
this.bipedCloak.isHidden = true;
|
||||
this.bipedEars.isHidden = true;
|
||||
this.bipedHead.isHidden = true;
|
||||
this.bipedHeadwear.isHidden = true;
|
||||
this.bipedBody.isHidden = true;
|
||||
this.bipedRightArm.isHidden = true;
|
||||
this.bipedLeftArm.isHidden = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class HiddenPlayerModel extends ModelBiped
|
||||
{
|
||||
public HiddenPlayerModel(float size, int slot)
|
||||
{
|
||||
super(size, 0, 64, 32);
|
||||
|
||||
if (slot != 0) //Head
|
||||
{
|
||||
this.bipedHead.isHidden = true;
|
||||
this.bipedHeadwear.isHidden = true;
|
||||
}
|
||||
if (slot != 1 && slot != 5) //Chest, belt
|
||||
{
|
||||
this.bipedBody.isHidden = true;
|
||||
}
|
||||
if (slot != 2 && slot != 3) //Legs, shoes
|
||||
{
|
||||
this.bipedRightLeg.isHidden = true;
|
||||
this.bipedLeftLeg.isHidden = true;
|
||||
}
|
||||
if (slot != 4) //Gloves
|
||||
{
|
||||
this.bipedRightArm.isHidden = true;
|
||||
this.bipedLeftArm.isHidden = true;
|
||||
}
|
||||
if (slot != 6) //Ears
|
||||
{
|
||||
this.bipedEars.isHidden = true;
|
||||
}
|
||||
if (slot != 7) //Cloak
|
||||
{
|
||||
this.bipedCloak.isHidden = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class WingModel extends ModelBase
|
||||
public class WingModel extends ModelBiped
|
||||
{
|
||||
ModelRenderer WingBaseRight;
|
||||
ModelRenderer WingEdgeRight;
|
||||
@@ -21,37 +22,37 @@ public class WingModel extends ModelBase
|
||||
|
||||
public WingModel()
|
||||
{
|
||||
super(0.25f, 0, 64, 64);
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
// Right Wing
|
||||
WingBaseRight = new ModelRenderer(this, 0, 41);
|
||||
//Right Wing
|
||||
WingBaseRight = new ModelRenderer(this, 0, 9);
|
||||
WingBaseRight.addBox(-0.5F, -1F, 0F, 1, 2, 10);
|
||||
WingBaseRight.setRotationPoint(-1F, 1F, 0F);
|
||||
setRotation(WingBaseRight, 0.5235988F, -0.5235988F, 0F);
|
||||
|
||||
WingEdgeRight = new ModelRenderer(this, 0, 53); // Texture position
|
||||
WingEdgeRight.addBox(0F, 0F, -2F, 1, 9, 2); // Offset, Size
|
||||
WingEdgeRight.setRotationPoint(-0.502F, -1F, 10F); // Negative x, y - 1,
|
||||
// Position
|
||||
setRotation(WingEdgeRight, 0.5235988F, 0F, 0F); // Angle in radians
|
||||
WingEdgeRight = new ModelRenderer(this, 0, 21); //Texture position
|
||||
WingEdgeRight.addBox(0F, 0F, -2F, 1, 9, 2); //Offset, Size
|
||||
WingEdgeRight.setRotationPoint(-0.502F, -1F, 10F); //Negative x, y - 1, Position
|
||||
setRotation(WingEdgeRight, 0.5235988F, 0F, 0F); //Angle in radians
|
||||
|
||||
WingInsetRight = new ModelRenderer(this, 6, 53);
|
||||
WingInsetRight = new ModelRenderer(this, 6, 21);
|
||||
WingInsetRight.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
WingInsetRight.setRotationPoint(-0.504F, 0F, 7.8F);
|
||||
setRotation(WingInsetRight, 0.3490659F, 0F, 0F);
|
||||
|
||||
WingCenterRight = new ModelRenderer(this, 12, 53);
|
||||
WingCenterRight = new ModelRenderer(this, 12, 21);
|
||||
WingCenterRight.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
WingCenterRight.setRotationPoint(-0.506F, 0.3F, 6.3F);
|
||||
setRotation(WingCenterRight, 0.1745329F, 0F, 0F);
|
||||
|
||||
WingFlangeRight = new ModelRenderer(this, 18, 53);
|
||||
WingFlangeRight = new ModelRenderer(this, 18, 21);
|
||||
WingFlangeRight.addBox(0F, 0F, -1F, 1, 8, 2);
|
||||
WingFlangeRight.setRotationPoint(-0.508F, 0.3F, 5.1F);
|
||||
setRotation(WingFlangeRight, 0F, 0F, 0F);
|
||||
|
||||
WingAuxRight = new ModelRenderer(this, 24, 53);
|
||||
WingAuxRight = new ModelRenderer(this, 24, 21);
|
||||
WingAuxRight.addBox(0F, 0F, -1F, 1, 7, 2);
|
||||
WingAuxRight.setRotationPoint(-0.51F, 0.1F, 4F);
|
||||
setRotation(WingAuxRight, -0.1745329F, 0F, 0F);
|
||||
@@ -62,33 +63,33 @@ public class WingModel extends ModelBase
|
||||
WingBaseRight.addChild(WingFlangeRight);
|
||||
WingBaseRight.addChild(WingAuxRight);
|
||||
|
||||
// Left Wing
|
||||
WingBaseLeft = new ModelRenderer(this, 42, 41);
|
||||
//Left Wing
|
||||
WingBaseLeft = new ModelRenderer(this, 42, 9);
|
||||
WingBaseLeft.addBox(-0.5F, -1F, 0F, 1, 2, 10);
|
||||
WingBaseLeft.setRotationPoint(1F, 1F, 0F);
|
||||
setRotation(WingBaseLeft, 0.5235988F, 0.5235988F, 0F);
|
||||
|
||||
WingEdgeLeft = new ModelRenderer(this, 58, 53);
|
||||
WingEdgeLeft = new ModelRenderer(this, 58, 21);
|
||||
WingEdgeLeft.addBox(0F, 0F, -2F, 1, 9, 2);
|
||||
WingEdgeLeft.setRotationPoint(-0.502F, -1F, 10F);
|
||||
setRotation(WingEdgeLeft, 0.5235988F, 0F, 0F);
|
||||
|
||||
WingInsetLeft = new ModelRenderer(this, 52, 53);
|
||||
WingInsetLeft = new ModelRenderer(this, 52, 21);
|
||||
WingInsetLeft.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
WingInsetLeft.setRotationPoint(-0.504F, 0F, 7.8F);
|
||||
setRotation(WingInsetLeft, 0.3490659F, 0F, 0F);
|
||||
|
||||
WingCenterLeft = new ModelRenderer(this, 46, 53);
|
||||
WingCenterLeft = new ModelRenderer(this, 46, 21);
|
||||
WingCenterLeft.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
WingCenterLeft.setRotationPoint(-0.506F, 0.3F, 6.3F);
|
||||
setRotation(WingCenterLeft, 0.1745329F, 0F, 0F);
|
||||
|
||||
WingFlangeLeft = new ModelRenderer(this, 40, 53);
|
||||
WingFlangeLeft = new ModelRenderer(this, 40, 21);
|
||||
WingFlangeLeft.addBox(0F, 0F, -1F, 1, 8, 2);
|
||||
WingFlangeLeft.setRotationPoint(-0.508F, 0.3F, 5.1F);
|
||||
setRotation(WingFlangeLeft, 0F, 0F, 0F);
|
||||
|
||||
WingAuxLeft = new ModelRenderer(this, 34, 53);
|
||||
WingAuxLeft = new ModelRenderer(this, 34, 21);
|
||||
WingAuxLeft.addBox(0F, 0F, -1F, 1, 7, 2);
|
||||
WingAuxLeft.setRotationPoint(-0.51F, 0.1F, 4F);
|
||||
setRotation(WingAuxLeft, -0.1745329F, 0F, 0F);
|
||||
@@ -98,9 +99,17 @@ public class WingModel extends ModelBase
|
||||
WingBaseLeft.addChild(WingCenterLeft);
|
||||
WingBaseLeft.addChild(WingFlangeLeft);
|
||||
WingBaseLeft.addChild(WingAuxLeft);
|
||||
|
||||
this.bipedCloak.isHidden = true;
|
||||
this.bipedEars.isHidden = true;
|
||||
this.bipedHead.isHidden = true;
|
||||
this.bipedHeadwear.isHidden = true;
|
||||
this.bipedRightArm.isHidden = true;
|
||||
this.bipedLeftArm.isHidden = true;
|
||||
this.bipedRightLeg.isHidden = true;
|
||||
this.bipedLeftLeg.isHidden = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
@@ -116,10 +125,72 @@ public class WingModel extends ModelBase
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
public void setRotationAngles (float f, float f1, float partialTick, float f3, float f4, float f5, Entity player)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
super.setRotationAngles(f, f1, partialTick, f3, f4, f5, player);
|
||||
if (this.isRiding)
|
||||
{
|
||||
float slow = 17f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 10f + 0.9F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 5.0f - 0.7f;
|
||||
this.WingBaseRight.rotateAngleZ = MathHelper.sin(partialTick / slow) / 2.5f - 0.3f;
|
||||
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 10 + 0.9F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 5.0f + 0.7f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 2.5f + 0.3f;
|
||||
}
|
||||
else if (player.isInWater())
|
||||
{
|
||||
float slow = 17f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.5235988F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 15f - 0.8f;
|
||||
this.WingBaseRight.rotateAngleZ = MathHelper.sin(partialTick / slow) / 15f - 0.8f;
|
||||
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.5235988F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 15f + 0.8f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 15f + 0.8f;
|
||||
}
|
||||
else if (player.posY - player.prevPosY < 0f && player.fallDistance > 2.3)
|
||||
{
|
||||
float slow = 20f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.7F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 15f - 0.8f;
|
||||
this.WingBaseRight.rotateAngleZ = MathHelper.sin(partialTick / slow) / 15f - 0.3f;
|
||||
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.7F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 15f + 0.8f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 15f + 0.3f;
|
||||
}
|
||||
else if (player.isSprinting() || this.onGround > 0)
|
||||
{
|
||||
float slow = 1.73f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.5235988F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 15f - 0.6f;
|
||||
this.WingBaseRight.rotateAngleZ = MathHelper.sin(partialTick / slow) / 15f - 0.3f;
|
||||
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.5235988F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 15f + 0.6f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 15f + 0.3f;
|
||||
}
|
||||
else
|
||||
{
|
||||
float slow = 17f;
|
||||
if (player.motionX != 0 || player.motionZ != 0)
|
||||
slow = 6f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 5f + 0.5235988F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 3.0f - 0.6f;
|
||||
this.WingBaseRight.rotateAngleZ = MathHelper.sin(partialTick / slow) / 1.5f - 0.3f;
|
||||
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 5f + 0.5235988F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 3.0f + 0.6f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 1.5f + 0.3f;
|
||||
}
|
||||
|
||||
if (this.isSneak)
|
||||
{
|
||||
this.WingBaseRight.rotateAngleX += 0.4f;
|
||||
this.WingBaseLeft.rotateAngleX += 0.4f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
public class AModDamageBoost extends ArmorModTypeFilter
|
||||
{
|
||||
final boolean modifierType;
|
||||
final int modifyAmount;
|
||||
final double scaleAmount;
|
||||
|
||||
public AModDamageBoost(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type, int modifiers, double scale)
|
||||
{
|
||||
super(effect, "ExoAttack" + (type ? "Percent" : "Flat"), armorTypes, items, values);
|
||||
this.modifierType = type;
|
||||
this.modifyAmount = modifiers;
|
||||
this.scaleAmount = scale;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingAmount(input) * modifyAmount;
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= matchingAmount(input) * modifyAmount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
if (armorTag.hasKey(key))
|
||||
{
|
||||
amount += armorTag.getInteger(key);
|
||||
}
|
||||
armorTag.setInteger(key, amount);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.getTagList("AttributeModifiers", 10);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
|
||||
if (tag.getString("AttributeName").equals("generic.attackDamage"))
|
||||
{
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.attackDamage", key, amount * scaleAmount, modifierType, getUUIDFromItem(armor)));
|
||||
}
|
||||
|
||||
private static final UUID headScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c10");
|
||||
private static final UUID chestScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c11");
|
||||
private static final UUID pantsScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c12");
|
||||
private static final UUID shoesScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c13");
|
||||
private static final UUID headFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c14");
|
||||
private static final UUID chestFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c15");
|
||||
private static final UUID pantsFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c16");
|
||||
private static final UUID shoesFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c17");
|
||||
|
||||
UUID getUUIDFromItem (ItemStack stack)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) stack.getItem();
|
||||
switch (item.armorPart)
|
||||
{
|
||||
case HELMET:
|
||||
return modifierType ? headScale : headFlat;
|
||||
case CHEST:
|
||||
return modifierType ? chestScale : chestFlat;
|
||||
case PANTS:
|
||||
return modifierType ? pantsScale : pantsFlat;
|
||||
case SHOES:
|
||||
return modifierType ? shoesScale : pantsFlat;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.AModInteger;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class AModDoubleJump extends AModInteger
|
||||
{
|
||||
public AModDoubleJump(ItemStack[] items)
|
||||
{
|
||||
super(6, "Double-Jump", EnumSet.of(EnumArmorPart.SHOES), items, 5, 1, "\u00a7a", StatCollector.translateToLocal("modifier.armour.jump.double"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack armor, ItemStack[] input)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (armorTypes.contains(item.armorPart))
|
||||
{
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
return tags.getInteger("Modifiers") >= modifyCount && tags.getInteger("Double-Jump") < 3;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int tipNum = 0;
|
||||
while (true)
|
||||
{
|
||||
tipNum++;
|
||||
String tip = "Tooltip" + tipNum;
|
||||
if (!tags.hasKey(tip))
|
||||
{
|
||||
tags.setString(tip, tooltip);
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
tags.setString(modTip, modifierTip);
|
||||
return tipNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
String tag = tags.getString(tip);
|
||||
if (tag.contains("Double-Jump") || tag.contains("Triple-Jump"))
|
||||
{
|
||||
tags.setString(tip, getProperName(tooltip, tag));
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
tag = tags.getString(modTip);
|
||||
tags.setString(modTip, getProperName(modifierTip, tag));
|
||||
return tipNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getProperName (String tooltip, String tag)
|
||||
{
|
||||
if (tag.contains("Double-Jump"))
|
||||
return color + StatCollector.translateToLocal("modifier.armour.jump.triple");
|
||||
|
||||
if (tag.contains("Triple-Jump"))
|
||||
return color + StatCollector.translateToLocal("modifier.armour.jump.quad");
|
||||
|
||||
return color + StatCollector.translateToLocal("modifier.armour.jump.double");
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
public class AModHealthBoost extends ArmorModTypeFilter
|
||||
{
|
||||
final boolean modifierType;
|
||||
final int modifyAmount = 3;
|
||||
|
||||
public AModHealthBoost(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
|
||||
{
|
||||
super(effect, "ExoHealth" + (type ? "Percent" : "Flat"), armorTypes, items, values);
|
||||
this.modifierType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingItems(input) * modifyAmount;
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= matchingAmount(input) * modifyAmount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
if (armorTag.hasKey(key))
|
||||
{
|
||||
amount += armorTag.getInteger(key);
|
||||
}
|
||||
armorTag.setInteger(key, amount);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.getTagList("AttributeModifiers", 10);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
|
||||
if (tag.getString("AttributeName").equals("generic.maxHealth"))
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.maxHealth", key, amount, modifierType, getUUIDFromItem(armor)));
|
||||
}
|
||||
|
||||
private static final UUID head = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dab8");
|
||||
private static final UUID chest = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dab9");
|
||||
private static final UUID pants = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6daba");
|
||||
private static final UUID shoes = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dabb");
|
||||
|
||||
UUID getUUIDFromItem (ItemStack stack)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) stack.getItem();
|
||||
switch (item.armorPart)
|
||||
{
|
||||
case HELMET:
|
||||
return head;
|
||||
case CHEST:
|
||||
return chest;
|
||||
case PANTS:
|
||||
return pants;
|
||||
case SHOES:
|
||||
return shoes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
public class AModJumpBoost
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
public class AModKnockbackResistance extends ArmorModTypeFilter
|
||||
{
|
||||
final boolean modifierType;
|
||||
final int modifyAmount = 2;
|
||||
|
||||
public AModKnockbackResistance(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
|
||||
{
|
||||
super(effect, "ExoKnockback" + (type ? "Percent" : "Flat"), armorTypes, items, values);
|
||||
this.modifierType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingItems(input) * modifyAmount;
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= matchingAmount(input) * modifyAmount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
if (armorTag.hasKey(key))
|
||||
{
|
||||
amount += armorTag.getInteger(key);
|
||||
}
|
||||
armorTag.setInteger(key, amount);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.getTagList("AttributeModifiers", 10);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
|
||||
if (tag.getString("AttributeName").equals("generic.knockbackResistance"))
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.knockbackResistance", key, amount * 0.01, modifierType, getUUIDFromItem(armor)));
|
||||
}
|
||||
|
||||
private static final UUID head = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c44");
|
||||
private static final UUID chest = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c45");
|
||||
private static final UUID pants = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c46");
|
||||
private static final UUID shoes = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c47");
|
||||
|
||||
UUID getUUIDFromItem (ItemStack stack)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) stack.getItem();
|
||||
switch (item.armorPart)
|
||||
{
|
||||
case HELMET:
|
||||
return head;
|
||||
case CHEST:
|
||||
return chest;
|
||||
case PANTS:
|
||||
return pants;
|
||||
case SHOES:
|
||||
return shoes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class AModMoveSpeed extends ArmorModTypeFilter
|
||||
{
|
||||
final boolean modifierType;
|
||||
|
||||
public AModMoveSpeed(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
|
||||
{
|
||||
super(effect, "ExoSpeed" + (type ? "Percent" : "Flat"), armorTypes, items, values);
|
||||
this.modifierType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingAmount(input);
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= amount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
if (armorTag.hasKey(key))
|
||||
{
|
||||
amount += armorTag.getInteger(key);
|
||||
}
|
||||
armorTag.setInteger(key, amount);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.getTagList("AttributeModifiers", 10);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
|
||||
if (tag.getString("AttributeName").equals(key))
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.movementSpeed", key, amount / 100d, modifierType, getUUIDFromItem(armor)));
|
||||
}
|
||||
|
||||
private static final UUID head = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c730");
|
||||
private static final UUID chest = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c731");
|
||||
private static final UUID pants = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c732");
|
||||
private static final UUID shoes = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c733");
|
||||
|
||||
UUID getUUIDFromItem (ItemStack stack)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) stack.getItem();
|
||||
switch (item.armorPart)
|
||||
{
|
||||
case HELMET:
|
||||
return head;
|
||||
case CHEST:
|
||||
return chest;
|
||||
case PANTS:
|
||||
return pants;
|
||||
case SHOES:
|
||||
return shoes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class AModProtection extends ArmorModTypeFilter
|
||||
{
|
||||
int modifyAmount = 3;
|
||||
|
||||
public AModProtection(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "ExoProtection", armorTypes, items, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingItems(input) * modifyAmount;
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= matchingItems(input) * modifyAmount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
double absorb = armorTag.getDouble("protection");
|
||||
absorb += amount;
|
||||
armorTag.setDouble("protection", absorb);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Type;
|
||||
import mantle.common.network.AbstractPacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.ArmorProxyCommon;
|
||||
@@ -13,14 +14,16 @@ import tconstruct.client.event.EventCloakRender;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.util.network.packet.PacketDoubleJump;
|
||||
import tconstruct.util.network.packet.PacketExtendedInventory;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Type;
|
||||
|
||||
public class TControls extends TKeyHandler
|
||||
{
|
||||
public static final String keybindCategory = "key.tconstruct.category";
|
||||
// static KeyBinding grabKey = new KeyBinding("key.grab", 29);
|
||||
// static KeyBinding stiltsKey = new KeyBinding("key.stilts", 46);
|
||||
public static KeyBinding armorKey = new KeyBinding("key.tarmor", 24, keybindCategory);
|
||||
public static KeyBinding refreshCapes = new KeyBinding("key.tcapes.reload", 88, keybindCategory);
|
||||
public static KeyBinding toggleGoggles = new KeyBinding("key.tgoggles", 34, keybindCategory);
|
||||
public static KeyBinding beltSwap = new KeyBinding("key.tbelt", 48, keybindCategory);
|
||||
public static KeyBinding zoomKey = new KeyBinding("key.tzoom", 29, keybindCategory); //TODO: Make this hold, not toggle
|
||||
static KeyBinding jumpKey;
|
||||
static KeyBinding invKey;
|
||||
static Minecraft mc;
|
||||
@@ -30,6 +33,7 @@ public class TControls extends TKeyHandler
|
||||
boolean climbing = false;
|
||||
boolean onGround = false;
|
||||
boolean onStilts = false;
|
||||
public static boolean zoom = false;
|
||||
|
||||
int currentTab = 1;
|
||||
|
||||
@@ -37,7 +41,7 @@ public class TControls extends TKeyHandler
|
||||
|
||||
public TControls()
|
||||
{
|
||||
super(new KeyBinding[] { armorKey, refreshCapes }, new boolean[] { false, false }, getVanillaKeyBindings(), new boolean[] { false, false });
|
||||
super(new KeyBinding[] { armorKey, refreshCapes, toggleGoggles, beltSwap, zoomKey }, new boolean[] { false, false, false, false, false }, getVanillaKeyBindings(), new boolean[] { false, false });
|
||||
// TConstruct.logger.info("Controls registered");
|
||||
}
|
||||
|
||||
@@ -87,8 +91,46 @@ public class TControls extends TKeyHandler
|
||||
}
|
||||
|
||||
if (!jumping)
|
||||
{
|
||||
jumping = mc.thePlayer.isAirBorne;
|
||||
ItemStack shoes = mc.thePlayer.getCurrentArmor(0);
|
||||
if (shoes != null && shoes.hasTagCompound() && shoes.getTagCompound().hasKey("TinkerArmor"))
|
||||
{
|
||||
NBTTagCompound shoeTag = shoes.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
ItemStack wings = mc.thePlayer.getCurrentArmor(1);
|
||||
if (wings != null && wings.hasTagCompound() && wings.getTagCompound().hasKey("TinkerArmor"))
|
||||
{
|
||||
NBTTagCompound shoeTag = wings.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if (mc.currentScreen == null)
|
||||
{
|
||||
if (kb == toggleGoggles)
|
||||
{
|
||||
ItemStack goggles = mc.thePlayer.getCurrentArmor(3);
|
||||
if (goggles != null && goggles.getItem() instanceof TravelGear) //TODO: Genericize this
|
||||
{
|
||||
PlayerAbilityHelper.toggleGoggles(mc.thePlayer);
|
||||
updateServer((byte) 9);
|
||||
}
|
||||
}
|
||||
if (kb == beltSwap)
|
||||
{
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(mc.thePlayer.username);
|
||||
if (stats.armor.inventory[3] != null)
|
||||
{
|
||||
//PlayerAbilityHelper.swapBelt(mc.thePlayer, stats);
|
||||
updateServer((byte) 8);
|
||||
}
|
||||
}
|
||||
if (kb == zoomKey)
|
||||
zoom = !zoom;
|
||||
}*/
|
||||
}
|
||||
/*
|
||||
* else if (kb == stiltsKey) //Stilts { float size = 1.8F; if
|
||||
|
||||
@@ -108,7 +108,7 @@ public class CraftingStationGui extends GuiContainer
|
||||
|
||||
void drawModularToolStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
|
||||
{
|
||||
List categories = Arrays.asList(tool.toolCategories());
|
||||
List categories = Arrays.asList(tool.getTraits());
|
||||
final int durability = tags.getInteger("Damage");
|
||||
final int maxDur = tags.getInteger("TotalDurability");
|
||||
int availableDurability = maxDur - durability;
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.TToolMaterial;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.tools.inventory.PartCrafterChestContainer;
|
||||
import tconstruct.tools.logic.PartBuilderLogic;
|
||||
@@ -26,7 +26,7 @@ public class PartCrafterGui extends NewContainerGui
|
||||
boolean drawChestPart;
|
||||
boolean hasTop, hasBottom;
|
||||
ItemStack topMaterial, bottomMaterial;
|
||||
TToolMaterial topEnum, bottomEnum;
|
||||
ToolMaterial topEnum, bottomEnum;
|
||||
|
||||
public PartCrafterGui(InventoryPlayer inventoryplayer, PartBuilderLogic partlogic, World world, int x, int y, int z)
|
||||
{
|
||||
|
||||
@@ -187,7 +187,7 @@ public class ToolStationGui extends GuiContainer
|
||||
|
||||
void drawModularToolStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
|
||||
{
|
||||
List categories = Arrays.asList(tool.toolCategories());
|
||||
List categories = Arrays.asList(tool.getTraits());
|
||||
final int durability = tags.getInteger("Damage");
|
||||
final int maxDur = tags.getInteger("TotalDurability");
|
||||
int availableDurability = maxDur - durability;
|
||||
|
||||
@@ -14,14 +14,14 @@ import org.w3c.dom.NodeList;
|
||||
import tconstruct.client.gui.PartCrafterGui;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.TToolMaterial;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
|
||||
public class MaterialPage extends BookPage
|
||||
{
|
||||
String title;
|
||||
ItemStack[] icons;
|
||||
String iconText;
|
||||
TToolMaterial material;
|
||||
ToolMaterial material;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
|
||||
@@ -83,7 +83,7 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "ammo" };
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class Battleaxe extends HarvestTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "harvest", "melee", "slicing" };
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class Chisel extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "utility" };
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Dagger extends Weapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "melee", "throwing" };
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ public class Hammer extends HarvestTool
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "harvest", "melee", "bludgeoning" };
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class Scythe extends Weapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "melee", "harvest" };
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Shortbow extends BowBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "ranged", "bow" };
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import mantle.lib.TabTools;
|
||||
@@ -16,13 +17,14 @@ import org.apache.logging.log4j.Logger;
|
||||
import tconstruct.library.crafting.Detailing;
|
||||
import tconstruct.library.crafting.LiquidCasting;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.modifier.ActiveArmorMod;
|
||||
import tconstruct.library.tools.ArrowMaterial;
|
||||
import tconstruct.library.tools.BowMaterial;
|
||||
import tconstruct.library.tools.BowstringMaterial;
|
||||
import tconstruct.library.tools.CustomMaterial;
|
||||
import tconstruct.library.tools.FletchingMaterial;
|
||||
import tconstruct.library.tools.TToolMaterial;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
|
||||
/**
|
||||
* A registry to store any relevant API work
|
||||
@@ -41,6 +43,7 @@ public class TConstructRegistry
|
||||
public static TabTools partTab;
|
||||
public static TabTools materialTab;
|
||||
public static TabTools blockTab;
|
||||
public static TabTools equipableTab;
|
||||
|
||||
/* Items */
|
||||
|
||||
@@ -231,8 +234,8 @@ public class TConstructRegistry
|
||||
}
|
||||
|
||||
// Materials
|
||||
public static HashMap<Integer, TToolMaterial> toolMaterials = new HashMap<Integer, TToolMaterial>(40);
|
||||
public static HashMap<String, TToolMaterial> toolMaterialStrings = new HashMap<String, TToolMaterial>(40);
|
||||
public static HashMap<Integer, ToolMaterial> toolMaterials = new HashMap<Integer, ToolMaterial>(40);
|
||||
public static HashMap<String, ToolMaterial> toolMaterialStrings = new HashMap<String, ToolMaterial>(40);
|
||||
|
||||
/**
|
||||
* Adds a tool material to the registry
|
||||
@@ -265,10 +268,10 @@ public class TConstructRegistry
|
||||
public static void addToolMaterial (int materialID, String materialName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float stonebound,
|
||||
String style, String ability)
|
||||
{
|
||||
TToolMaterial mat = toolMaterials.get(materialID);
|
||||
ToolMaterial mat = toolMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
mat = new TToolMaterial(materialName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style, ability);
|
||||
mat = new ToolMaterial(materialName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style, ability);
|
||||
toolMaterials.put(materialID, mat);
|
||||
toolMaterialStrings.put(materialName, mat);
|
||||
}
|
||||
@@ -309,10 +312,10 @@ public class TConstructRegistry
|
||||
public static void addToolMaterial (int materialID, String materialName, String displayName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced,
|
||||
float stonebound, String style, String ability)
|
||||
{
|
||||
TToolMaterial mat = toolMaterials.get(materialID);
|
||||
ToolMaterial mat = toolMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
mat = new TToolMaterial(materialName, displayName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style, ability);
|
||||
mat = new ToolMaterial(materialName, displayName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style, ability);
|
||||
toolMaterials.put(materialID, mat);
|
||||
toolMaterialStrings.put(materialName, mat);
|
||||
}
|
||||
@@ -332,9 +335,9 @@ public class TConstructRegistry
|
||||
* for lookup purposes.
|
||||
*/
|
||||
|
||||
public static void addtoolMaterial (int materialID, TToolMaterial material)
|
||||
public static void addtoolMaterial (int materialID, ToolMaterial material)
|
||||
{
|
||||
TToolMaterial mat = toolMaterials.get(materialID);
|
||||
ToolMaterial mat = toolMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
toolMaterials.put(materialID, mat);
|
||||
@@ -352,7 +355,7 @@ public class TConstructRegistry
|
||||
* @return Tool Material
|
||||
*/
|
||||
|
||||
public static TToolMaterial getMaterial (int key)
|
||||
public static ToolMaterial getMaterial (int key)
|
||||
{
|
||||
return (toolMaterials.get(key));
|
||||
}
|
||||
@@ -365,7 +368,7 @@ public class TConstructRegistry
|
||||
* @return Tool Material
|
||||
*/
|
||||
|
||||
public static TToolMaterial getMaterial (String key)
|
||||
public static ToolMaterial getMaterial (String key)
|
||||
{
|
||||
return (toolMaterialStrings.get(key));
|
||||
}
|
||||
@@ -545,12 +548,18 @@ public class TConstructRegistry
|
||||
}
|
||||
|
||||
public static ArrayList<ActiveToolMod> activeModifiers = new ArrayList<ActiveToolMod>();
|
||||
public static LinkedList<ActiveArmorMod> activeArmorModifiers = new LinkedList<ActiveArmorMod>();
|
||||
|
||||
public static void registerActiveToolMod (ActiveToolMod mod)
|
||||
{
|
||||
activeModifiers.add(mod);
|
||||
}
|
||||
|
||||
public static void registerActiveArmorMod (ActiveArmorMod mod)
|
||||
{
|
||||
activeArmorModifiers.add(mod);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Material Index 0: Wood 1: Stone 2: Iron 3: Flint 4: Cactus 5:
|
||||
* Bone 6: Obsidian 7: Netherrack 8: Green Slime 9: Paper 10: Cobalt 11:
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
package tconstruct.library.accessory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class AccessoryCore extends Item implements IAccessory, IModifyable
|
||||
{
|
||||
/**
|
||||
* Override getArmorModel() to have render on the player.
|
||||
*/
|
||||
protected String texture;
|
||||
public AccessoryCore( String texture)
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TConstructRegistry.equipableTab);
|
||||
this.setMaxStackSize(1);
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseTagName ()
|
||||
{
|
||||
return "TinkerAccessory";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModifyType ()
|
||||
{
|
||||
return "Accessory";
|
||||
}
|
||||
|
||||
final static String[] traits = new String[] { "accessory" };
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return traits;
|
||||
}
|
||||
|
||||
/*public void getSubItems (int id, CreativeTabs tab, List list)
|
||||
{
|
||||
ItemStack glove = new ItemStack(this);
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setBoolean("Built", true);
|
||||
tag.setInteger("Modifiers", 5);
|
||||
baseTag.setTag(getBaseTag(), tag);
|
||||
glove.setTagCompound(baseTag);
|
||||
list.add(glove);
|
||||
}*/
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(getDefaultItem());
|
||||
}
|
||||
|
||||
public ItemStack getDefaultItem()
|
||||
{
|
||||
ItemStack gear = new ItemStack(this, 1, 0);
|
||||
NBTTagCompound itemTag = new NBTTagCompound();
|
||||
|
||||
int baseDurability = 500;
|
||||
|
||||
itemTag.setInteger("Damage", 0); //Damage is damage to the tool
|
||||
itemTag.setInteger("TotalDurability", baseDurability);
|
||||
itemTag.setInteger("BaseDurability", baseDurability);
|
||||
itemTag.setInteger("BonusDurability", 0); //Modifier
|
||||
itemTag.setFloat("ModDurability", 0f); //Modifier
|
||||
itemTag.setInteger("Modifiers", 5);
|
||||
itemTag.setBoolean("Broken", false);
|
||||
itemTag.setBoolean("Built", true);
|
||||
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
baseTag.setTag(getBaseTagName(), itemTag);
|
||||
gear.setTagCompound(baseTag);
|
||||
return gear;
|
||||
}
|
||||
|
||||
/* Icons */
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon[] modifiers;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("tinker:"+texture);
|
||||
registerModifiers(iconRegister);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers(IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (ItemStack stack, int renderPass)
|
||||
{
|
||||
if (renderPass > 0)
|
||||
{
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("TinkerAccessory");
|
||||
if (renderPass == 1 && tags.hasKey("Effect1"))
|
||||
{
|
||||
return modifiers[tags.getInteger("Effect1")];
|
||||
}
|
||||
if (renderPass == 2 && tags.hasKey("Effect2"))
|
||||
{
|
||||
return modifiers[tags.getInteger("Effect2")];
|
||||
}
|
||||
if (renderPass == 3 && tags.hasKey("Effect3"))
|
||||
{
|
||||
return modifiers[tags.getInteger("Effect3")];
|
||||
}
|
||||
}
|
||||
return ToolCore.blankSprite;
|
||||
}
|
||||
|
||||
return itemIcon;
|
||||
}
|
||||
|
||||
/* Tooltips */
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags.hasKey(getBaseTagName()))
|
||||
{
|
||||
tags = stack.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
boolean broken = tags.getBoolean("Broken");
|
||||
if (broken)
|
||||
list.add("\u00A7oBroken");
|
||||
else
|
||||
{
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package tconstruct.library.accessory;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IAccessory
|
||||
{
|
||||
/** Accessory slots are not the same as armor slots!
|
||||
*
|
||||
* @param item Instance of the item
|
||||
* @param slot Accessory slot
|
||||
* @return Whether the accessory can be inserted into the slot
|
||||
*/
|
||||
public boolean canEquipAccessory (ItemStack item, int slot);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package tconstruct.library.accessory;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IAccessoryModel
|
||||
{
|
||||
/** Similar to how armor is rendered.
|
||||
*
|
||||
* @param stack
|
||||
* @param entity
|
||||
* @param slot
|
||||
* @return Resource location of the texture. Return null for none
|
||||
*/
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package tconstruct.library.accessory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IHealthAccessory extends IAccessory
|
||||
{
|
||||
public int getHealthBoost (ItemStack item);
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package tconstruct.library.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -14,7 +17,7 @@ public class AModInteger extends ArmorMod
|
||||
public final String color;
|
||||
public final String tooltipName;
|
||||
|
||||
public AModInteger(int effect, String dataKey, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int count, int increase, String c, String tip)
|
||||
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int count, int increase, String c, String tip)
|
||||
{
|
||||
super(effect, dataKey, armorTypes, items);
|
||||
this.modifyCount = count;
|
||||
@@ -26,11 +29,14 @@ public class AModInteger extends ArmorMod
|
||||
@Override
|
||||
protected boolean canModify (ItemStack armor, ItemStack[] input)
|
||||
{
|
||||
Item i = armor.getItem();
|
||||
if (!(i instanceof ArmorCore))
|
||||
return false;
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (armorTypes.contains(item.armorPart))
|
||||
{
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
return tags.getInteger("Modifiers") >= modifyCount;
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName(armor));
|
||||
return tags.getInteger("Modifiers") > modifyCount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -38,7 +44,7 @@ public class AModInteger extends ArmorMod
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName(tool));
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
int increase = tags.getInteger(key);
|
||||
@@ -57,4 +63,4 @@ public class AModInteger extends ArmorMod
|
||||
addToolTip(tool, color + tooltipName, color + key);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,231 +1,347 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.dispenser.IBehaviorDispenseItem;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.modifier.ActiveArmorMod;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* NBTTags Main tag - InfiArmor
|
||||
*/
|
||||
public abstract class ArmorCore extends ItemArmor implements IEnergyContainerItem, ISpecialArmor
|
||||
public abstract class ArmorCore extends ItemArmor implements ISpecialArmor, IModifyable
|
||||
{
|
||||
|
||||
public static final String SET_NAME = "TinkerArmor";
|
||||
public final EnumArmorPart armorPart;
|
||||
public final ArmorPart armorPart;
|
||||
private static final IBehaviorDispenseItem dispenserBehavior = new BehaviorDispenseArmorCopy();
|
||||
public final int baseProtection;
|
||||
protected final String modifyType;
|
||||
protected final String textureFolder;
|
||||
protected final String textureName;
|
||||
|
||||
// TE power constants -- TODO grab these from the items added
|
||||
protected int capacity = 400000;
|
||||
protected int maxReceive = 75;
|
||||
protected int maxExtract = 75;
|
||||
|
||||
public ArmorCore(int baseProtection, EnumArmorPart part)
|
||||
public ArmorCore(int baseProtection, ArmorPart part, String type, String textureFolder, String textureName)
|
||||
{
|
||||
super(ArmorMaterial.CHAIN, 0, part.getPartId());
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(100);
|
||||
this.setUnlocalizedName(SET_NAME);
|
||||
this.armorPart = part;
|
||||
this.baseProtection = baseProtection;
|
||||
this.modifyType = type;
|
||||
this.textureFolder = textureFolder;
|
||||
this.textureName = textureName;
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior);
|
||||
this.setCreativeTab(TConstructRegistry.equipableTab);
|
||||
}
|
||||
|
||||
public ArmorCore(int baseProtection, ArmorPart part, String type, String textureName)
|
||||
{
|
||||
this(baseProtection, part, type, "armor", textureName);
|
||||
}
|
||||
|
||||
//Temporary?
|
||||
public abstract ItemStack getRepairMaterial (ItemStack input);
|
||||
|
||||
public String getArmorName ()
|
||||
{
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
public String getBaseTagName ()
|
||||
{
|
||||
int i = EntityLiving.getArmorPosition(par1ItemStack) - 1;
|
||||
ItemStack itemstack1 = par3EntityPlayer.getCurrentArmor(i);
|
||||
return "TinkerArmor";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModifyType ()
|
||||
{
|
||||
return modifyType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "armor" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
int i = EntityLiving.getArmorPosition(stack) - 1;
|
||||
ItemStack itemstack1 = player.getCurrentArmor(i);
|
||||
|
||||
if (itemstack1 == null)
|
||||
{
|
||||
par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy());
|
||||
par1ItemStack.stackSize = 0;
|
||||
player.setCurrentItemOrArmor(i + 1, stack.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
return stack;
|
||||
}
|
||||
|
||||
// ISpecialArmor overrides
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
for (ActiveArmorMod mod : TConstructRegistry.activeArmorModifiers)
|
||||
{
|
||||
mod.onArmorTick(world, player, itemStack, this, this.armorPart);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
if (slot == 2)
|
||||
return "tinker:textures/armor/" + textureName + "_" + 2 + ".png";
|
||||
return "tinker:textures/armor/" + textureName + "_" + 1 + ".png";
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon[] modifiers;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:" + textureFolder + "/" + textureName
|
||||
+ (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "pants" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
registerModifiers(iconRegister);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (ItemStack stack, int renderPass)
|
||||
{
|
||||
if (renderPass > 0)
|
||||
{
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
if (renderPass == 1 && tags.hasKey("Effect1"))
|
||||
{
|
||||
return modifiers[tags.getInteger("Effect1")];
|
||||
}
|
||||
if (renderPass == 2 && tags.hasKey("Effect2"))
|
||||
{
|
||||
return modifiers[tags.getInteger("Effect2")];
|
||||
}
|
||||
if (renderPass == 3 && tags.hasKey("Effect3"))
|
||||
{
|
||||
return modifiers[tags.getInteger("Effect3")];
|
||||
}
|
||||
}
|
||||
return ToolCore.blankSprite;
|
||||
}
|
||||
|
||||
return itemIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderPasses (int metadata)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//ISpecialArmor overrides
|
||||
@Override
|
||||
public ArmorProperties getProperties (EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot)
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
return new ArmorProperties(0, 0, baseProtection);
|
||||
}
|
||||
NBTTagCompound tags = armor.getTagCompound();
|
||||
//Priority, absorbRatio, max
|
||||
if (!armor.hasTagCompound() || source.isUnblockable())
|
||||
return new ArmorProperties(0, 0, 0);
|
||||
|
||||
if (tags == null)
|
||||
{
|
||||
return new ArmorProperties(0, damage / baseProtection, baseProtection);
|
||||
}
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
if (tags.getBoolean("Broken"))
|
||||
return new ArmorProperties(0, 0, 0);
|
||||
|
||||
NBTTagCompound data = tags.getCompoundTag(SET_NAME);
|
||||
float maxDurability = tags.getInteger("TotalDurability");
|
||||
float currentDurability = maxDurability - tags.getInteger("Damage");
|
||||
float ratio = currentDurability / maxDurability;
|
||||
double base = tags.getDouble("BaseDefense");
|
||||
double max = tags.getDouble("MaxDefense");
|
||||
double current = (max - base) * ratio + base;
|
||||
|
||||
double amount = (data.getInteger("defense") / damage) + (data.getDouble("protection") / 100);
|
||||
if (source.isUnblockable())
|
||||
amount = 0;
|
||||
clamp_double(amount, 0, 1);
|
||||
return new ArmorProperties(0, amount, 100);
|
||||
}
|
||||
|
||||
public static double clamp_double (double par0, double par1, double par2)
|
||||
{
|
||||
return par0 < par1 ? par1 : (par0 > par2 ? par2 : par0);
|
||||
return new ArmorProperties(0, current / 100, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay (EntityPlayer player, ItemStack armor, int slot)
|
||||
{
|
||||
if (slot != 1)
|
||||
{
|
||||
ItemStack stack = player.getCurrentArmor(1);
|
||||
if (stack != null && stack.getItem() instanceof ArmorCore)
|
||||
return 0;
|
||||
return disconnectedArmorDisplay(player, armor, slot);
|
||||
}
|
||||
|
||||
return combinedArmorDisplay(player, armor);
|
||||
}
|
||||
|
||||
protected int disconnectedArmorDisplay (EntityPlayer player, ItemStack armor, int slot)
|
||||
{
|
||||
if (!armor.hasTagCompound())
|
||||
return this.baseProtection;
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(SET_NAME);
|
||||
double amount = armorTag.getDouble("protection") / 4;
|
||||
if (amount > 0 && amount < 1)
|
||||
return 0;
|
||||
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
if (armorTag.getBoolean("Broken"))
|
||||
return 0;
|
||||
|
||||
float max = armorTag.getInteger("TotalDurability");
|
||||
float current = max - armorTag.getInteger("Damage");
|
||||
float amount = current / max * 5 + 0.09F;
|
||||
if (slot == 2 && amount < 1)
|
||||
amount = 1;
|
||||
return (int) (Math.floor(amount));
|
||||
return (int) amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot)
|
||||
protected int combinedArmorDisplay (EntityPlayer player, ItemStack legs)
|
||||
{
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
NBTTagCompound data;
|
||||
|
||||
if (tags == null)
|
||||
ItemStack[] armors = new ItemStack[] { player.getCurrentArmor(3), player.getCurrentArmor(2), legs, player.getCurrentArmor(0) };
|
||||
int types = 0;
|
||||
int max = 0;
|
||||
int damage = 0;
|
||||
boolean anyAlive = false;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
tags = new NBTTagCompound();
|
||||
stack.setTagCompound(tags);
|
||||
data = new NBTTagCompound();
|
||||
tags.setTag(SET_NAME, data);
|
||||
data.setDouble("damageReduction", baseProtection);
|
||||
}
|
||||
|
||||
data = tags.getCompoundTag(SET_NAME);
|
||||
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
int energy = tags.getInteger("Energy");
|
||||
if (energy > damage)
|
||||
ItemStack stack = armors[i];
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
energy -= damage;
|
||||
tags.setInteger("Energy", energy);
|
||||
return;
|
||||
NBTTagCompound armorTag = stack.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
if (stack.getItem() instanceof ArmorCore)
|
||||
{
|
||||
types++;
|
||||
max += armorTag.getInteger("TotalDurability");
|
||||
if (armorTag.getBoolean("Broken"))
|
||||
{
|
||||
damage += armorTag.getInteger("TotalDurability");
|
||||
}
|
||||
else
|
||||
{
|
||||
damage += armorTag.getInteger("Damage");
|
||||
anyAlive = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
float ratio = ((float) max - (float) damage) / (float) max * (types * 5) + 0.1f;
|
||||
int minimum = anyAlive ? 1 : 0;
|
||||
if (ratio < minimum)
|
||||
ratio = minimum;
|
||||
return (int) ratio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor (EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot)
|
||||
{
|
||||
if (armor.hasTagCompound())
|
||||
{
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
if (!tags.getBoolean("Broken"))
|
||||
{
|
||||
damage -= energy;
|
||||
tags.setInteger("Energy", 0);
|
||||
int dmg = data.getInteger("Damage");
|
||||
dmg += damage;
|
||||
data.setDouble("Damage", dmg);
|
||||
int maxDurability = tags.getInteger("TotalDurability");
|
||||
int currentDurability = tags.getInteger("Damage");
|
||||
if (currentDurability + damage > maxDurability)
|
||||
{
|
||||
tags.setInteger("Damage", 0);
|
||||
tags.setBoolean("Broken", true);
|
||||
armor.setItemDamage(0);
|
||||
entity.worldObj.playSound(entity.posX, entity.posY, entity.posZ, "random.break", 1f, 1f, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
tags.setInteger("Damage", currentDurability + damage);
|
||||
armor.setItemDamage(currentDurability + damage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int dmg = data.getInteger("Damage");
|
||||
dmg += damage;
|
||||
data.setInteger("Damage", dmg);
|
||||
}
|
||||
}
|
||||
|
||||
// TE support section -- from COFH core API reference section
|
||||
public void setMaxTransfer (int maxTransfer)
|
||||
{
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public void setMaxReceive (int maxReceive)
|
||||
{
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxExtract (int maxExtract)
|
||||
{
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy (ItemStack container, int maxReceive, boolean simulate)
|
||||
{
|
||||
NBTTagCompound tags = container.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
return 0;
|
||||
int energy = tags.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
if (!simulate)
|
||||
{
|
||||
energy += energyReceived;
|
||||
tags.setInteger("Energy", energy);
|
||||
container.setItemDamage(1 + (getMaxEnergyStored(container) - energy) * (container.getMaxDamage() - 2) / getMaxEnergyStored(container));
|
||||
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy (ItemStack container, int maxExtract, boolean simulate)
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
NBTTagCompound tags = container.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int energy = tags.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
if (!simulate)
|
||||
{
|
||||
energy -= energyExtracted;
|
||||
tags.setInteger("Energy", energy);
|
||||
container.setItemDamage(1 + (getMaxEnergyStored(container) - energy) * (container.getMaxDamage() - 1) / getMaxEnergyStored(container));
|
||||
|
||||
}
|
||||
return energyExtracted;
|
||||
par3List.add(getDefaultItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored (ItemStack container)
|
||||
public ItemStack getDefaultItem ()
|
||||
{
|
||||
NBTTagCompound tags = container.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return tags.getInteger("Energy");
|
||||
ItemStack gear = new ItemStack(this, 1, 0);
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("Modifiers", 3);
|
||||
double flat = getFlatDefense();
|
||||
double base = getBaseDefense();
|
||||
double max = getMaxDefense();
|
||||
tag.setDouble("DamageReduction", flat);
|
||||
tag.setDouble("BaseDefense", base);
|
||||
tag.setDouble("MaxDefense", max);
|
||||
|
||||
int baseDurability = getDurability();
|
||||
|
||||
tag.setInteger("Damage", 0); //Damage is damage to the armor
|
||||
tag.setInteger("TotalDurability", baseDurability);
|
||||
tag.setInteger("BaseDurability", baseDurability);
|
||||
tag.setInteger("BonusDurability", 0); //Modifier
|
||||
tag.setFloat("ModDurability", 0f); //Modifier
|
||||
tag.setBoolean("Broken", false);
|
||||
tag.setBoolean("Built", true);
|
||||
|
||||
baseTag.setTag(getBaseTagName(), tag);
|
||||
gear.setTagCompound(baseTag);
|
||||
return gear;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored (ItemStack container)
|
||||
protected double getFlatDefense ()
|
||||
{
|
||||
NBTTagCompound tags = container.getTagCompound();
|
||||
if (tags == null || !tags.hasKey("Energy"))
|
||||
return 0;
|
||||
return capacity;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// end of TE support section
|
||||
protected abstract double getBaseDefense ();
|
||||
|
||||
protected abstract double getMaxDefense ();
|
||||
|
||||
protected abstract int getDurability ();
|
||||
|
||||
// Vanilla overrides
|
||||
@Override
|
||||
public boolean isItemTool (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
@@ -237,25 +353,21 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidArmor (ItemStack stack, int armorType, Entity entity)
|
||||
{
|
||||
return this.armorPart.getPartId() == armorType;
|
||||
@@ -270,16 +382,7 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
int energy = tags.getInteger("Energy");
|
||||
if (energy > 0)
|
||||
{
|
||||
return this.getMaxEnergyStored(stack);
|
||||
}
|
||||
}
|
||||
|
||||
return tags.getCompoundTag(SET_NAME).getInteger("TotalDurability");
|
||||
return tags.getCompoundTag(getBaseTagName()).getInteger("TotalDurability");
|
||||
}
|
||||
|
||||
public int getItemMaxDamageFromStackForDisplay (ItemStack stack)
|
||||
@@ -290,16 +393,47 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
int energy = tags.getInteger("Energy");
|
||||
if (energy > 0)
|
||||
{
|
||||
return this.getMaxEnergyStored(stack) - energy;
|
||||
}
|
||||
}
|
||||
|
||||
return tags.getCompoundTag(SET_NAME).getInteger("Damage");
|
||||
return tags.getCompoundTag(getBaseTagName()).getInteger("Damage");
|
||||
}
|
||||
|
||||
DecimalFormat df = new DecimalFormat("##.#");
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
double protection = 0;
|
||||
if (!tags.getBoolean("Broken"))
|
||||
{
|
||||
float maxDurability = tags.getInteger("TotalDurability");
|
||||
float currentDurability = maxDurability - tags.getInteger("Damage");
|
||||
float ratio = currentDurability / maxDurability;
|
||||
double base = tags.getDouble("BaseDefense");
|
||||
double max = tags.getDouble("MaxDefense");
|
||||
protection = (max - base) * ratio + base;
|
||||
}
|
||||
if (protection > 0)
|
||||
list.add("\u00a77Protection: " + df.format(protection) + "%");
|
||||
else
|
||||
list.add("\u00A7oBroken");
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,17 @@ package tconstruct.library.armor;
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public abstract class ArmorMod extends ToolMod
|
||||
public abstract class ArmorMod extends ItemModifier
|
||||
{
|
||||
protected final EnumSet<EnumArmorPart> armorTypes;
|
||||
protected final EnumSet<ArmorPart> armorTypes;
|
||||
|
||||
public ArmorMod(int effect, String dataKey, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items)
|
||||
public ArmorMod(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items)
|
||||
{
|
||||
super(items, effect, dataKey);
|
||||
this.armorTypes = armorTypes;
|
||||
@@ -20,36 +22,21 @@ public abstract class ArmorMod extends ToolMod
|
||||
@Override
|
||||
protected boolean canModify (ItemStack armor, ItemStack[] input)
|
||||
{
|
||||
Item i = armor.getItem();
|
||||
if (!(i instanceof ArmorCore))
|
||||
return false;
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (armorTypes.contains(item.armorPart))
|
||||
{
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
NBTTagCompound tags = getModifierTag(armor);
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getTagName ()
|
||||
public boolean validType (IModifyable type)
|
||||
{
|
||||
return "TinkerArmor";
|
||||
}
|
||||
|
||||
public boolean validArmorType (ArmorCore armor)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected NBTTagCompound getAttributeTag (String attributeType, String modifierName, double amount, boolean flat, UUID uuid)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", attributeType);
|
||||
tag.setString("Name", modifierName);
|
||||
tag.setDouble("Amount", amount);
|
||||
tag.setInteger("Operation", flat ? 0 : 1);// 0 = flat increase, 1 = %
|
||||
// increase
|
||||
tag.setLong("UUIDMost", uuid.getMostSignificantBits());
|
||||
tag.setLong("UUIDLeast", uuid.getLeastSignificantBits());
|
||||
return tag;
|
||||
return type.getModifyType().equals("Armor");
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ public abstract class ArmorModTypeFilter extends ArmorMod
|
||||
{
|
||||
public final List<Integer> increase;
|
||||
|
||||
public ArmorModTypeFilter(int effect, String dataKey, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values)
|
||||
public ArmorModTypeFilter(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, dataKey, armorTypes, items);
|
||||
assert items.length == values.length : "Itemstacks and their values for armor modifiers must be the same length";
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
public enum EnumArmorPart
|
||||
public enum ArmorPart
|
||||
{
|
||||
|
||||
HELMET(0), CHEST(1), PANTS(2), SHOES(3);
|
||||
Head(0), Chest(1), Legs(2), Feet(3);
|
||||
|
||||
private final int partID;
|
||||
|
||||
private EnumArmorPart(int partID)
|
||||
private ArmorPart(int partID)
|
||||
{
|
||||
this.partID = partID;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package tconstruct.library.armor;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IHealthAccessory
|
||||
{
|
||||
public boolean canEquipItem (ItemStack item, int slot);
|
||||
|
||||
public int getHealthBoost (ItemStack item);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package tconstruct.library.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorMod;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public class ModifyBuilder
|
||||
{
|
||||
public static ModifyBuilder instance = new ModifyBuilder();
|
||||
public List<ItemModifier> itemModifiers = new ArrayList<ItemModifier>();
|
||||
|
||||
public ItemStack modifyItem(ItemStack input, ItemStack[] modifiers)
|
||||
{
|
||||
ItemStack copy = input.copy(); //Prevent modifying the original
|
||||
if (copy.getItem() instanceof IModifyable)
|
||||
{
|
||||
IModifyable item = (IModifyable) copy.getItem();
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(item.getBaseTagName());
|
||||
|
||||
boolean built = false;
|
||||
for (ItemModifier mod : itemModifiers)
|
||||
{
|
||||
if (mod.matches(modifiers, copy))
|
||||
{
|
||||
built = true;
|
||||
mod.addMatchingEffect(copy); //Order matters here
|
||||
mod.modify(modifiers, copy);
|
||||
}
|
||||
}
|
||||
if (built)
|
||||
return copy;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void registerModifier(ItemModifier mod)
|
||||
{
|
||||
if (mod == null)
|
||||
throw new NullPointerException("Modifier cannot be null.");
|
||||
instance.itemModifiers.add(mod);
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,12 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorMod;
|
||||
import tconstruct.library.event.ToolCraftEvent;
|
||||
import tconstruct.library.tools.TToolMaterial;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.util.IToolPart;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
|
||||
@@ -28,8 +25,6 @@ public class ToolBuilder
|
||||
public HashMap<String, ToolRecipe> recipeList = new HashMap<String, ToolRecipe>();
|
||||
public List<ToolRecipe> combos = new ArrayList<ToolRecipe>();
|
||||
public HashMap<String, String> modifiers = new HashMap<String, String>();
|
||||
public List<ToolMod> toolMods = new ArrayList<ToolMod>();
|
||||
public List<ArmorMod> armorMods = new ArrayList<ArmorMod>();
|
||||
|
||||
/* Build tools */
|
||||
public static void addNormalToolRecipe (ToolCore output, Item head, Item handle)
|
||||
@@ -50,7 +45,7 @@ public class ToolBuilder
|
||||
|
||||
public static void addNormalToolRecipe (ToolCore output, Item head, Item handle, Item accessory)
|
||||
{
|
||||
// instance.combos.add(new ToolRecipe(head, accessory, output));
|
||||
//instance.combos.add(new ToolRecipe(head, accessory, output));
|
||||
ToolRecipe recipe = instance.recipeList.get(output.getToolName());
|
||||
if (recipe != null)
|
||||
{
|
||||
@@ -109,7 +104,7 @@ public class ToolBuilder
|
||||
return null;
|
||||
}
|
||||
|
||||
// Builds a tool from the parts given
|
||||
//Builds a tool from the parts given
|
||||
public ItemStack buildTool (ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, String name)
|
||||
{
|
||||
return buildTool(headStack, handleStack, accessoryStack, null, name);
|
||||
@@ -132,18 +127,10 @@ public class ToolBuilder
|
||||
|
||||
public ItemStack buildTool (ItemStack headStack, ItemStack handleStack, ItemStack accessoryStack, ItemStack extraStack, String name)
|
||||
{
|
||||
if (headStack != null)
|
||||
{
|
||||
if (headStack.getItem() instanceof ToolCore)
|
||||
return modifyTool(headStack, handleStack, accessoryStack, extraStack, name);
|
||||
else if (headStack.getItem() instanceof ArmorCore)
|
||||
return modifyArmor(headStack, new ItemStack[] { handleStack, accessoryStack, extraStack }, name);
|
||||
}
|
||||
/*if (headStack != null && headStack.getItem() instanceof ToolCore)
|
||||
return modifyTool(headStack, new ItemStack[] { handleStack, accessoryStack, extraStack }, name);*/
|
||||
|
||||
if (headStack == null || handleStack == null) // Nothing to build
|
||||
// without these. All
|
||||
// tools need at least
|
||||
// two parts!
|
||||
if (headStack == null || handleStack == null) //Nothing to build without these. All tools need at least two parts!
|
||||
return null;
|
||||
|
||||
ToolCore item;
|
||||
@@ -166,12 +153,6 @@ public class ToolBuilder
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* if (accessoryStack.getItem() instanceof IToolPart) accessory =
|
||||
* ((IToolPart)
|
||||
* accessoryStack.getItem()).getMaterialID(accessoryStack); else
|
||||
* return null;
|
||||
*/
|
||||
|
||||
accessory = getMaterialID(accessoryStack);
|
||||
if (accessory == -1)
|
||||
@@ -179,11 +160,6 @@ public class ToolBuilder
|
||||
|
||||
if (extraStack != null)
|
||||
{
|
||||
/*
|
||||
* if (extraStack.getItem() instanceof IToolPart) extra =
|
||||
* ((IToolPart) extraStack.getItem()).getMaterialID(extraStack);
|
||||
* else return null;
|
||||
*/
|
||||
|
||||
extra = getMaterialID(extraStack);
|
||||
if (extra == -1)
|
||||
@@ -197,12 +173,10 @@ public class ToolBuilder
|
||||
}
|
||||
}
|
||||
|
||||
// TConstruct.logger.info("Valid: "+item);
|
||||
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
TToolMaterial headMat = null, handleMat = null, accessoryMat = null, extraMat = null;
|
||||
ToolMaterial headMat = null, handleMat = null, accessoryMat = null, extraMat = null;
|
||||
headMat = TConstructRegistry.getMaterial(head);
|
||||
handleMat = TConstructRegistry.getMaterial(handle);
|
||||
|
||||
@@ -292,16 +266,11 @@ public class ToolBuilder
|
||||
compound.getCompoundTag("InfiTool").setInteger("RenderExtra", extra);
|
||||
}
|
||||
|
||||
compound.getCompoundTag("InfiTool").setInteger("Damage", 0); // Damage
|
||||
// is
|
||||
// damage
|
||||
// to
|
||||
// the
|
||||
// tool
|
||||
compound.getCompoundTag("InfiTool").setInteger("Damage", 0); //Damage is damage to the tool
|
||||
compound.getCompoundTag("InfiTool").setInteger("TotalDurability", durability);
|
||||
compound.getCompoundTag("InfiTool").setInteger("BaseDurability", durability);
|
||||
compound.getCompoundTag("InfiTool").setInteger("BonusDurability", 0); // Modifier
|
||||
compound.getCompoundTag("InfiTool").setFloat("ModDurability", 0f); // Modifier
|
||||
compound.getCompoundTag("InfiTool").setInteger("BonusDurability", 0); //Modifier
|
||||
compound.getCompoundTag("InfiTool").setFloat("ModDurability", 0f); //Modifier
|
||||
compound.getCompoundTag("InfiTool").setBoolean("Broken", false);
|
||||
compound.getCompoundTag("InfiTool").setInteger("Attack", attack);
|
||||
|
||||
@@ -343,7 +312,7 @@ public class ToolBuilder
|
||||
compound.getCompoundTag("display").setString("Name", "\u00A7f" + name);
|
||||
}
|
||||
|
||||
ToolCraftEvent.NormalTool event = new ToolCraftEvent.NormalTool(item, compound, new TToolMaterial[] { headMat, handleMat, accessoryMat, extraMat });
|
||||
ToolCraftEvent.NormalTool event = new ToolCraftEvent.NormalTool(item, compound, new ToolMaterial[] { headMat, handleMat, accessoryMat, extraMat });
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
|
||||
if (event.getResult() == Result.DEFAULT)
|
||||
@@ -362,69 +331,7 @@ public class ToolBuilder
|
||||
return tool;
|
||||
}
|
||||
|
||||
public ItemStack modifyTool (ItemStack input, ItemStack[] slots, String name)
|
||||
{
|
||||
ItemStack tool = input.copy();
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
tags.removeTag("Built");
|
||||
|
||||
boolean built = false;
|
||||
for (ToolMod mod : toolMods)
|
||||
{
|
||||
if (mod.matches(slots, tool))
|
||||
{
|
||||
built = true;
|
||||
mod.addMatchingEffect(tool);
|
||||
mod.modify(slots, tool);
|
||||
}
|
||||
}
|
||||
|
||||
tags = tool.getTagCompound();
|
||||
if (name != null && !name.equals("") && !tags.hasKey("display"))
|
||||
{
|
||||
tags.setTag("display", new NBTTagCompound());
|
||||
tags.getCompoundTag("display").setString("Name", "\u00A7f" + name);
|
||||
}
|
||||
|
||||
if (built)
|
||||
return tool;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack modifyArmor (ItemStack input, ItemStack[] slots, String name)
|
||||
{
|
||||
ItemStack armor = input.copy();
|
||||
if (!armor.hasTagCompound())
|
||||
addArmorTag(input);
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
tags.removeTag("Built");
|
||||
|
||||
boolean built = false;
|
||||
for (ArmorMod mod : armorMods)
|
||||
{
|
||||
if (mod.matches(slots, armor))
|
||||
{
|
||||
built = true;
|
||||
mod.addMatchingEffect(armor);
|
||||
mod.modify(slots, armor);
|
||||
}
|
||||
}
|
||||
|
||||
tags = armor.getTagCompound();
|
||||
if (name != null && !name.equals("") && !tags.hasKey("display"))
|
||||
{
|
||||
tags.setTag("display", new NBTTagCompound());
|
||||
tags.getCompoundTag("display").setString("Name", "\u00A7f" + name);
|
||||
}
|
||||
|
||||
if (built)
|
||||
return armor;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/*@Deprecated
|
||||
public ItemStack modifyTool (ItemStack input, ItemStack topSlot, ItemStack bottomSlot, ItemStack extraStack, String name)
|
||||
{
|
||||
if (extraStack != null)
|
||||
@@ -452,7 +359,7 @@ public class ToolBuilder
|
||||
tags = tool.getTagCompound();
|
||||
if (name != null && !name.equals("") && !tags.hasKey("display"))
|
||||
{
|
||||
tags.setTag("display", new NBTTagCompound());
|
||||
tags.setCompoundTag("display", new NBTTagCompound());
|
||||
tags.getCompoundTag("display").setString("Name", "\u00A7f" + name);
|
||||
}
|
||||
|
||||
@@ -460,21 +367,10 @@ public class ToolBuilder
|
||||
return tool;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}*/
|
||||
|
||||
public void addArmorTag (ItemStack armor) // Not sure if temporary or not
|
||||
{
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
NBTTagCompound armorTag = new NBTTagCompound();
|
||||
armorTag.setInteger("Modifiers", 30);
|
||||
baseTag.setTag("TinkerArmor", armorTag);
|
||||
|
||||
armor.setTagCompound(baseTag);
|
||||
}
|
||||
|
||||
int buildReinforced (TToolMaterial headMat, TToolMaterial handleMat, TToolMaterial accessoryMat, TToolMaterial extraMat)
|
||||
int buildReinforced (ToolMaterial headMat, ToolMaterial handleMat, ToolMaterial accessoryMat, ToolMaterial extraMat)
|
||||
{
|
||||
int reinforced = 0;
|
||||
|
||||
@@ -499,7 +395,7 @@ public class ToolBuilder
|
||||
return reinforced;
|
||||
}
|
||||
|
||||
float buildShoddy (TToolMaterial headMat, TToolMaterial handleMat, TToolMaterial accessoryMat, TToolMaterial extraMat)
|
||||
float buildShoddy (ToolMaterial headMat, ToolMaterial handleMat, ToolMaterial accessoryMat, ToolMaterial extraMat)
|
||||
{
|
||||
float sHead = headMat.shoddy();
|
||||
float sHandle = handleMat.shoddy();
|
||||
@@ -517,18 +413,11 @@ public class ToolBuilder
|
||||
}
|
||||
return (sHead + sHandle) / 2f;
|
||||
}
|
||||
|
||||
public static void registerToolMod (ToolMod mod)
|
||||
|
||||
//Passthrough for now
|
||||
@Deprecated
|
||||
public static void registerToolMod(ItemModifier mod)
|
||||
{
|
||||
if (mod == null)
|
||||
throw new NullPointerException("Tool modifier cannot be null.");
|
||||
instance.toolMods.add(mod);
|
||||
}
|
||||
|
||||
public static void registerArmorMod (ArmorMod mod)
|
||||
{
|
||||
if (mod == null)
|
||||
throw new NullPointerException("Armor modifier cannot be null.");
|
||||
instance.armorMods.add(mod);
|
||||
ModifyBuilder.registerModifier(mod);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package tconstruct.library.event;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.TToolMaterial;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
@@ -14,10 +14,10 @@ public class ToolCraftEvent extends Event
|
||||
{
|
||||
public final ToolCore tool;
|
||||
public final NBTTagCompound toolTag;
|
||||
public final TToolMaterial[] materials;
|
||||
public final ToolMaterial[] materials;
|
||||
protected ItemStack resultStack;
|
||||
|
||||
public ToolCraftEvent(ToolCore tool, NBTTagCompound toolTag, TToolMaterial[] materials)
|
||||
public ToolCraftEvent(ToolCore tool, NBTTagCompound toolTag, ToolMaterial[] materials)
|
||||
{
|
||||
this.tool = tool;
|
||||
this.toolTag = toolTag;
|
||||
@@ -27,7 +27,7 @@ public class ToolCraftEvent extends Event
|
||||
@HasResult
|
||||
public static class NormalTool extends ToolCraftEvent
|
||||
{
|
||||
public NormalTool(ToolCore tool, NBTTagCompound toolTag, TToolMaterial[] materials)
|
||||
public NormalTool(ToolCore tool, NBTTagCompound toolTag, ToolMaterial[] materials)
|
||||
{
|
||||
super(tool, toolTag, materials);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package tconstruct.library.modifier;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
|
||||
public class ActiveArmorMod
|
||||
{
|
||||
/* Ticks for every armor piece on client and server */
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack, ArmorCore armor, ArmorPart type)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package tconstruct.library.modifier;
|
||||
|
||||
public interface IModifyable
|
||||
{
|
||||
/**
|
||||
* @return The base tag to modify. Ex: InfiTool
|
||||
*/
|
||||
public String getBaseTagName();
|
||||
|
||||
public String getModifyType();
|
||||
|
||||
public String[] getTraits();
|
||||
}
|
||||
+63
-41
@@ -1,51 +1,55 @@
|
||||
package tconstruct.library.tools;
|
||||
package tconstruct.library.modifier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public abstract class ToolMod
|
||||
public abstract class ItemModifier
|
||||
{
|
||||
public final String key;
|
||||
public final List stacks;
|
||||
public final int effectIndex;
|
||||
public static Random random = new Random();
|
||||
|
||||
/** Default constructor
|
||||
*
|
||||
* @param recipe Items to compare against when checking the modifier
|
||||
* @param effect Render index for sprite layering
|
||||
* @param dataKey NBT string to put on the item
|
||||
*/
|
||||
|
||||
public ToolMod(ItemStack[] items, int effect, String dataKey)
|
||||
public ItemModifier(ItemStack[] recipe, int effect, String dataKey)
|
||||
{
|
||||
// recipeItems = items;
|
||||
List<ItemStack> itemstacks = new ArrayList<ItemStack>();
|
||||
for (int iter = 0; iter < items.length; iter++)
|
||||
itemstacks.add(items[iter]);
|
||||
for (int iter = 0; iter < recipe.length; iter++)
|
||||
itemstacks.add(recipe[iter]);
|
||||
stacks = itemstacks;
|
||||
effectIndex = effect;
|
||||
key = dataKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the inputs match the stored items Note: Works like
|
||||
* ShapelessRecipes
|
||||
/** Checks to see if the inputs match the stored items
|
||||
* Note: Works like ShapelessRecipes
|
||||
*
|
||||
* @param input
|
||||
* The ItemStacks to compare against
|
||||
* @param tool
|
||||
* Item to modify, used for restrictions
|
||||
* @param recipe The ItemStacks to compare against
|
||||
* @param input Item to modify, used for restrictions
|
||||
* @return Whether the recipe matches the input
|
||||
*/
|
||||
public boolean matches (ItemStack[] input, ItemStack tool)
|
||||
public boolean matches (ItemStack[] recipe, ItemStack input)
|
||||
{
|
||||
if (!canModify(tool, input))
|
||||
if (!canModify(input, recipe))
|
||||
return false;
|
||||
|
||||
ArrayList list = new ArrayList(this.stacks);
|
||||
|
||||
for (int iter = 0; iter < input.length; ++iter)
|
||||
for (int iter = 0; iter < recipe.length; ++iter)
|
||||
{
|
||||
ItemStack craftingStack = input[iter];
|
||||
ItemStack craftingStack = recipe[iter];
|
||||
|
||||
if (craftingStack != null)
|
||||
{
|
||||
@@ -74,38 +78,38 @@ public abstract class ToolMod
|
||||
return list.isEmpty();
|
||||
}
|
||||
|
||||
protected String getTagName ()
|
||||
protected String getTagName(ItemStack stack)
|
||||
{
|
||||
return "InfiTool";
|
||||
return ((IModifyable)stack.getItem()).getBaseTagName();
|
||||
}
|
||||
|
||||
protected NBTTagCompound getModifierTag(ItemStack stack)
|
||||
{
|
||||
return stack.getTagCompound().getCompoundTag(getTagName(stack));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tool
|
||||
* Tool to compare against
|
||||
* @param input Tool to compare against
|
||||
* @param recipe Items to modify with
|
||||
* @return Whether the tool can be modified
|
||||
*/
|
||||
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
protected boolean canModify (ItemStack input, ItemStack[] recipe)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(getTagName(input));
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the tool. Adds nbttags, changes existing ones, ticks down
|
||||
* modification counter, etc
|
||||
/** Modifies the tool. Adds nbttags, changes existing ones, ticks down modification counter, etc
|
||||
*
|
||||
* @param input
|
||||
* ItemStacks to pull info from
|
||||
* @param tool
|
||||
* The tool to modify
|
||||
* @param recipe ItemStacks to pull info from
|
||||
* @param input The tool to modify
|
||||
*/
|
||||
public abstract void modify (ItemStack[] input, ItemStack tool);
|
||||
public abstract void modify (ItemStack[] recipe, ItemStack input);
|
||||
|
||||
public void addMatchingEffect (ItemStack tool)
|
||||
public void addMatchingEffect (ItemStack input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(getTagName(input));
|
||||
if (tags.hasKey("Effect6") || tags.hasKey(key))
|
||||
return;
|
||||
|
||||
@@ -135,9 +139,10 @@ public abstract class ToolMod
|
||||
}
|
||||
}
|
||||
|
||||
protected int addModifierTip (ItemStack tool, String modifierTip)
|
||||
//Gui
|
||||
protected int addModifierTip (ItemStack input, String modifierTip)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(getTagName(input));
|
||||
int tipNum = 0;
|
||||
while (true)
|
||||
{
|
||||
@@ -153,9 +158,10 @@ public abstract class ToolMod
|
||||
}
|
||||
}
|
||||
|
||||
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
|
||||
//Item
|
||||
protected int addToolTip (ItemStack input, String tooltip, String modifierTip)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(getTagName(input));
|
||||
int tipNum = 0;
|
||||
while (true)
|
||||
{
|
||||
@@ -185,7 +191,10 @@ public abstract class ToolMod
|
||||
|
||||
protected String getProperName (String tooltip, String tag)
|
||||
{
|
||||
if (tag.equals(tooltip))
|
||||
if (tag.isEmpty())
|
||||
return tooltip + " I";
|
||||
|
||||
if (tag.equals(tooltip) || tag.equals(tooltip + " I"))
|
||||
return tooltip + " II";
|
||||
|
||||
if (tag.equals(tooltip + " II"))
|
||||
@@ -215,11 +224,12 @@ public abstract class ToolMod
|
||||
return tooltip + " X+";
|
||||
}
|
||||
|
||||
public boolean validType (ToolCore tool)
|
||||
public boolean validType (IModifyable input)
|
||||
{
|
||||
return true;
|
||||
return input.getModifyType().equals("Tool");
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
public boolean areItemsEquivalent (ItemStack stack1, ItemStack stack2)
|
||||
{
|
||||
if (stack1.getItem() != stack2.getItem())
|
||||
@@ -235,4 +245,16 @@ public abstract class ToolMod
|
||||
return false;
|
||||
return ItemStack.areItemStackTagsEqual(stack1, stack2);
|
||||
}
|
||||
|
||||
public static NBTTagCompound getAttributeTag (String attributeType, String modifierName, double amount, boolean flat, UUID uuid)
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", attributeType);
|
||||
tag.setString("Name", modifierName);
|
||||
tag.setDouble("Amount", amount);
|
||||
tag.setInteger("Operation", flat ? 0 : 1);//0 = flat increase, 1 = % increase
|
||||
tag.setLong("UUIDMost", uuid.getMostSignificantBits());
|
||||
tag.setLong("UUIDLeast", uuid.getLeastSignificantBits());
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public abstract class DualHarvestTool extends HarvestTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "harvest", "dualharvest" };
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public abstract class HarvestTool extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "harvest" };
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package tconstruct.library.tools;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -25,6 +24,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import tconstruct.library.ActiveToolMod;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.tools.entity.FancyEntityItem;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -35,26 +35,26 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*
|
||||
* @see ToolBuilder
|
||||
*
|
||||
* Required: Head: Base and render tag, above the handle Handle: Base and
|
||||
* render tag, bottom layer
|
||||
* Required: Head: Base and render tag, above the handle Handle: Base and
|
||||
* render tag, bottom layer
|
||||
*
|
||||
* Damage: Replacement for metadata MaxDamage: ItemStacks only read
|
||||
* setMaxDamage() Broken: Represents whether the tool is broken (boolean)
|
||||
* Attack: How much damage a mob will take MiningSpeed: The speed at which
|
||||
* a tool mines
|
||||
* Damage: Replacement for metadata MaxDamage: ItemStacks only read
|
||||
* setMaxDamage() Broken: Represents whether the tool is broken (boolean)
|
||||
* Attack: How much damage a mob will take MiningSpeed: The speed at which
|
||||
* a tool mines
|
||||
*
|
||||
* Others: Accessory: Base and tag, above head. Sword guards, binding, etc
|
||||
* Effects: Render tag, top layer. Fancy effects like moss or diamond edge.
|
||||
* Render order: Handle > Head > Accessory > Effect1 > Effect2 > Effect3 >
|
||||
* etc Unbreaking: Reinforced in-game, 10% chance to not use durability per
|
||||
* level Stonebound: Mines faster as the tool takes damage, but has less
|
||||
* attack Spiny: Opposite of stonebound
|
||||
* Others: Accessory: Base and tag, above head. Sword guards, binding, etc
|
||||
* Effects: Render tag, top layer. Fancy effects like moss or diamond edge.
|
||||
* Render order: Handle > Head > Accessory > Effect1 > Effect2 > Effect3 >
|
||||
* etc Unbreaking: Reinforced in-game, 10% chance to not use durability per
|
||||
* level Stonebound: Mines faster as the tool takes damage, but has less
|
||||
* attack Spiny: Opposite of stonebound
|
||||
*
|
||||
* Modifiers have their own tags.
|
||||
* @see ToolMod
|
||||
* Modifiers have their own tags.
|
||||
* @see ItemModifier
|
||||
*/
|
||||
|
||||
public abstract class ToolCore extends Item implements IEnergyContainerItem
|
||||
public abstract class ToolCore extends Item implements IEnergyContainerItem, IModifyable
|
||||
{
|
||||
// TE power constants -- TODO grab these from the items added
|
||||
protected int capacity = 400000;
|
||||
@@ -78,6 +78,18 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem
|
||||
setNoRepair();
|
||||
canRepair = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBaseTagName()
|
||||
{
|
||||
return "InfiTool";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModifyType()
|
||||
{
|
||||
return "Tool";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines crafting behavior with regards to durability 0: None 1: Adds
|
||||
@@ -428,10 +440,10 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem
|
||||
|
||||
public String getReinforcedName (int head, int handle, int accessory, int extra, int unbreaking)
|
||||
{
|
||||
TToolMaterial headMat = TConstructRegistry.getMaterial(head);
|
||||
TToolMaterial handleMat = TConstructRegistry.getMaterial(handle);
|
||||
TToolMaterial accessoryMat = TConstructRegistry.getMaterial(accessory);
|
||||
TToolMaterial extraMat = TConstructRegistry.getMaterial(extra);
|
||||
tconstruct.library.tools.ToolMaterial headMat = TConstructRegistry.getMaterial(head);
|
||||
tconstruct.library.tools.ToolMaterial handleMat = TConstructRegistry.getMaterial(handle);
|
||||
tconstruct.library.tools.ToolMaterial accessoryMat = TConstructRegistry.getMaterial(accessory);
|
||||
tconstruct.library.tools.ToolMaterial extraMat = TConstructRegistry.getMaterial(extra);
|
||||
|
||||
int reinforced = 0;
|
||||
String style = "";
|
||||
@@ -531,7 +543,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem
|
||||
while (iter.hasNext())
|
||||
{
|
||||
Map.Entry pairs = (Map.Entry) iter.next();
|
||||
TToolMaterial material = (TToolMaterial) pairs.getValue();
|
||||
tconstruct.library.tools.ToolMaterial material = (tconstruct.library.tools.ToolMaterial) pairs.getValue();
|
||||
buildTool((Integer) pairs.getKey(), material.displayName, list);
|
||||
}
|
||||
}
|
||||
@@ -545,20 +557,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, name + getToolName());
|
||||
if (tool == null)
|
||||
{
|
||||
Class clazz;
|
||||
Field fld;
|
||||
boolean supress = false;
|
||||
try
|
||||
{
|
||||
clazz = Class.forName("tconstruct.common.TRepo");
|
||||
fld = clazz.getField("supressMissingToolLogs");
|
||||
supress = fld.getBoolean(fld);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
TConstructRegistry.logger.error("TConstruct Library could not find parts of TContent");
|
||||
e.printStackTrace();
|
||||
}
|
||||
boolean supress = false; //TODO: Find this for iguana tweaks
|
||||
if (!supress)
|
||||
{
|
||||
TConstructRegistry.logger.error("Creative builder failed tool for " + name + this.getToolName());
|
||||
@@ -600,7 +599,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem
|
||||
/* Tool uses */
|
||||
|
||||
// Types
|
||||
public abstract String[] toolCategories ();
|
||||
public abstract String[] getTraits ();
|
||||
|
||||
// Mining
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@ package tconstruct.library.tools;
|
||||
/*
|
||||
* Dynamic substitute for an enum. It carries a lot of information
|
||||
*/
|
||||
public class TToolMaterial
|
||||
public class ToolMaterial
|
||||
{
|
||||
// mining level, durability, mining speed, baseDamage, handle modifier,
|
||||
// Reinforced level, shoddy/spiny level, color/style on name
|
||||
@@ -20,12 +20,12 @@ public class TToolMaterial
|
||||
public final String tipStyle;
|
||||
public final String ability;
|
||||
|
||||
public TToolMaterial(String name, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
|
||||
public ToolMaterial(String name, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
|
||||
{
|
||||
this(name, name + " ", level, durability, speed, damage, handle, reinforced, stonebound, style, ability);
|
||||
}
|
||||
|
||||
public TToolMaterial(String name, String displayName, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
|
||||
public ToolMaterial(String name, String displayName, int level, int durability, int speed, int damage, float handle, int reinforced, float stonebound, String style, String ability)
|
||||
{
|
||||
this.materialName = name;
|
||||
this.displayName = displayName;
|
||||
@@ -117,19 +117,13 @@ public abstract class Weapon extends ToolCore
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public boolean onLeftClickEntity (ItemStack stack, EntityPlayer
|
||||
* player, Entity entity) { TContent.modL.midStreamModify(stack); return
|
||||
* super.onLeftClickEntity(stack, player, entity); }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String[] toolCategories ()
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "melee" };
|
||||
}
|
||||
|
||||
public static Material[] web = new Material[] { Material.web };
|
||||
public static Material[] web = new Material[] { Material.web, Material.cloth, Material.coral, Material.cake };
|
||||
public static Material[] none = new Material[0];
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
@ObjectHolder(TConstruct.modID)
|
||||
//TODO handle migration of all items/blocks that were owned by the previously seperate mod
|
||||
@Pulse(id = "TinkerMechworks", description = "Mechanical machinations and steampunk inspired shenanigans.")
|
||||
@Pulse(id = "Tinkers' Mechworks", description = "Mechanical machinations and steampunk inspired shenanigans.")
|
||||
public class TinkerMechworks implements IPulse //TODO: Remove IPulse implementation, keep annotation
|
||||
{
|
||||
@PulseProxy(client = "tconstruct.mechworks.MechworksProxyClient", server = "tconstruct.mechworks.MechworksProxyCommon")
|
||||
|
||||
+17
-20
@@ -1,40 +1,37 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.accessory;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
|
||||
public class ModExtraModifier extends ToolMod
|
||||
/* Adds a boolean NBTTag */
|
||||
|
||||
public class GloveClimb extends ItemModifier
|
||||
{
|
||||
|
||||
public ModExtraModifier(ItemStack[] items, String dataKey)
|
||||
public GloveClimb(ItemStack[] items)
|
||||
{
|
||||
super(items, 0, dataKey);
|
||||
super(items, 3, "WallClimb");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("TinkerAccessory");
|
||||
return tags.getInteger("Modifiers") >= 3 && !tags.getBoolean(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
tags.setBoolean(key, true);
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers += 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("TinkerAccessory");
|
||||
|
||||
@Override
|
||||
public void addMatchingEffect (ItemStack tool)
|
||||
{
|
||||
tags.setBoolean(key, true);
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 3;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(tool, "\u00a7aWall Climb", "\u00a7aWall Climb");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package tconstruct.modifiers.accessory;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.modifiers.tools.ItemModTypeFilter;
|
||||
|
||||
public class GloveSpeed extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
int max = 100;
|
||||
|
||||
public GloveSpeed(int effect, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "Redstone", items, values);
|
||||
tooltipName = "\u00a74Haste";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack input, ItemStack[] modifiers)
|
||||
{
|
||||
IModifyable imod = (IModifyable) input.getItem();
|
||||
if (imod.getModifyType().equals("Accessory"))
|
||||
{
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(modifiers) <= max;//This line fails?
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(modifiers) <= keyPair[1])
|
||||
return true;
|
||||
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] modifiers, ItemStack input)
|
||||
{
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
int[] keyPair;
|
||||
int increase = matchingAmount(modifiers);
|
||||
int current = 0;
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
keyPair = tags.getIntArray(key);
|
||||
if (keyPair[0] % max == 0)
|
||||
{
|
||||
keyPair[0] += increase;
|
||||
keyPair[1] += max;
|
||||
tags.setIntArray(key, keyPair);
|
||||
|
||||
int mods = tags.getInteger("Modifiers");
|
||||
mods -= 1;
|
||||
tags.setInteger("Modifiers", mods);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyPair[0] += increase;
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
current = keyPair[0];
|
||||
updateModTag(input, keyPair);
|
||||
}
|
||||
else
|
||||
{
|
||||
int mods = tags.getInteger("Modifiers");
|
||||
mods -= 1;
|
||||
tags.setInteger("Modifiers", mods);
|
||||
String modName = "\u00a74Redstone (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(input, tooltipName, modName);
|
||||
keyPair = new int[] { increase, max, tooltipIndex };
|
||||
current = keyPair[0];
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
|
||||
int miningSpeed = tags.getInteger("MiningSpeed");
|
||||
int boost = 1;
|
||||
|
||||
miningSpeed += (increase * boost);
|
||||
tags.setInteger("MiningSpeed", miningSpeed);
|
||||
}
|
||||
|
||||
void updateModTag (ItemStack input, int[] keys)
|
||||
{
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
String tip = "ModifierTip" + keys[2];
|
||||
String modName = "\u00a74Redstone (" + keys[0] + "/" + keys[1] + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorMod;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
|
||||
/* Adds a boolean NBTTag */
|
||||
|
||||
public class AModBoolean extends ArmorMod
|
||||
{
|
||||
String color;
|
||||
String tooltipName;
|
||||
|
||||
public AModBoolean(int effect, String tag, EnumSet<ArmorPart> armorTypes, ItemStack[] items, String c, String tip)
|
||||
{
|
||||
super(effect, tag, armorTypes, items);
|
||||
color = c;
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack armor, ItemStack[] recipe)
|
||||
{
|
||||
Item i = armor.getItem();
|
||||
if (!(i instanceof ArmorCore))
|
||||
return false;
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (armorTypes.contains(item.armorPart))
|
||||
{
|
||||
NBTTagCompound tags = getModifierTag(armor);
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
}
|
||||
NBTTagCompound tags = getModifierTag(armor);
|
||||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); //Will fail if the modifier is false or the tag doesn't exist
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] recipe, ItemStack input)
|
||||
{
|
||||
NBTTagCompound tags =getModifierTag(input);
|
||||
|
||||
tags.setBoolean(key, true);
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(input, color + tooltipName, color + key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.ArmorMod;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
|
||||
/* Adds an integer NBTTag */
|
||||
|
||||
public class AModInteger extends ArmorMod
|
||||
{
|
||||
String color;
|
||||
String tooltipName;
|
||||
int initialIncrease;
|
||||
int secondaryIncrease;
|
||||
|
||||
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int increase, String c, String tip)
|
||||
{
|
||||
super(effect, dataKey, armorTypes, items);
|
||||
initialIncrease = secondaryIncrease = increase;
|
||||
color = c;
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
public AModInteger(int effect, String dataKey, EnumSet<ArmorPart> armorTypes, ItemStack[] items, int increase1, int increase2, String c, String tip)
|
||||
{
|
||||
super(effect, dataKey, armorTypes, items);
|
||||
initialIncrease = increase1;
|
||||
secondaryIncrease = increase2;
|
||||
color = c;
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] recipe, ItemStack input)
|
||||
{
|
||||
NBTTagCompound tags = getModifierTag(input);
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
int increase = tags.getInteger(key);
|
||||
increase += secondaryIncrease;
|
||||
tags.setInteger(key, increase);
|
||||
}
|
||||
else
|
||||
{
|
||||
tags.setInteger(key, initialIncrease);
|
||||
}
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(input, color + tooltipName, color + key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
|
||||
public class AModLeadBoots extends AModBoolean
|
||||
{
|
||||
|
||||
public AModLeadBoots(ItemStack[] items)
|
||||
{
|
||||
super(2, "LeadBoots", EnumSet.of(ArmorPart.Feet), items, "\u00a78", "Lead Boots");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] recipe, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName(armor));
|
||||
|
||||
armorTag.setBoolean(key, true);
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(armor, color + tooltipName, color + key);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.getTagList("AttributeModifiers", 0);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
|
||||
if (tag.getString("AttributeName").equals("generic.knockbackResistance"))
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.knockbackResistance", key, 0.4, true, shoes));
|
||||
}
|
||||
private static final UUID shoes = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c47");
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import tconstruct.library.modifier.ActiveArmorMod;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
|
||||
public class ActiveTinkerArmor extends ActiveArmorMod
|
||||
{
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack, ArmorCore armor, ArmorPart type)
|
||||
{
|
||||
NBTTagCompound tag = itemStack.getTagCompound().getCompoundTag(((IModifyable) itemStack.getItem()).getBaseTagName());
|
||||
if (tag.hasKey("Moss"))
|
||||
{
|
||||
int chance = tag.getInteger("Moss");
|
||||
int check = world.canBlockSeeTheSky((int) player.posX, (int) player.posY, (int) player.posZ) ? 350 : 1150;
|
||||
if (TConstruct.random.nextInt(check) < chance)
|
||||
{
|
||||
int current = tag.getInteger("Damage");
|
||||
if (current > 0)
|
||||
tag.setInteger("Damage", current-1);
|
||||
}
|
||||
}
|
||||
if (type == ArmorPart.Head)
|
||||
{
|
||||
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.getPersistentID());
|
||||
if (stats.activeGoggles)
|
||||
{
|
||||
if (tag.getBoolean("Night Vision"))
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 15 * 20, 0, true));
|
||||
}
|
||||
|
||||
/*List list = world.getEntitiesWithinAABB(EntityItem.class, player.boundingBox.addCoord(0.0D, 0.0D, 0.0D).expand(5.0D, 5.0D, 5.0D)); //TODO: Add modifier code
|
||||
for (int k = 0; k < list.size(); k++)
|
||||
{
|
||||
EntityItem entity = (EntityItem) list.get(k);
|
||||
entity.onCollideWithPlayer(player);
|
||||
}*/
|
||||
}
|
||||
if (type == ArmorPart.Chest)
|
||||
{
|
||||
if (player.isSneaking() && tag.getBoolean("Stealth"))
|
||||
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 2, 0, true));
|
||||
|
||||
/*int sprintboost = tag.getInteger("Sprint Assist");
|
||||
if (player.isSprinting() && sprintboost > 0)
|
||||
player.moveEntityWithHeading(-player.moveStrafing * 0.1f * sprintboost, player.moveForward * 0.2F * sprintboost); //Max of 0-1*/
|
||||
}
|
||||
if (type == ArmorPart.Feet)
|
||||
{
|
||||
if (player.isInWater())
|
||||
{
|
||||
if (!player.isSneaking() && tag.getBoolean("WaterWalk") && player.motionY <= 0)
|
||||
{
|
||||
player.motionY = 0;
|
||||
}
|
||||
if (tag.getBoolean("LeadBoots"))
|
||||
{
|
||||
if (player.motionY > 0)
|
||||
player.motionY *= 0.5f;
|
||||
else if (player.motionY < 0)
|
||||
player.motionY *= 1.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.ArmorMod;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
|
||||
public class TravelModDoubleJump extends ArmorMod
|
||||
{
|
||||
String color = "\u00a77";
|
||||
String tooltipName = "Double-Jump";
|
||||
public TravelModDoubleJump(EnumSet<ArmorPart> armorTypes, ItemStack[] items)
|
||||
{
|
||||
super(0, "Double-Jump", armorTypes, items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (IModifyable type)
|
||||
{
|
||||
return type.getModifyType().equals("Clothing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] recipe, ItemStack input)
|
||||
{
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(getTagName(input));
|
||||
int amount = 1;
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
int increase = tags.getInteger(key);
|
||||
increase += 1;
|
||||
tags.setInteger(key, increase);
|
||||
}
|
||||
else
|
||||
{
|
||||
tags.setInteger(key, amount);
|
||||
}
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(input, color + tooltipName, color + key);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName(tool));
|
||||
int tipNum = 0;
|
||||
while (true)
|
||||
{
|
||||
tipNum++;
|
||||
String tip = "Tooltip" + tipNum;
|
||||
if (!tags.hasKey(tip))
|
||||
{
|
||||
tags.setString(tip, tooltip);
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
tags.setString(modTip, modifierTip);
|
||||
return tipNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
String tag = tags.getString(tip);
|
||||
if (tag.contains("Double-Jump") || tag.contains("Triple-Jump"))
|
||||
{
|
||||
tags.setString(tip, getProperName(tooltip, tag));
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
tag = tags.getString(modTip);
|
||||
tags.setString(modTip, getProperName(modifierTip, tag));
|
||||
return tipNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getProperName (String tooltip, String tag)
|
||||
{
|
||||
if (tag.contains("Double-Jump"))
|
||||
return color + "Triple-Jump";
|
||||
|
||||
if (tag.contains("Triple-Jump"))
|
||||
return color + "Quadruple-Jump";
|
||||
|
||||
if (tag.contains("Quadruple-Jump"))
|
||||
return color + "Quintuple-Jump";
|
||||
|
||||
if (tag.contains("Quintuple-Jump"))
|
||||
return color + "Sextuple-Jump";
|
||||
|
||||
if (tag.contains("Sextuple-Jump"))
|
||||
return color + "Septuple-Jump";
|
||||
|
||||
return color + "Double-Jump";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public class TravelModRepair extends ItemModifier
|
||||
{
|
||||
|
||||
public TravelModRepair()
|
||||
{
|
||||
super(new ItemStack[0], 0, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches (ItemStack[] recipe, ItemStack input)
|
||||
{
|
||||
return canModify(input, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack input, ItemStack[] recipe)
|
||||
{
|
||||
if (input.getItem() instanceof TravelGear)
|
||||
{
|
||||
TravelGear gear = (TravelGear) input.getItem();
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(gear.getBaseTagName());
|
||||
int damage = tags.getInteger("Damage");
|
||||
if (damage > 0)
|
||||
{
|
||||
boolean validOutput = true;
|
||||
int outputs = 0;
|
||||
for (ItemStack curInput : recipe)
|
||||
{
|
||||
if (curInput == null)
|
||||
continue;
|
||||
|
||||
if (areItemStacksEquivalent(curInput, gear.getRepairMaterial(input)))
|
||||
outputs++;
|
||||
else
|
||||
validOutput = false;
|
||||
}
|
||||
return validOutput && outputs > 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private int calculateIncrease (ItemStack tool, NBTTagCompound tags, int materialValue, int itemsUsed)
|
||||
{
|
||||
int damage = tags.getInteger("Damage");
|
||||
int dur = tags.getInteger("BaseDurability");
|
||||
int increase = (int) (50 * itemsUsed + (dur * 0.4f * materialValue));
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
float mods = 1.0f;
|
||||
if (modifiers == 2)
|
||||
mods = 0.9f;
|
||||
else if (modifiers == 1)
|
||||
mods = 0.8f;
|
||||
else if (modifiers == 0)
|
||||
mods = 0.7f;
|
||||
|
||||
increase *= mods;
|
||||
|
||||
int repair = tags.getInteger("RepairCount");
|
||||
float repairCount = (100 - repair) / 100f;
|
||||
if (repairCount < 0.5f)
|
||||
repairCount = 0.5f;
|
||||
increase *= repairCount;
|
||||
//increase /= ((ToolCore) tool.getItem()).getRepairCost();
|
||||
return increase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] recipe, ItemStack input)
|
||||
{
|
||||
TravelGear gear = (TravelGear) input.getItem();
|
||||
NBTTagCompound tags = input.getTagCompound().getCompoundTag(gear.getBaseTagName());
|
||||
tags.setBoolean("Broken", false);
|
||||
int damage = tags.getInteger("Damage");
|
||||
int dur = tags.getInteger("BaseDurability");
|
||||
int itemsUsed = 0;
|
||||
|
||||
int materialValue = 0;
|
||||
for (ItemStack modify : recipe)
|
||||
{
|
||||
if (modify != null)
|
||||
{
|
||||
materialValue += 2;
|
||||
itemsUsed++;
|
||||
}
|
||||
}
|
||||
|
||||
int increase = calculateIncrease(input, tags, materialValue, itemsUsed);
|
||||
int repair = tags.getInteger("RepairCount");
|
||||
repair += itemsUsed;
|
||||
tags.setInteger("RepairCount", repair);
|
||||
|
||||
damage -= increase;
|
||||
if (damage < 0)
|
||||
damage = 0;
|
||||
tags.setInteger("Damage", damage);
|
||||
input.setItemDamage(damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMatchingEffect (ItemStack tool)
|
||||
{
|
||||
//Nope
|
||||
}
|
||||
}
|
||||
+11
-17
@@ -1,16 +1,16 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public abstract class ToolModTypeFilter extends ToolMod
|
||||
public abstract class ItemModTypeFilter extends ItemModifier
|
||||
{
|
||||
public final List<Integer> increase;
|
||||
|
||||
public ToolModTypeFilter(int effect, String dataKey, ItemStack[] items, int[] values)
|
||||
public ItemModTypeFilter(int effect, String dataKey, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(items, effect, dataKey);
|
||||
assert items.length == values.length : "Itemstacks and their values for tool modifiers must be the same length";
|
||||
@@ -21,14 +21,11 @@ public abstract class ToolModTypeFilter extends ToolMod
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the inputs match the stored items Note: Filters types,
|
||||
* doesn't care about amount
|
||||
/** Checks to see if the inputs match the stored items
|
||||
* Note: Filters types, doesn't care about amount
|
||||
*
|
||||
* @param input
|
||||
* The ItemStacks to compare against
|
||||
* @param tool
|
||||
* Item to modify, used for restrictions
|
||||
* @param input The ItemStacks to compare against
|
||||
* @param tool Item to modify, used for restrictions
|
||||
* @return Whether the recipe matches the input
|
||||
*/
|
||||
@Override
|
||||
@@ -94,13 +91,10 @@ public abstract class ToolModTypeFilter extends ToolMod
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new itemstack to the list for increases
|
||||
/** Adds a new itemstack to the list for increases
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack to compare against
|
||||
* @param amount
|
||||
* Amount to increase
|
||||
* @param stack ItemStack to compare against
|
||||
* @param amount Amount to increase
|
||||
*/
|
||||
public void addStackToMatchList (ItemStack stack, int amount)
|
||||
{
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModAntiSpider extends ToolModTypeFilter
|
||||
public class ModAntiSpider extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
int max = 4;
|
||||
@@ -13,7 +13,7 @@ public class ModAntiSpider extends ToolModTypeFilter
|
||||
public ModAntiSpider(String type, int effect, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "ModAntiSpider", items, values);
|
||||
tooltipName = "\u00a72" + StatCollector.translateToLocal("modifier.tool.spider");
|
||||
tooltipName = "\u00a72Bane of Arthropods";
|
||||
guiType = type;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ModAntiSpider extends ToolModTypeFilter
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
+45
-37
@@ -1,62 +1,82 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModAttack extends ToolModTypeFilter
|
||||
public class ModAttack extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
int max = 72;
|
||||
int max;
|
||||
int threshold;
|
||||
String guiType;
|
||||
String modifierType;
|
||||
|
||||
public ModAttack(String type, int effect, ItemStack[] items, int[] value)
|
||||
{
|
||||
super(effect, "ModAttack", items, value);
|
||||
tooltipName = "\u00a7f" + StatCollector.translateToLocal("modifier.tool.quartz");
|
||||
tooltipName = "\u00a7fSharpness";
|
||||
guiType = type;
|
||||
max = 72;
|
||||
threshold = 24;
|
||||
modifierType = "Tool";
|
||||
}
|
||||
|
||||
public ModAttack(String type, int effect, ItemStack[] items, int[] value, int max, int threshold, String modifierType)
|
||||
{
|
||||
super(effect, "ModAttack", items, value);
|
||||
tooltipName = "\u00a7fKnuckles";
|
||||
guiType = type;
|
||||
this.max = max;
|
||||
this.threshold = threshold;
|
||||
this.modifierType = modifierType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
if (tool.getItem() instanceof IModifyable)
|
||||
{
|
||||
IModifyable toolItem = (IModifyable) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(toolItem.getBaseTagName());
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
return true;
|
||||
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
return true;
|
||||
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (IModifyable input)
|
||||
{
|
||||
String type = input.getModifyType();
|
||||
return type.equals(modifierType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
IModifyable toolItem = (IModifyable) tool.getItem();
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(toolItem.getBaseTagName());
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
int amount = 24;
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (toolItem.pierceArmor() || !nerfType(toolItem))
|
||||
amount = 36;
|
||||
|
||||
int[] keyPair = tags.getIntArray(key);
|
||||
int increase = matchingAmount(input);
|
||||
|
||||
int leftToBoost = amount - (keyPair[0] % amount);
|
||||
int leftToBoost = threshold - (keyPair[0] % threshold);
|
||||
if (increase >= leftToBoost)
|
||||
{
|
||||
int attack = tags.getInteger("Attack");
|
||||
@@ -101,21 +121,9 @@ public class ModAttack extends ToolModTypeFilter
|
||||
|
||||
void updateModTag (ItemStack tool, int[] keys)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName(tool));
|
||||
String tip = "ModifierTip" + keys[2];
|
||||
String modName = "\u00a7f" + guiType + " (" + keys[0] + "/" + keys[1] + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (ToolCore tool)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean nerfType (ToolCore tool)
|
||||
{
|
||||
List list = Arrays.asList(tool.toolCategories());
|
||||
return list.contains("throwing") || list.contains("ammo");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
+20
-20
@@ -1,4 +1,4 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -6,9 +6,8 @@ import java.util.List;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModBlaze extends ToolModTypeFilter
|
||||
public class ModBlaze extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
int max;
|
||||
@@ -16,30 +15,32 @@ public class ModBlaze extends ToolModTypeFilter
|
||||
public ModBlaze(int effect, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "Blaze", items, values);
|
||||
tooltipName = "\u00a76" + StatCollector.translateToLocal("modifier.tool.blaze");
|
||||
tooltipName = "\u00a76Fiery";
|
||||
max = 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
if (tool.getItem() instanceof ToolCore)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
return true;
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
return true;
|
||||
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,14 +89,13 @@ public class ModBlaze extends ToolModTypeFilter
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
String tip = "ModifierTip" + keys[2];
|
||||
String modName = "\u00a76" + StatCollector.translateToLocal("gui.modifier.blaze") + "(" + keys[0] + "/" + keys[1] + ")";
|
||||
String modName = "\u00a76Blaze (" + keys[0] + "/" + keys[1] + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (ToolCore tool)
|
||||
{
|
||||
List list = Arrays.asList(tool.toolCategories());
|
||||
List list = Arrays.asList(tool.getTraits());
|
||||
return list.contains("melee") || list.contains("ammo");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
/* Adds a boolean NBTTag */
|
||||
|
||||
public class ModBoolean extends ItemModifier
|
||||
{
|
||||
String color;
|
||||
String tooltipName;
|
||||
|
||||
public ModBoolean(ItemStack[] items, int effect, String tag, String c, String tip)
|
||||
{
|
||||
super(items, effect, tag);
|
||||
color = c;
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); //Will fail if the modifier is false or the tag doesn't exist
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
tags.setBoolean(key, true);
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(tool, color + tooltipName, color + key);
|
||||
}
|
||||
}
|
||||
+16
-14
@@ -1,37 +1,40 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModButtertouch extends ModBoolean
|
||||
{
|
||||
|
||||
public ModButtertouch(ItemStack[] items, int effect)
|
||||
{
|
||||
super(items, effect, StatCollector.translateToLocal("gui.modifier.silk"), "\u00a7e", StatCollector.translateToLocal("modifier.tool.silk"));
|
||||
super(items, effect, "Silk Touch", "\u00a7e", "Silky");
|
||||
}
|
||||
|
||||
@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"))
|
||||
if (tool.getItem() instanceof ToolCore)
|
||||
{
|
||||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key);
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.getBoolean("Lava") && !tags.hasKey("Lapis"))
|
||||
{
|
||||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -71,7 +74,7 @@ public class ModButtertouch extends ModBoolean
|
||||
addToolTip(tool, color + tooltipName, color + key);
|
||||
}
|
||||
|
||||
public void addEnchantment (ItemStack tool, Enchantment enchant, int level)
|
||||
public void addEnchantment (ItemStack tool, Enchantment enchant, int level) //TODO: Move this to ItemModifier
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
Map enchantMap = EnchantmentHelper.getEnchantments(tool);
|
||||
@@ -108,10 +111,9 @@ public class ModButtertouch extends ModBoolean
|
||||
tool.stackTagCompound.setTag("ench", tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (ToolCore tool)
|
||||
{
|
||||
List list = Arrays.asList(tool.toolCategories());
|
||||
List list = Arrays.asList(tool.getTraits());
|
||||
return list.contains("weapon") || list.contains("harvest");
|
||||
}
|
||||
}
|
||||
+15
-11
@@ -1,11 +1,11 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
|
||||
public class ModCreativeToolModifier extends ToolMod
|
||||
public class ModCreativeToolModifier extends ItemModifier
|
||||
{
|
||||
public ModCreativeToolModifier(ItemStack[] items)
|
||||
{
|
||||
@@ -15,17 +15,21 @@ public class ModCreativeToolModifier extends ToolMod
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
for (ItemStack stack : input)
|
||||
if (tool.getItem() instanceof ToolCore)
|
||||
{
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
for (ItemStack stack : input)
|
||||
{
|
||||
String targetLock = stack.getTagCompound().getString("TargetLock");
|
||||
if (!targetLock.equals("") && !targetLock.equals(toolItem.getToolName()))
|
||||
return false;
|
||||
if (stack != null && stack.hasTagCompound())
|
||||
{
|
||||
String targetLock = stack.getTagCompound().getString("TargetLock");
|
||||
if (!targetLock.equals("") && !targetLock.equals(toolItem.getToolName()))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,4 +44,4 @@ public class ModCreativeToolModifier extends ToolMod
|
||||
public void addMatchingEffect (ItemStack tool)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
/* Adds an integer NBTTag */
|
||||
|
||||
public class ModDurability extends ToolMod
|
||||
public class ModDurability extends ItemModifier
|
||||
{
|
||||
String tooltipName;
|
||||
String color;
|
||||
@@ -0,0 +1,43 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public class ModExtraModifier extends ItemModifier
|
||||
{
|
||||
public ModExtraModifier(ItemStack[] items, String dataKey)
|
||||
{
|
||||
super(items, 0, dataKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] recipe)
|
||||
{
|
||||
if (tool != null && tool.getItem() instanceof IModifyable)
|
||||
{
|
||||
NBTTagCompound tags = this.getModifierTag(tool);
|
||||
if (tags.getBoolean(key))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] recipe, ItemStack input)
|
||||
{
|
||||
NBTTagCompound tags = this.getModifierTag(input);
|
||||
tags.setBoolean(key, true);
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers += 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
}
|
||||
|
||||
public void addMatchingEffect (ItemStack tool)
|
||||
{
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,12 +1,13 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cofh.api.energy.IEnergyContainerItem;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
/* TE3 support */
|
||||
|
||||
@@ -17,7 +18,7 @@ public class ModFlux extends ModBoolean
|
||||
|
||||
public ModFlux()
|
||||
{
|
||||
super(new ItemStack[0], 9, StatCollector.translateToLocal("mofifier.tool.flux"), "\u00a7e", "");
|
||||
super(new ItemStack[0], 9, "Flux", "\u00a7e", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
/* Adds an integer NBTTag */
|
||||
|
||||
public class ModInteger extends ToolMod
|
||||
public class ModInteger extends ItemModifier
|
||||
{
|
||||
String color;
|
||||
String tooltipName;
|
||||
+35
-24
@@ -1,4 +1,4 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
@@ -12,9 +12,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.tools.Weapon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModLapis extends ToolModTypeFilter
|
||||
public class ModLapis extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
int max = 450;
|
||||
@@ -22,29 +21,31 @@ public class ModLapis extends ToolModTypeFilter
|
||||
public ModLapis(int effect, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "Lapis", items, values);
|
||||
tooltipName = "\u00a79" + StatCollector.translateToLocal("modifier.tool.lapis");
|
||||
tooltipName = "\u00a79Luck";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
if (tool.getItem() instanceof ToolCore)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
if (tags.getBoolean("Silk Touch"))
|
||||
return false;
|
||||
if (tags.getBoolean("Silk Touch"))
|
||||
return false;
|
||||
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= max)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= max)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +57,7 @@ public class ModLapis extends ToolModTypeFilter
|
||||
tags.setBoolean(key, true);
|
||||
|
||||
String modName = "\u00a79Lapis (0/450)";
|
||||
int tooltipIndex = addToolTip(tool, "\u00a79" + StatCollector.translateToLocal("modifier.tool.lapis"), modName);
|
||||
int tooltipIndex = addToolTip(tool, "\u00a79Luck", modName);
|
||||
int[] keyPair = new int[] { 0, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
|
||||
@@ -69,7 +70,18 @@ public class ModLapis extends ToolModTypeFilter
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
keyPair[0] += increase;
|
||||
tags.setIntArray(key, keyPair);
|
||||
if (tool.getItem() instanceof Weapon)
|
||||
ToolCore toolcore = (ToolCore) tool.getItem();
|
||||
String[] types = toolcore.getTraits();
|
||||
boolean weapon = false;
|
||||
boolean harvest = false;
|
||||
for (String s : types)
|
||||
{
|
||||
if (s.equals("harvest"))
|
||||
harvest = true;
|
||||
else if (s.equals("weapon"))
|
||||
weapon = true;
|
||||
}
|
||||
if (weapon)
|
||||
{
|
||||
if (keyPair[0] >= 450)
|
||||
addEnchantment(tool, Enchantment.looting, 3);
|
||||
@@ -78,7 +90,7 @@ public class ModLapis extends ToolModTypeFilter
|
||||
else if (keyPair[0] >= 100)
|
||||
addEnchantment(tool, Enchantment.looting, 1);
|
||||
}
|
||||
else
|
||||
if (harvest)
|
||||
{
|
||||
if (keyPair[0] >= 450)
|
||||
addEnchantment(tool, Enchantment.fortune, 3);
|
||||
@@ -108,7 +120,7 @@ public class ModLapis extends ToolModTypeFilter
|
||||
updateModTag(tool, keyPair);
|
||||
}
|
||||
|
||||
List list = Arrays.asList(toolItem.toolCategories());
|
||||
List list = Arrays.asList(toolItem.getTraits());
|
||||
if (list.contains("weapon"))
|
||||
{
|
||||
if (keyPair[0] >= 450)
|
||||
@@ -203,14 +215,13 @@ public class ModLapis extends ToolModTypeFilter
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
String tip = "ModifierTip" + keys[1];
|
||||
String modName = "\u00a79" + StatCollector.translateToLocal("gui.modifier.lapis") + "(" + keys[0] + "/" + max + ")";
|
||||
String modName = "\u00a79Lapis (" + keys[0] + "/" + max + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (ToolCore tool)
|
||||
{
|
||||
List list = Arrays.asList(tool.toolCategories());
|
||||
List list = Arrays.asList(tool.getTraits());
|
||||
return list.contains("weapon") || list.contains("harvest");
|
||||
}
|
||||
}
|
||||
+24
-22
@@ -1,14 +1,15 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModPiston extends ToolModTypeFilter
|
||||
public class ModPiston extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
int max = 10;
|
||||
@@ -16,29 +17,31 @@ public class ModPiston extends ToolModTypeFilter
|
||||
public ModPiston(int effect, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "Piston", items, values);
|
||||
tooltipName = "\u00a77" + StatCollector.translateToLocal("modifier.tool.piston");
|
||||
tooltipName = "\u00a77Knockback";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
if (tool.getItem() instanceof ToolCore)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
return true;
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
return true;
|
||||
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,7 +74,7 @@ public class ModPiston extends ToolModTypeFilter
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a74" + StatCollector.translateToLocal("modifier.tool.piston") + "(" + increase + "/" + max + ")";
|
||||
String modName = "\u00a74Knockback (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
int[] keyPair = new int[] { increase, max, tooltipIndex };
|
||||
tags.setIntArray(key, keyPair);
|
||||
@@ -87,14 +90,13 @@ public class ModPiston extends ToolModTypeFilter
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
String tip = "ModifierTip" + keys[2];
|
||||
String modName = "\u00a77" + StatCollector.translateToLocal("modifier.tool.piston") + "(" + keys[0] + "/" + keys[1] + ")";
|
||||
String modName = "\u00a77Knockback (" + keys[0] + "/" + keys[1] + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (ToolCore tool)
|
||||
{
|
||||
List list = Arrays.asList(tool.toolCategories());
|
||||
List list = Arrays.asList(tool.getTraits());
|
||||
return list.contains("weapon");
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -1,11 +1,11 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public class ModPotion extends ToolMod
|
||||
public class ModPotion extends ItemModifier
|
||||
{
|
||||
|
||||
public ModPotion(ItemStack[] items, int effect, String dataKey)
|
||||
@@ -13,7 +13,6 @@ public class ModPotion extends ToolMod
|
||||
super(new ItemStack[] { new ItemStack(Items.potionitem, 1, Short.MAX_VALUE) }, 0, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
+39
-24
@@ -1,14 +1,14 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModRedstone extends ToolModTypeFilter
|
||||
public class ModRedstone extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
int max = 50;
|
||||
@@ -16,29 +16,31 @@ public class ModRedstone extends ToolModTypeFilter
|
||||
public ModRedstone(int effect, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "Redstone", items, values);
|
||||
tooltipName = "\u00a74" + StatCollector.translateToLocal("modifier.tool.redstone");
|
||||
tooltipName = "\u00a74Haste";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
if (tool.getItem() instanceof ToolCore)
|
||||
{
|
||||
ToolCore toolItem = (ToolCore) tool.getItem();
|
||||
if (!validType(toolItem))
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
return true;
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
return true;
|
||||
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
else if (keyPair[0] == keyPair[1])
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
}
|
||||
|
||||
else
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,6 +49,7 @@ public class ModRedstone extends ToolModTypeFilter
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
int[] keyPair;
|
||||
int increase = matchingAmount(input);
|
||||
int current = 0;
|
||||
if (tags.hasKey(key))
|
||||
{
|
||||
keyPair = tags.getIntArray(key);
|
||||
@@ -65,6 +68,7 @@ public class ModRedstone extends ToolModTypeFilter
|
||||
keyPair[0] += increase;
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
current = keyPair[0];
|
||||
updateModTag(tool, keyPair);
|
||||
}
|
||||
else
|
||||
@@ -72,14 +76,27 @@ public class ModRedstone extends ToolModTypeFilter
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
String modName = "\u00a74" + StatCollector.translateToLocal("gui.modifier.redstone") + "(" + increase + "/" + max + ")";
|
||||
String modName = "\u00a74Redstone (" + increase + "/" + max + ")";
|
||||
int tooltipIndex = addToolTip(tool, tooltipName, modName);
|
||||
keyPair = new int[] { increase, max, tooltipIndex };
|
||||
current = keyPair[0];
|
||||
tags.setIntArray(key, keyPair);
|
||||
}
|
||||
|
||||
int miningSpeed = tags.getInteger("MiningSpeed");
|
||||
miningSpeed += (increase * 8);
|
||||
int boost = 8 + ((current - 1) / 50 * 2);
|
||||
Item temp = tool.getItem();
|
||||
if (temp instanceof ToolCore)
|
||||
{
|
||||
ToolCore toolcore = (ToolCore) temp;
|
||||
if (toolcore.durabilityTypeHandle() == 2)
|
||||
boost += 2;
|
||||
if (toolcore.durabilityTypeAccessory() == 2)
|
||||
boost += 2;
|
||||
if (toolcore.durabilityTypeExtra() == 2)
|
||||
boost += 2;
|
||||
}
|
||||
miningSpeed += (increase * boost);
|
||||
tags.setInteger("MiningSpeed", miningSpeed);
|
||||
|
||||
String[] type = { "MiningSpeed2", "MiningSpeedHandle", "MiningSpeedExtra" };
|
||||
@@ -89,14 +106,13 @@ public class ModRedstone extends ToolModTypeFilter
|
||||
if (tags.hasKey(type[i]))
|
||||
{
|
||||
int speed = tags.getInteger(type[i]);
|
||||
speed += (increase * 8);
|
||||
speed += (increase * boost);
|
||||
tags.setInteger(type[i], speed);
|
||||
}
|
||||
}
|
||||
|
||||
if (tags.hasKey("DrawSpeed"))
|
||||
{
|
||||
// int drawSpeed = tags.getInteger("DrawSpeed");
|
||||
int baseDrawSpeed = tags.getInteger("BaseDrawSpeed");
|
||||
int drawSpeed = (int) (baseDrawSpeed - (0.1f * baseDrawSpeed * (keyPair[0] / 50f)));
|
||||
tags.setInteger("DrawSpeed", drawSpeed);
|
||||
@@ -107,14 +123,13 @@ public class ModRedstone extends ToolModTypeFilter
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
String tip = "ModifierTip" + keys[2];
|
||||
String modName = "\u00a74" + StatCollector.translateToLocal("gui.modifier.redstone") + "(" + keys[0] + "/" + keys[1] + ")";
|
||||
String modName = "\u00a74Redstone (" + keys[0] + "/" + keys[1] + ")";
|
||||
tags.setString(tip, modName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType (ToolCore tool)
|
||||
{
|
||||
List list = Arrays.asList(tool.toolCategories());
|
||||
List list = Arrays.asList(tool.getTraits());
|
||||
return list.contains("harvest") || list.contains("utility") || list.contains("bow");
|
||||
}
|
||||
}
|
||||
+4
-6
@@ -1,15 +1,14 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModReinforced extends ModInteger
|
||||
{
|
||||
|
||||
public ModReinforced(ItemStack[] items, int effect, int increase)
|
||||
{
|
||||
super(items, effect, StatCollector.translateToLocal("modifier.tool.reinforced"), 1, "\u00a75", StatCollector.translateToLocal("modifier.tool.reinforced"));
|
||||
super(items, effect, "Reinforced", 1, "\u00a75", "Reinforced");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,7 +37,6 @@ public class ModReinforced extends ModInteger
|
||||
addToolTip(tool, color + tooltipName, color + key);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
@@ -49,7 +47,7 @@ public class ModReinforced extends ModInteger
|
||||
String tip = "Tooltip" + tipNum;
|
||||
if (!tags.hasKey(tip))
|
||||
{
|
||||
// tags.setString(tip, tooltip);
|
||||
//tags.setString(tip, tooltip);
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
String tag = tags.getString(modTip);
|
||||
tags.setString(modTip, getProperName(modifierTip, tag));
|
||||
@@ -61,7 +59,7 @@ public class ModReinforced extends ModInteger
|
||||
String tag = tags.getString(modTip);
|
||||
if (tag.contains(modifierTip))
|
||||
{
|
||||
// tags.setString(tip, getProperName(tooltip, tag));
|
||||
//tags.setString(tip, getProperName(tooltip, tag));
|
||||
tag = tags.getString(modTip);
|
||||
tags.setString(modTip, getProperName(modifierTip, tag));
|
||||
return tipNum;
|
||||
+3
-3
@@ -1,15 +1,15 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
|
||||
/* Little mod for actually adding the lapis modifier */
|
||||
|
||||
public class ModRepair extends ToolMod
|
||||
public class ModRepair extends ItemModifier
|
||||
{
|
||||
|
||||
public ModRepair()
|
||||
+4
-5
@@ -1,10 +1,9 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ModSmite extends ToolModTypeFilter
|
||||
public class ModSmite extends ItemModTypeFilter
|
||||
{
|
||||
String tooltipName;
|
||||
int max = 36;
|
||||
@@ -13,7 +12,7 @@ public class ModSmite extends ToolModTypeFilter
|
||||
public ModSmite(String type, int effect, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "ModSmite", items, values);
|
||||
tooltipName = "\u00a7e" + StatCollector.translateToLocal("modifier.tool.smite");
|
||||
tooltipName = "\u00a7eSmite";
|
||||
tagName = type;
|
||||
}
|
||||
|
||||
@@ -22,7 +21,7 @@ public class ModSmite extends ToolModTypeFilter
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!tags.hasKey(key))
|
||||
return tags.getInteger("Modifiers") > 0;
|
||||
return tags.getInteger("Modifiers") > 0 && matchingAmount(input) <= max;
|
||||
|
||||
int keyPair[] = tags.getIntArray(key);
|
||||
if (keyPair[0] + matchingAmount(input) <= keyPair[1])
|
||||
@@ -0,0 +1,133 @@
|
||||
package tconstruct.modifiers.tools;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
import tconstruct.library.tools.*;
|
||||
|
||||
public class ModToolRepair extends ItemModifier
|
||||
{
|
||||
|
||||
public ModToolRepair()
|
||||
{
|
||||
super(new ItemStack[0], 0, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
return canModify(tool, input);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getInteger("Damage") > 0)
|
||||
{
|
||||
int headID = tags.getInteger("Head");
|
||||
boolean areInputsValid = true;
|
||||
for (ItemStack curInput : input)
|
||||
{
|
||||
if (curInput != null && headID != PatternBuilder.instance.getPartID(curInput))
|
||||
{
|
||||
areInputsValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areInputsValid)
|
||||
{
|
||||
return calculateIfNecessary(tool, input);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean calculateIfNecessary (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
int damage = tags.getInteger("Damage");
|
||||
int numInputs = 0;
|
||||
int materialValue = 0;
|
||||
for (ItemStack curInput : input)
|
||||
{
|
||||
if (curInput != null)
|
||||
{
|
||||
materialValue += PatternBuilder.instance.getPartValue(curInput);
|
||||
numInputs++;
|
||||
}
|
||||
}
|
||||
if (numInputs == 0)
|
||||
return false;
|
||||
|
||||
int totalRepairValue = calculateIncrease(tool, materialValue, numInputs);
|
||||
float averageRepairValue = totalRepairValue / numInputs;
|
||||
|
||||
return numInputs == 1 || (damage - totalRepairValue >= -averageRepairValue);
|
||||
}
|
||||
|
||||
private int calculateIncrease (ItemStack tool, int materialValue, int itemsUsed)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
int damage = tags.getInteger("Damage");
|
||||
int dur = tags.getInteger("BaseDurability");
|
||||
int increase = (int) (50 * itemsUsed + (dur * 0.4f * materialValue));
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
float mods = 1.0f;
|
||||
if (modifiers == 2)
|
||||
mods = 0.9f;
|
||||
else if (modifiers == 1)
|
||||
mods = 0.8f;
|
||||
else if (modifiers == 0)
|
||||
mods = 0.7f;
|
||||
|
||||
increase *= mods;
|
||||
|
||||
int repair = tags.getInteger("RepairCount");
|
||||
float repairCount = (100 - repair) / 100f;
|
||||
if (repairCount < 0.5f)
|
||||
repairCount = 0.5f;
|
||||
increase *= repairCount;
|
||||
increase /= ((ToolCore) tool.getItem()).getRepairCost();
|
||||
return increase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
tags.setBoolean("Broken", false);
|
||||
int damage = tags.getInteger("Damage");
|
||||
int dur = tags.getInteger("BaseDurability");
|
||||
int itemsUsed = 0;
|
||||
|
||||
int materialValue = 0;
|
||||
for (ItemStack curInput : input)
|
||||
{
|
||||
if (curInput != null)
|
||||
{
|
||||
materialValue += PatternBuilder.instance.getPartValue(curInput);
|
||||
itemsUsed++;
|
||||
}
|
||||
}
|
||||
|
||||
int increase = calculateIncrease(tool, materialValue, itemsUsed);
|
||||
int repair = tags.getInteger("RepairCount");
|
||||
repair += itemsUsed;
|
||||
tags.setInteger("RepairCount", repair);
|
||||
|
||||
damage -= increase;
|
||||
if (damage < 0)
|
||||
damage = 0;
|
||||
tags.setInteger("Damage", damage);
|
||||
|
||||
AbilityHelper.damageTool(tool, 0, null, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMatchingEffect (ItemStack tool)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,6 @@ import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
@@ -86,11 +85,9 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
@ObjectHolder(TConstruct.modID)
|
||||
@Pulse(id = "TinkerSmeltery", description = "Liquid metals, casting, and the multiblock structure.")
|
||||
@Pulse(id = "Tinker's Smeltery", description = "Liquid metals, casting, and the multiblock structure.")
|
||||
public class TinkerSmeltery implements IPulse //TODO: Remove IPulse implementation, keep annotation
|
||||
{
|
||||
@Instance("TinkerSmeltery")
|
||||
public static TinkerSmeltery instance;
|
||||
@PulseProxy(client = "tconstruct.smeltery.SmelteryProxyClient", server = "tconstruct.smeltery.SmelteryProxyCommon")
|
||||
public static SmelteryProxyCommon proxy;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
package tconstruct.tools;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package tconstruct.tools;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import mantle.pulsar.pulse.IPulse;
|
||||
import mantle.pulsar.pulse.Pulse;
|
||||
@@ -21,13 +19,6 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.modifiers.AModDamageBoost;
|
||||
import tconstruct.armor.modifiers.AModDoubleJump;
|
||||
import tconstruct.armor.modifiers.AModHealthBoost;
|
||||
import tconstruct.armor.modifiers.AModKnockbackResistance;
|
||||
import tconstruct.armor.modifiers.AModMoveSpeed;
|
||||
import tconstruct.armor.modifiers.AModProtection;
|
||||
import tconstruct.common.itemblocks.MetadataItemBlock;
|
||||
import tconstruct.items.tools.Arrow;
|
||||
import tconstruct.items.tools.BattleSign;
|
||||
@@ -51,13 +42,28 @@ import tconstruct.items.tools.Scythe;
|
||||
import tconstruct.items.tools.Shortbow;
|
||||
import tconstruct.items.tools.Shovel;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
import tconstruct.library.crafting.Detailing;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.util.IPattern;
|
||||
import tconstruct.modifiers.tools.ModAntiSpider;
|
||||
import tconstruct.modifiers.tools.ModAttack;
|
||||
import tconstruct.modifiers.tools.ModAutoSmelt;
|
||||
import tconstruct.modifiers.tools.ModBlaze;
|
||||
import tconstruct.modifiers.tools.ModButtertouch;
|
||||
import tconstruct.modifiers.tools.ModCreativeToolModifier;
|
||||
import tconstruct.modifiers.tools.ModDurability;
|
||||
import tconstruct.modifiers.tools.ModExtraModifier;
|
||||
import tconstruct.modifiers.tools.ModFlux;
|
||||
import tconstruct.modifiers.tools.ModInteger;
|
||||
import tconstruct.modifiers.tools.ModLapis;
|
||||
import tconstruct.modifiers.tools.ModPiston;
|
||||
import tconstruct.modifiers.tools.ModRedstone;
|
||||
import tconstruct.modifiers.tools.ModReinforced;
|
||||
import tconstruct.modifiers.tools.ModRepair;
|
||||
import tconstruct.modifiers.tools.ModSmite;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.tools.blocks.CraftingSlab;
|
||||
import tconstruct.tools.blocks.CraftingStationBlock;
|
||||
@@ -85,23 +91,6 @@ import tconstruct.tools.logic.PatternChestLogic;
|
||||
import tconstruct.tools.logic.StencilTableLogic;
|
||||
import tconstruct.tools.logic.ToolForgeLogic;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
import tconstruct.tools.modifiers.ModAntiSpider;
|
||||
import tconstruct.tools.modifiers.ModAttack;
|
||||
import tconstruct.tools.modifiers.ModAutoSmelt;
|
||||
import tconstruct.tools.modifiers.ModBlaze;
|
||||
import tconstruct.tools.modifiers.ModButtertouch;
|
||||
import tconstruct.tools.modifiers.ModCreativeToolModifier;
|
||||
import tconstruct.tools.modifiers.ModDurability;
|
||||
import tconstruct.tools.modifiers.ModExtraModifier;
|
||||
import tconstruct.tools.modifiers.ModFlux;
|
||||
import tconstruct.tools.modifiers.ModInteger;
|
||||
import tconstruct.tools.modifiers.ModLapis;
|
||||
import tconstruct.tools.modifiers.ModPiston;
|
||||
import tconstruct.tools.modifiers.ModRedstone;
|
||||
import tconstruct.tools.modifiers.ModReinforced;
|
||||
import tconstruct.tools.modifiers.ModRepair;
|
||||
import tconstruct.tools.modifiers.ModSmite;
|
||||
import tconstruct.tools.modifiers.TActiveOmniMod;
|
||||
import tconstruct.util.ItemHelper;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
@@ -110,26 +99,20 @@ import tconstruct.world.itemblocks.CraftedSoilItemBlock;
|
||||
import tconstruct.world.items.GoldenHead;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
@ObjectHolder(TConstruct.modID)
|
||||
@Pulse(id = "TinkerTools", description = "The main core of the mod! All of the tools, the tables, and the patterns are here.")
|
||||
@Pulse(id = "Tinker's Tools", description = "The main core of the mod! All of the tools, the tables, and the patterns are here.")
|
||||
public class TinkerTools implements IPulse //TODO: Remove IPulse implementation, keep annotation
|
||||
{
|
||||
/* Proxies for sides, used for graphics processing */
|
||||
@PulseProxy(client = "tconstruct.tools.ToolProxyClient", server = "tconstruct.tools.ToolProxyCommon")
|
||||
public static ToolProxyCommon proxy;
|
||||
|
||||
@Instance("TinkerTools")
|
||||
public static TinkerTools instance;
|
||||
|
||||
// Crafting blocks
|
||||
public static Block toolStationWood;
|
||||
public static Block toolStationStone;
|
||||
@@ -398,7 +381,6 @@ public class TinkerTools implements IPulse //TODO: Remove IPulse implementation,
|
||||
compound.getCompoundTag("InfiTool").setInteger("RenderAccessory", 10);
|
||||
tool.setTagCompound(compound);
|
||||
|
||||
// TConstruct.
|
||||
TConstructRegistry.toolTab.init(tool);
|
||||
}
|
||||
|
||||
@@ -547,8 +529,8 @@ public class TinkerTools implements IPulse //TODO: Remove IPulse implementation,
|
||||
ItemStack obsidianPlate = new ItemStack(TinkerTools.largePlate, 1, 6);
|
||||
tb.registerToolMod(new ModReinforced(new ItemStack[] { obsidianPlate }, 16, 1));
|
||||
|
||||
EnumSet<EnumArmorPart> allArmors = EnumSet.of(EnumArmorPart.HELMET, EnumArmorPart.CHEST, EnumArmorPart.PANTS, EnumArmorPart.SHOES);
|
||||
EnumSet<EnumArmorPart> chest = EnumSet.of(EnumArmorPart.CHEST);
|
||||
/*EnumSet<ArmorPart> allArmors = EnumSet.of(ArmorPart.Head, ArmorPart.Chest, ArmorPart.Legs, ArmorPart.Feet);
|
||||
EnumSet<ArmorPart> chest = EnumSet.of(ArmorPart.Chest);
|
||||
tb.registerArmorMod(new AModMoveSpeed(0, allArmors, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }, false));
|
||||
tb.registerArmorMod(new AModKnockbackResistance(1, allArmors, new ItemStack[] { new ItemStack(Items.gold_ingot), new ItemStack(Blocks.gold_block) }, new int[] { 1, 9 }, false));
|
||||
tb.registerArmorMod(new AModHealthBoost(2, allArmors, new ItemStack[] { new ItemStack(TinkerArmor.heartCanister, 1, 2) }, new int[] { 2 }, true));
|
||||
@@ -556,7 +538,7 @@ public class TinkerTools implements IPulse //TODO: Remove IPulse implementation,
|
||||
tb.registerArmorMod(new AModDamageBoost(4, chest, new ItemStack[] { new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1 }, true, 5, 1));
|
||||
tb.registerArmorMod(new AModProtection(5, allArmors, new ItemStack[] { new ItemStack(TinkerTools.largePlate, 1, 2) }, new int[] { 2 }));
|
||||
|
||||
tb.registerArmorMod(new AModDoubleJump(new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(TinkerWorld.slimeGel, 1, 1) }));
|
||||
tb.registerArmorMod(new AModDoubleJump(new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(TinkerWorld.slimeGel, 1, 1) }));*/
|
||||
|
||||
TConstructRegistry.registerActiveToolMod(new TActiveOmniMod());
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.crafting.ModifyBuilder;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
@@ -116,7 +116,7 @@ public class CraftingStationContainer extends Container
|
||||
slots[i] = craftMatrix.getStackInSlot(i);
|
||||
slots[i + 4] = craftMatrix.getStackInSlot(i + 5);
|
||||
}
|
||||
ItemStack output = ToolBuilder.instance.modifyTool(input, slots, "");
|
||||
ItemStack output = ModifyBuilder.instance.modifyItem(input, slots);
|
||||
if (output != null)
|
||||
return output;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class CraftingStationContainer extends Container
|
||||
slots[i] = craftMatrix.getStackInSlot(i);
|
||||
slots[i + 4] = craftMatrix.getStackInSlot(i + 5);
|
||||
}
|
||||
ItemStack output = ToolBuilder.instance.modifyArmor(input, slots, "");
|
||||
ItemStack output = ModifyBuilder.instance.modifyItem(input, slots);
|
||||
if (output != null)
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
package tconstruct.tools.modifiers;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.tools.ToolMod;
|
||||
|
||||
/* Adds a boolean NBTTag */
|
||||
|
||||
public class ModBoolean extends ToolMod
|
||||
{
|
||||
String color;
|
||||
String tooltipName;
|
||||
|
||||
public ModBoolean(ItemStack[] items, int effect, String tag, String c, String tip)
|
||||
{
|
||||
super(items, effect, tag);
|
||||
color = c;
|
||||
tooltipName = tip;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
return tags.getInteger("Modifiers") > 0 && !tags.getBoolean(key); // Will
|
||||
// fail
|
||||
// if
|
||||
// the
|
||||
// modifier
|
||||
// is
|
||||
// false
|
||||
// or
|
||||
// the
|
||||
// tag
|
||||
// doesn't
|
||||
// exist
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack tool)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
|
||||
tags.setBoolean(key, true);
|
||||
// TConstruct.logger.info("Key: "+key+" "+tags.getBoolean(key));
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
modifiers -= 1;
|
||||
tags.setInteger("Modifiers", modifiers);
|
||||
|
||||
addToolTip(tool, color + tooltipName, color + key);
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,7 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.armor.IHealthAccessory;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -132,15 +131,6 @@ public class ArmorExtended implements IInventory
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
* public void recalculateSkills(EntityPlayer player, TPlayerStats stats) {
|
||||
* if (inventory[1] != null && inventory[1].getItem() == TRepo.glove) { if
|
||||
* (stats.skillList.size() < 1) { try {
|
||||
* stats.skillList.add(SkillRegistry.skills.get("Wall Building").copy()); }
|
||||
* catch (Exception e) { e.printStackTrace(); } } } else { if
|
||||
* (stats.skillList.size() > 0) { stats.skillList.remove(0); } } }
|
||||
*/
|
||||
|
||||
public void recalculateHealth (EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
@@ -157,13 +147,7 @@ public class ArmorExtended implements IInventory
|
||||
}
|
||||
}
|
||||
int prevHealth = stats.bonusHealth;
|
||||
if (side == Side.CLIENT)
|
||||
prevHealth = stats.bonusHealthClient;
|
||||
|
||||
if (side == Side.CLIENT)
|
||||
stats.bonusHealthClient = bonusHP;
|
||||
else
|
||||
stats.bonusHealth = bonusHP;
|
||||
stats.bonusHealth = bonusHP;
|
||||
|
||||
int healthChange = bonusHP - prevHealth;
|
||||
if (healthChange != 0)
|
||||
@@ -183,13 +167,8 @@ public class ArmorExtended implements IInventory
|
||||
else if (parent != null && parent.get() != null)
|
||||
{
|
||||
int prevHealth = stats.bonusHealth;
|
||||
if (side == Side.CLIENT)
|
||||
prevHealth = stats.bonusHealthClient;
|
||||
int bonusHP = 0;
|
||||
if (side == Side.CLIENT)
|
||||
stats.bonusHealthClient = bonusHP;
|
||||
else
|
||||
stats.bonusHealth = bonusHP;
|
||||
stats.bonusHealth = bonusHP;
|
||||
int healthChange = bonusHP - prevHealth;
|
||||
if (healthChange != 0)
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
//TODO: Redesign this class
|
||||
public class TPlayerHandler
|
||||
{
|
||||
/* Player */
|
||||
@@ -58,7 +59,8 @@ public class TPlayerHandler
|
||||
|
||||
public void onPlayerLogin (EntityPlayer entityplayer)
|
||||
{
|
||||
TPlayerStats playerData = playerStats.remove(entityplayer.getPersistentID());
|
||||
TPlayerStats playerData = new TPlayerStats();//playerStats.remove(entityplayer.getPersistentID());
|
||||
playerStats.put(entityplayer.getPersistentID(), playerData); //TODO: wtf was going on with removing a nonexistant player in the login?!
|
||||
if (playerData != null)
|
||||
{
|
||||
playerData.saveNBTData(entityplayer.getEntityData());
|
||||
@@ -220,19 +222,6 @@ public class TPlayerHandler
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @SubscribeEvent public void livingUpdate (LivingUpdateEvent evt) { Side
|
||||
* side = FMLCommonHandler.instance().getEffectiveSide(); if (side ==
|
||||
* Side.CLIENT && evt.entityLiving instanceof EntityPlayer) { EntityPlayer
|
||||
* player = (EntityPlayer) evt.entityLiving; TPlayerStats stats =
|
||||
* playerStats.get(player.getDisplayName()); if (player.onGround !=
|
||||
* stats.prevOnGround) { if (player.onGround)// && -stats.prevMotionY > 0.1)
|
||||
* //player.motionY = 0.5; player.motionY = -stats.prevMotionY * 0.8;
|
||||
* //player.motionY *= -1.2; stats.prevOnGround = player.onGround; //if ()
|
||||
*
|
||||
* //TConstruct.logger.info("Fall: "+player.fallDistance); } } }
|
||||
*/
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerDeath (LivingDeathEvent event)
|
||||
{
|
||||
@@ -316,5 +305,18 @@ public class TPlayerHandler
|
||||
}
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
|
||||
public TPlayerStats getPlayerStats (UUID playerID)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
{
|
||||
return playerStats.get(playerID);
|
||||
}
|
||||
else
|
||||
{
|
||||
return playerStats.get(playerID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,19 +8,27 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
|
||||
public class TPlayerStats implements IExtendedEntityProperties
|
||||
public class TPlayerStats implements IExtendedEntityProperties //TODO: IExtendedEntityProperties is not appropriate!
|
||||
{
|
||||
public static final String PROP_NAME = "TConstruct";
|
||||
|
||||
public WeakReference<EntityPlayer> player;
|
||||
|
||||
public int level;
|
||||
public int bonusHealth;
|
||||
public int bonusHealthClient;
|
||||
public int damage;
|
||||
public int hunger;
|
||||
public int previousDimension;
|
||||
public int mineSpeed;
|
||||
|
||||
public boolean climbWalls;
|
||||
public boolean activeGoggles = true;
|
||||
|
||||
public boolean beginnerManual;
|
||||
public boolean materialManual;
|
||||
public boolean smelteryManual;
|
||||
public boolean battlesignBonus;
|
||||
|
||||
public ArmorExtended armor;
|
||||
public KnapsackInventory knapsack;
|
||||
|
||||
@@ -81,7 +89,6 @@ public class TPlayerStats implements IExtendedEntityProperties
|
||||
|
||||
if (copyCalc) {
|
||||
this.bonusHealth = stats.bonusHealth;
|
||||
this.bonusHealthClient = stats.bonusHealthClient;
|
||||
this.hunger = stats.hunger;
|
||||
this.level = stats.level;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
|
||||
@ObjectHolder(TConstruct.modID)
|
||||
@Pulse(id = "TinkerWorld", description = "Ores, slime islands, essence berries, and the like.")
|
||||
@Pulse(id = "Tinker's World", description = "Ores, slime islands, essence berries, and the like.")
|
||||
public class TinkerWorld implements IPulse //TODO: Remove IPulse implementation, keep annotation
|
||||
{
|
||||
@Instance("TinkerWorld")
|
||||
|
||||
Reference in new issue
Block a user