Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First merging of weaponry into tinkers
- Loading branch information
Showing
191 changed files
with
5,325 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+83 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/_arrow_fletching.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-20 Bytes
(90%)
resources/assets/tinker/textures/items/arrow/_arrow_head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-29 Bytes
(85%)
resources/assets/tinker/textures/items/arrow/_arrow_shaft.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+101 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/alumite_arrow_head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-100 Bytes
resources/assets/tinker/textures/items/arrow/alumite_arrow_shaft.png
Binary file not shown.
Binary file modified
BIN
+104 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/ardite_arrow_head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-94 Bytes
resources/assets/tinker/textures/items/arrow/ardite_arrow_shaft.png
Binary file not shown.
Binary file modified
BIN
+105 Bytes
(180%)
resources/assets/tinker/textures/items/arrow/beheading_arrow_effect.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+137 Bytes
(210%)
resources/assets/tinker/textures/items/arrow/blaze_arrow_effect.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+80 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/blueslime_arrow_fletching.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(110%)
resources/assets/tinker/textures/items/arrow/blueslime_arrow_head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-212 Bytes
resources/assets/tinker/textures/items/arrow/blueslime_arrow_shaft.png
Binary file not shown.
Binary file modified
BIN
+96 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/bone_arrow_head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+94 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/bone_arrow_shaft.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+108 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/bronze_arrow_head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-99 Bytes
resources/assets/tinker/textures/items/arrow/bronze_arrow_shaft.png
Binary file not shown.
Binary file modified
BIN
+88 Bytes
(180%)
resources/assets/tinker/textures/items/arrow/cactus_arrow_head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-114 Bytes
resources/assets/tinker/textures/items/arrow/cactus_arrow_shaft.png
Binary file not shown.
Binary file modified
BIN
+96 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/cobalt_arrow_head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-96 Bytes
resources/assets/tinker/textures/items/arrow/cobalt_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+109 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/copper_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-96 Bytes
resources/assets/tinker/textures/items/arrow/copper_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+81 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/diamond_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+73 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/emerald_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+83 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/feather_arrow_fletching.png
Oops, something went wrong.
Binary file modified
BIN
+81 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/flint_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-101 Bytes
resources/assets/tinker/textures/items/arrow/flint_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
-765 Bytes
(37%)
resources/assets/tinker/textures/items/arrow/flux_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+83 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/ice_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+92 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/iron_arrow_head.png
Oops, something went wrong.
Diff not rendered.
Binary file modified
BIN
+82 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/lapis_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+73 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/lava_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+80 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/leaf_arrow_fletching.png
Oops, something went wrong.
Binary file modified
BIN
+113 Bytes
(210%)
resources/assets/tinker/textures/items/arrow/manyullyn_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-96 Bytes
resources/assets/tinker/textures/items/arrow/manyullyn_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+102 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/moss_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+102 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/necrotic_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+110 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/netherrack_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-126 Bytes
resources/assets/tinker/textures/items/arrow/netherrack_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+102 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/obsidian_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-105 Bytes
resources/assets/tinker/textures/items/arrow/obsidian_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+89 Bytes
(180%)
resources/assets/tinker/textures/items/arrow/paper_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-111 Bytes
resources/assets/tinker/textures/items/arrow/paper_arrow_shaft.png
Diff not rendered.
Binary file removed
BIN
-242 Bytes
resources/assets/tinker/textures/items/arrow/pigiron_arrow_fletching.png
Diff not rendered.
Binary file modified
BIN
-34 Bytes
(85%)
resources/assets/tinker/textures/items/arrow/pigiron_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-211 Bytes
resources/assets/tinker/textures/items/arrow/pigiron_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+82 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/piston_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+86 Bytes
(180%)
resources/assets/tinker/textures/items/arrow/quartz_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+75 Bytes
(180%)
resources/assets/tinker/textures/items/arrow/redstone_arrow_effect.png
Oops, something went wrong.
Oops, something went wrong.
Binary file modified
BIN
+85 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/reinforced_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+103 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/silk_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+80 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/slime_arrow_fletching.png
Oops, something went wrong.
Binary file modified
BIN
+108 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/slime_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-100 Bytes
resources/assets/tinker/textures/items/arrow/slime_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+120 Bytes
(170%)
resources/assets/tinker/textures/items/arrow/smite_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+79 Bytes
(180%)
resources/assets/tinker/textures/items/arrow/spider_arrow_effect.png
Oops, something went wrong.
Binary file modified
BIN
+12 Bytes
(110%)
resources/assets/tinker/textures/items/arrow/steel_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-157 Bytes
resources/assets/tinker/textures/items/arrow/steel_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+99 Bytes
(190%)
resources/assets/tinker/textures/items/arrow/stone_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-96 Bytes
resources/assets/tinker/textures/items/arrow/stone_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+114 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/thaumium_arrow_head.png
Oops, something went wrong.
Binary file removed
BIN
-104 Bytes
resources/assets/tinker/textures/items/arrow/thaumium_arrow_shaft.png
Diff not rendered.
Binary file modified
BIN
+104 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/wood_arrow_head.png
Oops, something went wrong.
Binary file modified
BIN
+95 Bytes
(200%)
resources/assets/tinker/textures/items/arrow/wood_arrow_shaft.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+249 Bytes
resources/assets/tinker/textures/items/crossbow/_crossbow_binding.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+291 Bytes
resources/assets/tinker/textures/items/crossbow/_crossbow_bow_1.png
Oops, something went wrong.
Binary file added
BIN
+304 Bytes
resources/assets/tinker/textures/items/crossbow/_crossbow_bow_2.png
Oops, something went wrong.
Binary file added
BIN
+289 Bytes
resources/assets/tinker/textures/items/crossbow/_crossbow_bow_3.png
Oops, something went wrong.
Binary file added
BIN
+248 Bytes
resources/assets/tinker/textures/items/crossbow/_crossbow_string.png
Oops, something went wrong.
Binary file added
BIN
+282 Bytes
resources/assets/tinker/textures/items/crossbow/_crossbow_string_1.png
Oops, something went wrong.
Binary file added
BIN
+282 Bytes
resources/assets/tinker/textures/items/crossbow/_crossbow_string_2.png
Oops, something went wrong.
Binary file added
BIN
+280 Bytes
resources/assets/tinker/textures/items/crossbow/_crossbow_string_3.png
Oops, something went wrong.
Binary file added
BIN
+184 Bytes
resources/assets/tinker/textures/items/javelin/_javelin_accessory.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+161 Bytes
resources/assets/tinker/textures/items/longbow/_bowstring_broken.png
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+601 Bytes
resources/assets/tinker/textures/items/patterns/cast_crossbowbody.png
Oops, something went wrong.
Binary file added
BIN
+551 Bytes
resources/assets/tinker/textures/items/patterns/cast_crossbowlimb.png
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+483 Bytes
resources/assets/tinker/textures/items/patterns/pattern_bowlimb.png
Oops, something went wrong.
Binary file added
BIN
+488 Bytes
resources/assets/tinker/textures/items/patterns/pattern_crossbowbody.png
Oops, something went wrong.
Binary file added
BIN
+452 Bytes
resources/assets/tinker/textures/items/patterns/pattern_crossbowlimb.png
Oops, something went wrong.
Binary file added
BIN
+460 Bytes
resources/assets/tinker/textures/items/patterns/pattern_shuriken.png
Oops, something went wrong.
Binary file modified
BIN
+13 Bytes
(100%)
resources/assets/tinker/textures/items/shortbow/_bowstring.png
Oops, something went wrong.
Binary file modified
BIN
+3 Bytes
(100%)
resources/assets/tinker/textures/items/shortbow/_bowstring_1.png
Oops, something went wrong.
Binary file modified
BIN
+21 Bytes
(110%)
resources/assets/tinker/textures/items/shortbow/_bowstring_2.png
Oops, something went wrong.
Binary file modified
BIN
+12 Bytes
(110%)
resources/assets/tinker/textures/items/shortbow/_bowstring_3.png
Oops, something went wrong.
Binary file modified
BIN
+13 Bytes
(110%)
resources/assets/tinker/textures/items/shortbow/_bowstring_broken.png
Oops, something went wrong.
Binary file added
BIN
+293 Bytes
resources/assets/tinker/textures/items/shuriken/_shuriken - Kopie.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+477 Bytes
resources/assets/tinker/textures/items/throwingknife/_knife_blade.png
Oops, something went wrong.
Binary file added
BIN
+292 Bytes
resources/assets/tinker/textures/items/throwingknife/_knife_handle.png
Oops, something went wrong.
Binary file added
BIN
+340 Bytes
resources/assets/tinker/textures/items/throwingknife/iron_knife_blade.png
Oops, something went wrong.
Binary file added
BIN
+127 Bytes
resources/assets/tinker/textures/items/throwingknife/iron_knife_handle.png
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
114 changes: 114 additions & 0 deletions
114
src/main/java/tconstruct/weaponry/WeaponryClientProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
package boni.tinkersweaponry; | ||
|
||
import boni.tinkersweaponry.client.AmmoSlotHandler; | ||
import boni.tinkersweaponry.client.CrosshairHandler; | ||
import boni.tinkersweaponry.client.RenderEventHandler; | ||
import boni.tinkersweaponry.client.entityrenderer.ArrowEntityRenderer; | ||
import boni.tinkersweaponry.client.entityrenderer.JavelinEntityRenderer; | ||
import boni.tinkersweaponry.client.entityrenderer.ProjectileBaseRenderer; | ||
import boni.tinkersweaponry.client.entityrenderer.ShurikenEntityRenderer; | ||
import boni.tinkersweaponry.client.renderer.*; | ||
import boni.tinkersweaponry.entity.*; | ||
import boni.tinkersweaponry.util.Reference; | ||
import cpw.mods.fml.client.registry.RenderingRegistry; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.client.MinecraftForgeClient; | ||
import net.minecraftforge.common.MinecraftForge; | ||
import tconstruct.library.client.TConstructClientRegistry; | ||
import tconstruct.library.crafting.StencilBuilder; | ||
import tconstruct.library.tools.ToolCore; | ||
import tconstruct.tools.TinkerTools; | ||
|
||
public class WeaponryClientProxy extends WeaponryCommonProxy { | ||
public static AmmoItemRenderer renderer; | ||
|
||
@Override | ||
public void init() { | ||
super.init(); | ||
|
||
MinecraftForge.EVENT_BUS.register(new CrosshairHandler()); | ||
MinecraftForge.EVENT_BUS.register(new AmmoSlotHandler()); | ||
MinecraftForge.EVENT_BUS.register(new RenderEventHandler()); | ||
|
||
registerRenderers(); | ||
registerEntityRendering(); | ||
registerMaterialRendering(); | ||
|
||
buttons(); | ||
} | ||
|
||
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()); | ||
|
||
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.shortbow, new BowRenderer()); | ||
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.longbow, new BowRenderer()); | ||
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.crossbow, new CrossbowRenderer()); | ||
|
||
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.arrowAmmo, renderer); | ||
MinecraftForgeClient.registerItemRenderer(TinkerWeaponry.boltAmmo, renderer); | ||
} | ||
|
||
private void registerEntityRendering() | ||
{ | ||
ProjectileBaseRenderer defaultRenderer = new ProjectileBaseRenderer<ProjectileBase>(); | ||
RenderingRegistry.registerEntityRenderingHandler(ShurikenEntity.class, new ShurikenEntityRenderer()); | ||
RenderingRegistry.registerEntityRenderingHandler(ThrowingKnifeEntity.class, defaultRenderer); | ||
RenderingRegistry.registerEntityRenderingHandler(JavelinEntity.class, new JavelinEntityRenderer()); | ||
RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowEntityRenderer()); | ||
RenderingRegistry.registerEntityRenderingHandler(BoltEntity.class, new ArrowEntityRenderer(0.6f)); | ||
} | ||
|
||
private void registerMaterialRendering() | ||
{ | ||
ToolCore arrow = TinkerWeaponry.arrowAmmo; | ||
String pre = Reference.resource(arrow.getDefaultFolder()) + "/"; | ||
|
||
String[] shaft = {"wood", "bone", "blaze", "reed"}; | ||
String[] fletching = { "feather", "leaf", "slime", "blueslime" }; | ||
|
||
// we register different textures for the different parts per index | ||
for(int i = 0; i < 4; i++) { | ||
String handletex = pre + shaft[i] + arrow.getIconSuffix(2); | ||
String acctex = pre + fletching[i] + arrow.getIconSuffix(3); | ||
arrow.registerAlternatePartPaths(i, new String[]{null, null, handletex, acctex}); | ||
TinkerWeaponry.boltAmmo.registerAlternatePartPaths(i, new String[]{null, null, null, acctex}); | ||
} | ||
|
||
// for bolts too | ||
pre = Reference.resource(TinkerWeaponry.boltAmmo.getDefaultFolder()) + "/"; | ||
for(int i = 0; i < 4; i++) { | ||
String acctex = pre + fletching[i] + TinkerWeaponry.boltAmmo.getIconSuffix(3); | ||
TinkerWeaponry.boltAmmo.registerAlternatePartPaths(i, new String[]{null, null, null, acctex}); | ||
} | ||
|
||
// todo: do properly when moving stuff into tinkers code | ||
arrow.headStrings.clear(); | ||
arrow.headStrings.put(TinkerTools.MaterialID.PigIron, Reference.resource(arrow.getDefaultFolder() + "/pigiron" + arrow.getIconSuffix(0))); | ||
|
||
/* | ||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TinkerWeaponry.shuriken, 2, Reference.RESOURCE, "iron", true); | ||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TinkerWeaponry.throwingknife, 2, Reference.RESOURCE, "iron", true); | ||
String[] fletching = { "feather", "leaf", "slime", "blueslime" }; | ||
for (int arrowIter = 0; arrowIter < fletching.length; arrowIter++) | ||
{ | ||
TConstructClientRegistry.addAlternateMaterialRenderMapping(TinkerWeaponry.throwArrow, arrowIter, "tinker", fletching[arrowIter], true); | ||
} | ||
*/ | ||
} | ||
|
||
private void buttons() | ||
{ | ||
int base = StencilBuilder.getIndex(new ItemStack(TinkerWeaponry.woodPattern, 0, 0)); | ||
TConstructClientRegistry.addStencilButton2(0, 4, base + 0, Reference.RESOURCE, "textures/gui/icons.png"); // shuriken | ||
TConstructClientRegistry.addStencilButton2(1, 4, base + 1, Reference.RESOURCE, "textures/gui/icons.png"); // crossbow limb | ||
TConstructClientRegistry.addStencilButton2(2, 4, base + 2, Reference.RESOURCE, "textures/gui/icons.png"); // crossbow body | ||
TConstructClientRegistry.addStencilButton2(3, 4, base + 3, Reference.RESOURCE, "textures/gui/icons.png"); // bow limb | ||
//TConstructClientRegistry.addStencilButton2(4, 4, index, Reference.RESOURCE, "textures/gui/icons.png"); // bolt | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/tconstruct/weaponry/WeaponryCommonProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package boni.tinkersweaponry; | ||
|
||
import boni.tinkersweaponry.entity.*; | ||
import cpw.mods.fml.common.registry.EntityRegistry; | ||
|
||
public class WeaponryCommonProxy { | ||
public void init() { | ||
EntityRegistry.registerModEntity(ShurikenEntity.class, "Shuriken", 0, TinkerWeaponry.instance, 32, 5, true); | ||
EntityRegistry.registerModEntity(ThrowingKnifeEntity.class, "ThrowingKnife", 1, TinkerWeaponry.instance, 32, 5, true); | ||
EntityRegistry.registerModEntity(JavelinEntity.class, "Javelin", 2, TinkerWeaponry.instance, 32, 5, true); | ||
EntityRegistry.registerModEntity(ArrowEntity.class, "Arrow", 3, TinkerWeaponry.instance, 32, 5, true); | ||
EntityRegistry.registerModEntity(BoltEntity.class, "Bolt", 4, TinkerWeaponry.instance, 32, 5, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
package boni.tinkersweaponry; | ||
|
||
import boni.tinkersweaponry.ammo.ArrowAmmo; | ||
import boni.tinkersweaponry.ammo.BoltAmmo; | ||
import boni.tinkersweaponry.items.DualMaterialToolPart; | ||
import boni.tinkersweaponry.library.weaponry.ArrowShaftMaterial; | ||
import boni.tinkersweaponry.library.weaponry.BowBaseAmmo; | ||
import boni.tinkersweaponry.library.weaponry.ProjectileWeapon; | ||
import boni.tinkersweaponry.library.weaponry.IAmmo; | ||
import boni.tinkersweaponry.weapons.Crossbow; | ||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import tconstruct.library.TConstructRegistry; | ||
import tconstruct.library.crafting.ToolBuilder; | ||
import tconstruct.library.event.ToolBuildEvent; | ||
import tconstruct.library.event.ToolCraftEvent; | ||
import tconstruct.library.tools.*; | ||
|
||
public class WeaponryHandler { | ||
// Provides ammo-items with the necessary NBT | ||
@SubscribeEvent | ||
public void onAmmoCrafted(ToolCraftEvent.NormalTool event) | ||
{ | ||
if(!(event.tool instanceof IAmmo)) | ||
return; | ||
|
||
NBTTagCompound tags = event.toolTag.getCompoundTag("InfiTool"); | ||
|
||
// calculate its stats | ||
if(event.tool instanceof ArrowAmmo) | ||
{ | ||
// arrows work like this: | ||
// the head is responsible for the damage, but also adds weight | ||
// the shaft defines how fragile the arrow is, and also adds to the weight a bit. But mostly it functions at the durability modifier | ||
// the fletching defines the accuracy of the bow, adds a bit of durability and also breakchance | ||
|
||
// Shortbows work better with lighter arrows | ||
// while Longbows require a bit heavier arrows, the lighter the arrow the more impact the accuracy has otherwise | ||
|
||
// summa sumarum: heavier arrows fall faster (less range) but accuracy has less impact | ||
|
||
// the materials | ||
ToolMaterial head = TConstructRegistry.getMaterial(tags.getInteger("Head")); | ||
ArrowMaterial arrow = TConstructRegistry.getArrowMaterial(tags.getInteger("Head")); | ||
ArrowShaftMaterial shaft = (ArrowShaftMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Handle"), ArrowShaftMaterial.class); | ||
FletchingMaterial fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), FletchingMaterial.class); | ||
|
||
// todo: fix leaf fletching | ||
if(fletching == null) | ||
fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), FletchlingLeafMaterial.class); | ||
|
||
int durability = (int)((float)head.durability() * shaft.durabilityModifier); // todo: fletching durability | ||
float weight = arrow.mass + shaft.weight/2f; | ||
float accuracy = fletching.accuracy; | ||
float breakChance = shaft.fragility + fletching.breakChance; | ||
|
||
tags.setInteger("TotalDurability", durability); | ||
tags.setFloat("Mass", weight); | ||
tags.setFloat("BreakChance", breakChance); | ||
tags.setFloat("Accuracy", accuracy); | ||
} | ||
else if(event.tool instanceof BoltAmmo) | ||
{ | ||
// bolts work like ammos, but have more weight as they have 2 main materials | ||
// Crossbows work better with heavier bolts | ||
|
||
// the materials | ||
ToolMaterial headMat = TConstructRegistry.getMaterial(tags.getInteger("Head")); | ||
ToolMaterial coreMat = TConstructRegistry.getMaterial(tags.getInteger("Handle")); | ||
ArrowMaterial head = TConstructRegistry.getArrowMaterial(tags.getInteger("Head")); | ||
ArrowMaterial core = TConstructRegistry.getArrowMaterial(tags.getInteger("Handle")); | ||
FletchingMaterial fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), FletchingMaterial.class); | ||
|
||
// todo: fix leaf fletching | ||
if(fletching == null) | ||
fletching = (FletchingMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), FletchlingLeafMaterial.class); | ||
|
||
int durability = (int)((float)headMat.durability() * coreMat.handleDurability()); // todo: fletching durability | ||
float weight = head.mass + core.mass; | ||
float accuracy = fletching.accuracy; | ||
float breakChance = fletching.breakChance; | ||
|
||
tags.setInteger("TotalDurability", durability); | ||
tags.setFloat("Mass", weight); | ||
tags.setFloat("BreakChance", breakChance); | ||
tags.setFloat("Accuracy", accuracy); | ||
} | ||
|
||
// now that durability has been handled... | ||
// fill the ammo full and at the same time provide the missing NBT tag | ||
IAmmo ammoItem = (IAmmo) event.tool; | ||
tags.setInteger("Ammo", ammoItem.getMaxAmmo(tags)); | ||
} | ||
|
||
@SubscribeEvent | ||
public void onProjectileWeaponCrafted(ToolCraftEvent.NormalTool event) | ||
{ | ||
if(!(event.tool instanceof ProjectileWeapon)) | ||
return; | ||
|
||
NBTTagCompound tags = event.toolTag.getCompoundTag("InfiTool"); | ||
|
||
int drawSpeed = 0; | ||
float flightSpeed = 0; | ||
|
||
BowMaterial top; | ||
BowMaterial bottom; | ||
BowstringMaterial string; | ||
|
||
if(event.tool instanceof BowBaseAmmo) { | ||
top = TConstructRegistry.getBowMaterial(tags.getInteger("Head")); | ||
bottom = TConstructRegistry.getBowMaterial(tags.getInteger("Accessory")); | ||
string = (BowstringMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Handle"), BowstringMaterial.class); | ||
|
||
drawSpeed = (int) ((top.drawspeed + bottom.drawspeed) / 2f * string.drawspeedModifier); | ||
flightSpeed = (top.flightSpeedMax + bottom.flightSpeedMax)/2 * string.flightSpeedModifier; | ||
} | ||
else if(event.tool instanceof Crossbow) | ||
{ | ||
top = TConstructRegistry.getBowMaterial(tags.getInteger("Head")); | ||
string = (BowstringMaterial) TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), BowstringMaterial.class); | ||
|
||
drawSpeed = (int) ((float)top.drawspeed * string.drawspeedModifier); | ||
flightSpeed = (top.flightSpeedMax * string.flightSpeedModifier); | ||
} | ||
else | ||
return; | ||
|
||
// enchanted fabric | ||
/* | ||
if (tags.getInteger("Handle") == 1) { | ||
int modifiers = tags.getInteger("Modifiers"); | ||
modifiers += 1; | ||
tags.setInteger("Modifiers", modifiers); | ||
}*/ | ||
|
||
tags.setInteger("DrawSpeed", drawSpeed); | ||
tags.setFloat("FlightSpeed", flightSpeed); | ||
} | ||
|
||
|
||
// arrows use custom materials. But we don't allow the creation of those items | ||
// we therefore replace the items with their toolpart counterparts here | ||
@SubscribeEvent | ||
public void buildArrow(ToolBuildEvent event) | ||
{ | ||
if(event.headStack == null || event.handleStack == null || event.accessoryStack == null) | ||
return; | ||
|
||
// are we building an arrow? | ||
CustomMaterial mat = TConstructRegistry.getCustomMaterial(event.handleStack, ArrowShaftMaterial.class); | ||
if(mat == null) | ||
return; | ||
Item extra = event.extraStack != null ? event.extraStack.getItem() : null; | ||
ToolCore tool = ToolBuilder.instance.getMatchingRecipe(event.headStack.getItem(), mat.craftingItem.getItem(), event.accessoryStack.getItem(), extra); | ||
|
||
// it's an arrow! | ||
if(tool == TinkerWeaponry.arrowAmmo) | ||
event.handleStack = mat.craftingItem.copy(); | ||
} | ||
|
||
// bolts require special treatment because of their dual-material cores | ||
@SubscribeEvent | ||
public void buildBolt(ToolBuildEvent event) | ||
{ | ||
if(event.headStack == null || event.handleStack == null) | ||
return; | ||
|
||
if(event.headStack.getItem() != TinkerWeaponry.partBolt) | ||
return; | ||
|
||
// split the bolt into its two parts | ||
ItemStack bolt1 = event.headStack.copy(); | ||
ItemStack bolt2 = event.headStack; | ||
ItemStack fletching = event.handleStack; | ||
|
||
|
||
// set the correct material on the 2nd part | ||
DualMaterialToolPart dualPart = (DualMaterialToolPart) bolt2.getItem(); | ||
bolt1.setItemDamage(dualPart.getMaterialID2(bolt1)); | ||
|
||
// update the part positions xX | ||
event.headStack = bolt1; | ||
event.handleStack = bolt2; | ||
event.accessoryStack = fletching; | ||
} | ||
} |
Oops, something went wrong.