Skip to content

Commit

Permalink
Update modifiers, start travellers gear
Browse files Browse the repository at this point in the history
  • Loading branch information
mDiyo committed Jul 1, 2014
1 parent 0230307 commit c525493
Show file tree
Hide file tree
Showing 96 changed files with 2,803 additions and 1,549 deletions.
12 changes: 3 additions & 9 deletions src/main/java/tconstruct/TConstruct.java
Expand Up @@ -114,6 +114,7 @@ public void preInit (FMLPreInitializationEvent event)
TConstructRegistry.toolTab = new TabTools("TConstructTools");
TConstructRegistry.partTab = new TabTools("TConstructParts");
TConstructRegistry.blockTab = new TabTools("TConstructBlocks");
TConstructRegistry.equipableTab = new TabTools("TConstructEquipables");

tableCasting = new LiquidCasting();
basinCasting = new LiquidCasting();
Expand All @@ -129,15 +130,8 @@ public void preInit (FMLPreInitializationEvent event)
VillagerRegistry.instance().registerVillageTradeHandler(78943, new TVillageTrades());
VillagerRegistry.instance().registerVillageCreationHandler(new VillageToolStationHandler());
VillagerRegistry.instance().registerVillageCreationHandler(new VillageSmelteryHandler());
try
{
MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure");
MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure");
}
catch (Throwable e)
{
logger.error("Error registering TConstruct Structures with Vanilla Minecraft: this is expected in versions earlier than 1.6.4");
}
MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure");
MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure");
}

playerTracker = new TPlayerHandler();
Expand Down
188 changes: 155 additions & 33 deletions src/main/java/tconstruct/armor/ArmorProxyClient.java
Expand Up @@ -3,21 +3,18 @@
import java.util.ArrayList;
import java.util.Random;

import com.google.common.collect.Lists;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.MathHelper;
Expand All @@ -26,47 +23,40 @@
import net.minecraftforge.client.GuiIngameForge;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.TConstruct;
import tconstruct.armor.model.BeltModel;
import tconstruct.armor.model.BootBump;
import tconstruct.armor.model.HiddenPlayerModel;
import tconstruct.armor.model.WingModel;
import tconstruct.client.TControls;
import tconstruct.client.TKeyHandler;
import tconstruct.client.TProxyClient;
import tconstruct.client.gui.AdaptiveSmelteryGui;
import tconstruct.client.gui.ArmorExtendedGui;
import tconstruct.client.gui.CraftingStationGui;
import tconstruct.client.gui.FrypanGui;
import tconstruct.client.gui.FurnaceGui;
import tconstruct.client.gui.GuiLandmine;
import tconstruct.client.gui.KnapsackGui;
import tconstruct.client.gui.PartCrafterGui;
import tconstruct.client.gui.PatternChestGui;
import tconstruct.client.gui.SmelteryGui;
import tconstruct.client.gui.StencilTableGui;
import tconstruct.client.gui.ToolForgeGui;
import tconstruct.client.gui.ToolStationGui;
import tconstruct.client.tabs.InventoryTabArmorExtended;
import tconstruct.client.tabs.InventoryTabKnapsack;
import tconstruct.client.tabs.InventoryTabVanilla;
import tconstruct.client.tabs.TabRegistry;
import tconstruct.common.TProxyCommon;
import tconstruct.mechworks.MechworksProxyCommon;
import tconstruct.mechworks.inventory.ContainerLandmine;
import tconstruct.mechworks.logic.TileEntityLandmine;
import tconstruct.smeltery.SmelteryProxyCommon;
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
import tconstruct.smeltery.logic.SmelteryLogic;
import tconstruct.tools.ToolProxyCommon;
import tconstruct.tools.logic.CraftingStationLogic;
import tconstruct.tools.logic.FrypanLogic;
import tconstruct.tools.logic.FurnaceLogic;
import tconstruct.tools.logic.PartBuilderLogic;
import tconstruct.tools.logic.PatternChestLogic;
import tconstruct.tools.logic.StencilTableLogic;
import tconstruct.tools.logic.ToolForgeLogic;
import tconstruct.tools.logic.ToolStationLogic;
import tconstruct.util.config.PHConstruct;
import tconstruct.library.accessory.IAccessoryModel;
import tconstruct.util.player.TPlayerStats;

