mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -1,8 +1,10 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,51 +14,42 @@ import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.network.HealthUpdatePacket;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class ArmorAbilities
|
||||
{
|
||||
public class ArmorAbilities {
|
||||
public static List<String> stepBoostedPlayers = new ArrayList();
|
||||
//ItemStack prevFeet;
|
||||
// ItemStack prevFeet;
|
||||
double prevMotionY;
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerTick (TickEvent.PlayerTickEvent event)
|
||||
{
|
||||
public void playerTick(TickEvent.PlayerTickEvent event) {
|
||||
EntityPlayer player = event.player;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
|
||||
// Wall climb
|
||||
if (stats.climbWalls)
|
||||
{
|
||||
if (stats.climbWalls) {
|
||||
double motionX = player.posX - player.lastTickPosX;
|
||||
double motionZ = player.posZ - player.lastTickPosZ;
|
||||
double motionY = player.posY - player.lastTickPosY - 0.762;
|
||||
if (motionY > 0.0D && (motionX == 0D || motionZ == 0D))
|
||||
{
|
||||
if (motionY > 0.0D && (motionX == 0D || motionZ == 0D)) {
|
||||
player.fallDistance = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
//Feet changes
|
||||
// Feet changes
|
||||
ItemStack feet = player.getCurrentArmor(0);
|
||||
if (feet != null && feet.hasTagCompound())
|
||||
{
|
||||
if (feet.getItem() instanceof IModifyable && !player.isSneaking())
|
||||
{
|
||||
NBTTagCompound tag = feet.getTagCompound().getCompoundTag(((IModifyable) feet.getItem()).getBaseTagName());
|
||||
if (feet != null && feet.hasTagCompound()) {
|
||||
if (feet.getItem() instanceof IModifyable && !player.isSneaking()) {
|
||||
NBTTagCompound tag =
|
||||
feet.getTagCompound().getCompoundTag(((IModifyable) feet.getItem()).getBaseTagName());
|
||||
int sole = tag.getInteger("Slimy Soles");
|
||||
if (sole > 0)
|
||||
{
|
||||
if (sole > 0) {
|
||||
if (!player.isSneaking() && player.onGround && prevMotionY < -0.4)
|
||||
player.motionY = -prevMotionY * (Math.min(0.99, sole * 0.2));
|
||||
}
|
||||
}
|
||||
prevMotionY = player.motionY;
|
||||
}
|
||||
/* Former step height boost handling
|
||||
/* Former step height boost handling
|
||||
if (feet != prevFeet)
|
||||
{
|
||||
if (prevFeet != null && prevFeet.getItem() instanceof TravelGear)
|
||||
@@ -65,19 +58,16 @@ public class ArmorAbilities
|
||||
player.stepHeight += 0.6f;
|
||||
prevFeet = feet;
|
||||
}*/
|
||||
boolean stepBoosted = stepBoostedPlayers.contains(player.getGameProfile().getName());
|
||||
if (stepBoosted)
|
||||
player.stepHeight = 1.1f;
|
||||
if (!stepBoosted && feet != null && feet.getItem() instanceof TravelGear)
|
||||
{
|
||||
boolean stepBoosted =
|
||||
stepBoostedPlayers.contains(player.getGameProfile().getName());
|
||||
if (stepBoosted) player.stepHeight = 1.1f;
|
||||
if (!stepBoosted && feet != null && feet.getItem() instanceof TravelGear) {
|
||||
stepBoostedPlayers.add(player.getGameProfile().getName());
|
||||
}
|
||||
else if (stepBoosted && (feet == null || !(feet.getItem() instanceof TravelGear)))
|
||||
{
|
||||
} else if (stepBoosted && (feet == null || !(feet.getItem() instanceof TravelGear))) {
|
||||
stepBoostedPlayers.remove(player.getGameProfile().getName());
|
||||
player.stepHeight -= 0.6f;
|
||||
}
|
||||
//TODO: Proper minimap support
|
||||
// TODO: Proper minimap support
|
||||
/*ItemStack stack = player.inventory.getStackInSlot(8);
|
||||
if (stack != null && stack.getItem() instanceof ItemMap)
|
||||
{
|
||||
@@ -85,16 +75,14 @@ public class ArmorAbilities
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void dimensionChanged(PlayerEvent.PlayerChangedDimensionEvent event)
|
||||
{
|
||||
if(event.player == null || !(event.player instanceof EntityPlayerMP))
|
||||
return;
|
||||
public void dimensionChanged(PlayerEvent.PlayerChangedDimensionEvent event) {
|
||||
if (event.player == null || !(event.player instanceof EntityPlayerMP)) return;
|
||||
|
||||
// this callback is only called serverside
|
||||
float oldHealth = event.player.getHealth();
|
||||
// tell the client to update its hp
|
||||
TConstruct.packetPipeline.sendTo(new HealthUpdatePacket(oldHealth), (net.minecraft.entity.player.EntityPlayerMP) event.player);
|
||||
TConstruct.packetPipeline.sendTo(
|
||||
new HealthUpdatePacket(oldHealth), (net.minecraft.entity.player.EntityPlayerMP) event.player);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -9,41 +9,34 @@ import tconstruct.armor.inventory.*;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
|
||||
public class ArmorProxyCommon implements IGuiHandler
|
||||
{
|
||||
public class ArmorProxyCommon implements IGuiHandler {
|
||||
public static final int inventoryGui = 100;
|
||||
public static final int armorGuiID = 101;
|
||||
public static final int knapsackGuiID = 102;
|
||||
|
||||
public void preInit() {}
|
||||
|
||||
public void initialize ()
|
||||
{
|
||||
public void initialize() {
|
||||
registerGuiHandler();
|
||||
}
|
||||
|
||||
protected void registerGuiHandler ()
|
||||
{
|
||||
protected void registerGuiHandler() {
|
||||
TProxyCommon.registerServerGuiHandler(inventoryGui, this);
|
||||
TProxyCommon.registerServerGuiHandler(armorGuiID, this);
|
||||
TProxyCommon.registerServerGuiHandler(knapsackGuiID, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
if (ID == ArmorProxyCommon.inventoryGui)
|
||||
{
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == ArmorProxyCommon.inventoryGui) {
|
||||
// GuiInventory inv = new GuiInventory(player);
|
||||
return player.inventoryContainer;
|
||||
}
|
||||
if (ID == ArmorProxyCommon.armorGuiID)
|
||||
{
|
||||
if (ID == ArmorProxyCommon.armorGuiID) {
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
return new ArmorExtendedContainer(player.inventory, stats.armor);
|
||||
}
|
||||
if (ID == ArmorProxyCommon.knapsackGuiID)
|
||||
{
|
||||
if (ID == ArmorProxyCommon.knapsackGuiID) {
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
return new KnapsackContainer(player.inventory, stats.knapsack);
|
||||
}
|
||||
@@ -52,29 +45,18 @@ public class ArmorProxyCommon implements IGuiHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void registerTickHandler ()
|
||||
{
|
||||
public void registerTickHandler() {}
|
||||
|
||||
}
|
||||
public void registerKeys() {}
|
||||
|
||||
public void registerKeys ()
|
||||
{
|
||||
public void updatePlayerStats(TPlayerStats stats) {}
|
||||
|
||||
}
|
||||
|
||||
public void updatePlayerStats(TPlayerStats stats)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void dumpTPlayerStats(TPlayerStats stats)
|
||||
{
|
||||
public void dumpTPlayerStats(TPlayerStats stats) {
|
||||
TConstruct.logger.debug("~~~~~~~~~~~~~~~~~ STATS ~~~~~~~~~~~~~~~~~");
|
||||
TConstruct.logger.debug("Player: " + stats.player.get().getCommandSenderName());
|
||||
TConstruct.logger.debug("Level: " + stats.level);
|
||||
@@ -91,19 +73,15 @@ public class ArmorProxyCommon implements IGuiHandler
|
||||
TConstruct.logger.debug("BattleSign Bonus: " + stats.battlesignBonus);
|
||||
TConstruct.logger.debug("Derp Level: " + stats.derpLevel);
|
||||
int i = 0;
|
||||
for (ItemStack stack : stats.armor.inventory)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
TConstruct.logger.debug("Armor Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
for (ItemStack stack : stats.armor.inventory) {
|
||||
if (stack != null) {
|
||||
TConstruct.logger.debug("Armor Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
for (ItemStack stack : stats.knapsack.inventory)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
for (ItemStack stack : stats.knapsack.inventory) {
|
||||
if (stack != null) {
|
||||
TConstruct.logger.debug("Knapsack Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
}
|
||||
i++;
|
||||
|
||||
@@ -6,21 +6,18 @@ import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import tconstruct.client.ArmorControls;
|
||||
|
||||
public class ArmorTickHandler
|
||||
{
|
||||
public class ArmorTickHandler {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
ArmorControls controlInstance = ((ArmorProxyClient) TinkerArmor.proxy).controlInstance;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void tickEnd (ClientTickEvent event)
|
||||
{
|
||||
public void tickEnd(ClientTickEvent event) {
|
||||
/*TinkerWorld.oreBerry.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TinkerWorld.oreBerrySecond.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TinkerWorld.slimeLeaves.setGraphicsLevel(Blocks.leaves.field_150121_P);*/
|
||||
if (mc.thePlayer != null && mc.thePlayer.onGround)
|
||||
controlInstance.landOnGround();
|
||||
if (mc.thePlayer != null && mc.thePlayer.onGround) controlInstance.landOnGround();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,48 +8,37 @@ import net.minecraft.potion.*;
|
||||
import tconstruct.armor.player.*;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class PlayerAbilityHelper
|
||||
{
|
||||
public class PlayerAbilityHelper {
|
||||
|
||||
public static void toggleGoggles (EntityPlayer player, boolean active)
|
||||
{
|
||||
public static void toggleGoggles(EntityPlayer player, boolean active) {
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
stats.activeGoggles = active;
|
||||
if (!stats.activeGoggles)
|
||||
{
|
||||
if (!stats.activeGoggles) {
|
||||
player.removePotionEffect(Potion.nightVision.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 15 * 20, 0, true));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDimensionAllowed (EntityPlayer player) {
|
||||
public static boolean isDimensionAllowed(EntityPlayer player) {
|
||||
int currentDimID = player.worldObj.provider.dimensionId;
|
||||
for (int id : PHConstruct.cfgForbiddenDim)
|
||||
{
|
||||
if (id == currentDimID)
|
||||
return false;
|
||||
for (int id : PHConstruct.cfgForbiddenDim) {
|
||||
if (id == currentDimID) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void swapBelt (EntityPlayer player, ArmorExtended armor)
|
||||
{
|
||||
public static void swapBelt(EntityPlayer player, ArmorExtended armor) {
|
||||
if (!isDimensionAllowed(player)) return;
|
||||
NBTTagList slots = new NBTTagList();
|
||||
InventoryPlayer hotbar = player.inventory;
|
||||
ItemStack belt = armor.inventory[3];
|
||||
if(belt == null)
|
||||
return;
|
||||
if (belt == null) return;
|
||||
|
||||
NBTTagCompound itemTag;
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
if (hotbar.mainInventory[i] != null)
|
||||
{
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (hotbar.mainInventory[i] != null) {
|
||||
itemTag = new NBTTagCompound();
|
||||
itemTag.setByte("Slot", (byte) i);
|
||||
hotbar.mainInventory[i].writeToNBT(itemTag);
|
||||
@@ -59,16 +48,13 @@ public class PlayerAbilityHelper
|
||||
}
|
||||
|
||||
NBTTagList replaceSlots = belt.getTagCompound().getTagList("Inventory", 10);
|
||||
for (int i = 0; i < replaceSlots.tagCount(); ++i)
|
||||
{
|
||||
for (int i = 0; i < replaceSlots.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound = replaceSlots.getCompoundTagAt(i);
|
||||
int j = nbttagcompound.getByte("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (j >= 0 && j < hotbar.mainInventory.length)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
if (j >= 0 && j < hotbar.mainInventory.length) {
|
||||
hotbar.mainInventory[j] = itemstack;
|
||||
}
|
||||
}
|
||||
@@ -76,12 +62,10 @@ public class PlayerAbilityHelper
|
||||
belt.getTagCompound().setTag("Inventory", slots);
|
||||
}
|
||||
|
||||
public static void setEntitySize (Entity entity, float width, float height)
|
||||
{
|
||||
public static void setEntitySize(Entity entity, float width, float height) {
|
||||
float f2;
|
||||
|
||||
if (width != entity.width || height != entity.height)
|
||||
{
|
||||
if (width != entity.width || height != entity.height) {
|
||||
f2 = entity.width;
|
||||
entity.width = width;
|
||||
entity.height = height;
|
||||
@@ -89,36 +73,24 @@ public class PlayerAbilityHelper
|
||||
entity.boundingBox.maxZ = entity.boundingBox.minZ + (double) entity.width;
|
||||
entity.boundingBox.maxY = entity.boundingBox.minY + (double) entity.height;
|
||||
|
||||
if (entity.width > f2 && !entity.worldObj.isRemote)
|
||||
{
|
||||
if (entity.width > f2 && !entity.worldObj.isRemote) {
|
||||
entity.moveEntity((double) (f2 - entity.width), 0.0D, (double) (f2 - entity.width));
|
||||
}
|
||||
}
|
||||
|
||||
f2 = width % 2.0F;
|
||||
|
||||
if ((double) f2 < 0.375D)
|
||||
{
|
||||
if ((double) f2 < 0.375D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_1;
|
||||
}
|
||||
else if ((double) f2 < 0.75D)
|
||||
{
|
||||
} else if ((double) f2 < 0.75D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_2;
|
||||
}
|
||||
else if ((double) f2 < 1.0D)
|
||||
{
|
||||
} else if ((double) f2 < 1.0D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_3;
|
||||
}
|
||||
else if ((double) f2 < 1.375D)
|
||||
{
|
||||
} else if ((double) f2 < 1.375D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_4;
|
||||
}
|
||||
else if ((double) f2 < 1.75D)
|
||||
{
|
||||
} else if ((double) f2 < 1.75D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_5;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_6;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,7 @@ import cpw.mods.fml.common.*;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.registry.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mantle.pulsar.pulse.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.*;
|
||||
@@ -21,8 +18,6 @@ import tconstruct.TConstruct;
|
||||
import tconstruct.armor.blocks.DryingRack;
|
||||
import tconstruct.armor.items.*;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.client.ArmorControls;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
@@ -30,14 +25,12 @@ import tconstruct.library.crafting.*;
|
||||
import tconstruct.modifiers.accessory.GloveSpeed;
|
||||
import tconstruct.modifiers.armor.*;
|
||||
import tconstruct.modifiers.tools.ModAttack;
|
||||
import tconstruct.modifiers.tools.ModInteger;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
@ObjectHolder(TConstruct.modID)
|
||||
@Pulse(id = "Tinkers' Armory", description = "Modifyable armors, such as the traveller's gear.")
|
||||
public class TinkerArmor
|
||||
{
|
||||
public class TinkerArmor {
|
||||
@SidedProxy(clientSide = "tconstruct.armor.ArmorProxyClient", serverSide = "tconstruct.armor.ArmorProxyCommon")
|
||||
public static ArmorProxyCommon proxy;
|
||||
|
||||
@@ -63,7 +56,7 @@ public class TinkerArmor
|
||||
public static Item bootsWood;
|
||||
public static ArmorMaterial materialWood;
|
||||
|
||||
//Clothing - Travel Gear
|
||||
// Clothing - Travel Gear
|
||||
public static TravelGear travelGoggles;
|
||||
public static TravelGear travelWings;
|
||||
public static TravelGear travelVest;
|
||||
@@ -74,8 +67,7 @@ public class TinkerArmor
|
||||
public static ModAttack modAttackGlove;
|
||||
|
||||
@Handler
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
proxy.preInit();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new TinkerArmorEvents());
|
||||
@@ -87,8 +79,7 @@ public class TinkerArmor
|
||||
TinkerArmor.diamondApple = new DiamondApple().setUnlocalizedName("tconstruct.apple.diamond");
|
||||
GameRegistry.registerItem(TinkerArmor.diamondApple, "diamondApple");
|
||||
boolean foodOverhaul = false;
|
||||
if (Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food"))
|
||||
{
|
||||
if (Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food")) {
|
||||
foodOverhaul = true;
|
||||
}
|
||||
|
||||
@@ -111,11 +102,15 @@ public class TinkerArmor
|
||||
GameRegistry.registerItem(TinkerArmor.knapsack, "knapsack");
|
||||
|
||||
LiquidCasting basinCasting = TConstruct.getBasinCasting();
|
||||
TinkerArmor.materialWood = EnumHelper.addArmorMaterial("WOOD", 2, new int[] { 1, 2, 2, 1 }, 3);
|
||||
TinkerArmor.helmetWood = new ArmorBasic(TinkerArmor.materialWood, 0, "wood").setUnlocalizedName("tconstruct.helmetWood");
|
||||
TinkerArmor.chestplateWood = new ArmorBasic(TinkerArmor.materialWood, 1, "wood").setUnlocalizedName("tconstruct.chestplateWood");
|
||||
TinkerArmor.leggingsWood = new ArmorBasic(TinkerArmor.materialWood, 2, "wood").setUnlocalizedName("tconstruct.leggingsWood");
|
||||
TinkerArmor.bootsWood = new ArmorBasic(TinkerArmor.materialWood, 3, "wood").setUnlocalizedName("tconstruct.bootsWood");
|
||||
TinkerArmor.materialWood = EnumHelper.addArmorMaterial("WOOD", 2, new int[] {1, 2, 2, 1}, 3);
|
||||
TinkerArmor.helmetWood =
|
||||
new ArmorBasic(TinkerArmor.materialWood, 0, "wood").setUnlocalizedName("tconstruct.helmetWood");
|
||||
TinkerArmor.chestplateWood =
|
||||
new ArmorBasic(TinkerArmor.materialWood, 1, "wood").setUnlocalizedName("tconstruct.chestplateWood");
|
||||
TinkerArmor.leggingsWood =
|
||||
new ArmorBasic(TinkerArmor.materialWood, 2, "wood").setUnlocalizedName("tconstruct.leggingsWood");
|
||||
TinkerArmor.bootsWood =
|
||||
new ArmorBasic(TinkerArmor.materialWood, 3, "wood").setUnlocalizedName("tconstruct.bootsWood");
|
||||
GameRegistry.registerItem(TinkerArmor.helmetWood, "helmetWood");
|
||||
GameRegistry.registerItem(TinkerArmor.chestplateWood, "chestplateWood");
|
||||
GameRegistry.registerItem(TinkerArmor.leggingsWood, "leggingsWood");
|
||||
@@ -141,8 +136,7 @@ public class TinkerArmor
|
||||
}
|
||||
|
||||
@Handler
|
||||
public void init (FMLInitializationEvent event)
|
||||
{
|
||||
public void init(FMLInitializationEvent event) {
|
||||
craftingTableRecipes();
|
||||
registerModifiers();
|
||||
addRecipesForDryingRack();
|
||||
@@ -151,58 +145,139 @@ public class TinkerArmor
|
||||
}
|
||||
|
||||
@Handler
|
||||
public void postInit (FMLPostInitializationEvent evt)
|
||||
{
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
proxy.registerTickHandler();
|
||||
}
|
||||
|
||||
private void craftingTableRecipes ()
|
||||
{
|
||||
private void craftingTableRecipes() {
|
||||
|
||||
// Armor Recipes
|
||||
Object[] helm = new String[] { "www", "w w" };
|
||||
Object[] chest = new String[] { "w w", "www", "www" };
|
||||
Object[] pants = new String[] { "www", "w w", "w w" };
|
||||
Object[] shoes = new String[] { "w w", "w w" };
|
||||
Object[] helm = new String[] {"www", "w w"};
|
||||
Object[] chest = new String[] {"w w", "www", "www"};
|
||||
Object[] pants = new String[] {"www", "w w", "w w"};
|
||||
Object[] shoes = new String[] {"w w", "w w"};
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.helmetWood, helm, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.chestplateWood, chest, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.leggingsWood, pants, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.bootsWood, shoes, 'w', "logWood"));
|
||||
|
||||
// Accessories
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
|
||||
// GameRegistry.addRecipe(new ShapedOreRecipe(new
|
||||
// ItemStack(TRepo.heartCanister, 1, 0), "##", "##", '#',
|
||||
// "ingotNaturalAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), " # ", "#B#", " # ", '#', "ingotTin", 'B', Items.bone));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 0), " # ", "#B#", " # ", '#', "ingotTin", 'B', Items.bone));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.diamondApple), " d ", "d#d", " d ", 'd', "gemDiamond", '#', new ItemStack(Items.apple)));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 2), new ItemStack(TinkerArmor.diamondApple), new ItemStack(TinkerTools.materials, 1, 8), new ItemStack(TinkerArmor.heartCanister, 1, 0), new ItemStack(TinkerArmor.heartCanister, 1, 1));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 1), new ItemStack(TinkerArmor.heartCanister, 1, 3));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 4), new ItemStack(TinkerArmor.heartCanister, 1, 2), new ItemStack(TinkerArmor.heartCanister, 1, 3), new ItemStack(Items.golden_apple, 1, 1));
|
||||
//GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 0), new ItemStack(heartCanister, 1, 4), new ItemStack(heartCanister, 1, 5));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(TinkerArmor.diamondApple),
|
||||
" d ",
|
||||
"d#d",
|
||||
" d ",
|
||||
'd',
|
||||
"gemDiamond",
|
||||
'#',
|
||||
new ItemStack(Items.apple)));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 2),
|
||||
new ItemStack(TinkerArmor.diamondApple),
|
||||
new ItemStack(TinkerTools.materials, 1, 8),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 0),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 1));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 1), new ItemStack(TinkerArmor.heartCanister, 1, 3));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 4),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 2),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 3),
|
||||
new ItemStack(Items.golden_apple, 1, 1));
|
||||
// GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 0), new
|
||||
// ItemStack(heartCanister, 1, 4), new ItemStack(heartCanister, 1, 5));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TinkerTools.toughRod, 1, 2), 'm', "ingotGold"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(TinkerArmor.knapsack, 1, 0),
|
||||
"###",
|
||||
"rmr",
|
||||
"###",
|
||||
'#',
|
||||
new ItemStack(Items.leather),
|
||||
'r',
|
||||
new ItemStack(TinkerTools.toughRod, 1, 2),
|
||||
'm',
|
||||
"ingotGold"));
|
||||
ItemStack aluBrass = new ItemStack(TinkerTools.materials, 1, 14);
|
||||
GameRegistry.addRecipe(new ItemStack(TinkerArmor.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TinkerTools.toughRod, 1, 2), 'm', aluBrass);
|
||||
GameRegistry.addRecipe(
|
||||
new ItemStack(TinkerArmor.knapsack, 1, 0),
|
||||
"###",
|
||||
"rmr",
|
||||
"###",
|
||||
'#',
|
||||
new ItemStack(Items.leather),
|
||||
'r',
|
||||
new ItemStack(TinkerTools.toughRod, 1, 2),
|
||||
'm',
|
||||
aluBrass);
|
||||
// Drying Rack Recipes
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.dryingRack, 1, 0), "bbb", 'b', "slabWood"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(TinkerArmor.dryingRack, 1, 0), "bbb", 'b', "slabWood"));
|
||||
|
||||
//Temporary recipes
|
||||
// Temporary recipes
|
||||
ItemStack leather = new ItemStack(Items.leather);
|
||||
ItemStack glass = new ItemStack(Blocks.glass);
|
||||
ItemStack string = new ItemStack(Items.string);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelGoggles.getDefaultItem(), "# #", "q#q", "g g", '#', leather, 'q', "blockGlass", 'g', "ingotGold"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelWings.getDefaultItem(), "g g", "i#i", "i i", '#', Items.ender_pearl, 'g', "ingotGold", 'i', "ingotBronze"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelVest.getDefaultItem(), "#w#", "#i#", "#w#", '#', leather, 'i', "ingotAluminum", 'w', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE)));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelBoots.getDefaultItem(), "#s#", "#i#", "#s#", '#', leather, 's', string, 'i', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelGoggles.getDefaultItem(),
|
||||
"# #",
|
||||
"q#q",
|
||||
"g g",
|
||||
'#',
|
||||
leather,
|
||||
'q',
|
||||
"blockGlass",
|
||||
'g',
|
||||
"ingotGold"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelWings.getDefaultItem(),
|
||||
"g g",
|
||||
"i#i",
|
||||
"i i",
|
||||
'#',
|
||||
Items.ender_pearl,
|
||||
'g',
|
||||
"ingotGold",
|
||||
'i',
|
||||
"ingotBronze"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelVest.getDefaultItem(),
|
||||
"#w#",
|
||||
"#i#",
|
||||
"#w#",
|
||||
'#',
|
||||
leather,
|
||||
'i',
|
||||
"ingotAluminum",
|
||||
'w',
|
||||
new ItemStack(Blocks.wool, 1, Short.MAX_VALUE)));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelBoots.getDefaultItem(), "#s#", "#i#", "#s#", '#', leather, 's', string, 'i', "ingotAluminum"));
|
||||
GameRegistry.addShapedRecipe(travelGlove.getDefaultItem(), " #", "###", " ##", '#', leather);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelBelt.getDefaultItem(), "###", "ici", "###", '#', leather, 'c', "chestWood", 'i', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelBelt.getDefaultItem(),
|
||||
"###",
|
||||
"ici",
|
||||
"###",
|
||||
'#',
|
||||
leather,
|
||||
'c',
|
||||
"chestWood",
|
||||
'i',
|
||||
"ingotAluminum"));
|
||||
}
|
||||
|
||||
protected static void addRecipesForDryingRack ()
|
||||
{
|
||||
protected static void addRecipesForDryingRack() {
|
||||
// Drying rack
|
||||
DryingRackRecipes.addDryingRecipe(Items.beef, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 0));
|
||||
DryingRackRecipes.addDryingRecipe(Items.chicken, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 1));
|
||||
@@ -211,46 +286,148 @@ public class TinkerArmor
|
||||
// ItemStack(TRepo.jerky, 1, 3));
|
||||
DryingRackRecipes.addDryingRecipe(Items.fish, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 4));
|
||||
DryingRackRecipes.addDryingRecipe(Items.rotten_flesh, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 5));
|
||||
DryingRackRecipes.addDryingRecipe(new ItemStack(TinkerWorld.strangeFood, 1, 0), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 6));
|
||||
DryingRackRecipes.addDryingRecipe(new ItemStack(TinkerWorld.strangeFood, 1, 1), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 7));
|
||||
DryingRackRecipes.addDryingRecipe(
|
||||
new ItemStack(TinkerWorld.strangeFood, 1, 0), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 6));
|
||||
DryingRackRecipes.addDryingRecipe(
|
||||
new ItemStack(TinkerWorld.strangeFood, 1, 1), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 7));
|
||||
|
||||
// DryingRackRecipes.addDryingRecipe(new ItemStack(TRepo.jerky, 1, 5),
|
||||
// 20 * 60 * 10, Item.leather);
|
||||
}
|
||||
|
||||
private void registerModifiers ()
|
||||
{
|
||||
private void registerModifiers() {
|
||||
ItemStack redstoneItem = new ItemStack(Items.redstone);
|
||||
ItemStack redstoneBlock = new ItemStack(Blocks.redstone_block);
|
||||
//Travel gear modifiers
|
||||
//MultiType
|
||||
ModifyBuilder.registerModifier(new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(Blocks.piston) }));
|
||||
ModifyBuilder.registerModifier(new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 1), new ItemStack(Blocks.piston) }));
|
||||
ModifyBuilder.registerModifier(new AModInteger(4, "Moss", EnumSet.of(ArmorPart.Legs, ArmorPart.Feet, ArmorPart.Chest, ArmorPart.Head), new ItemStack[] { new ItemStack(TinkerTools.materials, 1, 6) }, 3, "\u00a72", StatCollector.translateToLocal("modifier.tool.moss")));
|
||||
// Travel gear modifiers
|
||||
// MultiType
|
||||
ModifyBuilder.registerModifier(
|
||||
new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] {
|
||||
new ItemStack(Items.ghast_tear),
|
||||
new ItemStack(TinkerWorld.slimeGel, 1, 0),
|
||||
new ItemStack(Blocks.piston)
|
||||
}));
|
||||
ModifyBuilder.registerModifier(
|
||||
new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] {
|
||||
new ItemStack(Items.ghast_tear),
|
||||
new ItemStack(TinkerWorld.slimeGel, 1, 1),
|
||||
new ItemStack(Blocks.piston)
|
||||
}));
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
4,
|
||||
"Moss",
|
||||
EnumSet.of(ArmorPart.Legs, ArmorPart.Feet, ArmorPart.Chest, ArmorPart.Head),
|
||||
new ItemStack[] {new ItemStack(TinkerTools.materials, 1, 6)},
|
||||
3,
|
||||
"\u00a72",
|
||||
StatCollector.translateToLocal("modifier.tool.moss")));
|
||||
ModifyBuilder.registerModifier(new TravelModRepair());
|
||||
TConstructRegistry.registerActiveArmorMod(new ActiveTinkerArmor());
|
||||
|
||||
//Head
|
||||
ModifyBuilder.registerModifier(new AModBoolean(0, "Night Vision", EnumSet.of(ArmorPart.Head), new ItemStack[] { new ItemStack(Items.flint_and_steel), new ItemStack(Items.potionitem, 1, 8198), new ItemStack(Items.golden_carrot) }, "\u00a78", "Night Vision"));
|
||||
// Head
|
||||
ModifyBuilder.registerModifier(new AModBoolean(
|
||||
0,
|
||||
"Night Vision",
|
||||
EnumSet.of(ArmorPart.Head),
|
||||
new ItemStack[] {
|
||||
new ItemStack(Items.flint_and_steel),
|
||||
new ItemStack(Items.potionitem, 1, 8198),
|
||||
new ItemStack(Items.golden_carrot)
|
||||
},
|
||||
"\u00a78",
|
||||
"Night Vision"));
|
||||
|
||||
//Chest
|
||||
ModifyBuilder.registerModifier(new AModInteger(0, "Perfect Dodge", EnumSet.of(ArmorPart.Chest), new ItemStack[] { new ItemStack(Items.ender_eye), new ItemStack(Items.ender_pearl), new ItemStack(Items.sugar) }, 1, "\u00a7d", "Perfect Dodge"));
|
||||
ModifyBuilder.registerModifier(new AModBoolean(1, "Stealth", EnumSet.of(ArmorPart.Chest), new ItemStack[] { new ItemStack(Items.fermented_spider_eye), new ItemStack(Items.ender_eye), new ItemStack(Items.potionitem, 1, 8206), new ItemStack(Items.golden_carrot) }, "\u00a78", "Stealth"));
|
||||
// Chest
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
0,
|
||||
"Perfect Dodge",
|
||||
EnumSet.of(ArmorPart.Chest),
|
||||
new ItemStack[] {
|
||||
new ItemStack(Items.ender_eye), new ItemStack(Items.ender_pearl), new ItemStack(Items.sugar)
|
||||
},
|
||||
1,
|
||||
"\u00a7d",
|
||||
"Perfect Dodge"));
|
||||
ModifyBuilder.registerModifier(new AModBoolean(
|
||||
1,
|
||||
"Stealth",
|
||||
EnumSet.of(ArmorPart.Chest),
|
||||
new ItemStack[] {
|
||||
new ItemStack(Items.fermented_spider_eye),
|
||||
new ItemStack(Items.ender_eye),
|
||||
new ItemStack(Items.potionitem, 1, 8206),
|
||||
new ItemStack(Items.golden_carrot)
|
||||
},
|
||||
"\u00a78",
|
||||
"Stealth"));
|
||||
|
||||
//Wings
|
||||
// Wings
|
||||
ItemStack feather = new ItemStack(Items.feather);
|
||||
ModifyBuilder.registerModifier(new AModInteger(1, "Feather Fall", EnumSet.of(ArmorPart.Legs), new ItemStack[] { new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(Items.ender_pearl), feather, feather, feather, feather, feather, feather }, 1, "\u00a7f", "Feather Fall"));
|
||||
ModifyBuilder.registerModifier(new AModInteger(1, "Feather Fall", EnumSet.of(ArmorPart.Legs), new ItemStack[] { new ItemStack(TinkerWorld.slimeGel, 1, 1), new ItemStack(Items.ender_pearl), feather, feather, feather, feather, feather, feather }, 1, "\u00a7f", "Feather Fall"));
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
1,
|
||||
"Feather Fall",
|
||||
EnumSet.of(ArmorPart.Legs),
|
||||
new ItemStack[] {
|
||||
new ItemStack(TinkerWorld.slimeGel, 1, 0),
|
||||
new ItemStack(Items.ender_pearl),
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather
|
||||
},
|
||||
1,
|
||||
"\u00a7f",
|
||||
"Feather Fall"));
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
1,
|
||||
"Feather Fall",
|
||||
EnumSet.of(ArmorPart.Legs),
|
||||
new ItemStack[] {
|
||||
new ItemStack(TinkerWorld.slimeGel, 1, 1),
|
||||
new ItemStack(Items.ender_pearl),
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather
|
||||
},
|
||||
1,
|
||||
"\u00a7f",
|
||||
"Feather Fall"));
|
||||
|
||||
//Feet
|
||||
ModifyBuilder.registerModifier(new AModBoolean(1, "WaterWalk", EnumSet.of(ArmorPart.Feet), new ItemStack[] { new ItemStack(Blocks.waterlily), new ItemStack(Blocks.waterlily) }, "\u00a79", "Water-Walking"));
|
||||
ModifyBuilder.registerModifier(new AModLeadBoots(new ItemStack[] { new ItemStack(Blocks.iron_block) }));
|
||||
ModifyBuilder.registerModifier(new AModInteger(3, "Slimy Soles", EnumSet.of(ArmorPart.Feet), new ItemStack[] { new ItemStack(TinkerWorld.slimePad, 1, 0), new ItemStack(TinkerWorld.slimePad, 1, 0) }, 1, "\u00a7a", "Slimy Soles"));
|
||||
// Feet
|
||||
ModifyBuilder.registerModifier(new AModBoolean(
|
||||
1,
|
||||
"WaterWalk",
|
||||
EnumSet.of(ArmorPart.Feet),
|
||||
new ItemStack[] {new ItemStack(Blocks.waterlily), new ItemStack(Blocks.waterlily)},
|
||||
"\u00a79",
|
||||
"Water-Walking"));
|
||||
ModifyBuilder.registerModifier(new AModLeadBoots(new ItemStack[] {new ItemStack(Blocks.iron_block)}));
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
3,
|
||||
"Slimy Soles",
|
||||
EnumSet.of(ArmorPart.Feet),
|
||||
new ItemStack[] {new ItemStack(TinkerWorld.slimePad, 1, 0), new ItemStack(TinkerWorld.slimePad, 1, 0)},
|
||||
1,
|
||||
"\u00a7a",
|
||||
"Slimy Soles"));
|
||||
|
||||
//Glove
|
||||
ModifyBuilder.registerModifier(new GloveSpeed(1, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }));
|
||||
//ModifyBuilder.registerModifier(new GloveClimb(new ItemStack[] { new ItemStack(Items.slime_ball), new ItemStack(Blocks.web), new ItemStack(TinkerTools.materials, 1, 25) }));
|
||||
modAttackGlove = new ModAttack("Quartz", 2, new ItemStack[] { new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1, 4 }, 50, 50, "Accessory");
|
||||
//ModifyBuilder.registerModifier(modAttackGlove);
|
||||
// Glove
|
||||
ModifyBuilder.registerModifier(
|
||||
new GloveSpeed(1, new ItemStack[] {redstoneItem, redstoneBlock}, new int[] {1, 9}));
|
||||
// ModifyBuilder.registerModifier(new GloveClimb(new ItemStack[] { new ItemStack(Items.slime_ball), new
|
||||
// ItemStack(Blocks.web), new ItemStack(TinkerTools.materials, 1, 25) }));
|
||||
modAttackGlove = new ModAttack(
|
||||
"Quartz",
|
||||
2,
|
||||
new ItemStack[] {new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE)},
|
||||
new int[] {1, 4},
|
||||
50,
|
||||
50,
|
||||
"Accessory");
|
||||
// ModifyBuilder.registerModifier(modAttackGlove);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.entity.boss.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
@@ -14,47 +14,47 @@ import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.util.network.ArmourGuiSyncPacket;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class TinkerArmorEvents
|
||||
{
|
||||
public class TinkerArmorEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingDrop (LivingDropsEvent event)
|
||||
{
|
||||
if (event.entityLiving == null)
|
||||
return;
|
||||
public void onLivingDrop(LivingDropsEvent event) {
|
||||
if (event.entityLiving == null) return;
|
||||
|
||||
if(!event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
|
||||
return;
|
||||
if (!event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) return;
|
||||
|
||||
if (TConstruct.random.nextInt(200) == 0 && event.entityLiving instanceof IMob && event.source.damageType.equals("player"))
|
||||
{
|
||||
if (TConstruct.random.nextInt(200) == 0
|
||||
&& event.entityLiving instanceof IMob
|
||||
&& event.source.damageType.equals("player")) {
|
||||
ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 1);
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
EntityItem entityitem = new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
event.entityLiving.posY,
|
||||
event.entityLiving.posZ,
|
||||
dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
if (event.entityLiving instanceof IBossDisplayData)
|
||||
{
|
||||
if (event.entityLiving instanceof IBossDisplayData) {
|
||||
String entityName = event.entityLiving.getClass().getSimpleName().toLowerCase();
|
||||
for(String name : PHConstruct.heartDropBlacklist)
|
||||
if (name.toLowerCase(Locale.US).equals(entityName))
|
||||
return;
|
||||
for (String name : PHConstruct.heartDropBlacklist)
|
||||
if (name.toLowerCase(Locale.US).equals(entityName)) return;
|
||||
|
||||
int count = event.entityLiving instanceof EntityDragon ? 5 : 1;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
for (int i = 0; i < count; i++) {
|
||||
ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 3);
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
EntityItem entityitem = new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
event.entityLiving.posY,
|
||||
event.entityLiving.posZ,
|
||||
dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
@@ -63,20 +63,18 @@ public class TinkerArmorEvents
|
||||
|
||||
/* Abilities */
|
||||
@SubscribeEvent
|
||||
public void armorMineSpeed (net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event)
|
||||
{
|
||||
if(event.entityPlayer == null)
|
||||
return;
|
||||
public void armorMineSpeed(net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event) {
|
||||
if (event.entityPlayer == null) return;
|
||||
|
||||
ItemStack glove = TPlayerStats.get(event.entityPlayer).armor.getStackInSlot(1);
|
||||
if(event.entityPlayer.worldObj.isRemote) { // todo: sync extended inventory with clients so this stuff and rendering is done properly...
|
||||
if(ArmorProxyClient.armorExtended != null)
|
||||
glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
|
||||
else
|
||||
glove = null;
|
||||
if (event.entityPlayer
|
||||
.worldObj
|
||||
.isRemote) { // todo: sync extended inventory with clients so this stuff and rendering is done
|
||||
// properly...
|
||||
if (ArmorProxyClient.armorExtended != null) glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
|
||||
else glove = null;
|
||||
}
|
||||
if(glove == null || !glove.hasTagCompound())
|
||||
return;
|
||||
if (glove == null || !glove.hasTagCompound()) return;
|
||||
|
||||
// ok, we got a glove. bonus mining speeeeed
|
||||
NBTTagCompound tags = glove.getTagCompound().getCompoundTag(TinkerArmor.travelGlove.getBaseTagName());
|
||||
@@ -88,25 +86,21 @@ public class TinkerArmorEvents
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void jumpHeight (LivingJumpEvent event)
|
||||
{
|
||||
public void jumpHeight(LivingJumpEvent event) {
|
||||
ItemStack stack = event.entityLiving.getEquipmentInSlot(2);
|
||||
if (stack != null && stack.getItem() instanceof TravelWings)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof TravelWings) {
|
||||
event.entityLiving.motionY += 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void slimefall (LivingFallEvent event)
|
||||
{
|
||||
public void slimefall(LivingFallEvent event) {
|
||||
ItemStack boots = event.entityLiving.getEquipmentInSlot(1);
|
||||
if (boots != null && boots.getItem() instanceof IModifyable)
|
||||
{
|
||||
NBTTagCompound tag = boots.getTagCompound().getCompoundTag(((IModifyable) boots.getItem()).getBaseTagName());
|
||||
if (boots != null && boots.getItem() instanceof IModifyable) {
|
||||
NBTTagCompound tag =
|
||||
boots.getTagCompound().getCompoundTag(((IModifyable) boots.getItem()).getBaseTagName());
|
||||
int sole = tag.getInteger("Slimy Soles");
|
||||
if (sole > 0)
|
||||
{
|
||||
if (sole > 0) {
|
||||
event.distance /= (1 + sole);
|
||||
event.entityLiving.fallDistance /= (1 + sole);
|
||||
}
|
||||
@@ -114,38 +108,30 @@ public class TinkerArmorEvents
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void perfectDodge(LivingAttackEvent event)
|
||||
{
|
||||
if(!event.source.isProjectile())
|
||||
return;
|
||||
public void perfectDodge(LivingAttackEvent event) {
|
||||
if (!event.source.isProjectile()) return;
|
||||
|
||||
// perfect dodge?
|
||||
if(!(event.entityLiving instanceof EntityPlayer))
|
||||
return;
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack chest = player.getCurrentArmor(2);
|
||||
if(chest == null || !(chest.getItem() instanceof IModifyable) || !chest.hasTagCompound())
|
||||
return;
|
||||
if (chest == null || !(chest.getItem() instanceof IModifyable) || !chest.hasTagCompound()) return;
|
||||
|
||||
NBTTagCompound tags = chest.getTagCompound().getCompoundTag(((IModifyable) chest.getItem()).getBaseTagName());
|
||||
int dodge = tags.getInteger("Perfect Dodge");
|
||||
if(dodge > TConstruct.random.nextInt(10))
|
||||
event.setCanceled(true);
|
||||
if (dodge > TConstruct.random.nextInt(10)) event.setCanceled(true);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void joinWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayerMP)
|
||||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP)event.entity;
|
||||
public void joinWorld(EntityJoinWorldEvent event) {
|
||||
if (event.entity instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) event.entity;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
stats.saveNBTData(tag);
|
||||
ArmourGuiSyncPacket syncPacket = new ArmourGuiSyncPacket(tag);
|
||||
TConstruct.packetPipeline.sendTo(syncPacket, player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,9 @@ import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
|
||||
public class DryingRack extends InventoryBlock
|
||||
{
|
||||
public class DryingRack extends InventoryBlock {
|
||||
|
||||
public DryingRack()
|
||||
{
|
||||
public DryingRack() {
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
setHardness(2.0f);
|
||||
@@ -29,76 +27,60 @@ public class DryingRack extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new DryingRackLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced (World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta)
|
||||
{
|
||||
if (side > 1)
|
||||
return side;
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) {
|
||||
if (side > 1) return side;
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLiving living, ItemStack stack)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving living, ItemStack stack) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0)
|
||||
{
|
||||
if (meta == 0) {
|
||||
int l = MathHelper.floor_double((double) (living.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int direction = l % 2;
|
||||
if (direction == 1)
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
if (direction == 1) world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Activation */
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) {
|
||||
return activateDryingRack(world, x, y, z, player);
|
||||
}
|
||||
|
||||
boolean activateDryingRack (World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
boolean activateDryingRack(World world, int x, int y, int z, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
DryingRackLogic logic = (DryingRackLogic) world.getTileEntity(x, y, z);
|
||||
|
||||
if (!logic.isStackInSlot(0))
|
||||
{
|
||||
if (!logic.isStackInSlot(0)) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack != null) {
|
||||
stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
logic.setInventorySlotContents(0, stack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ItemStack decrStack = logic.decrStackSize(0, 1);
|
||||
if (decrStack != null)
|
||||
AbilityHelper.spawnItemAtPlayer(player, decrStack);
|
||||
if (decrStack != null) AbilityHelper.spawnItemAtPlayer(player, decrStack);
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
@@ -107,8 +89,7 @@ public class DryingRack extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
float xMin = 0F;
|
||||
float yMin = 0F;
|
||||
@@ -116,41 +97,45 @@ public class DryingRack extends InventoryBlock
|
||||
float xMax = 1F;
|
||||
float yMax = 1F;
|
||||
float zMax = 1F;
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
}
|
||||
return AxisAlignedBB.getBoundingBox((double) x + xMin, (double) y + yMin, (double) z + zMin, (double) x + xMax, (double) y + yMax, (double) z + zMax);
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(double) x + xMin,
|
||||
(double) y + yMin,
|
||||
(double) z + zMin,
|
||||
(double) x + xMax,
|
||||
(double) y + yMax,
|
||||
(double) z + zMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
float xMin = 0F;
|
||||
float yMin = 0F;
|
||||
@@ -158,98 +143,95 @@ public class DryingRack extends InventoryBlock
|
||||
float xMax = 1F;
|
||||
float yMax = 1F;
|
||||
float zMax = 1F;
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
}
|
||||
this.setBlockBounds(xMin, yMin, zMin, xMax, yMax, zMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity)
|
||||
{
|
||||
public void addCollisionBoxesToList(
|
||||
World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
|
||||
}
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return DryingRackRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "castingtable_top", "castingtable_side", "castingtable_bottom", "faucet", "blockcast_top", "blockcast_side", "blockcast_bottom" };
|
||||
public String[] getTextureNames() {
|
||||
String[] textureNames = {
|
||||
"castingtable_top",
|
||||
"castingtable_side",
|
||||
"castingtable_bottom",
|
||||
"faucet",
|
||||
"blockcast_top",
|
||||
"blockcast_side",
|
||||
"blockcast_bottom"
|
||||
};
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.planks.getIcon(side, 0);
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new DryingRackLogic();
|
||||
}
|
||||
|
||||
@@ -271,11 +253,11 @@ public class DryingRack extends InventoryBlock
|
||||
* != 1) { this.setBlockBounds(0, 0, 0, 1, 1, 1); } else { FaucetLogic logic
|
||||
* = (FaucetLogic) world.getBlockTileEntity(x, y, z); float xMin = 0.25F;
|
||||
* float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F;
|
||||
*
|
||||
*
|
||||
* switch (logic.getRenderDirection()) { case 2: zMin = 0.625F; zMax = 1.0F;
|
||||
* break; case 3: zMax = 0.375F; zMin = 0F; break; case 4: xMin = 0.625F;
|
||||
* xMax = 1.0F; break; case 5: xMax = 0.375F; xMin = 0F; break; }
|
||||
*
|
||||
*
|
||||
* this.setBlockBounds(xMin, 0.25F, zMin, xMax, 0.625F, zMax); } }
|
||||
*/
|
||||
|
||||
@@ -286,15 +268,15 @@ public class DryingRack extends InventoryBlock
|
||||
* 1, y + 1, z + 1); } else { FaucetLogic logic = (FaucetLogic)
|
||||
* world.getBlockTileEntity(x, y, z); if (logic != null) { float xMin =
|
||||
* 0.25F; float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F;
|
||||
*
|
||||
*
|
||||
* switch (logic.getRenderDirection()) { case 2: zMin = 0.625F; zMax = 1.0F;
|
||||
* break; case 3: zMax = 0.375F; zMin = 0F; break; case 4: xMin = 0.625F;
|
||||
* xMax = 1.0F; break; case 5: xMax = 0.375F; xMin = 0F; break; }
|
||||
*
|
||||
*
|
||||
* return AxisAlignedBB.getBoundingBox((double) ((float) x + xMin),
|
||||
* (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x +
|
||||
* xMax), (double) y + 0.625, (double) ((float) z + zMax)); } }
|
||||
*
|
||||
*
|
||||
* return super.getCollisionBoundingBoxFromPool(world, x, y, z); }
|
||||
*/
|
||||
|
||||
|
||||
@@ -10,24 +10,21 @@ import tconstruct.armor.inventory.ArmorExtendedContainer;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.client.tabs.*;
|
||||
|
||||
public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
{
|
||||
public class ArmorExtendedGui extends InventoryEffectRenderer {
|
||||
public InventoryPlayer inv;
|
||||
public ArmorExtended stats;
|
||||
|
||||
private float xSize_lo;
|
||||
private float ySize_lo;
|
||||
|
||||
public ArmorExtendedGui(InventoryPlayer inventoryplayer, ArmorExtended holder)
|
||||
{
|
||||
public ArmorExtendedGui(InventoryPlayer inventoryplayer, ArmorExtended holder) {
|
||||
super(new ArmorExtendedContainer(inventoryplayer, holder));
|
||||
inv = inventoryplayer;
|
||||
stats = holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int cornerX = guiLeft;
|
||||
@@ -47,8 +44,7 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
// fontRenderer.drawString(StatCollector.translateToLocal("inventory.armorextended"),
|
||||
// 60, 6, 0x404040);
|
||||
// fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"),
|
||||
@@ -56,8 +52,7 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen (int par1, int par2, float par3)
|
||||
{
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
this.xSize_lo = (float) par1;
|
||||
this.ySize_lo = (float) par2;
|
||||
@@ -85,8 +80,7 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/armorextended.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// mc.renderEngine.bindTexture("/mods/tinker/textures/gui/armorextended.png");
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
@@ -94,28 +88,26 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
int cornerY = guiTop;
|
||||
drawTexturedModalRect(cornerX, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if (!stats.isStackInSlot(0))
|
||||
drawTexturedModalRect(cornerX + 79, cornerY + 16, 176, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(1))
|
||||
drawTexturedModalRect(cornerX + 79, cornerY + 34, 176, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(2))
|
||||
drawTexturedModalRect(cornerX + 115, cornerY + 16, 212, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(3))
|
||||
drawTexturedModalRect(cornerX + 115, cornerY + 34, 212, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(4))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 52, 230, 0, 18, 18);
|
||||
if (!stats.isStackInSlot(5))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 34, 230, 18, 18, 18);
|
||||
if (!stats.isStackInSlot(6))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 16, 230, 36, 18, 18);
|
||||
if (!stats.isStackInSlot(0)) drawTexturedModalRect(cornerX + 79, cornerY + 16, 176, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(1)) drawTexturedModalRect(cornerX + 79, cornerY + 34, 176, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(2)) drawTexturedModalRect(cornerX + 115, cornerY + 16, 212, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(3)) drawTexturedModalRect(cornerX + 115, cornerY + 34, 212, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(4)) drawTexturedModalRect(cornerX + 151, cornerY + 52, 230, 0, 18, 18);
|
||||
if (!stats.isStackInSlot(5)) drawTexturedModalRect(cornerX + 151, cornerY + 34, 230, 18, 18, 18);
|
||||
if (!stats.isStackInSlot(6)) drawTexturedModalRect(cornerX + 151, cornerY + 16, 230, 36, 18, 18);
|
||||
|
||||
cornerX = this.guiLeft;
|
||||
cornerY = this.guiTop;
|
||||
drawPlayerOnGui(this.mc, cornerX + 33, cornerY + 75, 30, (float) (cornerX + 51) - this.xSize_lo, (float) (cornerY + 75 - 50) - this.ySize_lo);
|
||||
drawPlayerOnGui(
|
||||
this.mc,
|
||||
cornerX + 33,
|
||||
cornerY + 75,
|
||||
30,
|
||||
(float) (cornerX + 51) - this.xSize_lo,
|
||||
(float) (cornerY + 75 - 50) - this.ySize_lo);
|
||||
}
|
||||
|
||||
public static void drawPlayerOnGui (Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5)
|
||||
{
|
||||
public static void drawPlayerOnGui(Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5) {
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par1, (float) par2, 50.0F);
|
||||
@@ -150,7 +142,7 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
/*
|
||||
* protected void keyTyped(char par1, int par2) { if (par2 ==
|
||||
* TControls.armorKey.keyCode) { this.mc.thePlayer.closeScreen(); }
|
||||
*
|
||||
*
|
||||
* super.keyTyped(par1, par2); }
|
||||
*/
|
||||
}
|
||||
@@ -8,21 +8,18 @@ import tconstruct.armor.inventory.KnapsackContainer;
|
||||
import tconstruct.armor.player.KnapsackInventory;
|
||||
import tconstruct.client.tabs.*;
|
||||
|
||||
public class KnapsackGui extends InventoryEffectRenderer
|
||||
{
|
||||
public class KnapsackGui extends InventoryEffectRenderer {
|
||||
public InventoryPlayer inv;
|
||||
public KnapsackInventory stats;
|
||||
|
||||
public KnapsackGui(InventoryPlayer inventoryplayer, KnapsackInventory holder)
|
||||
{
|
||||
public KnapsackGui(InventoryPlayer inventoryplayer, KnapsackInventory holder) {
|
||||
super(new KnapsackContainer(inventoryplayer, holder));
|
||||
inv = inventoryplayer;
|
||||
stats = holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int cornerX = guiLeft;
|
||||
@@ -45,17 +42,16 @@ public class KnapsackGui extends InventoryEffectRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.knapsack"), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/knapsack.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = guiLeft;
|
||||
@@ -66,7 +62,7 @@ public class KnapsackGui extends InventoryEffectRenderer
|
||||
/*
|
||||
* protected void keyTyped(char par1, int par2) { if (par2 ==
|
||||
* TControls.armorKey.keyCode) { this.mc.thePlayer.closeScreen(); }
|
||||
*
|
||||
*
|
||||
* super.keyTyped(par1, par2); }
|
||||
*/
|
||||
}
|
||||
@@ -6,13 +6,11 @@ import net.minecraft.item.ItemStack;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
|
||||
public class ArmorExtendedContainer extends ActiveContainer
|
||||
{
|
||||
public class ArmorExtendedContainer extends ActiveContainer {
|
||||
public InventoryPlayer invPlayer;
|
||||
public ArmorExtended armor;
|
||||
|
||||
public ArmorExtendedContainer(InventoryPlayer inventoryplayer, ArmorExtended armor)
|
||||
{
|
||||
public ArmorExtendedContainer(InventoryPlayer inventoryplayer, ArmorExtended armor) {
|
||||
invPlayer = inventoryplayer;
|
||||
this.armor = armor;
|
||||
|
||||
@@ -20,40 +18,40 @@ public class ArmorExtendedContainer extends ActiveContainer
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 1, 80, 35, 1));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 2, 116, 17, 1));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 3, 116, 35, 1));
|
||||
|
||||
|
||||
// HeartCanister
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 4, 152, 53, 10));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 5, 152, 35, 10));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 6, 152, 17, 10));
|
||||
for (int playerArmor = 0; playerArmor < 4; ++playerArmor)
|
||||
{
|
||||
this.addSlotToContainer(new SlotArmorCopy(this, inventoryplayer, inventoryplayer.getSizeInventory() - 1 - playerArmor, 98, 8 + playerArmor * 18, playerArmor));
|
||||
for (int playerArmor = 0; playerArmor < 4; ++playerArmor) {
|
||||
this.addSlotToContainer(new SlotArmorCopy(
|
||||
this,
|
||||
inventoryplayer,
|
||||
inventoryplayer.getSizeInventory() - 1 - playerArmor,
|
||||
98,
|
||||
8 + playerArmor * 18,
|
||||
playerArmor));
|
||||
}
|
||||
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
for (int column = 0; column < 3; column++) {
|
||||
for (int row = 0; row < 9; row++) {
|
||||
this.addSlotToContainer(
|
||||
new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
for (int column = 0; column < 9; column++) {
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer var1)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer var1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,74 +5,58 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.armor.player.KnapsackInventory;
|
||||
|
||||
public class KnapsackContainer extends Container
|
||||
{
|
||||
public class KnapsackContainer extends Container {
|
||||
public KnapsackInventory backpack;
|
||||
public int progress = 0;
|
||||
public int fuel = 0;
|
||||
public int fuelGague = 0;
|
||||
|
||||
public KnapsackContainer(InventoryPlayer inventoryplayer, KnapsackInventory knapsack)
|
||||
{
|
||||
public KnapsackContainer(InventoryPlayer inventoryplayer, KnapsackInventory knapsack) {
|
||||
backpack = knapsack;
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
for (int column = 0; column < 3; column++) {
|
||||
for (int row = 0; row < 9; row++) {
|
||||
this.addSlotToContainer(new Slot(knapsack, row + column * 9, 8 + row * 18, 17 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
for (int column = 0; column < 3; column++) {
|
||||
for (int row = 0; row < 9; row++) {
|
||||
this.addSlotToContainer(
|
||||
new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
for (int column = 0; column < 9; column++) {
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return backpack.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < backpack.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, backpack.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
if (slotID < backpack.getSizeInventory()) {
|
||||
if (!this.mergeItemStack(slotStack, backpack.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, backpack.getSizeInventory(), false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(slotStack, 0, backpack.getSizeInventory(), false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
if (slotStack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,11 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import tconstruct.library.accessory.IAccessory;
|
||||
|
||||
public class SlotAccessory extends Slot
|
||||
{
|
||||
public class SlotAccessory extends Slot {
|
||||
private final int slotID;
|
||||
private final int slotStackLimit;
|
||||
|
||||
public SlotAccessory(IInventory par2IInventory, int par3, int par4, int par5, int slotStackLimit)
|
||||
{
|
||||
public SlotAccessory(IInventory par2IInventory, int par3, int par4, int par5, int slotStackLimit) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.slotID = par3;
|
||||
this.slotStackLimit = slotStackLimit;
|
||||
@@ -20,17 +18,17 @@ public class SlotAccessory extends Slot
|
||||
* 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 ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return slotStackLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof IAccessory) && ((IAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
return item != null
|
||||
&& (item instanceof IAccessory)
|
||||
&& ((IAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class SlotArmorCopy extends Slot
|
||||
{
|
||||
public class SlotArmorCopy extends Slot {
|
||||
/**
|
||||
* The armor type that can be placed on that slot, it uses the same values
|
||||
* of armorType field on ItemArmor.
|
||||
@@ -19,8 +18,7 @@ public class SlotArmorCopy extends Slot
|
||||
*/
|
||||
final Container parent;
|
||||
|
||||
public SlotArmorCopy(Container container, IInventory par2IInventory, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
public SlotArmorCopy(Container container, IInventory par2IInventory, int par3, int par4, int par5, int par6) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.parent = container;
|
||||
this.armorType = par6;
|
||||
@@ -31,8 +29,7 @@ public class SlotArmorCopy extends Slot
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -41,12 +38,10 @@ public class SlotArmorCopy extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
boolean isValidArmor = false;
|
||||
if (item instanceof ItemArmor)
|
||||
{
|
||||
if (item instanceof ItemArmor) {
|
||||
isValidArmor = (((ItemArmor) item).armorType == armorType);
|
||||
}
|
||||
return item != null && (isValidArmor || (item instanceof ItemBlock && armorType == 0));
|
||||
@@ -57,8 +52,7 @@ public class SlotArmorCopy extends Slot
|
||||
/**
|
||||
* Returns the icon index on items.png that is used as background image of the slot.
|
||||
*/
|
||||
public IIcon getBackgroundIconIndex ()
|
||||
{
|
||||
public IIcon getBackgroundIconIndex() {
|
||||
return ItemArmor.func_94602_b(this.armorType);
|
||||
}
|
||||
}
|
||||
@@ -4,36 +4,30 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.mechworks.landmine.behavior.Behavior;
|
||||
|
||||
public class SlotBehavedOnly extends Slot
|
||||
{
|
||||
public class SlotBehavedOnly extends Slot {
|
||||
|
||||
public SlotBehavedOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
public SlotBehavedOnly(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Behavior b = Behavior.getBehaviorFromStack(par1ItemStack);
|
||||
|
||||
if (b == null)
|
||||
{
|
||||
if (b == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int stackL = b.getStackLimit(par1ItemStack);
|
||||
|
||||
if (b != null && this.inventory.getStackInSlot(this.slotNumber) != null && !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack))
|
||||
{
|
||||
if (b != null
|
||||
&& this.inventory.getStackInSlot(this.slotNumber) != null
|
||||
&& !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack)) {
|
||||
ItemStack is = this.inventory.getStackInSlot(this.slotNumber);
|
||||
if (is.stackSize + par1ItemStack.stackSize <= stackL)
|
||||
{
|
||||
if (is.stackSize + par1ItemStack.stackSize <= stackL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return par1ItemStack.stackSize <= stackL;
|
||||
}
|
||||
|
||||
@@ -41,8 +35,9 @@ public class SlotBehavedOnly extends Slot
|
||||
// return b != null;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit (ItemStack par1ItemStack)
|
||||
{
|
||||
return Behavior.getBehaviorFromStack(par1ItemStack) != null ? Behavior.getBehaviorFromStack(par1ItemStack).getStackLimit(par1ItemStack) : 1;
|
||||
public int getSlotStackLimit(ItemStack par1ItemStack) {
|
||||
return Behavior.getBehaviorFromStack(par1ItemStack) != null
|
||||
? Behavior.getBehaviorFromStack(par1ItemStack).getStackLimit(par1ItemStack)
|
||||
: 1;
|
||||
}
|
||||
}
|
||||
@@ -4,28 +4,23 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SlotBlocksOnly extends Slot
|
||||
{
|
||||
public class SlotBlocksOnly extends Slot {
|
||||
|
||||
public SlotBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
public SlotBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return par1ItemStack.getItem() instanceof ItemBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,12 +4,10 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
|
||||
public class SlotCanister extends Slot
|
||||
{
|
||||
public class SlotCanister extends Slot {
|
||||
private final int slotID;
|
||||
|
||||
public SlotCanister(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
public SlotCanister(IInventory par2IInventory, int par3, int par4, int par5) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.slotID = par3;
|
||||
}
|
||||
@@ -19,8 +17,7 @@ public class SlotCanister extends Slot
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@@ -29,10 +26,10 @@ public class SlotCanister extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof IHealthAccessory) && ((IHealthAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
|
||||
return item != null
|
||||
&& (item instanceof IHealthAccessory)
|
||||
&& ((IHealthAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,8 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import tconstruct.armor.items.Knapsack;
|
||||
|
||||
public class SlotKnapsack extends Slot
|
||||
{
|
||||
public SlotKnapsack(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
public class SlotKnapsack extends Slot {
|
||||
public SlotKnapsack(IInventory par2IInventory, int par3, int par4, int par5) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
}
|
||||
|
||||
@@ -16,8 +14,7 @@ public class SlotKnapsack extends Slot
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -26,9 +23,8 @@ public class SlotKnapsack extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof Knapsack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,9 @@ package tconstruct.armor.inventory;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotOnlyTake extends Slot
|
||||
{
|
||||
public class SlotOnlyTake extends Slot {
|
||||
|
||||
public SlotOnlyTake(IInventory builder, int par3, int par4, int par5)
|
||||
{
|
||||
public SlotOnlyTake(IInventory builder, int par3, int par4, int par5) {
|
||||
super(builder, par3, par4, par5);
|
||||
}
|
||||
|
||||
@@ -16,8 +14,7 @@ public class SlotOnlyTake extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack stack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -6,23 +6,19 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SlotOpaqueBlocksOnly extends SlotBlocksOnly
|
||||
{
|
||||
public class SlotOpaqueBlocksOnly extends SlotBlocksOnly {
|
||||
|
||||
public SlotOpaqueBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
public SlotOpaqueBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
if (super.isItemValid(par1ItemStack))
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
if (super.isItemValid(par1ItemStack)) {
|
||||
Block b = BlockUtils.getBlockFromItemStack(par1ItemStack);
|
||||
return b.isOpaqueCube() && b.renderAsNormalBlock();
|
||||
}
|
||||
@@ -31,9 +27,7 @@ public class SlotOpaqueBlocksOnly extends SlotBlocksOnly
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,10 +3,8 @@ package tconstruct.armor.inventory;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotUnused extends Slot
|
||||
{
|
||||
public SlotUnused(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
public class SlotUnused extends Slot {
|
||||
public SlotUnused(IInventory par2IInventory, int par3, int par4, int par5) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
}
|
||||
|
||||
@@ -15,8 +13,7 @@ public class SlotUnused extends Slot
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,8 +22,7 @@ public class SlotUnused extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,28 +4,28 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.*;
|
||||
|
||||
public class ArmorBasic extends ItemArmor
|
||||
{
|
||||
public class ArmorBasic extends ItemArmor {
|
||||
|
||||
public String textureName;
|
||||
|
||||
public ArmorBasic(ArmorMaterial par2EnumArmorMaterial, int par3, String textureName)
|
||||
{
|
||||
public ArmorBasic(ArmorMaterial par2EnumArmorMaterial, int par3, String textureName) {
|
||||
super(par2EnumArmorMaterial, 0, par3);
|
||||
this.textureName = textureName;
|
||||
}
|
||||
|
||||
@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"));
|
||||
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 type)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "tinker:textures/armor/" + textureName + "_" + suffix + ".png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,13 +9,11 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.library.*;
|
||||
|
||||
public class ArmorPattern extends CraftingItem implements ItemBlocklike
|
||||
{
|
||||
public class ArmorPattern extends CraftingItem implements ItemBlocklike {
|
||||
|
||||
private IIcon baseIcon;
|
||||
|
||||
public ArmorPattern(int id, String patternType, String folder)
|
||||
{
|
||||
public ArmorPattern(int id, String patternType, String folder) {
|
||||
super(patternName, getPatternNames(patternType), folder, "tinker", TConstructRegistry.materialTab);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
@@ -23,36 +21,29 @@ public class ArmorPattern extends CraftingItem implements ItemBlocklike
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
protected static String[] getPatternNames(String partType) {
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
names[i] = partType + patternName[i];
|
||||
for (int i = 0; i < patternName.length; i++) names[i] = partType + patternName[i];
|
||||
return names;
|
||||
}
|
||||
|
||||
public IIcon getBaseIcon ()
|
||||
{
|
||||
public IIcon getBaseIcon() {
|
||||
return baseIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
super.registerIcons(iconRegister);
|
||||
baseIcon = iconRegister.registerIcon("tinker:" + folder + "armor_cast");
|
||||
}
|
||||
|
||||
private static final String[] patternName = new String[] { "helmet", "chestplate", "leggings", "boots" };
|
||||
private static final String[] patternName = new String[] {"helmet", "chestplate", "leggings", "boots"};
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item block, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
{
|
||||
public void getSubItems(Item block, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < patternName.length; i++) {
|
||||
list.add(new ItemStack(block, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,12 @@ import net.minecraft.potion.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DiamondApple extends ItemFood
|
||||
{
|
||||
public class DiamondApple extends ItemFood {
|
||||
public IIcon[] icons;
|
||||
public String[] textureNames = new String[] { "food/apple_diamond" };
|
||||
public String[] itemNames = new String[] { "apple.diamond" };
|
||||
public String[] textureNames = new String[] {"food/apple_diamond"};
|
||||
public String[] itemNames = new String[] {"apple.diamond"};
|
||||
|
||||
public DiamondApple()
|
||||
{
|
||||
public DiamondApple() {
|
||||
super(4, 2.0F, false);
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
@@ -23,58 +21,54 @@ public class DiamondApple extends ItemFood
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
int duration = 0;
|
||||
PotionEffect potion;
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, duration + 60 * 40, 4));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, duration + 60 * 20, 0));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.digSpeed);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, duration + 60 * 20, 0));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.damageBoost);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, duration + 60 * 20, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Name override */
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
return (new StringBuilder()).append("item.food.").append(itemNames[(itemstack.getItemDamage()>=itemNames.length||itemstack.getItemDamage()<0)?(0):(itemstack.getItemDamage())]).toString();
|
||||
public String getUnlocalizedName(ItemStack itemstack) {
|
||||
return (new StringBuilder())
|
||||
.append("item.food.")
|
||||
.append(itemNames[
|
||||
(itemstack.getItemDamage() >= itemNames.length || itemstack.getItemDamage() < 0)
|
||||
? (0)
|
||||
: (itemstack.getItemDamage())])
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -4,17 +4,14 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class Glove extends Item
|
||||
{
|
||||
public Glove()
|
||||
{
|
||||
public class Glove extends Item {
|
||||
public Glove() {
|
||||
super();
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
itemIcon = iconRegister.registerIcon("tinker:armor/dirthand");
|
||||
}
|
||||
}
|
||||
@@ -11,37 +11,43 @@ import tconstruct.armor.player.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
|
||||
public class HeartCanister extends CraftingItem implements IHealthAccessory
|
||||
{
|
||||
public class HeartCanister extends CraftingItem implements IHealthAccessory {
|
||||
|
||||
public HeartCanister()
|
||||
{
|
||||
super(new String[] { "empty", "miniheart.red", "red", "miniheart.yellow", "yellow", "miniheart.green", "green" }, new String[] { "canister_empty", "miniheart_red", "canister_red", "miniheart_yellow", "canister_yellow", "miniheart_green", "canister_green" }, "", "tinker", TConstructRegistry.materialTab);
|
||||
public HeartCanister() {
|
||||
super(
|
||||
new String[] {"empty", "miniheart.red", "red", "miniheart.yellow", "yellow", "miniheart.green", "green"
|
||||
},
|
||||
new String[] {
|
||||
"canister_empty",
|
||||
"miniheart_red",
|
||||
"canister_red",
|
||||
"miniheart_yellow",
|
||||
"canister_yellow",
|
||||
"miniheart_green",
|
||||
"canister_green"
|
||||
},
|
||||
"",
|
||||
"tinker",
|
||||
TConstructRegistry.materialTab);
|
||||
this.setMaxStackSize(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 1 || meta == 3 || meta == 5)
|
||||
{
|
||||
if (meta == 1 || meta == 3 || meta == 5) {
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
}
|
||||
if (!world.isRemote && meta == 2)
|
||||
{
|
||||
if (!world.isRemote && meta == 2) {
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
if (stats != null && stats.armor != null)
|
||||
{
|
||||
if (stats != null && stats.armor != null) {
|
||||
ArmorExtended armor = stats.armor;
|
||||
ItemStack slotStack = armor.getStackInSlot(6);
|
||||
if (slotStack == null)// || slotStack.getItem() == this)
|
||||
if (slotStack == null) // || slotStack.getItem() == this)
|
||||
{
|
||||
armor.setInventorySlotContents(6, new ItemStack(this, 1, 2));
|
||||
stack.stackSize--;
|
||||
}
|
||||
else if (slotStack.getItem() == this && slotStack.stackSize < this.maxStackSize)
|
||||
{
|
||||
} else if (slotStack.getItem() == this && slotStack.stackSize < this.maxStackSize) {
|
||||
slotStack.stackSize++;
|
||||
stack.stackSize--;
|
||||
}
|
||||
@@ -52,8 +58,7 @@ public class HeartCanister extends CraftingItem implements IHealthAccessory
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
int meta = stack.getItemDamage();
|
||||
--stack.stackSize;
|
||||
player.heal((meta + 1) * 10);
|
||||
@@ -62,53 +67,44 @@ public class HeartCanister extends CraftingItem implements IHealthAccessory
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.eat;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration (ItemStack par1ItemStack)
|
||||
{
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 0 || meta % 2 == 1)
|
||||
list.add(StatCollector.translateToLocal("item.crafting.tooltip"));
|
||||
else
|
||||
{
|
||||
if (meta == 0 || meta % 2 == 1) list.add(StatCollector.translateToLocal("item.crafting.tooltip"));
|
||||
else {
|
||||
list.add(StatCollector.translateToLocal("item.accessory.tooltip"));
|
||||
list.add(StatCollector.translateToLocal("canister.tooltip"));
|
||||
}
|
||||
|
||||
switch (meta)
|
||||
{
|
||||
case 1:
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip2"));
|
||||
break;
|
||||
case 2:
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip2"));
|
||||
break;
|
||||
switch (meta) {
|
||||
case 1:
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip2"));
|
||||
break;
|
||||
case 2:
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip2"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (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));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthBoost (ItemStack item)
|
||||
{
|
||||
public int getHealthBoost(ItemStack item) {
|
||||
return item.stackSize * 2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,65 +10,65 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.world.items.SpecialFood;
|
||||
|
||||
public class Jerky extends SpecialFood
|
||||
{
|
||||
public static String[] textureNames = new String[] { "beef", "chicken", "pork", "mutton", "fish", "monster", "blueslime", "blood" };
|
||||
public static String[] itemNames = new String[] { "jerky.beef", "jerky.chicken", "jerky.pig", "jerky.sheep", "jerky.fish", "jerky.zombie", "jerky.blueslime", "jerky.blood" };
|
||||
public static int[] hunger = new int[] { 8, 6, 8, 6, 5, 4, 6, 4 };
|
||||
public static float[] saturation = new float[] { 1.0f, 0.8f, 1.0f, 0.8f, 0.8f, 0.4f, 1.0f, 0.4f };
|
||||
public static int[] overhaulHunger = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||
public class Jerky extends SpecialFood {
|
||||
public static String[] textureNames =
|
||||
new String[] {"beef", "chicken", "pork", "mutton", "fish", "monster", "blueslime", "blood"};
|
||||
public static String[] itemNames = new String[] {
|
||||
"jerky.beef",
|
||||
"jerky.chicken",
|
||||
"jerky.pig",
|
||||
"jerky.sheep",
|
||||
"jerky.fish",
|
||||
"jerky.zombie",
|
||||
"jerky.blueslime",
|
||||
"jerky.blood"
|
||||
};
|
||||
public static int[] hunger = new int[] {8, 6, 8, 6, 5, 4, 6, 4};
|
||||
public static float[] saturation = new float[] {1.0f, 0.8f, 1.0f, 0.8f, 0.8f, 0.4f, 1.0f, 0.4f};
|
||||
public static int[] overhaulHunger = new int[] {1, 1, 1, 1, 1, 1, 1, 1};
|
||||
|
||||
public Jerky(boolean hungerOverhaul)
|
||||
{
|
||||
public Jerky(boolean hungerOverhaul) {
|
||||
super(hungerOverhaul ? overhaulHunger : hunger, saturation, itemNames, textureNames);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:food/jerky_" + iconNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
|
||||
return "item.tconstruct." + unlocalizedNames[arr];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (stack.getItemDamage() == 7)
|
||||
{
|
||||
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (stack.getItemDamage() == 7) {
|
||||
int duration = 0;
|
||||
PotionEffect potion = player.getActivePotionEffect(Potion.field_76434_w);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, duration + 60 * 60, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
int type = stack.getItemDamage();
|
||||
switch (type)
|
||||
{
|
||||
case 6:
|
||||
list.add("\u00a7b" + StatCollector.translateToLocal("strangefood5.tooltip"));
|
||||
break;
|
||||
case 7:
|
||||
list.add("\u00a74" + StatCollector.translateToLocal("strangefood6.tooltip"));
|
||||
break;
|
||||
switch (type) {
|
||||
case 6:
|
||||
list.add("\u00a7b" + StatCollector.translateToLocal("strangefood5.tooltip"));
|
||||
break;
|
||||
case 7:
|
||||
list.add("\u00a74" + StatCollector.translateToLocal("strangefood6.tooltip"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,30 +9,25 @@ import net.minecraft.util.StatCollector;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.accessory.IAccessory;
|
||||
|
||||
public class Knapsack extends CraftingItem implements IAccessory
|
||||
{
|
||||
public class Knapsack extends CraftingItem implements IAccessory {
|
||||
|
||||
public Knapsack()
|
||||
{
|
||||
super(new String[] { "knapsack" }, new String[] { "knapsack" }, "armor/", "tinker", TConstructRegistry.materialTab);
|
||||
public Knapsack() {
|
||||
super(new String[] {"knapsack"}, new String[] {"knapsack"}, "armor/", "tinker", TConstructRegistry.materialTab);
|
||||
this.setMaxStackSize(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add(StatCollector.translateToLocal("knapsack.tooltip"));
|
||||
break;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case 0:
|
||||
list.add(StatCollector.translateToLocal("knapsack.tooltip"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
public boolean canEquipAccessory(ItemStack item, int slot) {
|
||||
return slot == 2;
|
||||
}
|
||||
|
||||
@@ -42,7 +37,7 @@ public class Knapsack extends CraftingItem implements IAccessory
|
||||
* player, ItemStack itemStack) { TPlayerStats stats =
|
||||
* TConstruct.playerTracker.getPlayerStats(player.getDisplayName());
|
||||
* KnapsackInventory inv = stats.knapsack;
|
||||
*
|
||||
*
|
||||
* if (stats != null && inv != null) { for (int i = 0; i <
|
||||
* inv.getSizeInventory(); i++) { if (inv.getStackInSlot(i) != null) {
|
||||
* inv.getStackInSlot(i).getItem().onUpdate(inv.getStackInSlot(i),
|
||||
|
||||
@@ -14,13 +14,12 @@ public class TArmorBase extends ItemArmor
|
||||
// implements ISpecialArmor
|
||||
{
|
||||
IIcon[] icons;
|
||||
String[] iconNames = { "wood_boots" };
|
||||
String[] iconNames = {"wood_boots"};
|
||||
|
||||
// static Minecraft mc = Minecraft.getMinecraft();
|
||||
// private ModelBiped modelArmor;
|
||||
|
||||
public TArmorBase(int armorSlot)
|
||||
{
|
||||
public TArmorBase(int armorSlot) {
|
||||
super(ArmorMaterial.CLOTH, 0, armorSlot);
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(100);
|
||||
@@ -31,18 +30,15 @@ public class TArmorBase extends ItemArmor
|
||||
// this.setCreativeTab(TConstructRegistry.toolTab);
|
||||
}
|
||||
|
||||
public void onArmorTickUpdate (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
|
||||
}
|
||||
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) {}
|
||||
|
||||
/**
|
||||
* Called by RenderBiped and RenderPlayer to determine the armor texture
|
||||
* that should be use for the currently equiped item. This will only be
|
||||
* called on instances of ItemArmor.
|
||||
*
|
||||
*
|
||||
* Returning null from this function will use the default value.
|
||||
*
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack for the equpt armor
|
||||
* @param entity
|
||||
@@ -56,52 +52,46 @@ public class TArmorBase extends ItemArmor
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
|
||||
return "/mods/tinker/textures/armor/wood_1.png";
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to have an item handle its own armor rendering.
|
||||
*
|
||||
*
|
||||
* @param entityLiving
|
||||
* The entity wearing the armor
|
||||
* @param itemStack
|
||||
* The itemStack to render the model of
|
||||
* @param armorSlot
|
||||
* 0=head, 1=torso, 2=legs, 3=feet
|
||||
*
|
||||
*
|
||||
* @return A ModelBiped to render instead of the default
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase par1EntityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
public ModelBiped getArmorModel(EntityLivingBase par1EntityLiving, ItemStack itemStack, int armorSlot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:armor/" + iconNames[i]);
|
||||
}
|
||||
}
|
||||
@@ -110,14 +100,14 @@ public class TArmorBase extends ItemArmor
|
||||
* @Override public ArmorProperties getProperties (EntityLiving player,
|
||||
* ItemStack armor, DamageSource source, double damage, int slot) { // TODO
|
||||
* Auto-generated method stub return null; }
|
||||
*
|
||||
*
|
||||
* @Override public int getArmorDisplay (EntityPlayer player, ItemStack
|
||||
* armor, int slot) { // TODO Auto-generated method stub return 0; }
|
||||
*
|
||||
*
|
||||
* @Override public void damageArmor (EntityLiving entity, ItemStack stack,
|
||||
* DamageSource source, int damage, int slot) { // TODO Auto-generated
|
||||
* method stub
|
||||
*
|
||||
*
|
||||
* }
|
||||
*/
|
||||
}
|
||||
@@ -14,29 +14,23 @@ import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.client.ArmorControls;
|
||||
import tconstruct.library.accessory.*;
|
||||
|
||||
public class TravelBelt extends AccessoryCore implements IAccessoryModel
|
||||
{
|
||||
public TravelBelt()
|
||||
{
|
||||
public class TravelBelt extends AccessoryCore implements IAccessoryModel {
|
||||
public TravelBelt() {
|
||||
super("travelgear/travel_belt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
public boolean canEquipAccessory(ItemStack item, int slot) {
|
||||
return slot == 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
protected void registerModifiers(IIconRegister iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
|
||||
return ArmorProxyClient.belt;
|
||||
}
|
||||
|
||||
@@ -44,19 +38,17 @@ public class TravelBelt extends AccessoryCore implements IAccessoryModel
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot)
|
||||
{
|
||||
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;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (!stack.hasTagCompound()) return;
|
||||
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelbelt.ability"));
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelbelt.control") + GameSettings.getKeyDisplayString(ArmorControls.beltSwap.getKeyCode()));
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelbelt.control")
|
||||
+ GameSettings.getKeyDisplayString(ArmorControls.beltSwap.getKeyCode()));
|
||||
}
|
||||
}
|
||||
@@ -23,48 +23,35 @@ import thaumcraft.api.nodes.IRevealer;
|
||||
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.nodes.IRevealer"),
|
||||
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.IGoggles")
|
||||
})
|
||||
public class TravelGear extends ArmorCore implements IRevealer, IGoggles
|
||||
{
|
||||
public class TravelGear extends ArmorCore implements IRevealer, IGoggles {
|
||||
|
||||
public TravelGear(ArmorPart part)
|
||||
{
|
||||
public TravelGear(ArmorPart part) {
|
||||
super(0, part, "Clothing", "travelgear", "travel");
|
||||
this.setMaxDamage(1035);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
super.onArmorTick(world, player, itemStack);
|
||||
if (armorPart == ArmorPart.Chest)
|
||||
{
|
||||
if (player.isInWater())
|
||||
{
|
||||
if (armorPart == ArmorPart.Chest) {
|
||||
if (player.isInWater()) {
|
||||
player.motionX *= 1.2D;
|
||||
if (player.motionY > 0.0D)
|
||||
{
|
||||
if (player.motionY > 0.0D) {
|
||||
player.motionY *= 1.2D;
|
||||
}
|
||||
player.motionZ *= 1.2D;
|
||||
double maxSpeed = 0.2D;
|
||||
if (player.motionX > maxSpeed)
|
||||
{
|
||||
if (player.motionX > maxSpeed) {
|
||||
player.motionX = maxSpeed;
|
||||
}
|
||||
else if (player.motionX < -maxSpeed)
|
||||
{
|
||||
} else if (player.motionX < -maxSpeed) {
|
||||
player.motionX = -maxSpeed;
|
||||
}
|
||||
if (player.motionY > maxSpeed)
|
||||
{
|
||||
if (player.motionY > maxSpeed) {
|
||||
player.motionY = maxSpeed;
|
||||
}
|
||||
if (player.motionZ > maxSpeed)
|
||||
{
|
||||
if (player.motionZ > maxSpeed) {
|
||||
player.motionZ = maxSpeed;
|
||||
}
|
||||
else if (player.motionZ < -maxSpeed)
|
||||
{
|
||||
} else if (player.motionZ < -maxSpeed) {
|
||||
player.motionZ = -maxSpeed;
|
||||
}
|
||||
}
|
||||
@@ -72,129 +59,129 @@ public class TravelGear extends ArmorCore implements IRevealer, IGoggles
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getBaseDefense ()
|
||||
{
|
||||
switch (armorPart)
|
||||
{
|
||||
case Head:
|
||||
return 0;
|
||||
case Chest:
|
||||
return 4;
|
||||
case Legs:
|
||||
return 2;
|
||||
case Feet:
|
||||
return 2;
|
||||
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;
|
||||
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 ()
|
||||
{
|
||||
protected int getDurability() {
|
||||
return 1035;
|
||||
}
|
||||
|
||||
//Temporary?
|
||||
public ItemStack getRepairMaterial (ItemStack input)
|
||||
{
|
||||
// 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"));
|
||||
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;
|
||||
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[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "thaumic1");
|
||||
modifiers[2] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "thaumic2");
|
||||
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;
|
||||
protected void registerModifiers(IIconRegister iconRegister) // temporary
|
||||
{
|
||||
switch (armorType) {
|
||||
case 0:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "nightvision");
|
||||
modifiers[1] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "thaumic1");
|
||||
modifiers[2] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "thaumic2");
|
||||
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)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
|
||||
switch (armorPart)
|
||||
{
|
||||
case Head:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelgoggles.ability") + GameSettings.getKeyDisplayString(tconstruct.client.ArmorControls.zoomKey.getKeyCode()));
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelgoggles.toggleabilities") + GameSettings.getKeyDisplayString(tconstruct.client.ArmorControls.toggleGoggles.getKeyCode()));
|
||||
break;
|
||||
case Chest:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelvest.ability"));
|
||||
break;
|
||||
case Legs:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelwings.ability"));
|
||||
break;
|
||||
case Feet:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelboots.ability"));
|
||||
break;
|
||||
default:
|
||||
switch (armorPart) {
|
||||
case Head:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelgoggles.ability")
|
||||
+ GameSettings.getKeyDisplayString(tconstruct.client.ArmorControls.zoomKey.getKeyCode()));
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelgoggles.toggleabilities")
|
||||
+ GameSettings.getKeyDisplayString(tconstruct.client.ArmorControls.toggleGoggles.getKeyCode()));
|
||||
break;
|
||||
case Chest:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelvest.ability"));
|
||||
break;
|
||||
case Legs:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelwings.ability"));
|
||||
break;
|
||||
case Feet:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelboots.ability"));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
super.addInformation(stack, player, list, par4);
|
||||
@@ -203,7 +190,7 @@ public class TravelGear extends ArmorCore implements IRevealer, IGoggles
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public boolean showNodes(ItemStack itemstack, EntityLivingBase player) {
|
||||
if(itemstack == null || !itemstack.hasTagCompound() || itemstack.getItem() != TinkerArmor.travelGoggles)
|
||||
if (itemstack == null || !itemstack.hasTagCompound() || itemstack.getItem() != TinkerArmor.travelGoggles)
|
||||
return false;
|
||||
|
||||
return itemstack.getTagCompound().getCompoundTag(this.getBaseTagName()).getBoolean("Thaumic Senses");
|
||||
@@ -212,7 +199,7 @@ public class TravelGear extends ArmorCore implements IRevealer, IGoggles
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) {
|
||||
if(itemstack == null || !itemstack.hasTagCompound() || itemstack.getItem() != TinkerArmor.travelGoggles)
|
||||
if (itemstack == null || !itemstack.hasTagCompound() || itemstack.getItem() != TinkerArmor.travelGoggles)
|
||||
return false;
|
||||
|
||||
return itemstack.getTagCompound().getCompoundTag(this.getBaseTagName()).getBoolean("Thaumic Vision");
|
||||
|
||||
@@ -9,23 +9,19 @@ import net.minecraft.util.*;
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.library.accessory.*;
|
||||
|
||||
public class TravelGlove extends AccessoryCore implements IAccessoryModel
|
||||
{
|
||||
public TravelGlove()
|
||||
{
|
||||
public class TravelGlove extends AccessoryCore implements IAccessoryModel {
|
||||
public TravelGlove() {
|
||||
super("travelgear/travel_glove");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
public boolean canEquipAccessory(ItemStack item, int slot) {
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister)
|
||||
{
|
||||
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");
|
||||
@@ -34,8 +30,7 @@ public class TravelGlove extends AccessoryCore implements IAccessoryModel
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
|
||||
return ArmorProxyClient.glove;
|
||||
}
|
||||
|
||||
@@ -43,13 +38,12 @@ public class TravelGlove extends AccessoryCore implements IAccessoryModel
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot)
|
||||
{
|
||||
public ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot) {
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] { "accessory", "glove" };
|
||||
return new String[] {"accessory", "glove"};
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -9,21 +11,16 @@ 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 class TravelWings extends TravelGear {
|
||||
|
||||
public TravelWings()
|
||||
{
|
||||
public TravelWings() {
|
||||
super(ArmorPart.Legs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister IIconRegister)
|
||||
{
|
||||
protected void registerModifiers(IIconRegister IIconRegister) {
|
||||
String base = "tinker:armor/travel_wings_";
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = IIconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_" + "doublejump");
|
||||
@@ -36,26 +33,19 @@ public class TravelWings extends TravelGear
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
super.onArmorTick(world, player, itemStack);
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
if (itemStack.hasTagCompound()) {
|
||||
NBTTagCompound tag = itemStack.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
int feather = tag.getInteger("Feather Fall");
|
||||
if (feather > 0)
|
||||
{
|
||||
if (player.fallDistance > 2.5)
|
||||
player.fallDistance = 2.5f;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
if (!flying && player.motionY < terminalVelocity) {
|
||||
player.motionY = terminalVelocity;
|
||||
}
|
||||
}
|
||||
@@ -64,14 +54,12 @@ public class TravelWings extends TravelGear
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
|
||||
return "tinker:textures/armor/travel_wings.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRepairMaterial (ItemStack input)
|
||||
{
|
||||
public ItemStack getRepairMaterial(ItemStack input) {
|
||||
return new ItemStack(TinkerTools.materials, 1, 13);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ package tconstruct.armor.model;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class BeltModel extends ModelBiped
|
||||
{
|
||||
public class BeltModel extends ModelBiped {
|
||||
ModelRenderer Buckle;
|
||||
ModelRenderer FrontRight;
|
||||
ModelRenderer FrontLeft;
|
||||
@@ -12,8 +11,7 @@ public class BeltModel extends ModelBiped
|
||||
ModelRenderer SideLeft;
|
||||
ModelRenderer Back;
|
||||
|
||||
public BeltModel()
|
||||
{
|
||||
public BeltModel() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
@@ -54,12 +52,11 @@ public class BeltModel extends ModelBiped
|
||||
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);
|
||||
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);
|
||||
// Buckle.render(f5);
|
||||
/*FrontRight.render(f5);
|
||||
FrontLeft.render(f5);
|
||||
SideRight.render(f5);
|
||||
@@ -67,17 +64,14 @@ public class BeltModel extends ModelBiped
|
||||
Back.render(f5);*/
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,13 +2,11 @@ package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.*;
|
||||
|
||||
public class BootBump extends ModelBiped
|
||||
{
|
||||
public class BootBump extends ModelBiped {
|
||||
ModelRenderer rightBump;
|
||||
ModelRenderer leftBump;
|
||||
|
||||
public BootBump()
|
||||
{
|
||||
public BootBump() {
|
||||
super(0.5f, 0, 64, 32);
|
||||
|
||||
rightBump = new ModelRenderer(this, 24, 0);
|
||||
|
||||
@@ -2,36 +2,34 @@ package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
|
||||
public class HiddenPlayerModel extends ModelBiped
|
||||
{
|
||||
public HiddenPlayerModel(float size, int slot)
|
||||
{
|
||||
public class HiddenPlayerModel extends ModelBiped {
|
||||
public HiddenPlayerModel(float size, int slot) {
|
||||
super(size, 0, 64, 32);
|
||||
|
||||
if (slot != 0) //Head
|
||||
if (slot != 0) // Head
|
||||
{
|
||||
this.bipedHead.isHidden = true;
|
||||
this.bipedHeadwear.isHidden = true;
|
||||
}
|
||||
if (slot != 1 && slot != 5) //Chest, belt
|
||||
if (slot != 1 && slot != 5) // Chest, belt
|
||||
{
|
||||
this.bipedBody.isHidden = true;
|
||||
}
|
||||
if (slot != 2 && slot != 3) //Legs, shoes
|
||||
if (slot != 2 && slot != 3) // Legs, shoes
|
||||
{
|
||||
this.bipedRightLeg.isHidden = true;
|
||||
this.bipedLeftLeg.isHidden = true;
|
||||
}
|
||||
if (slot != 4) //Gloves
|
||||
if (slot != 4) // Gloves
|
||||
{
|
||||
this.bipedRightArm.isHidden = true;
|
||||
this.bipedLeftArm.isHidden = true;
|
||||
}
|
||||
if (slot != 6) //Ears
|
||||
if (slot != 6) // Ears
|
||||
{
|
||||
this.bipedEars.isHidden = true;
|
||||
}
|
||||
if (slot != 7) //Cloak
|
||||
if (slot != 7) // Cloak
|
||||
{
|
||||
this.bipedCloak.isHidden = true;
|
||||
}
|
||||
|
||||
@@ -12,60 +12,56 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.armor.items.ArmorPattern;
|
||||
|
||||
public class RenderArmorCast implements IItemRenderer
|
||||
{
|
||||
public class RenderArmorCast implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
switch (helper)
|
||||
{
|
||||
case BLOCK_3D:
|
||||
return true;
|
||||
case ENTITY_BOBBING:
|
||||
return true;
|
||||
case ENTITY_ROTATION:
|
||||
return true;
|
||||
case EQUIPPED_BLOCK:
|
||||
return true;
|
||||
case INVENTORY_BLOCK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
switch (helper) {
|
||||
case BLOCK_3D:
|
||||
return true;
|
||||
case ENTITY_BOBBING:
|
||||
return true;
|
||||
case ENTITY_ROTATION:
|
||||
return true;
|
||||
case EQUIPPED_BLOCK:
|
||||
return true;
|
||||
case INVENTORY_BLOCK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
RenderBlocks renderer = Minecraft.getMinecraft().renderGlobal.renderBlocksRg;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IIcon baseIcon = item.getItem() instanceof ArmorPattern ? ((ArmorPattern) item.getItem()).getBaseIcon() : item.getIconIndex();
|
||||
IIcon baseIcon = item.getItem() instanceof ArmorPattern
|
||||
? ((ArmorPattern) item.getItem()).getBaseIcon()
|
||||
: item.getIconIndex();
|
||||
GL11.glPushMatrix();
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.8F, 0.33F, 0.8F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
GL11.glTranslatef(0F, -0.1F, 0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.8F, 0.33F, 0.8F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
GL11.glTranslatef(0F, -0.1F, 0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F);
|
||||
renderCube(tessellator, renderer, baseIcon);
|
||||
@@ -81,8 +77,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderCube (Tessellator tessellator, RenderBlocks renderer, IIcon icon)
|
||||
{
|
||||
public void renderCube(Tessellator tessellator, RenderBlocks renderer, IIcon icon) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
@@ -99,37 +94,29 @@ public class RenderArmorCast implements IItemRenderer
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderSelectedCube (Tessellator tessellator, RenderBlocks renderer, IIcon icon, List<ForgeDirection> sidesToRender)
|
||||
{
|
||||
public void renderSelectedCube(
|
||||
Tessellator tessellator, RenderBlocks renderer, IIcon icon, List<ForgeDirection> sidesToRender) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.WEST))
|
||||
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.WEST)) renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(1F, 0F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.EAST))
|
||||
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.EAST)) renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, -1F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.DOWN))
|
||||
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.DOWN)) renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.UP))
|
||||
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.UP)) renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, -1F);
|
||||
if (sidesToRender.contains(ForgeDirection.SOUTH))
|
||||
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.SOUTH)) renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, 1F);
|
||||
if (sidesToRender.contains(ForgeDirection.NORTH))
|
||||
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.NORTH)) renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderCastTop (ItemStack par1ItemStack, ItemRenderType type)
|
||||
{
|
||||
public void renderCastTop(ItemStack par1ItemStack, ItemRenderType type) {
|
||||
GL11.glPushMatrix();
|
||||
IIcon icon = par1ItemStack.getIconIndex();
|
||||
|
||||
if (icon == null)
|
||||
{
|
||||
if (icon == null) {
|
||||
GL11.glPopMatrix();
|
||||
return;
|
||||
}
|
||||
@@ -158,8 +145,15 @@ public class RenderArmorCast implements IItemRenderer
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderItemIn2D (Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
public static void renderItemIn2D(
|
||||
Tessellator par0Tessellator,
|
||||
float par1,
|
||||
float par2,
|
||||
float par3,
|
||||
float par4,
|
||||
float par5,
|
||||
float par6,
|
||||
float par7) {
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4);
|
||||
@@ -182,8 +176,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
float f7;
|
||||
float f8;
|
||||
|
||||
for (k = 0; k < par5; ++k)
|
||||
{
|
||||
for (k = 0; k < par5; ++k) {
|
||||
f7 = (float) k / (float) par5;
|
||||
f8 = par1 + (par3 - par1) * f7 - f5;
|
||||
par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
|
||||
@@ -197,8 +190,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
par0Tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
float f9;
|
||||
|
||||
for (k = 0; k < par5; ++k)
|
||||
{
|
||||
for (k = 0; k < par5; ++k) {
|
||||
f7 = (float) k / (float) par5;
|
||||
f8 = par1 + (par3 - par1) * f7 - f5;
|
||||
f9 = f7 + 1.0F / (float) par5;
|
||||
@@ -212,8 +204,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < par6; ++k)
|
||||
{
|
||||
for (k = 0; k < par6; ++k) {
|
||||
f7 = (float) k / (float) par6;
|
||||
f8 = par4 + (par2 - par4) * f7 - f6;
|
||||
f9 = f7 + 1.0F / (float) par6;
|
||||
@@ -227,8 +218,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < par6; ++k)
|
||||
{
|
||||
for (k = 0; k < par6; ++k) {
|
||||
f7 = (float) k / (float) par6;
|
||||
f8 = par4 + (par2 - par4) * f7 - f6;
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8);
|
||||
@@ -239,5 +229,4 @@ public class RenderArmorCast implements IItemRenderer
|
||||
|
||||
par0Tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import net.minecraft.client.model.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class WingModel extends ModelBiped
|
||||
{
|
||||
public class WingModel extends ModelBiped {
|
||||
ModelRenderer WingBaseRight;
|
||||
ModelRenderer WingEdgeRight;
|
||||
ModelRenderer WingInsetRight;
|
||||
@@ -19,22 +18,21 @@ public class WingModel extends ModelBiped
|
||||
ModelRenderer WingFlangeLeft;
|
||||
ModelRenderer WingAuxLeft;
|
||||
|
||||
public WingModel()
|
||||
{
|
||||
public WingModel() {
|
||||
super(0.25f, 0, 64, 64);
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
//Right Wing
|
||||
// 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, 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
|
||||
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, 21);
|
||||
WingInsetRight.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
@@ -62,7 +60,7 @@ public class WingModel extends ModelBiped
|
||||
WingBaseRight.addChild(WingFlangeRight);
|
||||
WingBaseRight.addChild(WingAuxRight);
|
||||
|
||||
//Left Wing
|
||||
// Left Wing
|
||||
WingBaseLeft = new ModelRenderer(this, 42, 9);
|
||||
WingBaseLeft.addBox(-0.5F, -1F, 0F, 1, 2, 10);
|
||||
WingBaseLeft.setRotationPoint(1F, 1F, 0F);
|
||||
@@ -109,26 +107,22 @@ public class WingModel extends ModelBiped
|
||||
this.bipedLeftLeg.isHidden = true;
|
||||
}
|
||||
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
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);
|
||||
WingBaseRight.render(f5);
|
||||
WingBaseLeft.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles (float f, float f1, float partialTick, float f3, float f4, float f5, Entity player)
|
||||
{
|
||||
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);
|
||||
if (this.isRiding)
|
||||
{
|
||||
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;
|
||||
@@ -137,9 +131,7 @@ public class WingModel extends ModelBiped
|
||||
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())
|
||||
{
|
||||
} 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;
|
||||
@@ -148,9 +140,7 @@ public class WingModel extends ModelBiped
|
||||
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)
|
||||
{
|
||||
} 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;
|
||||
@@ -159,9 +149,7 @@ public class WingModel extends ModelBiped
|
||||
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)
|
||||
{
|
||||
} 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;
|
||||
@@ -170,12 +158,9 @@ public class WingModel extends ModelBiped
|
||||
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
|
||||
{
|
||||
} else {
|
||||
float slow = 17f;
|
||||
if (player.motionX != 0 || player.motionZ != 0)
|
||||
slow = 6f;
|
||||
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;
|
||||
@@ -185,11 +170,9 @@ public class WingModel extends ModelBiped
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 1.5f + 0.3f;
|
||||
}
|
||||
|
||||
if (this.isSneak)
|
||||
{
|
||||
if (this.isSneak) {
|
||||
this.WingBaseRight.rotateAngleX += 0.4f;
|
||||
this.WingBaseLeft.rotateAngleX += 0.4f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,49 +7,39 @@ import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
public class DryingRackRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public class DryingRackRender implements ISimpleBlockRenderingHandler {
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
public boolean renderWorldBlock(
|
||||
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 0)
|
||||
{
|
||||
if (metadata == 0) {
|
||||
renderer.setRenderBounds(0.0F, 0.0, 0.375F, 1.0F, 0.25F, 0.625F);
|
||||
}
|
||||
if (metadata == 1)
|
||||
{
|
||||
if (metadata == 1) {
|
||||
renderer.setRenderBounds(0.375F, 0.0, 0.0f, 0.625F, 0.25F, 1F);
|
||||
}
|
||||
|
||||
if (metadata == 2)
|
||||
{
|
||||
if (metadata == 2) {
|
||||
renderer.setRenderBounds(0.0F, 0.75F, 0.75F, 1F, 1.0F, 1F);
|
||||
}
|
||||
if (metadata == 3)
|
||||
{
|
||||
if (metadata == 3) {
|
||||
renderer.setRenderBounds(0.0F, 0.75F, 0F, 1F, 1.0F, 0.25F);
|
||||
}
|
||||
if (metadata == 4)
|
||||
{
|
||||
if (metadata == 4) {
|
||||
renderer.setRenderBounds(0.75F, 0.75F, 0.0f, 1F, 1.0F, 1F);
|
||||
}
|
||||
if (metadata == 5)
|
||||
{
|
||||
if (metadata == 5) {
|
||||
renderer.setRenderBounds(0F, 0.75F, 0.0f, 0.25F, 1.0F, 1F);
|
||||
}
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -59,19 +49,16 @@ public class DryingRackRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelID)
|
||||
{
|
||||
public boolean shouldRender3DInInventory(int modelID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
public int getRenderId() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
@@ -12,11 +12,9 @@ import tconstruct.tools.entity.FancyEntityItem;
|
||||
/* Special renderer, only used for drawing tools */
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class DryingRackSpecialRender extends TileEntitySpecialRenderer
|
||||
{
|
||||
public class DryingRackSpecialRender extends TileEntitySpecialRenderer {
|
||||
|
||||
public void render (DryingRackLogic logic, double posX, double posY, double posZ, float var8)
|
||||
{
|
||||
public void render(DryingRackLogic logic, double posX, double posY, double posZ, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
float var10 = (float) (posX - 0.5F);
|
||||
float var11 = (float) (posY - 0.5F);
|
||||
@@ -26,56 +24,45 @@ public class DryingRackSpecialRender extends TileEntitySpecialRenderer
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void func_82402_b (DryingRackLogic logic)
|
||||
{
|
||||
private void func_82402_b(DryingRackLogic logic) {
|
||||
ItemStack stack = logic.getStackInSlot(0);
|
||||
|
||||
if (stack != null)
|
||||
renderItem(logic, stack);
|
||||
if (stack != null) renderItem(logic, stack);
|
||||
}
|
||||
|
||||
void renderItem (DryingRackLogic logic, ItemStack stack)
|
||||
{
|
||||
void renderItem(DryingRackLogic logic, ItemStack stack) {
|
||||
FancyEntityItem entityitem = new FancyEntityItem(logic.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
int meta = logic.getWorldObj().getBlockMetadata(logic.xCoord, logic.yCoord, logic.zCoord);
|
||||
if (meta <= 1)
|
||||
GL11.glTranslatef(1F, -0.375F, 0.905F);
|
||||
else
|
||||
{
|
||||
if (meta <= 1) GL11.glTranslatef(1F, -0.375F, 0.905F);
|
||||
else {
|
||||
GL11.glTranslatef(1F, 0.375F, 0.905F);
|
||||
|
||||
if (meta / 2 == 2)
|
||||
{
|
||||
if (meta / 2 == 2) {
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(-0.0625F, 0F, 0F);
|
||||
}
|
||||
if (meta == 2)
|
||||
GL11.glTranslatef(0F, 0F, 0.375F);
|
||||
if (meta == 3)
|
||||
{
|
||||
// Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.2F);
|
||||
//GL11.glTranslatef(0F, 0F, -0.375F);
|
||||
if (meta == 2) GL11.glTranslatef(0F, 0F, 0.375F);
|
||||
if (meta == 3) {
|
||||
// Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.2F);
|
||||
// GL11.glTranslatef(0F, 0F, -0.375F);
|
||||
}
|
||||
if (meta == 4)
|
||||
{
|
||||
if (meta == 4) {
|
||||
GL11.glTranslatef(0F, 0F, 0.2875F);
|
||||
}
|
||||
if (meta == 5)
|
||||
{
|
||||
//Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.3F);
|
||||
//GL11.glTranslatef(0F, 0F, -0.5F);
|
||||
if (meta == 5) {
|
||||
// Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.3F);
|
||||
// GL11.glTranslatef(0F, 0F, -0.5F);
|
||||
}
|
||||
}
|
||||
GL11.glScalef(2F, 2F, 2F);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (stack.getItem() instanceof ItemBlock) {
|
||||
// GL11.glRotatef(90F, -1, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0.2125F, 0.0375F);
|
||||
}
|
||||
@@ -88,8 +75,7 @@ public class DryingRackSpecialRender extends TileEntitySpecialRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
public void renderTileEntityAt(TileEntity logic, double var2, double var4, double var6, float var8) {
|
||||
this.render((DryingRackLogic) logic, var2, var4, var6, var8);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
@@ -19,76 +18,62 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
|
||||
public class ArmorExtended implements IInventory
|
||||
{
|
||||
public class ArmorExtended implements IInventory {
|
||||
public ItemStack[] inventory = new ItemStack[7];
|
||||
public WeakReference<EntityPlayer> parent;
|
||||
public UUID globalID = UUID.fromString("B243BE32-DC1B-4C53-8D13-8752D5C69D5B");
|
||||
|
||||
public void init (EntityPlayer player)
|
||||
{
|
||||
public void init(EntityPlayer player) {
|
||||
parent = new WeakReference<EntityPlayer>(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory ()
|
||||
{
|
||||
public int getSizeInventory() {
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
public boolean isStackInSlot (int slot)
|
||||
{
|
||||
public boolean isStackInSlot(int slot) {
|
||||
return inventory[slot] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot)
|
||||
{
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
if (inventory[slot] != null)
|
||||
{
|
||||
public ItemStack decrStackSize(int slot, int quantity) {
|
||||
if (inventory[slot] != null) {
|
||||
// TConstruct.logger.info("Took something from slot " + slot);
|
||||
if (inventory[slot].stackSize <= quantity)
|
||||
{
|
||||
if (inventory[slot].stackSize <= quantity) {
|
||||
ItemStack stack = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return stack;
|
||||
}
|
||||
ItemStack split = inventory[slot].splitStack(quantity);
|
||||
if (inventory[slot].stackSize == 0)
|
||||
{
|
||||
if (inventory[slot].stackSize == 0) {
|
||||
inventory[slot] = null;
|
||||
}
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
recalculateHealth(player, stats);
|
||||
return split;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int slot)
|
||||
{
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack) {
|
||||
inventory[slot] = itemstack;
|
||||
// TConstruct.logger.info("Changed slot " + slot + " on side " +
|
||||
// FMLCommonHandler.instance().getEffectiveSide());
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@@ -98,26 +83,22 @@ public class ArmorExtended implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
public String getInventoryName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty ()
|
||||
{
|
||||
public void markDirty() {
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
// recalculateSkills(player, stats);
|
||||
@@ -129,18 +110,14 @@ public class ArmorExtended implements IInventory
|
||||
*/
|
||||
}
|
||||
|
||||
public void recalculateHealth (EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
public void recalculateHealth(EntityPlayer player, TPlayerStats stats) {
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
if (inventory[4] != null || inventory[5] != null || inventory[6] != null)
|
||||
{
|
||||
if (inventory[4] != null || inventory[5] != null || inventory[6] != null) {
|
||||
int bonusHP = 0;
|
||||
for (int i = 4; i < 7; i++)
|
||||
{
|
||||
for (int i = 4; i < 7; i++) {
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null && stack.getItem() instanceof IHealthAccessory)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof IHealthAccessory) {
|
||||
bonusHP += ((IHealthAccessory) stack.getItem()).getHealthBoost(stack);
|
||||
}
|
||||
}
|
||||
@@ -148,70 +125,53 @@ public class ArmorExtended implements IInventory
|
||||
stats.bonusHealth = bonusHP;
|
||||
|
||||
int healthChange = bonusHP - prevHealth;
|
||||
if (healthChange != 0)
|
||||
{
|
||||
IAttributeInstance attributeinstance = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
try
|
||||
{
|
||||
if (healthChange != 0) {
|
||||
IAttributeInstance attributeinstance =
|
||||
player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
try {
|
||||
attributeinstance.removeModifier(attributeinstance.getModifier(globalID));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
attributeinstance.applyModifier(new AttributeModifier(globalID, "tconstruct.heartCanister", bonusHP, 0));
|
||||
|
||||
attributeinstance.applyModifier(
|
||||
new AttributeModifier(globalID, "tconstruct.heartCanister", bonusHP, 0));
|
||||
}
|
||||
}
|
||||
else if (parent != null && parent.get() != null)
|
||||
{
|
||||
} else if (parent != null && parent.get() != null) {
|
||||
int prevHealth = stats.bonusHealth;
|
||||
int bonusHP = 0;
|
||||
stats.bonusHealth = bonusHP;
|
||||
int healthChange = bonusHP - prevHealth;
|
||||
if (healthChange != 0)
|
||||
{
|
||||
IAttributeInstance attributeinstance = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
try
|
||||
{
|
||||
if (healthChange != 0) {
|
||||
IAttributeInstance attributeinstance =
|
||||
player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
try {
|
||||
attributeinstance.removeModifier(attributeinstance.getModifier(globalID));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void openChest ()
|
||||
{
|
||||
}
|
||||
public void openChest() {}
|
||||
|
||||
public void closeChest ()
|
||||
{
|
||||
}
|
||||
public void closeChest() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int slot, ItemStack itemstack)
|
||||
{
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Save/Load */
|
||||
public void saveToNBT (NBTTagCompound tagCompound)
|
||||
{
|
||||
public void saveToNBT(NBTTagCompound tagCompound) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
NBTTagCompound invSlot;
|
||||
|
||||
for (int i = 0; i < this.inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
for (int i = 0; i < this.inventory.length; ++i) {
|
||||
if (this.inventory[i] != null) {
|
||||
invSlot = new NBTTagCompound();
|
||||
invSlot.setByte("Slot", (byte) i);
|
||||
this.inventory[i].writeToNBT(invSlot);
|
||||
@@ -222,27 +182,22 @@ public class ArmorExtended implements IInventory
|
||||
tagCompound.setTag("Inventory", tagList);
|
||||
}
|
||||
|
||||
public void readFromNBT (NBTTagCompound tagCompound)
|
||||
{
|
||||
if (tagCompound != null)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
if (tagCompound != null) {
|
||||
NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
|
||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
||||
{
|
||||
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
int j = nbttagcompound.getByte("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
this.inventory[j] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- EnderIO SoulBound enchant support
|
||||
// --- EnderIO SoulBound enchant support
|
||||
|
||||
private static int soulBoundID = -6;
|
||||
|
||||
@@ -273,18 +228,13 @@ public class ArmorExtended implements IInventory
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---
|
||||
// ---
|
||||
|
||||
|
||||
public void dropItems ()
|
||||
{
|
||||
public void dropItems() {
|
||||
EntityPlayer player = parent.get();
|
||||
if (player != null)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null && !isSoulBounded(this.inventory[i]))
|
||||
{
|
||||
if (player != null) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (this.inventory[i] != null && !isSoulBounded(this.inventory[i])) {
|
||||
player.func_146097_a(this.inventory[i], true, false);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
@@ -293,24 +243,16 @@ public class ArmorExtended implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
public void closeInventory() {}
|
||||
|
||||
public void writeInventoryToStream(ByteBuf os) throws IOException {
|
||||
for (int i = 0; i < inventory.length; i++) ByteBufUtils.writeItemStack(os, inventory[i]);
|
||||
}
|
||||
|
||||
public void writeInventoryToStream (ByteBuf os) throws IOException
|
||||
{
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
ByteBufUtils.writeItemStack(os, inventory[i]);
|
||||
}
|
||||
|
||||
public void readInventoryFromStream (ByteBuf is) throws IOException
|
||||
{
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
inventory[i] = ByteBufUtils.readItemStack(is);
|
||||
public void readInventoryFromStream(ByteBuf is) throws IOException {
|
||||
for (int i = 0; i < inventory.length; i++) inventory[i] = ByteBufUtils.readItemStack(is);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
public class ArmorExtendedClient extends ArmorExtended
|
||||
{
|
||||
public class ArmorExtendedClient extends ArmorExtended {
|
||||
/*
|
||||
* public void recalculateSkills(EntityPlayer player, TPlayerStats stats) {
|
||||
* TConstruct.logger.info("Client skills"); if (inventory[1] != null &&
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -13,126 +12,99 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class KnapsackInventory implements IInventory
|
||||
{
|
||||
public class KnapsackInventory implements IInventory {
|
||||
public ItemStack[] inventory = new ItemStack[27];
|
||||
public WeakReference<EntityPlayer> parent;
|
||||
|
||||
public void init (EntityPlayer player)
|
||||
{
|
||||
public void init(EntityPlayer player) {
|
||||
parent = new WeakReference<EntityPlayer>(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot)
|
||||
{
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
public boolean isStackInSlot (int slot)
|
||||
{
|
||||
public boolean isStackInSlot(int slot) {
|
||||
return inventory[slot] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory ()
|
||||
{
|
||||
public int getSizeInventory() {
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean canDropInventorySlot (int slot)
|
||||
{
|
||||
public boolean canDropInventorySlot(int slot) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack) {
|
||||
inventory[slot] = itemstack;
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
if (inventory[slot] != null)
|
||||
{
|
||||
if (inventory[slot].stackSize <= quantity)
|
||||
{
|
||||
public ItemStack decrStackSize(int slot, int quantity) {
|
||||
if (inventory[slot] != null) {
|
||||
if (inventory[slot].stackSize <= quantity) {
|
||||
ItemStack stack = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return stack;
|
||||
}
|
||||
ItemStack split = inventory[slot].splitStack(quantity);
|
||||
if (inventory[slot].stackSize == 0)
|
||||
{
|
||||
if (inventory[slot].stackSize == 0) {
|
||||
inventory[slot] = null;
|
||||
}
|
||||
return split;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
public String getInventoryName() {
|
||||
return "tconstruct.knapsack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int slot)
|
||||
{
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void openChest ()
|
||||
{
|
||||
}
|
||||
public void openChest() {}
|
||||
|
||||
public void closeChest ()
|
||||
{
|
||||
}
|
||||
public void closeChest() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int i, ItemStack itemstack)
|
||||
{
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Save/Load */
|
||||
public void saveToNBT (NBTTagCompound tagCompound)
|
||||
{
|
||||
public void saveToNBT(NBTTagCompound tagCompound) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
NBTTagCompound invSlot;
|
||||
|
||||
for (int i = 0; i < this.inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
for (int i = 0; i < this.inventory.length; ++i) {
|
||||
if (this.inventory[i] != null) {
|
||||
invSlot = new NBTTagCompound();
|
||||
invSlot.setByte("Slot", (byte) i);
|
||||
this.inventory[i].writeToNBT(invSlot);
|
||||
@@ -143,36 +115,28 @@ public class KnapsackInventory implements IInventory
|
||||
tagCompound.setTag("Knapsack", tagList);
|
||||
}
|
||||
|
||||
public void readFromNBT (NBTTagCompound tagCompound)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
// player doesn't have a knapsack saved, tcon probably wasn't present before. don't error out.
|
||||
if(tagCompound == null || !tagCompound.hasKey("Knapsack"))
|
||||
return;
|
||||
if (tagCompound == null || !tagCompound.hasKey("Knapsack")) return;
|
||||
|
||||
NBTTagList tagList = tagCompound.getTagList("Knapsack", 10);
|
||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
||||
{
|
||||
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
int j = nbttagcompound.getByte("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
this.inventory[j] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dropItems ()
|
||||
{
|
||||
public void dropItems() {
|
||||
EntityPlayer player = parent.get();
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
if (player != null) {
|
||||
for (int i = 0; i < inventory.length; ++i) {
|
||||
if (this.inventory[i] != null) {
|
||||
player.func_146097_a(this.inventory[i], true, false);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
@@ -180,16 +144,12 @@ public class KnapsackInventory implements IInventory
|
||||
}
|
||||
}
|
||||
|
||||
public void unequipItems ()
|
||||
{
|
||||
public void unequipItems() {
|
||||
EntityPlayer player = parent.get();
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
if (player != null) {
|
||||
for (int i = 0; i < inventory.length; ++i) {
|
||||
if (this.inventory[i] != null) {
|
||||
dropItemEntity(player, inventory[i]);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
@@ -197,37 +157,25 @@ public class KnapsackInventory implements IInventory
|
||||
}
|
||||
}
|
||||
|
||||
void dropItemEntity (Entity dropper, ItemStack dropStack)
|
||||
{
|
||||
void dropItemEntity(Entity dropper, ItemStack dropStack) {
|
||||
EntityItem entityitem = new EntityItem(dropper.worldObj, dropper.posX, dropper.posY, dropper.posZ, dropStack);
|
||||
dropper.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty ()
|
||||
{
|
||||
}
|
||||
public void markDirty() {}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
public void closeInventory() {}
|
||||
|
||||
public void writeInventoryToStream(ByteBuf os) throws IOException {
|
||||
for (int i = 0; i < 27; i++) ByteBufUtils.writeItemStack(os, inventory[i]);
|
||||
}
|
||||
|
||||
public void writeInventoryToStream (ByteBuf os) throws IOException
|
||||
{
|
||||
for (int i = 0; i < 27; i++)
|
||||
ByteBufUtils.writeItemStack(os, inventory[i]);
|
||||
public void readInventoryFromStream(ByteBuf is) throws IOException {
|
||||
for (int i = 0; i < 27; i++) inventory[i] = ByteBufUtils.readItemStack(is);
|
||||
}
|
||||
|
||||
public void readInventoryFromStream (ByteBuf is) throws IOException
|
||||
{
|
||||
for (int i = 0; i < 27; i++)
|
||||
inventory[i] = ByteBufUtils.readItemStack(is);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import mantle.player.PlayerUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.Entity.EnumEntitySize;
|
||||
@@ -21,69 +20,58 @@ import net.minecraft.nbt.*;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
//TODO: Redesign this class
|
||||
public class TPlayerHandler
|
||||
{
|
||||
// TODO: Redesign this class
|
||||
public class TPlayerHandler {
|
||||
/* Player */
|
||||
// public int hunger;
|
||||
|
||||
private ConcurrentHashMap<UUID, TPlayerStats> playerStats = new ConcurrentHashMap<UUID, TPlayerStats>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void PlayerLoggedInEvent (PlayerLoggedInEvent event)
|
||||
{
|
||||
public void PlayerLoggedInEvent(PlayerLoggedInEvent event) {
|
||||
onPlayerLogin(event.player);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerRespawn (PlayerRespawnEvent event)
|
||||
{
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
onPlayerRespawn(event.player);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityConstructing (EntityEvent.EntityConstructing event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer && TPlayerStats.get((EntityPlayer) event.entity) == null)
|
||||
{
|
||||
public void onEntityConstructing(EntityEvent.EntityConstructing event) {
|
||||
if (event.entity instanceof EntityPlayer && TPlayerStats.get((EntityPlayer) event.entity) == null) {
|
||||
TPlayerStats.register((EntityPlayer) event.entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerLogin (EntityPlayer player)
|
||||
{
|
||||
public void onPlayerLogin(EntityPlayer player) {
|
||||
// Lookup player
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
|
||||
stats.level = player.experienceLevel;
|
||||
stats.hunger = player.getFoodStats().getFoodLevel();
|
||||
|
||||
//stats.battlesignBonus = tags.getCompoundTag("TConstruct").getBoolean("battlesignBonus");
|
||||
// stats.battlesignBonus = tags.getCompoundTag("TConstruct").getBoolean("battlesignBonus");
|
||||
|
||||
// gamerule naturalRegeneration false
|
||||
if (!PHConstruct.enableHealthRegen)
|
||||
player.worldObj.getGameRules().setOrCreateGameRule("naturalRegeneration", "false");
|
||||
if (!stats.beginnerManual)
|
||||
{
|
||||
if (!stats.beginnerManual) {
|
||||
stats.beginnerManual = true;
|
||||
stats.battlesignBonus = true;
|
||||
if (PHConstruct.beginnerBook)
|
||||
{
|
||||
if (PHConstruct.beginnerBook) {
|
||||
ItemStack diary = new ItemStack(TinkerTools.manualBook);
|
||||
if (!player.inventory.addItemStackToInventory(diary))
|
||||
{
|
||||
if (!player.inventory.addItemStackToInventory(diary)) {
|
||||
AbilityHelper.spawnItemAtPlayer(player, diary);
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getDisplayName().toLowerCase().equals("fractuality"))
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().equals("fractuality")) {
|
||||
ItemStack pattern = new ItemStack(TinkerTools.woodPattern, 1, 22);
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -98,8 +86,7 @@ public class TPlayerHandler
|
||||
AbilityHelper.spawnItemAtPlayer(player, pattern);
|
||||
}
|
||||
|
||||
if (player.getDisplayName().toLowerCase().equals("zerokyuuni"))
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().equals("zerokyuuni")) {
|
||||
ItemStack pattern = new ItemStack(Items.stick);
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -112,15 +99,13 @@ public class TPlayerHandler
|
||||
|
||||
AbilityHelper.spawnItemAtPlayer(player, pattern);
|
||||
}
|
||||
if (player.getDisplayName().toLowerCase().equals("zisteau"))
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().equals("zisteau")) {
|
||||
spawnPigmanModifier(player);
|
||||
}
|
||||
|
||||
NBTTagCompound tags = player.getEntityData();
|
||||
NBTTagCompound persistTag = tags.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
|
||||
if (stickUsers.contains(player.getDisplayName()) && !persistTag.hasKey("TCon-Stick"))
|
||||
{
|
||||
if (stickUsers.contains(player.getDisplayName()) && !persistTag.hasKey("TCon-Stick")) {
|
||||
ItemStack stick = new ItemStack(Items.stick);
|
||||
persistTag.setBoolean("TCon-Stick", true);
|
||||
|
||||
@@ -139,11 +124,8 @@ public class TPlayerHandler
|
||||
AbilityHelper.spawnItemAtPlayer(player, stick);
|
||||
tags.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!stats.battlesignBonus)
|
||||
{
|
||||
} else {
|
||||
if (!stats.battlesignBonus) {
|
||||
stats.battlesignBonus = true;
|
||||
ItemStack modifier = new ItemStack(TinkerTools.creativeModifier);
|
||||
|
||||
@@ -158,27 +140,24 @@ public class TPlayerHandler
|
||||
|
||||
AbilityHelper.spawnItemAtPlayer(player, modifier);
|
||||
|
||||
if (player.getDisplayName().toLowerCase().equals("zisteau"))
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().equals("zisteau")) {
|
||||
spawnPigmanModifier(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PHConstruct.gregtech && Loader.isModLoaded("GregTech-Addon"))
|
||||
{
|
||||
if (PHConstruct.gregtech && Loader.isModLoaded("GregTech-Addon")) {
|
||||
PHConstruct.gregtech = false;
|
||||
if (PHConstruct.lavaFortuneInteraction)
|
||||
{
|
||||
if (PHConstruct.lavaFortuneInteraction) {
|
||||
PlayerUtils.sendChatMessage(player, "Warning: Cross-mod Exploit Present!");
|
||||
PlayerUtils.sendChatMessage(player, "Solution 1: Disable Reverse Smelting recipes from GregTech.");
|
||||
PlayerUtils.sendChatMessage(player, "Solution 2: Disable Auto-Smelt/Fortune interaction from TConstruct.");
|
||||
PlayerUtils.sendChatMessage(
|
||||
player, "Solution 2: Disable Auto-Smelt/Fortune interaction from TConstruct.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void spawnPigmanModifier (EntityPlayer entityplayer)
|
||||
{
|
||||
void spawnPigmanModifier(EntityPlayer entityplayer) {
|
||||
ItemStack modifier = new ItemStack(TinkerTools.creativeModifier);
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -194,13 +173,11 @@ public class TPlayerHandler
|
||||
AbilityHelper.spawnItemAtPlayer(entityplayer, modifier);
|
||||
}
|
||||
|
||||
public void onPlayerRespawn (EntityPlayer entityplayer)
|
||||
{
|
||||
public void onPlayerRespawn(EntityPlayer entityplayer) {
|
||||
// Boom!
|
||||
TPlayerStats playerData = playerStats.remove(entityplayer.getPersistentID());
|
||||
TPlayerStats stats = TPlayerStats.get(entityplayer);
|
||||
if (playerData != null)
|
||||
{
|
||||
if (playerData != null) {
|
||||
stats.copyFrom(playerData, false);
|
||||
stats.level = playerData.level;
|
||||
stats.hunger = playerData.hunger;
|
||||
@@ -213,37 +190,29 @@ public class TPlayerHandler
|
||||
* TFoodStats food = new TFoodStats(); entityplayer.foodStats = food;
|
||||
*/
|
||||
|
||||
if (PHConstruct.keepLevels)
|
||||
entityplayer.experienceLevel = stats.level;
|
||||
if (PHConstruct.keepHunger)
|
||||
entityplayer.getFoodStats().addStats(-1 * (20 - stats.hunger), 0);
|
||||
if (PHConstruct.keepLevels) entityplayer.experienceLevel = stats.level;
|
||||
if (PHConstruct.keepHunger) entityplayer.getFoodStats().addStats(-1 * (20 - stats.hunger), 0);
|
||||
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
if (side == Side.CLIENT)
|
||||
{
|
||||
if (side == Side.CLIENT) {
|
||||
// TProxyClient.controlInstance.resetControls();
|
||||
if (PHConstruct.keepHunger)
|
||||
entityplayer.getFoodStats().setFoodLevel(stats.hunger);
|
||||
if (PHConstruct.keepHunger) entityplayer.getFoodStats().setFoodLevel(stats.hunger);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void livingFall (LivingFallEvent evt) // Only for negating fall damage
|
||||
{
|
||||
if (evt.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
public void livingFall(LivingFallEvent evt) // Only for negating fall damage
|
||||
{
|
||||
if (evt.entityLiving instanceof EntityPlayer) {
|
||||
evt.distance -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerDeath (LivingDeathEvent event)
|
||||
{
|
||||
if(!(event.entity instanceof EntityPlayer))
|
||||
return;
|
||||
public void playerDeath(LivingDeathEvent event) {
|
||||
if (!(event.entity instanceof EntityPlayer)) return;
|
||||
|
||||
if (!event.entity.worldObj.isRemote)
|
||||
{
|
||||
if (!event.entity.worldObj.isRemote) {
|
||||
TPlayerStats properties = (TPlayerStats) event.entity.getExtendedProperties(TPlayerStats.PROP_NAME);
|
||||
properties.hunger = ((EntityPlayer) event.entity).getFoodStats().getFoodLevel();
|
||||
playerStats.put(((EntityPlayer) event.entity).getPersistentID(), properties);
|
||||
@@ -251,21 +220,17 @@ public class TPlayerHandler
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerDrops (PlayerDropsEvent evt)
|
||||
{
|
||||
public void playerDrops(PlayerDropsEvent evt) {
|
||||
// After playerDeath event. Modifying saved data.
|
||||
TPlayerStats stats = playerStats.get(evt.entityPlayer.getPersistentID());
|
||||
|
||||
stats.level = evt.entityPlayer.experienceLevel / 2;
|
||||
// stats.health = 20;
|
||||
int hunger = evt.entityPlayer.getFoodStats().getFoodLevel();
|
||||
if (hunger < 6)
|
||||
stats.hunger = 6;
|
||||
else
|
||||
stats.hunger = evt.entityPlayer.getFoodStats().getFoodLevel();
|
||||
if (hunger < 6) stats.hunger = 6;
|
||||
else stats.hunger = evt.entityPlayer.getFoodStats().getFoodLevel();
|
||||
|
||||
if (evt.entityPlayer.capturedDrops != evt.drops)
|
||||
{
|
||||
if (evt.entityPlayer.capturedDrops != evt.drops) {
|
||||
evt.entityPlayer.capturedDrops.clear();
|
||||
}
|
||||
|
||||
@@ -274,8 +239,7 @@ public class TPlayerHandler
|
||||
stats.knapsack.dropItems();
|
||||
evt.entityPlayer.captureDrops = false;
|
||||
|
||||
if (evt.entityPlayer.capturedDrops != evt.drops)
|
||||
{
|
||||
if (evt.entityPlayer.capturedDrops != evt.drops) {
|
||||
evt.drops.addAll(evt.entityPlayer.capturedDrops);
|
||||
}
|
||||
|
||||
@@ -283,19 +247,16 @@ public class TPlayerHandler
|
||||
}
|
||||
|
||||
/* Modify Player */
|
||||
public void updateSize (String user, float offset)
|
||||
{
|
||||
public void updateSize(String user, float offset) {
|
||||
/*
|
||||
* EntityPlayer player = getEntityPlayer(user); setEntitySize(0.6F,
|
||||
* offset, player); player.yOffset = offset - 0.18f;
|
||||
*/
|
||||
}
|
||||
|
||||
public static void setEntitySize (float width, float height, Entity entity)
|
||||
{
|
||||
public static void setEntitySize(float width, float height, Entity entity) {
|
||||
// TConstruct.logger.info("Size: " + height);
|
||||
if (width != entity.width || height != entity.height)
|
||||
{
|
||||
if (width != entity.width || height != entity.height) {
|
||||
entity.width = width;
|
||||
entity.height = height;
|
||||
entity.boundingBox.maxX = entity.boundingBox.minX + (double) entity.width;
|
||||
@@ -305,28 +266,17 @@ public class TPlayerHandler
|
||||
|
||||
float que = width % 2.0F;
|
||||
|
||||
if ((double) que < 0.375D)
|
||||
{
|
||||
if ((double) que < 0.375D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_1;
|
||||
}
|
||||
else if ((double) que < 0.75D)
|
||||
{
|
||||
} else if ((double) que < 0.75D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_2;
|
||||
}
|
||||
else if ((double) que < 1.0D)
|
||||
{
|
||||
} else if ((double) que < 1.0D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_3;
|
||||
}
|
||||
else if ((double) que < 1.375D)
|
||||
{
|
||||
} else if ((double) que < 1.375D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_4;
|
||||
}
|
||||
else if ((double) que < 1.75D)
|
||||
{
|
||||
} else if ((double) que < 1.75D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_5;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_6;
|
||||
}
|
||||
// entity.yOffset = height;
|
||||
@@ -336,11 +286,9 @@ public class TPlayerHandler
|
||||
private final int timeout = 1000;
|
||||
private HashSet<String> stickUsers = new HashSet<String>();
|
||||
|
||||
public void buildStickURLDatabase (String location)
|
||||
{
|
||||
public void buildStickURLDatabase(String location) {
|
||||
URL url;
|
||||
try
|
||||
{
|
||||
try {
|
||||
url = new URL(location);
|
||||
URLConnection con = url.openConnection();
|
||||
con.setConnectTimeout(timeout);
|
||||
@@ -350,19 +298,15 @@ public class TPlayerHandler
|
||||
|
||||
String nick;
|
||||
int linetracker = 1;
|
||||
while ((nick = br.readLine()) != null)
|
||||
{
|
||||
if (!nick.startsWith("--"))
|
||||
{
|
||||
while ((nick = br.readLine()) != null) {
|
||||
if (!nick.startsWith("--")) {
|
||||
stickUsers.add(nick);
|
||||
}
|
||||
linetracker++;
|
||||
}
|
||||
|
||||
br.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
TConstruct.logger.error(e.getMessage() != null ? e.getMessage() : "UNKOWN DL ERROR", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -10,7 +9,9 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
import tconstruct.api.IPlayerExtendedInventoryWrapper;
|
||||
|
||||
public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedInventoryWrapper //TODO: IExtendedEntityProperties is not appropriate!
|
||||
public class TPlayerStats
|
||||
implements IExtendedEntityProperties,
|
||||
IPlayerExtendedInventoryWrapper // TODO: IExtendedEntityProperties is not appropriate!
|
||||
{
|
||||
public static final String PROP_NAME = "TConstruct";
|
||||
|
||||
@@ -37,14 +38,12 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
public ArmorExtended armor;
|
||||
public KnapsackInventory knapsack;
|
||||
|
||||
public TPlayerStats()
|
||||
{
|
||||
public TPlayerStats() {
|
||||
this.armor = new ArmorExtended();
|
||||
this.knapsack = new KnapsackInventory();
|
||||
}
|
||||
|
||||
public TPlayerStats(EntityPlayer entityplayer)
|
||||
{
|
||||
public TPlayerStats(EntityPlayer entityplayer) {
|
||||
this.player = new WeakReference<EntityPlayer>(entityplayer);
|
||||
this.armor = new ArmorExtended();
|
||||
this.armor.init(entityplayer);
|
||||
@@ -56,8 +55,7 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveNBTData (NBTTagCompound compound)
|
||||
{
|
||||
public void saveNBTData(NBTTagCompound compound) {
|
||||
NBTTagCompound tTag = new NBTTagCompound();
|
||||
armor.saveToNBT(tTag);
|
||||
knapsack.saveToNBT(tTag);
|
||||
@@ -71,11 +69,9 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadNBTData (NBTTagCompound compound)
|
||||
{
|
||||
public void loadNBTData(NBTTagCompound compound) {
|
||||
NBTTagCompound properties = (NBTTagCompound) compound.getTag(PROP_NAME);
|
||||
if (properties != null)
|
||||
{
|
||||
if (properties != null) {
|
||||
this.armor.readFromNBT(properties);
|
||||
this.knapsack.readFromNBT(properties);
|
||||
this.beginnerManual = properties.getBoolean("beginnerManual");
|
||||
@@ -88,15 +84,13 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init (Entity entity, World world)
|
||||
{
|
||||
public void init(Entity entity, World world) {
|
||||
this.player = new WeakReference<EntityPlayer>((EntityPlayer) entity);
|
||||
this.armor.init((EntityPlayer) entity);
|
||||
this.knapsack.init((EntityPlayer) entity);
|
||||
}
|
||||
|
||||
public void copyFrom (TPlayerStats stats, boolean copyCalc)
|
||||
{
|
||||
public void copyFrom(TPlayerStats stats, boolean copyCalc) {
|
||||
this.armor = stats.armor;
|
||||
this.knapsack = stats.knapsack;
|
||||
this.beginnerManual = stats.beginnerManual;
|
||||
@@ -107,34 +101,28 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
|
||||
this.derpLevel = stats.derpLevel;
|
||||
|
||||
if (copyCalc)
|
||||
{
|
||||
if (copyCalc) {
|
||||
this.bonusHealth = stats.bonusHealth;
|
||||
this.hunger = stats.hunger;
|
||||
this.level = stats.level;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void register (EntityPlayer player)
|
||||
{
|
||||
public static final void register(EntityPlayer player) {
|
||||
player.registerExtendedProperties(TPlayerStats.PROP_NAME, new TPlayerStats(player));
|
||||
}
|
||||
|
||||
public static final TPlayerStats get (EntityPlayer player)
|
||||
{
|
||||
public static final TPlayerStats get(EntityPlayer player) {
|
||||
return (TPlayerStats) player.getExtendedProperties(PROP_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getKnapsackInventory (EntityPlayer player)
|
||||
{
|
||||
public IInventory getKnapsackInventory(EntityPlayer player) {
|
||||
return this.knapsack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getAccessoryInventory (EntityPlayer player)
|
||||
{
|
||||
public IInventory getAccessoryInventory(EntityPlayer player) {
|
||||
return this.armor;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user