Skip to content

Commit

Permalink
Lots of integration. Graphics n stuff. Items. Everything.
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Oct 5, 2014
1 parent 4bb32da commit 0bdf319
Show file tree
Hide file tree
Showing 48 changed files with 119 additions and 384 deletions.
@@ -1,6 +1,6 @@
package tconstruct.weaponry.client.renderer;
package tconstruct.client;

import tconstruct.weaponry.library.weaponry.IAmmo;
import tconstruct.library.weaponry.IAmmo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.weaponry.client.renderer;
package tconstruct.client;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.weaponry.client;
package tconstruct.client;

import net.minecraft.util.IIcon;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/tconstruct/library/TConstructRegistry.java
Expand Up @@ -26,6 +26,7 @@ public class TConstructRegistry
public static TConstructCreativeTab materialTab;
public static TConstructCreativeTab blockTab;
public static TConstructCreativeTab equipableTab;
public static TConstructCreativeTab weaponryTab;

/* Items */

Expand Down
@@ -1,7 +1,7 @@
package tconstruct.weaponry.entity;
package tconstruct.library.entity;

import tconstruct.weaponry.library.weaponry.AmmoItem;
import tconstruct.weaponry.util.Reference;
import tconstruct.library.weaponry.AmmoItem;
import tconstruct.util.Reference;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import io.netty.buffer.ByteBuf;
Expand Down
@@ -1,7 +1,5 @@
package tconstruct.weaponry.items;
package tconstruct.library.tools;

import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.util.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
Expand All @@ -19,7 +17,7 @@
import java.util.List;
import java.util.Map;