import com.google.common.collect.Lists;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class ArmorProxyClient extends ArmorProxyCommon
{
public static WingModel wings = new WingModel();
public static BootBump bootbump = new BootBump();
public static HiddenPlayerModel glove = new HiddenPlayerModel(0.25F, 4);
public static HiddenPlayerModel vest = new HiddenPlayerModel(0.25f, 1);
public static BeltModel belt = new BeltModel();

public ArmorProxyClient()
{
registerGuiHandler();
Expand Down Expand Up @@ -301,4 +291,136 @@ public void drawTexturedModalRect (int par1, int par2, int par3, int par4, int p
}

double zLevel = 0;

@SubscribeEvent
public void adjustArmor (RenderPlayerEvent.SetArmorModel event)
{
switch (event.slot)
{
case 1:
ArmorProxyClient.vest.onGround = event.renderer.modelBipedMain.onGround;
ArmorProxyClient.vest.isRiding = event.renderer.modelBipedMain.isRiding;
ArmorProxyClient.vest.isChild = event.renderer.modelBipedMain.isChild;
ArmorProxyClient.vest.isSneak = event.renderer.modelBipedMain.isSneak;
case 2:
ArmorProxyClient.wings.onGround = event.renderer.modelBipedMain.onGround;
ArmorProxyClient.wings.isRiding = event.renderer.modelBipedMain.isRiding;
ArmorProxyClient.wings.isChild = event.renderer.modelBipedMain.isChild;
ArmorProxyClient.wings.isSneak = event.renderer.modelBipedMain.isSneak;

ArmorProxyClient.glove.onGround = event.renderer.modelBipedMain.onGround;
ArmorProxyClient.glove.isRiding = event.renderer.modelBipedMain.isRiding;
ArmorProxyClient.glove.isChild = event.renderer.modelBipedMain.isChild;
ArmorProxyClient.glove.isSneak = event.renderer.modelBipedMain.isSneak;
ArmorProxyClient.glove.heldItemLeft = event.renderer.modelBipedMain.heldItemLeft;
ArmorProxyClient.glove.heldItemRight = event.renderer.modelBipedMain.heldItemRight;

ArmorProxyClient.belt.onGround = event.renderer.modelBipedMain.onGround;
ArmorProxyClient.belt.isRiding = event.renderer.modelBipedMain.isRiding;
ArmorProxyClient.belt.isChild = event.renderer.modelBipedMain.isChild;
ArmorProxyClient.belt.isSneak = event.renderer.modelBipedMain.isSneak;

renderArmorExtras(event);

break;
case 3:
ArmorProxyClient.bootbump.onGround = event.renderer.modelBipedMain.onGround;
ArmorProxyClient.bootbump.isRiding = event.renderer.modelBipedMain.isRiding;
ArmorProxyClient.bootbump.isChild = event.renderer.modelBipedMain.isChild;
ArmorProxyClient.bootbump.isSneak = event.renderer.modelBipedMain.isSneak;
break;
}
}

void renderArmorExtras(RenderPlayerEvent.SetArmorModel event)
{
float partialTick = event.partialRenderTick;

EntityPlayer player = event.entityPlayer;
float posX = (float) (player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTick);
float posY = (float) (player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTick);
float posZ = (float) (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTick);

float yawOffset = this.interpolateRotation(player.prevRenderYawOffset, player.renderYawOffset, partialTick);
float yawRotation = this.interpolateRotation(player.prevRotationYawHead, player.rotationYawHead, partialTick);
float pitch;
final float zeropointsixtwofive = 0.0625F;

if (player.isRiding() && player.ridingEntity instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase1 = (EntityLivingBase) player.ridingEntity;
yawOffset = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset, partialTick);
pitch = MathHelper.wrapAngleTo180_float(yawRotation - yawOffset);

if (pitch < -85.0F)
{
pitch = -85.0F;
}

if (pitch >= 85.0F)
{
pitch = 85.0F;
}

yawOffset = yawRotation - pitch;

if (pitch * pitch > 2500.0F)
{
yawOffset += pitch * 0.2F;
}
}

pitch = this.handleRotationFloat(player, partialTick);
float bodyRotation = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTick;
float limbSwing = player.prevLimbSwingAmount + (player.limbSwingAmount - player.prevLimbSwingAmount) * partialTick;
float limbSwingMod = player.limbSwing - player.limbSwingAmount * (1.0F - partialTick);
TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.getPersistentID());
if (stats.armor.inventory[1] != null)
{
Item item = stats.armor.inventory[1].getItem();
ModelBiped model = item.getArmorModel(player, stats.armor.inventory[1], 4);

if (item instanceof IAccessoryModel)
{
this.mc.getTextureManager().bindTexture(((IAccessoryModel) item).getWearbleTexture(player, stats.armor.inventory[1], 1));
model.setLivingAnimations(player, limbSwingMod, limbSwing, partialTick);
model.render(player, limbSwingMod, limbSwing, pitch, yawRotation - yawOffset, bodyRotation, zeropointsixtwofive);
}
}

if (stats.armor.inventory[3] != null)
{
Item item = stats.armor.inventory[3].getItem();
ModelBiped model = item.getArmorModel(player, stats.armor.inventory[3], 5);

if (item instanceof IAccessoryModel)
{
this.mc.getTextureManager().bindTexture(((IAccessoryModel) item).getWearbleTexture(player, stats.armor.inventory[1], 1));
model.setLivingAnimations(player, limbSwingMod, limbSwing, partialTick);
model.render(player, limbSwingMod, limbSwing, pitch, yawRotation - yawOffset, bodyRotation, zeropointsixtwofive);
}
}
}

private float interpolateRotation (float par1, float par2, float par3)
{
float f3;

for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F)
{
;
}

while (f3 >= 180.0F)
{
f3 -= 360.0F;
}

return par1 + par3 * f3;
}

protected float handleRotationFloat (EntityLivingBase par1EntityLivingBase, float par2)
{
return (float) par1EntityLivingBase.ticksExisted + par2;
}
}
71 changes: 29 additions & 42 deletions src/main/java/tconstruct/armor/TinkerArmor.java
Expand Up @@ -16,37 +16,34 @@
import tconstruct.armor.blocks.DryingRack;
import tconstruct.armor.items.ArmorBasic;
import tconstruct.armor.items.DiamondApple;
import tconstruct.armor.items.ExoArmor;
import tconstruct.armor.items.HeartCanister;
import tconstruct.armor.items.Jerky;
import tconstruct.armor.items.Knapsack;
import tconstruct.armor.items.TravelBelt;
import tconstruct.armor.items.TravelGear;
import tconstruct.armor.items.TravelGlove;
import tconstruct.armor.items.TravelWings;
import tconstruct.blocks.logic.DryingRackLogic;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.armor.EnumArmorPart;
import tconstruct.library.accessory.AccessoryCore;
import tconstruct.library.armor.ArmorPart;
import tconstruct.library.crafting.DryingRackRecipes;
import tconstruct.library.crafting.LiquidCasting;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.tools.TinkerTools;
import tconstruct.util.config.PHConstruct;
import tconstruct.world.TinkerWorld;
import tconstruct.world.items.GoldenHead;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;