public class DualMaterialToolPart extends WeaponryToolPart {
public class DualMaterialToolPart extends DynamicToolPart {
public IIcon defaultIcon2;
public IIcon[] icons2;

Expand Down
@@ -1,4 +1,4 @@
package tconstruct.weaponry.library.util;
package tconstruct.library.util;

import net.minecraft.entity.Entity;
import net.minecraft.util.EntityDamageSourceIndirect;
Expand Down
@@ -1,7 +1,8 @@
package tconstruct.weaponry.library.weaponry;
package tconstruct.library.weaponry;

import tconstruct.library.TConstructRegistry;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.util.Reference;
import tconstruct.util.Reference;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand All @@ -11,8 +12,7 @@
public abstract class AmmoItem extends ToolCore implements IAmmo {
public AmmoItem(int baseDamage, String name) {
super(baseDamage);
this.setUnlocalizedName(Reference.prefix(name));
this.setCreativeTab(TinkerWeaponry.creativeTab);
this.setCreativeTab(TConstructRegistry.weaponryTab);
}

@Override
Expand Down Expand Up @@ -110,9 +110,4 @@ public boolean onLeftClickEntity (ItemStack stack, EntityPlayer player, Entity e
// ammo doesn't hurt on smacking stuff with it
return false;
}

@Override
public String getDefaultTexturePath() {
return Reference.RESOURCE + ":" + getDefaultFolder();
}
}
@@ -1,4 +1,4 @@
package tconstruct.weaponry.library.weaponry;
package tconstruct.library.weaponry;

import tconstruct.weaponry.client.CrosshairType;
import cpw.mods.fml.relauncher.Side;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.weaponry.library.weaponry;
package tconstruct.library.weaponry;

import tconstruct.weaponry.TinkerWeaponry;
import net.minecraft.item.Item;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.weaponry.library.weaponry;
package tconstruct.library.weaponry;

import tconstruct.weaponry.ammo.ArrowAmmo;
import tconstruct.weaponry.entity.ArrowEntity;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.weaponry.library.weaponry;
package tconstruct.library.weaponry;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.weaponry.library.weaponry;
package tconstruct.library.weaponry;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
Expand Down
@@ -1,4 +1,4 @@
package tconstruct.weaponry.library.weaponry;
package tconstruct.library.weaponry;

import tconstruct.weaponry.client.CrosshairType;
import net.minecraft.entity.player.EntityPlayer;
Expand Down
@@ -1,8 +1,9 @@
package tconstruct.weaponry.library.weaponry;
package tconstruct.library.weaponry;

import tconstruct.library.TConstructRegistry;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.client.CrosshairType;
import tconstruct.weaponry.util.Reference;
import tconstruct.util.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
Expand All @@ -29,8 +30,8 @@
public abstract class ProjectileWeapon extends ToolCore implements IAccuracy, IWindup {
public ProjectileWeapon(int baseDamage, String name) {
super(baseDamage);
this.setUnlocalizedName(Reference.prefix(name));
this.setCreativeTab(TinkerWeaponry.creativeTab);

this.setCreativeTab(TConstructRegistry.weaponryTab);
}

@SideOnly(Side.CLIENT)
Expand Down Expand Up @@ -211,11 +212,6 @@ public void onPlayerStoppedUsing (ItemStack weapon, World world, EntityPlayer pl

// todo: animated effects

@Override
public String getDefaultTexturePath() {
return Reference.RESOURCE + ":" + getDefaultFolder();
}

/**
* return true if the current renderpass should use animations.
* 0 == handle
Expand Down
@@ -1,17 +1,18 @@
package tconstruct.weaponry.util;
package tconstruct.util;

import tconstruct.TConstruct;

public final class Reference {
private Reference() {}

public static final String MOD_ID = "tinkersweaponry";
public static final String MOD_NAME = "Tinker's Weaponry";
public static final String TCON_MOD_ID = "TConstruct";
public static final String MOD_ID = TConstruct.modID;
public static final String MOD_NAME = "Tinkers' Construct";

public static final String RESOURCE = MOD_ID.toLowerCase();

public static String resource(String res)
{
return String.format("%s:%s", RESOURCE, res);
}
public static String prefix(String name) { return String.format("tcon.weaponry.%s", name);}
public static String prefix(String name) { return String.format("tconstruct.%s", name);}
}
51 changes: 31 additions & 20 deletions src/main/java/tconstruct/weaponry/TinkerWeaponry.java
@@ -1,7 +1,6 @@
package tconstruct.weaponry;


import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
Expand All @@ -12,13 +11,15 @@
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import tconstruct.TConstruct;
import tconstruct.library.TConstructCreativeTab;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.*;
import tconstruct.library.tools.DynamicToolPart;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.util.IPattern;
import tconstruct.library.util.IToolPart;
Expand All @@ -27,13 +28,12 @@
import tconstruct.tools.items.Pattern;
import tconstruct.weaponry.ammo.ArrowAmmo;
import tconstruct.weaponry.ammo.BoltAmmo;
import tconstruct.weaponry.items.DualMaterialToolPart;
import tconstruct.library.tools.DualMaterialToolPart;
import tconstruct.weaponry.items.WeaponryPattern;
import tconstruct.weaponry.items.WeaponryToolPart;
import tconstruct.weaponry.library.weaponry.AmmoItem;
import tconstruct.weaponry.library.weaponry.AmmoWeapon;
import tconstruct.weaponry.library.weaponry.ArrowShaftMaterial;
import tconstruct.weaponry.library.weaponry.ProjectileWeapon;
import tconstruct.library.weaponry.AmmoItem;
import tconstruct.library.weaponry.AmmoWeapon;
import tconstruct.library.weaponry.ArrowShaftMaterial;
import tconstruct.library.weaponry.ProjectileWeapon;
import tconstruct.weaponry.weapons.*;

import java.util.Map;
Expand All @@ -48,7 +48,6 @@ public class TinkerWeaponry {
public static WeaponryCommonProxy proxy;

// Throwing Weapons
public static ToolCore throwArrow;
public static AmmoWeapon shuriken;
public static AmmoWeapon throwingknife;
public static AmmoWeapon javelin;
Expand All @@ -62,11 +61,11 @@ public class TinkerWeaponry {
public static AmmoItem boltAmmo;

// Tool Parts
public static WeaponryToolPart partShuriken;
public static WeaponryToolPart partArrowShaft; // not craftable, used internally
public static WeaponryToolPart partBowLimb;
public static WeaponryToolPart partCrossbowLimb;
public static WeaponryToolPart partCrossbowBody;
public static DynamicToolPart partShuriken;
public static DynamicToolPart partArrowShaft; // not craftable, used internally
public static DynamicToolPart partBowLimb;
public static DynamicToolPart partCrossbowLimb;
public static DynamicToolPart partCrossbowBody;
public static DualMaterialToolPart partBolt;

// patterns/casts
Expand Down Expand Up @@ -106,15 +105,14 @@ public void postInit(FMLPostInitializationEvent event)
private void registerItems()
{
// create tool part
partShuriken = new WeaponryToolPart("_shuriken", "Shuriken");
partArrowShaft = new WeaponryToolPart("_arrow_shaft", "Shaft");
partBowLimb = new WeaponryToolPart("_bow_limb", "BowLimb");
partCrossbowLimb = new WeaponryToolPart("_crossbow_limb", "CrossbowLimb");
partCrossbowBody = new WeaponryToolPart("_crossbow_body", "CrossbowBody");
partShuriken = new DynamicToolPart("_shuriken", "Shuriken");
partArrowShaft = new DynamicToolPart("_arrow_shaft", "Shaft");
partBowLimb = new DynamicToolPart("_bow_limb", "BowLimb");
partCrossbowLimb = new DynamicToolPart("_crossbow_limb", "CrossbowLimb");
partCrossbowBody = new DynamicToolPart("_crossbow_body", "CrossbowBody");
partBolt = new DualMaterialToolPart("_bolt", "Bolt");

// create throwing weapons
throwArrow = new ThrowArrowItem();
shuriken = new Shuriken();
throwingknife = new ThrowingKnife();
javelin = new Javelin();
Expand All @@ -136,7 +134,6 @@ private void registerItems()
GameRegistry.registerItem(partCrossbowBody, "CrossbowBodyPart");
GameRegistry.registerItem(partBolt, "BoltPart");
// register throwing weapons
GameRegistry.registerItem(throwArrow, "ThrowArrow");
GameRegistry.registerItem(shuriken, "Shuriken");
GameRegistry.registerItem(throwingknife, "ThrowingKnife");
GameRegistry.registerItem(javelin, "Javelin");
Expand Down Expand Up @@ -308,4 +305,18 @@ private void registerBoltCasting()
}
}
}

private void setupCreativeTab()
{
ItemStack tool = new ItemStack(TinkerWeaponry.longbow, 1, 0);

NBTTagCompound compound = new NBTTagCompound();
compound.setTag("InfiTool", new NBTTagCompound());
compound.getCompoundTag("InfiTool").setInteger("RenderHead", 0);
compound.getCompoundTag("InfiTool").setInteger("RenderHandle", 0);
compound.getCompoundTag("InfiTool").setInteger("RenderAccessory", 0);
tool.setTagCompound(compound);

TConstructRegistry.weaponryTab.init(tool);
}
}
15 changes: 8 additions & 7 deletions src/main/java/tconstruct/weaponry/WeaponryClientProxy.java
@@ -1,15 +1,17 @@
package tconstruct.weaponry;

import tconstruct.client.AmmoItemRenderer;
import tconstruct.library.entity.ProjectileBase;
import tconstruct.weaponry.client.AmmoSlotHandler;
import tconstruct.weaponry.client.CrosshairHandler;
import tconstruct.weaponry.client.RenderEventHandler;
import tconstruct.weaponry.client.entityrenderer.ArrowEntityRenderer;
import tconstruct.weaponry.client.entityrenderer.JavelinEntityRenderer;
import tconstruct.weaponry.client.entityrenderer.ProjectileBaseRenderer;
import tconstruct.weaponry.client.entityrenderer.ShurikenEntityRenderer;
import tconstruct.weaponry.client.renderer.*;
import tconstruct.weaponry.client.entity.ArrowEntityRenderer;
import tconstruct.weaponry.client.entity.JavelinEntityRenderer;
import tconstruct.weaponry.client.entity.ProjectileBaseRenderer;
import tconstruct.weaponry.client.entity.ShurikenEntityRenderer;
import tconstruct.weaponry.client.item.*;
import tconstruct.weaponry.entity.*;
import tconstruct.weaponry.util.Reference;
import tconstruct.util.Reference;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
Expand Down Expand Up @@ -40,7 +42,6 @@ public void init() {
private void registerRenderers()
{
renderer = new AmmoItemRenderer();
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.throwArrow, renderer);
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.shuriken, renderer);
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.throwingknife, new ThrowingKnifeRenderer());
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.javelin, new JavelinRenderer());
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/tconstruct/weaponry/WeaponryHandler.java
Expand Up @@ -2,11 +2,11 @@

import tconstruct.weaponry.ammo.ArrowAmmo;
import tconstruct.weaponry.ammo.BoltAmmo;
import tconstruct.weaponry.items.DualMaterialToolPart;
import tconstruct.weaponry.library.weaponry.ArrowShaftMaterial;
import tconstruct.weaponry.library.weaponry.BowBaseAmmo;
import tconstruct.weaponry.library.weaponry.ProjectileWeapon;
import tconstruct.weaponry.library.weaponry.IAmmo;
import tconstruct.library.tools.DualMaterialToolPart;
import tconstruct.library.weaponry.ArrowShaftMaterial;
import tconstruct.library.weaponry.BowBaseAmmo;
import tconstruct.library.weaponry.ProjectileWeapon;
import tconstruct.library.weaponry.IAmmo;
import tconstruct.weaponry.weapons.Crossbow;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.item.Item;
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/tconstruct/weaponry/ammo/ArrowAmmo.java
Expand Up @@ -2,8 +2,8 @@

import tconstruct.TConstruct;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.library.weaponry.AmmoItem;
import tconstruct.weaponry.util.Reference;
import tconstruct.library.weaponry.AmmoItem;
import tconstruct.util.Reference;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -49,11 +49,6 @@ public String getDefaultFolder ()
return "arrow";
}

@Override
public String getDefaultTexturePath() {
return Reference.RESOURCE + ":" + getDefaultFolder();
}

@Override
public void registerPartPaths (int index, String[] location)
{
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tconstruct/weaponry/ammo/BoltAmmo.java
@@ -1,8 +1,8 @@
package tconstruct.weaponry.ammo;

import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.items.DualMaterialToolPart;
import tconstruct.weaponry.library.weaponry.AmmoItem;
import tconstruct.library.tools.DualMaterialToolPart;
import tconstruct.library.weaponry.AmmoItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import tconstruct.library.crafting.ToolBuilder;
Expand Down
@@ -1,6 +1,6 @@
package tconstruct.weaponry.client;

import tconstruct.weaponry.library.weaponry.ProjectileWeapon;
import tconstruct.library.weaponry.ProjectileWeapon;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
Expand Down

0 comments on commit 0bdf319

Please sign in to comment.