@ObjectHolder(TConstruct.modID)
@Pulse(id = "TinkerArmor", description = "Modifyable armors, such as the traveller's gear.")
@Pulse(id = "Tinkers' Armor", description = "Modifyable armors, such as the traveller's gear.")
public class TinkerArmor implements IPulse //TODO: Remove IPulse implementation, keep annotation
{
@Instance("TinkerArmor")
public static TinkerArmor instance;
@PulseProxy(client = "tconstruct.armor.ArmorProxyClient", server = "tconstruct.armor.ArmorProxyCommon")
public static ArmorProxyCommon proxy;

Expand All @@ -67,14 +64,17 @@ public class TinkerArmor implements IPulse //TODO: Remove IPulse implementation,
public static Item helmetWood;
public static Item chestplateWood;
public static Item leggingsWood;
// Armor - exosuit
public static Item exoGoggles;
public static Item exoChest;
public static Item exoPants;
public static Item exoShoes;
public static Item bootsWood;
public static ArmorMaterial materialWood;

//Clothing - Travel Gear
public static TravelGear travelGoggles;
public static TravelGear travelWings;
public static TravelGear travelVest;
public static TravelGear travelBoots;
public static AccessoryCore travelGlove;
public static AccessoryCore travelBelt;

public TinkerArmor()
{
MinecraftForge.EVENT_BUS.register(new TinkerArmorEvents());
Expand Down Expand Up @@ -123,29 +123,32 @@ public void preInit (FMLPreInitializationEvent event)
GameRegistry.registerItem(TinkerArmor.chestplateWood, "chestplateWood");
GameRegistry.registerItem(TinkerArmor.leggingsWood, "leggingsWood");
GameRegistry.registerItem(TinkerArmor.bootsWood, "bootsWood");

TinkerArmor.exoGoggles = new ExoArmor(EnumArmorPart.HELMET, "exosuit").setUnlocalizedName("tconstruct.exoGoggles");
TinkerArmor.exoChest = new ExoArmor(EnumArmorPart.CHEST, "exosuit").setUnlocalizedName("tconstruct.exoChest");
TinkerArmor.exoPants = new ExoArmor(EnumArmorPart.PANTS, "exosuit").setUnlocalizedName("tconstruct.exoPants");
TinkerArmor.exoShoes = new ExoArmor(EnumArmorPart.SHOES, "exosuit").setUnlocalizedName("tconstruct.exoShoes");

GameRegistry.registerItem(TinkerArmor.exoGoggles, "helmetExo");
GameRegistry.registerItem(TinkerArmor.exoChest, "chestplateExo");
GameRegistry.registerItem(TinkerArmor.exoPants, "leggingsExo");
GameRegistry.registerItem(TinkerArmor.exoShoes, "bootsExo");

TConstructRegistry.addItemStackToDirectory("diamondApple", new ItemStack(TinkerArmor.diamondApple, 1, 0));

TConstructRegistry.addItemStackToDirectory("canisterEmpty", new ItemStack(TinkerArmor.heartCanister, 1, 0));
TConstructRegistry.addItemStackToDirectory("miniRedHeart", new ItemStack(TinkerArmor.heartCanister, 1, 1));
TConstructRegistry.addItemStackToDirectory("canisterRedHeart", new ItemStack(TinkerArmor.heartCanister, 1, 2));

travelGoggles = (TravelGear) new TravelGear(ArmorPart.Head).setUnlocalizedName("tconstruct.travelgoggles");
travelVest = (TravelGear) new TravelGear(ArmorPart.Chest).setUnlocalizedName("tconstruct.travelvest");
travelWings = (TravelGear) new TravelWings().setUnlocalizedName("tconstruct.travelwings");
travelBoots = (TravelGear) new TravelGear(ArmorPart.Feet).setUnlocalizedName("tconstruct.travelboots");
travelGlove = (AccessoryCore) new TravelGlove().setUnlocalizedName("tconstruct.travelgloves");
travelBelt = (AccessoryCore) new TravelBelt().setUnlocalizedName("tconstruct.travelbelt");
GameRegistry.registerItem(travelGoggles, "travelGoggles");
GameRegistry.registerItem(travelVest, "travelVest");
GameRegistry.registerItem(travelWings, "travelWings");
GameRegistry.registerItem(travelBoots, "travelBoots");
GameRegistry.registerItem(travelGlove, "travelGlove");
GameRegistry.registerItem(travelBelt, "travelBelt");
}

@EventHandler
public void init (FMLInitializationEvent event)
{
craftingTableRecipes();
addRecipesForDryingRack();
TConstructRegistry.equipableTab.init(travelGoggles.getDefaultItem());
}

@EventHandler
Expand All @@ -167,22 +170,6 @@ private void craftingTableRecipes ()
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.leggingsWood, pants, 'w', "logWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.bootsWood, shoes, 'w', "logWood"));

ItemStack exoGoggleStack = new ItemStack(TinkerArmor.exoGoggles);
ItemStack exoChestStack = new ItemStack(TinkerArmor.exoChest);
ItemStack exoPantsStack = new ItemStack(TinkerArmor.exoPants);
ItemStack exoShoesStack = new ItemStack(TinkerArmor.exoShoes);
if (PHConstruct.exoCraftingEnabled)
{
ToolBuilder.instance.addArmorTag(exoGoggleStack);
ToolBuilder.instance.addArmorTag(exoChestStack);
ToolBuilder.instance.addArmorTag(exoPantsStack);
ToolBuilder.instance.addArmorTag(exoShoesStack);
GameRegistry.addShapedRecipe(exoGoggleStack, helm, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoChestStack, chest, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoPantsStack, pants, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
GameRegistry.addShapedRecipe(exoShoesStack, shoes, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
}

// Accessories
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
Expand Down

0 comments on commit c525493

Please sign in to comment.