[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-28 18:04:28 -08:00
1 parent 83698cb73c
commit 84c2239244
561 files changed
+8872 -9300

No files matched your search

@@ -5,16 +5,18 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import net.minecraftforge.oredict.RecipeSorter;
import tconstruct.library.tools.DualMaterialToolPart;
import tconstruct.library.util.IToolPart;
import tconstruct.tools.TinkerTools;
import tconstruct.util.Reference;
public class AlternateBoltRecipe implements IRecipe {
static {
// register the recipe with the recipesorter
RecipeSorter.register(
Reference.MOD_ID + ":part", AlternateBoltRecipe.class, RecipeSorter.Category.SHAPELESS, "");
RecipeSorter
.register(Reference.MOD_ID + ":part", AlternateBoltRecipe.class, RecipeSorter.Category.SHAPELESS, "");
}
private ItemStack outputPart;
@@ -2,16 +2,12 @@ package tconstruct.weaponry;
import static tconstruct.tools.TinkerTools.MaterialID;
import cpw.mods.fml.common.FMLCommonHandler;
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.registry.GameRegistry;
import java.util.Map;
import java.util.Random;
import mantle.pulsar.pulse.Handler;
import mantle.pulsar.pulse.Pulse;
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.IPosition;
import net.minecraft.init.Blocks;
@@ -23,6 +19,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.*;
@@ -55,6 +52,12 @@ import tconstruct.weaponry.items.WeaponryPattern;
import tconstruct.weaponry.items.WeaponryPatternClay;
import tconstruct.weaponry.weapons.*;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.common.FMLCommonHandler;
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.registry.GameRegistry;
@GameRegistry.ObjectHolder(TConstruct.modID)
@Pulse(
@@ -62,6 +65,7 @@ import tconstruct.world.TinkerWorld;
description = "The main core of the mod! All of the tools, the tables, and the patterns are here.",
pulsesRequired = "Tinkers' Tools")
public class TinkerWeaponry {
@SidedProxy(
clientSide = "tconstruct.weaponry.WeaponryClientProxy",
serverSide = "tconstruct.weaponry.WeaponryCommonProxy")
@@ -124,14 +128,14 @@ public class TinkerWeaponry {
ItemStack redstoneItem = new ItemStack(Items.redstone);
ItemStack redstoneBlock = new ItemStack(Blocks.redstone_block);
ModifyBuilder.registerModifier(
new ModWindup(2, new ItemStack[] {redstoneItem, redstoneBlock}, new int[] {1, 9}));
new ModWindup(2, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }));
ModifyBuilder.registerModifier(new ModAmmoRestock());
modAttack = new ModAttack(
"Quartz",
11,
new ItemStack[] {new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE)},
new int[] {1, 4},
new ItemStack[] { new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) },
new int[] { 1, 4 },
true);
ModifyBuilder.registerModifier(modAttack);
@@ -149,8 +153,8 @@ public class TinkerWeaponry {
// "vanilla" bolt:
// iron-tipped wood-shaft with feather fletching
ItemStack headStack = DualMaterialToolPart.createDualMaterial(
boltAmmo.getHeadItem(), TinkerTools.MaterialID.Wood, TinkerTools.MaterialID.Iron);
ItemStack headStack = DualMaterialToolPart
.createDualMaterial(boltAmmo.getHeadItem(), TinkerTools.MaterialID.Wood, TinkerTools.MaterialID.Iron);
ItemStack handleStack = new ItemStack(boltAmmo.getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(headStack, handleStack, null, null, "");
@@ -231,26 +235,22 @@ public class TinkerWeaponry {
PatternBuilder.instance.addToolPattern(woodPattern);
// todo: integrate into tcon
int[] nonMetals = {0, 1, 3, 4, 5, 6, 7, 8, 9, 17};
int[] liquidDamage = new int[] {2, 13, 10, 11, 12, 14, 15, 6, 16, 18};
patternOutputs = new Item[] {partShuriken, partCrossbowLimb, partCrossbowBody, partBowLimb};
int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 };
int[] liquidDamage = new int[] { 2, 13, 10, 11, 12, 14, 15, 6, 16, 18 };
patternOutputs = new Item[] { partShuriken, partCrossbowLimb, partCrossbowBody, partBowLimb };
// register part crafting
if (PHConstruct.craftMetalTools) {
for (int m = 0; m < patternOutputs.length; m++)
for (int i = 0; i < 18; i++)
TConstructRegistry.addPartMapping(woodPattern, m, i, new ItemStack(patternOutputs[m], 1, i));
for (int m = 0; m < patternOutputs.length; m++) for (int i = 0; i < 18; i++)
TConstructRegistry.addPartMapping(woodPattern, m, i, new ItemStack(patternOutputs[m], 1, i));
} else {
for (int m = 0; m < patternOutputs.length; m++)
for (int nonMetal : nonMetals)
TConstructRegistry.addPartMapping(
woodPattern, m, nonMetal, new ItemStack(patternOutputs[m], 1, nonMetal));
for (int m = 0; m < patternOutputs.length; m++) for (int nonMetal : nonMetals) TConstructRegistry
.addPartMapping(woodPattern, m, nonMetal, new ItemStack(patternOutputs[m], 1, nonMetal));
}
// arrowhead is still integrated in tinkertools.. bla n stuff
for (int nonMetal : nonMetals)
TConstructRegistry.addPartMapping(
TinkerTools.woodPattern, 25, nonMetal, new ItemStack(arrowhead, 1, nonMetal));
for (int nonMetal : nonMetals) TConstructRegistry
.addPartMapping(TinkerTools.woodPattern, 25, nonMetal, new ItemStack(arrowhead, 1, nonMetal));
// register part casting
if (TConstruct.pulsar.isPulseLoaded("Tinkers' Smeltery")) {
@@ -265,13 +265,12 @@ public class TinkerWeaponry {
new ItemStack(patternOutputs[i], 1, Short.MAX_VALUE),
false,
50);
if (!PHConstruct.removeGoldCastRecipes)
tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(patternOutputs[i], 1, Short.MAX_VALUE),
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(patternOutputs[i], 1, Short.MAX_VALUE),
false,
50);
for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) {
Fluid fs = TinkerSmeltery.liquids[iterTwo].getFluid();
@@ -304,18 +303,18 @@ public class TinkerWeaponry {
new ItemStack(arrowhead, 1, Short.MAX_VALUE),
false,
50);
if (!PHConstruct.removeGoldCastRecipes)
tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(arrowhead, 1, Short.MAX_VALUE),
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(arrowhead, 1, Short.MAX_VALUE),
false,
50);
for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) {
Fluid fs = TinkerSmeltery.liquids[iterTwo].getFluid();
int fluidAmount =
((IPattern) TinkerSmeltery.metalPattern).getPatternCost(cast) * TConstruct.ingotLiquidValue / 2;
int fluidAmount = ((IPattern) TinkerSmeltery.metalPattern).getPatternCost(cast)
* TConstruct.ingotLiquidValue
/ 2;
ItemStack metalCast = new ItemStack(arrowhead, 1, liquidDamage[iterTwo]);
tableCasting.addCastingRecipe(metalCast, new FluidStack(fs, fluidAmount), cast, 50);
tableCasting.addCastingRecipe(metalCast, new FluidStack(fs, fluidAmount), clay_cast, true, 50);
@@ -362,8 +361,8 @@ public class TinkerWeaponry {
TConstructRegistry.addBowMaterial(MaterialID.Manyullyn, 50, 5.0f); // Manyullyn
TConstructRegistry.addBowMaterial(MaterialID.Copper, 40, 4.9f); // Copper
TConstructRegistry.addBowMaterial(MaterialID.Bronze, 45, 5.1f); // Bronze
TConstructRegistry.addBowMaterial(
MaterialID.Alumite, 45, 5.0f); // Alumite - a bit stone-ish since it has obsidian
TConstructRegistry.addBowMaterial(MaterialID.Alumite, 45, 5.0f); // Alumite - a bit stone-ish since it has
// obsidian
// Stone doesn't bend. takes forever, has no pow. WHY WOULD YOU DO THAT
TConstructRegistry.addBowMaterial(MaterialID.Stone, 90, 1.0f); // Stone
TConstructRegistry.addBowMaterial(MaterialID.Flint, 90, 1.0f); // Flint
@@ -392,25 +391,47 @@ public class TinkerWeaponry {
TConstructRegistry.addArrowMaterial(MaterialID.PigIron, 3.0F, 0.5F); // Pigiron
// Arrow Shaft Materials: Material ID, crafting item, durability-medifier, mass, fragility
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(
0, Items.stick, 1.0f, 1.0f, 0.15f, 0x866526)); // wood: reference material, 10% break chance
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(
1, Items.bone, 0.95f, 1.8f, 0.02f, 0xede6bf)); // bone: heavier, but durable
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(
2, Items.reeds, 1.5f, 0.5f, 0.66f, 0xc7ff87)); // reed: light, but less durable
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(
3, Items.blaze_rod, 1.2f, 0.9f, 0.08f, 0xfff32d)); // blaze: tad lighter, tad more durable, fieryyyy
TConstructRegistry
.addCustomMaterial(ArrowShaftMaterial.createMaterial(0, Items.stick, 1.0f, 1.0f, 0.15f, 0x866526)); // wood:
// reference
// material,
// 10%
// break
// chance
TConstructRegistry
.addCustomMaterial(ArrowShaftMaterial.createMaterial(1, Items.bone, 0.95f, 1.8f, 0.02f, 0xede6bf)); // bone:
// heavier,
// but
// durable
TConstructRegistry
.addCustomMaterial(ArrowShaftMaterial.createMaterial(2, Items.reeds, 1.5f, 0.5f, 0.66f, 0xc7ff87)); // reed:
// light,
// but
// less
// durable
TConstructRegistry
.addCustomMaterial(ArrowShaftMaterial.createMaterial(3, Items.blaze_rod, 1.2f, 0.9f, 0.08f, 0xfff32d)); // blaze:
// tad
// lighter,
// tad
// more
// durable,
// fieryyyy
// also add the tool rod variants, same stats
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(
0,
TinkerTools.toolRod,
MaterialID.Wood,
1.0f,
1.0f,
0.15f,
0x866526)); // wood: reference material, 10% break chance
TConstructRegistry.addCustomMaterial(ArrowShaftMaterial.createMaterial(
1, TinkerTools.toolRod, MaterialID.Bone, 0.95f, 1.8f, 0.02f, 0xede6bf)); // bone: heavier, but durable
TConstructRegistry.addCustomMaterial(
ArrowShaftMaterial
.createMaterial(0, TinkerTools.toolRod, MaterialID.Wood, 1.0f, 1.0f, 0.15f, 0x866526)); // wood:
// reference
// material,
// 10%
// break
// chance
TConstructRegistry.addCustomMaterial(
ArrowShaftMaterial
.createMaterial(1, TinkerTools.toolRod, MaterialID.Bone, 0.95f, 1.8f, 0.02f, 0xede6bf)); // bone:
// heavier,
// but
// durable
// Arrow Fletching Materials
TConstructRegistry.addFletchingMaterial(
@@ -422,14 +443,15 @@ public class TinkerWeaponry {
0.05F,
1.0f,
0xffffff); // Feather
TConstructRegistry.addCustomMaterial(new FletchlingLeafMaterial(
1,
2,
"treeLeaves",
new ItemStack(TinkerWeaponry.fletching, 1, 1),
75F,
0F,
2.5f)); // all vanilla and oredicted leaves. and all leaves in general.
TConstructRegistry.addCustomMaterial(
new FletchlingLeafMaterial(
1,
2,
"treeLeaves",
new ItemStack(TinkerWeaponry.fletching, 1, 1),
75F,
0F,
2.5f)); // all vanilla and oredicted leaves. and all leaves in general.
TConstructRegistry.addFletchingMaterial(
2,
2,
@@ -477,8 +499,8 @@ public class TinkerWeaponry {
TConstructRegistry.addToolRecipe(shortbow, partBowLimb, bowstring, partBowLimb);
TConstructRegistry.addToolRecipe(longbow, partBowLimb, bowstring, partBowLimb, TinkerTools.largePlate);
TConstructRegistry.addToolRecipe(
crossbow, partCrossbowLimb, partCrossbowBody, bowstring, TinkerTools.toughBinding);
TConstructRegistry
.addToolRecipe(crossbow, partCrossbowLimb, partCrossbowBody, bowstring, TinkerTools.toughBinding);
TConstructRegistry.addToolRecipe(arrowAmmo, arrowhead, partArrowShaft, fletching);
TConstructRegistry.addToolRecipe(boltAmmo, partBolt, partBolt, fletching);
@@ -496,8 +518,7 @@ public class TinkerWeaponry {
// get a casting recipe for it D:
FluidStack liquid = new FluidStack(entry.getValue().fluid, TConstruct.ingotLiquidValue);
CastingRecipe recipe =
tb.getCastingRecipe(liquid, new ItemStack(TinkerSmeltery.metalPattern, 1, 2)); // pickaxe
CastingRecipe recipe = tb.getCastingRecipe(liquid, new ItemStack(TinkerSmeltery.metalPattern, 1, 2)); // pickaxe
// no recipe found
if (recipe == null) continue;
@@ -510,7 +531,11 @@ public class TinkerWeaponry {
if (((IToolPart) TinkerTools.toolRod).getMaterialID(rod) == -1) continue;
tb.addCastingRecipe(
DualMaterialToolPart.createDualMaterial(partBolt, id, matID), liquid, rod, true, 150);
DualMaterialToolPart.createDualMaterial(partBolt, id, matID),
liquid,
rod,
true,
150);
}
}
}
@@ -563,6 +588,7 @@ public class TinkerWeaponry {
// arrows
BlockDispenser.dispenseBehaviorRegistry.putObject(arrowAmmo, new BehaviorProjectileBaseDispense() {
@Override
protected ProjectileBase getProjectileEntity(World world, IPosition position, ItemStack stack) {
return new ArrowEntity(world, position.getX(), position.getY(), position.getZ());
@@ -571,6 +597,7 @@ public class TinkerWeaponry {
// bolts
BlockDispenser.dispenseBehaviorRegistry.putObject(boltAmmo, new BehaviorProjectileBaseDispense() {
@Override
protected ProjectileBase getProjectileEntity(World world, IPosition position, ItemStack stack) {
return new BoltEntity(world, position.getX(), position.getY(), position.getZ());
@@ -3,10 +3,12 @@ package tconstruct.weaponry;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.ActiveToolMod;
import tconstruct.library.weaponry.IAmmo;
public class WeaponryActiveToolMod extends ActiveToolMod {
@Override
public boolean damageTool(ItemStack stack, int damage, EntityLivingBase entity) {
// does not proc on tool 'healing'
@@ -2,12 +2,13 @@ package tconstruct.weaponry;
import static tconstruct.weaponry.TinkerWeaponry.*;
import cpw.mods.fml.client.registry.RenderingRegistry;
import mantle.lib.client.MantleClientRegistry;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.client.AmmoItemRenderer;
import tconstruct.library.client.TConstructClientRegistry;
import tconstruct.library.crafting.ToolBuilder;
@@ -23,8 +24,10 @@ import tconstruct.weaponry.client.entity.ProjectileBaseRenderer;
import tconstruct.weaponry.client.entity.ShurikenEntityRenderer;
import tconstruct.weaponry.client.item.*;
import tconstruct.weaponry.entity.*;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class WeaponryClientProxy extends WeaponryCommonProxy {
public static AmmoItemRenderer renderer;
@Override
@@ -72,29 +75,33 @@ public class WeaponryClientProxy extends WeaponryCommonProxy {
ToolCore arrow = TinkerWeaponry.arrowAmmo;
String pre = Reference.resource(arrow.getDefaultFolder()) + "/";
String[] shaft = {"wood", "bone", "reed", "blaze", null};
String[] fletching = {"feather", "leaf", "slime", "blueslime", "slimeleaf"};
String[] shaft = { "wood", "bone", "reed", "blaze", null };
String[] fletching = { "feather", "leaf", "slime", "blueslime", "slimeleaf" };
// we register different textures for the different parts per index
for (int i = 0; i < 5; 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});
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 < 5; i++) {
String acctex = pre + fletching[i] + TinkerWeaponry.boltAmmo.getIconSuffix(3);
TinkerWeaponry.boltAmmo.registerAlternatePartPaths(i, new String[] {null, null, null, acctex});
TinkerWeaponry.boltAmmo.registerAlternatePartPaths(i, new String[] { null, null, null, acctex });
}
// bowstring
String[] bowstringTypes = {"string", "magicfabric", "flamestring"};
String[] bowstringTypes = { "string", "magicfabric", "flamestring" };
for (int bowIter = 0; bowIter < bowstringTypes.length; bowIter++) {
TConstructClientRegistry.addAlternateMaterialRenderMapping(
TinkerWeaponry.shortbow, bowIter, Reference.RESOURCE, bowstringTypes[bowIter], true);
TinkerWeaponry.shortbow,
bowIter,
Reference.RESOURCE,
bowstringTypes[bowIter],
true);
}
}
@@ -117,23 +124,20 @@ public class WeaponryClientProxy extends WeaponryCommonProxy {
// bolt
// Tool Station
ToolCore[] tools = {shortbow, arrowAmmo, throwingknife, javelin};
int[][] icons = {
new int[] {3, 9, 1}, // shortbow
new int[] {7, 10, 1}, // arrow
new int[] {2, 1, 5}, // throwingknife
new int[] {1, 2, 5} // javelin
ToolCore[] tools = { shortbow, arrowAmmo, throwingknife, javelin };
int[][] icons = { new int[] { 3, 9, 1 }, // shortbow
new int[] { 7, 10, 1 }, // arrow
new int[] { 2, 1, 5 }, // throwingknife
new int[] { 1, 2, 5 } // javelin
};
int[][] coords = {
new int[] {3, 10, 3, 13}, new int[] {4, 3, 4, 13}, // shortbow
new int[] {11, 0, 12, 13}, new int[] {3, 3, 3, 13}, // arrow
new int[] {7, 0, 13, 13}, new int[] {2, 3, 13, 13}, // throwingknife
new int[] {11, 8, 8, 13}, new int[] {3, 3, 3, 13} // javelin
int[][] coords = { new int[] { 3, 10, 3, 13 }, new int[] { 4, 3, 4, 13 }, // shortbow
new int[] { 11, 0, 12, 13 }, new int[] { 3, 3, 3, 13 }, // arrow
new int[] { 7, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // throwingknife
new int[] { 11, 8, 8, 13 }, new int[] { 3, 3, 3, 13 } // javelin
};
for (int i = 0; i < tools.length; i++) {
String locString = String.format(
"gui.toolstation.%s.desc", tools[i].getToolName().toLowerCase());
String locString = String.format("gui.toolstation.%s.desc", tools[i].getToolName().toLowerCase());
TConstructClientRegistry.addToolButton(
icons[i][0],
icons[i][1],
@@ -147,23 +151,20 @@ public class WeaponryClientProxy extends WeaponryCommonProxy {
}
// Tool Forge
tools = new ToolCore[] {longbow, crossbow, boltAmmo, shuriken};
icons = new int[][] {
new int[] {8, 11, 1}, // longbow
new int[] {9, 12, 1}, // crossbow
new int[] {2, 13, 1}, // bolt
new int[] {4, 0, 5} // shuriken
tools = new ToolCore[] { longbow, crossbow, boltAmmo, shuriken };
icons = new int[][] { new int[] { 8, 11, 1 }, // longbow
new int[] { 9, 12, 1 }, // crossbow
new int[] { 2, 13, 1 }, // bolt
new int[] { 4, 0, 5 } // shuriken
};
coords = new int[][] {
new int[] {3, 10, 3, 9}, new int[] {4, 3, 4, 2}, // longbow
new int[] {1, 2, 10, 9}, new int[] {4, 4, 3, 3}, // crossbow
new int[] {4, 12, 13, 13}, new int[] {4, 3, 13, 13}, // bolt
new int[] {0, 0, 0, 0}, new int[] {4, 4, 4, 4} // shuriken
coords = new int[][] { new int[] { 3, 10, 3, 9 }, new int[] { 4, 3, 4, 2 }, // longbow
new int[] { 1, 2, 10, 9 }, new int[] { 4, 4, 3, 3 }, // crossbow
new int[] { 4, 12, 13, 13 }, new int[] { 4, 3, 13, 13 }, // bolt
new int[] { 0, 0, 0, 0 }, new int[] { 4, 4, 4, 4 } // shuriken
};
for (int i = 0; i < tools.length; i++) {
String locString = String.format(
"gui.toolstation.%s.desc", tools[i].getToolName().toLowerCase());
String locString = String.format("gui.toolstation.%s.desc", tools[i].getToolName().toLowerCase());
TConstructClientRegistry.addTierTwoButton(
icons[i][0],
icons[i][1],
@@ -1,14 +1,15 @@
package tconstruct.weaponry;
import cpw.mods.fml.common.registry.EntityRegistry;
import tconstruct.TConstruct;
import tconstruct.weaponry.entity.*;
import cpw.mods.fml.common.registry.EntityRegistry;
public class WeaponryCommonProxy {
public void init() {
EntityRegistry.registerModEntity(ShurikenEntity.class, "Shuriken", 20, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(
ThrowingKnifeEntity.class, "ThrowingKnife", 21, TConstruct.instance, 32, 5, true);
EntityRegistry
.registerModEntity(ThrowingKnifeEntity.class, "ThrowingKnife", 21, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(JavelinEntity.class, "Javelin", 22, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(ArrowEntity.class, "Arrow", 23, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(BoltEntity.class, "Bolt", 24, TConstruct.instance, 32, 5, true);
@@ -1,9 +1,5 @@
package tconstruct.weaponry;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -13,6 +9,7 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import tconstruct.armor.player.TPlayerStats;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.PatternBuilder;
@@ -35,8 +32,13 @@ import tconstruct.weaponry.ammo.BoltAmmo;
import tconstruct.weaponry.weapons.Crossbow;
import tconstruct.weaponry.weapons.LongBow;
import tconstruct.weaponry.weapons.ShortBow;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
public class WeaponryHandler {
@SubscribeEvent
public void onCrafting(PlayerEvent.ItemCraftedEvent event) {
Item item = event.crafting.getItem();
@@ -79,15 +81,14 @@ public class WeaponryHandler {
// 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);
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);
if (fletching == null) fletching = (FletchingMaterial) TConstructRegistry
.getCustomMaterial(tags.getInteger("Accessory"), FletchlingLeafMaterial.class);
// invalid materials
if (arrow == null || shaft == null || fletching == null) {
@@ -95,8 +96,8 @@ public class WeaponryHandler {
return;
}
int durability =
(int) ((float) head.durability() * shaft.durabilityModifier * fletching.durabilityModifier);
int durability = (int) ((float) head.durability() * shaft.durabilityModifier
* fletching.durabilityModifier);
float weight = arrow.mass + shaft.weight;
float accuracy = fletching.accuracy;
float breakChance = shaft.fragility * arrow.breakChance + fletching.breakChance;
@@ -119,13 +120,12 @@ public class WeaponryHandler {
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);
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);
if (fletching == null) fletching = (FletchingMaterial) TConstructRegistry
.getCustomMaterial(tags.getInteger("Accessory"), FletchlingLeafMaterial.class);
// invalid materials
if (head == null || core == null || fletching == null) {
@@ -133,8 +133,8 @@ public class WeaponryHandler {
return;
}
int durability =
(int) ((float) headMat.durability() * coreMat.handleDurability() * fletching.durabilityModifier);
int durability = (int) ((float) headMat.durability() * coreMat.handleDurability()
* fletching.durabilityModifier);
float weight = head.mass + core.mass * 1.5f;
float accuracy = (100f + fletching.accuracy) / 2f;
float breakChance = (fletching.breakChance * 2 + 0.15f * core.breakChance) * head.breakChance / 2f;
@@ -172,8 +172,8 @@ public class WeaponryHandler {
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);
string = (BowstringMaterial) TConstructRegistry
.getCustomMaterial(tags.getInteger("Handle"), BowstringMaterial.class);
// some materials seem to be incompatible
if (top == null || bottom == null || string == null) {
@@ -198,8 +198,8 @@ public class WeaponryHandler {
enchanted = tags.getInteger("Handle") == 1;
} else if (event.tool instanceof Crossbow) {
top = TConstructRegistry.getBowMaterial(tags.getInteger("Head"));
string = (BowstringMaterial)
TConstructRegistry.getCustomMaterial(tags.getInteger("Accessory"), BowstringMaterial.class);
string = (BowstringMaterial) TConstructRegistry
.getCustomMaterial(tags.getInteger("Accessory"), BowstringMaterial.class);
// some materials seem to be incompatible
if (top == null || string == null) {
@@ -245,7 +245,10 @@ public class WeaponryHandler {
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);
event.headStack.getItem(),
mat.craftingItem.getItem(),
event.accessoryStack.getItem(),
extra);
// it's an arrow!
if (tool == TinkerWeaponry.arrowAmmo) event.handleStack = mat.craftingItem.copy();
@@ -259,10 +262,10 @@ public class WeaponryHandler {
if (event.headStack.getItem() != TinkerWeaponry.partBolt) return;
// is the bolt already split into 2 items?
if (event.accessoryStack != null
&& event.headStack.getItem() == TinkerWeaponry.partBolt
if (event.accessoryStack != null && event.headStack.getItem() == TinkerWeaponry.partBolt
&& event.handleStack.getItem() == TinkerWeaponry.partBolt
&& event.accessoryStack.getItem() == TinkerWeaponry.fletching) return;
&& event.accessoryStack.getItem() == TinkerWeaponry.fletching)
return;
// split the bolt into its two parts
ItemStack bolt1 = event.headStack.copy();
@@ -279,14 +282,8 @@ public class WeaponryHandler {
event.accessoryStack = fletching;
}
private void setAmmoData(
NBTTagCompound tags,
int durability,
float weight,
float breakChance,
float accuracy,
float shoddy,
int reinforced) {
private void setAmmoData(NBTTagCompound tags, int durability, float weight, float breakChance, float accuracy,
float shoddy, int reinforced) {
tags.setInteger("TotalDurability", durability);
tags.setInteger("BaseDurability", durability);
tags.setFloat("Mass", weight);
@@ -348,27 +345,21 @@ public class WeaponryHandler {
// high priority because we want to do these checks on unmodified stacks
@SubscribeEvent(priority = EventPriority.HIGH)
public void boneanaParts(ToolBuildEvent event) {
if (event.headStack == null
|| event.handleStack == null
if (event.headStack == null || event.handleStack == null
|| event.accessoryStack != null
|| event.extraStack != null) return;
|| event.extraStack != null)
return;
// golden carrot + bone
if (event.headStack.getItem() == Items.golden_carrot && event.handleStack.getItem() == Items.bone) {
// golden carrot must be named banana
if (!event.headStack.hasTagCompound()
|| !event.headStack.getTagCompound().hasKey("display")
|| !event.headStack
.getTagCompound()
.getCompoundTag("display")
.hasKey("Name")
|| !event.headStack
.getTagCompound()
.getCompoundTag("display")
.getString("Name")
.equalsIgnoreCase("banana")) return;
event.name =
'\u2400' + "Bonæna"; // the \u2400 is a non-printable unicode character so you can't just type it
if (!event.headStack.hasTagCompound() || !event.headStack.getTagCompound().hasKey("display")
|| !event.headStack.getTagCompound().getCompoundTag("display").hasKey("Name")
|| !event.headStack.getTagCompound().getCompoundTag("display").getString("Name")
.equalsIgnoreCase("banana"))
return;
event.name = '\u2400' + "Bonæna"; // the \u2400 is a non-printable unicode character so you can't just type
// it
event.headStack = new ItemStack(TinkerTools.swordBlade, 1, TinkerTools.MaterialID.Bone);
event.handleStack = new ItemStack(TinkerTools.toolRod, 1, TinkerTools.MaterialID.Bone);
event.accessoryStack = new ItemStack(TinkerTools.wideGuard, 1, TinkerTools.MaterialID.Bone);
@@ -1,10 +1,12 @@
package tconstruct.weaponry.ammo;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
@@ -16,6 +18,7 @@ import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.TinkerWeaponry;
public class ArrowAmmo extends AmmoItem {
public static ItemStack vanillaArrow;
public ArrowAmmo() {
@@ -82,7 +85,7 @@ public class ArrowAmmo extends AmmoItem {
@Override
public String[] getTraits() {
return new String[] {"ammo", "projectile", "weapon"};
return new String[] { "ammo", "projectile", "weapon" };
}
@Override
@@ -92,8 +95,8 @@ public class ArrowAmmo extends AmmoItem {
ItemStack handleStack = new ItemStack(getHandleItem(), 1, 0); // wooden shaft
ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(
new ItemStack(getHeadItem(), 1, id), handleStack, accessoryStack, null, "");
ItemStack tool = ToolBuilder.instance
.buildTool(new ItemStack(getHeadItem(), 1, id), handleStack, accessoryStack, null, "");
if (tool != null) {
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
list.add(tool);
@@ -133,7 +136,7 @@ public class ArrowAmmo extends AmmoItem {
// blaze shaft?
if (part == 1 && type == 3) return "\u00a76" + StatCollector.translateToLocal("modifier.tool.blaze");
if (part >= 1) // only head has ability otherwise
return "";
return "";
return super.getAbilityNameForType(type, part);
}
}
@@ -1,8 +1,10 @@
package tconstruct.weaponry.ammo;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.CustomMaterial;
@@ -14,6 +16,7 @@ import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.TinkerWeaponry;
public class BoltAmmo extends AmmoItem {
public BoltAmmo() {
super(0, "Bolts");
}
@@ -72,7 +75,7 @@ public class BoltAmmo extends AmmoItem {
@Override
public String[] getTraits() {
return new String[] {"ammo", "projectile", "weapon"};
return new String[] { "ammo", "projectile", "weapon" };
}
@Override
@@ -80,8 +83,8 @@ public class BoltAmmo extends AmmoItem {
if (TConstructRegistry.getArrowMaterial(id) == null) return;
// dual material head: we use wooden shafts
ItemStack headStack = DualMaterialToolPart.createDualMaterial(
getHeadItem(), id, TinkerTools.MaterialID.Iron); // material shaft
ItemStack headStack = DualMaterialToolPart.createDualMaterial(getHeadItem(), id, TinkerTools.MaterialID.Iron); // material
// shaft
ItemStack handleStack = new ItemStack(getAccessoryItem(), 1, 0); // feather Fletchling
// ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
@@ -107,7 +110,7 @@ public class BoltAmmo extends AmmoItem {
@Override
public String getAbilityNameForType(int type, int part) {
if (part >= 2) // only head and handle have ability
return "";
return "";
return super.getAbilityNameForType(type, part);
}
}
@@ -1,14 +1,16 @@
package tconstruct.weaponry.client;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import tconstruct.library.weaponry.ProjectileWeapon;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class AmmoSlotHandler {
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Pre event) {
if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) return;
@@ -26,11 +28,10 @@ public class AmmoSlotHandler {
// check if it's in the inventory
int slot = -1;
for (int i = 0; i < 9; i++)
if (player.inventory.mainInventory[i] == ammo) {
slot = i;
break;
}
for (int i = 0; i < 9; i++) if (player.inventory.mainInventory[i] == ammo) {
slot = i;
break;
}
// not in the hotbar
if (slot == -1) return;
@@ -1,6 +1,5 @@
package tconstruct.weaponry.client;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -8,21 +7,29 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import org.lwjgl.opengl.GL11;
import tconstruct.library.weaponry.IWindup;
import tconstruct.util.Reference;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class CrosshairHandler {
private static final Minecraft mc = Minecraft.getMinecraft();
private static final ResourceLocation crossHairSquare =
new ResourceLocation(Reference.RESOURCE, "textures/gui/Crosshair.png");
private static final ResourceLocation crossHairTip =
new ResourceLocation(Reference.RESOURCE, "textures/gui/Crosshair2.png");
private static final ResourceLocation crossHairWeird =
new ResourceLocation(Reference.RESOURCE, "textures/gui/Crosshair3.png");
private static final ResourceLocation crossHairSpike =
new ResourceLocation(Reference.RESOURCE, "textures/gui/Crosshair4.png");
private static final ResourceLocation crossHairSquare = new ResourceLocation(
Reference.RESOURCE,
"textures/gui/Crosshair.png");
private static final ResourceLocation crossHairTip = new ResourceLocation(
Reference.RESOURCE,
"textures/gui/Crosshair2.png");
private static final ResourceLocation crossHairWeird = new ResourceLocation(
Reference.RESOURCE,
"textures/gui/Crosshair3.png");
private static final ResourceLocation crossHairSpike = new ResourceLocation(
Reference.RESOURCE,
"textures/gui/Crosshair4.png");
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Pre event) {
@@ -100,7 +107,7 @@ public class CrosshairHandler {
double v1 = 0;
switch (part) {
// top left
// top left
case 0:
w -= s;
h -= s;
@@ -1,13 +1,15 @@
package tconstruct.weaponry.client;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import tconstruct.library.weaponry.BowBaseAmmo;
import tconstruct.library.weaponry.IWindup;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class RenderEventHandler {
@SubscribeEvent
public void onAimZoom(FOVUpdateEvent event) {
if (!event.entity.isUsingItem()) return;
@@ -17,9 +19,8 @@ public class RenderEventHandler {
ItemStack weapon = event.entity.getItemInUse();
IWindup item = (IWindup) weapon.getItem();
if (item.zoomOnWindup(weapon))
event.newfov = event.fov
/ (event.fov + (item.getZoom(weapon) - 1.0f) * item.getWindupProgress(weapon, event.entity));
if (item.zoomOnWindup(weapon)) event.newfov = event.fov
/ (event.fov + (item.getZoom(weapon) - 1.0f) * item.getWindupProgress(weapon, event.entity));
}
@SubscribeEvent
@@ -1,9 +1,11 @@
package tconstruct.weaponry.client.entity;
import org.lwjgl.opengl.GL11;
import tconstruct.weaponry.entity.ArrowEntity;
public class ArrowEntityRenderer extends ProjectileBaseRenderer<ArrowEntity> {
private int count = 0;
private final float size;
@@ -1,12 +1,14 @@
package tconstruct.weaponry.client.entity;
import org.lwjgl.opengl.GL11;
import tconstruct.weaponry.entity.JavelinEntity;
public class JavelinEntityRenderer extends ProjectileBaseRenderer<JavelinEntity> {
@Override
public void customRendering(
JavelinEntity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
public void customRendering(JavelinEntity entity, double x, double y, double z, float p_76986_8_,
float p_76986_9_) {
// rotate it into the direction we threw it
GL11.glRotatef(entity.rotationYaw, 0f, 1f, 0f);
@@ -6,22 +6,20 @@ import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.client.FlexibleToolRenderer;
import tconstruct.library.entity.ProjectileBase;
public class ProjectileBaseRenderer<T extends ProjectileBase> extends Render {
protected static FlexibleToolRenderer toolCoreRenderer = new FlexibleToolRenderer();
@SuppressWarnings("unchecked")
@Override
public void doRender(
Entity p_76986_1_,
double p_76986_2_,
double p_76986_4_,
double p_76986_6_,
float p_76986_8_,
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_,
float p_76986_9_) {
doRender((T) p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
@@ -88,7 +86,7 @@ public class ProjectileBaseRenderer<T extends ProjectileBase> extends Render {
}
protected ResourceLocation func_110796_a(ProjectileBase par1ArrowEntity) {
return this.renderManager.renderEngine.getResourceLocation(
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
return this.renderManager.renderEngine
.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
}
}
@@ -1,13 +1,14 @@
package tconstruct.weaponry.client.entity;
import org.lwjgl.opengl.GL11;
import tconstruct.weaponry.entity.ShurikenEntity;
public class ShurikenEntityRenderer extends ProjectileBaseRenderer<ShurikenEntity> {
@Override
public void customRendering(
ShurikenEntity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
public void customRendering(ShurikenEntity entity, double x, double y, double z, float p_76986_8_,
float p_76986_9_) {
// make it smaller
GL11.glScalef(0.6F, 0.6F, 0.6F);
@@ -6,7 +6,9 @@ import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import tconstruct.client.FlexibleToolRenderer;
import tconstruct.library.weaponry.IWindup;
import tconstruct.library.weaponry.ProjectileWeapon;
@@ -15,6 +17,7 @@ import tconstruct.weaponry.ammo.ArrowAmmo;
import tconstruct.weaponry.entity.ArrowEntity;
public class BowRenderer extends FlexibleToolRenderer {
private static final ArrowEntity dummy = new ArrowEntity(null);
@Override
@@ -48,8 +51,9 @@ public class BowRenderer extends FlexibleToolRenderer {
GL11.glTranslatef(progress * -0.1f, progress * -0.125f, 0.0F);
// we're crazy, so.. render the arrow =D
ItemStack ammo = ((ProjectileWeapon) item.getItem())
.searchForAmmo(player, item); // we know it's a projectile weapon, it's a bow!
ItemStack ammo = ((ProjectileWeapon) item.getItem()).searchForAmmo(player, item); // we know it's a
// projectile weapon, it's
// a bow!
if (ammo != null) {
if (ammo.getItem() == Items.arrow) dummy.returnStack = ArrowAmmo.vanillaArrow;
else dummy.returnStack = ammo;
@@ -74,8 +78,9 @@ public class BowRenderer extends FlexibleToolRenderer {
}
} else if (type == ItemRenderType.EQUIPPED && player.isUsingItem()) {
// we're crazy, so.. render the arrow =D
ItemStack ammo = ((ProjectileWeapon) item.getItem())
.searchForAmmo(player, item); // we know it's a projectile weapon, it's a bow!
ItemStack ammo = ((ProjectileWeapon) item.getItem()).searchForAmmo(player, item); // we know it's a
// projectile weapon, it's
// a bow!
if (ammo != null) {
if (ammo.getItem() == Items.arrow || !(ammo.getItem() instanceof ArrowAmmo))
dummy.returnStack = ArrowAmmo.vanillaArrow;
@@ -5,7 +5,9 @@ import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import tconstruct.client.FlexibleToolRenderer;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.ammo.BoltAmmo;
@@ -13,6 +15,7 @@ import tconstruct.weaponry.entity.BoltEntity;
import tconstruct.weaponry.weapons.Crossbow;
public class CrossbowRenderer extends FlexibleToolRenderer {
private static final BoltEntity dummy = new BoltEntity(null);
@Override
@@ -2,7 +2,9 @@ package tconstruct.weaponry.client.item;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import tconstruct.client.AmmoItemRenderer;
import tconstruct.library.weaponry.IWindup;
@@ -13,8 +15,10 @@ public class JavelinRenderer extends AmmoItemRenderer {
GL11.glTranslatef(0.5f, 0.5f, 0);
GL11.glScalef(0.5f, 0.5f, 0.5f);
float progress = ((IWindup) item.getItem())
.getWindupProgress(item, Minecraft.getMinecraft().thePlayer); // 0.5 while not winding
float progress = ((IWindup) item.getItem()).getWindupProgress(item, Minecraft.getMinecraft().thePlayer); // 0.5
// while
// not
// winding
if (type == ItemRenderType.EQUIPPED) GL11.glRotatef(90, 0, 0, 1);
@@ -5,12 +5,15 @@ import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import tconstruct.client.AmmoItemRenderer;
import tconstruct.library.weaponry.IWindup;
public class ThrowingKnifeRenderer extends AmmoItemRenderer {
private static final Minecraft mc = Minecraft.getMinecraft();
@Override
@@ -8,12 +8,14 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import tconstruct.TConstruct;
import tconstruct.library.entity.ProjectileBase;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.util.PiercingArrowDamage;
public class ArrowEntity extends ProjectileBase {
public ArrowEntity(World world) {
super(world);
}
@@ -80,7 +82,7 @@ public class ArrowEntity extends ProjectileBase {
public boolean dealDamage(float damage, ToolCore ammo, NBTTagCompound tags, Entity entityHit) {
boolean dealtDamage = false;
// Minecraft.getMinecraft().thePlayer.sendChatMessage("Damage/Weight: " + damage + " - " +
// Minecraft.getMinecraft().thePlayer.sendChatMessage("Damage/Weight: " + damage + " - " +
// tags.getFloat("Mass"));
// we take the weight, and shift the damage done towards armor piercing, the more weight the arrow/bolt has!
@@ -5,6 +5,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class BoltEntity extends ArrowEntity {
public BoltEntity(World world) {
super(world);
this.setSize(0.3f, 0.3f);
@@ -1,13 +1,15 @@
package tconstruct.weaponry.entity;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import tconstruct.library.entity.ProjectileBase;
import tconstruct.weaponry.TinkerWeaponry;
import io.netty.buffer.ByteBuf;
public class JavelinEntity extends ProjectileBase {
public int roll = 0;
public JavelinEntity(World world) {
@@ -1,13 +1,15 @@
package tconstruct.weaponry.entity;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import tconstruct.library.entity.ProjectileBase;
import tconstruct.weaponry.TinkerWeaponry;
import io.netty.buffer.ByteBuf;
public class ShurikenEntity extends ProjectileBase {
public int spin = 0;
public int rollAngle = 0;
@@ -48,8 +50,8 @@ public class ShurikenEntity extends ProjectileBase {
@Override
protected double getGravity() {
return (this.ticksExisted / 8)
* 0.018d; // integer division. so the first 20 ticks it will have no gravity at all.
return (this.ticksExisted / 8) * 0.018d; // integer division. so the first 20 ticks it will have no gravity at
// all.
}
@Override
@@ -3,10 +3,12 @@ package tconstruct.weaponry.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import tconstruct.library.entity.ProjectileBase;
import tconstruct.weaponry.TinkerWeaponry;
public class ThrowingKnifeEntity extends ProjectileBase {
public ThrowingKnifeEntity(World world) {
super(world);
}
@@ -1,17 +1,20 @@
package tconstruct.weaponry.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import tconstruct.items.tools.Broadsword;
import tconstruct.util.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Boneana extends Broadsword {
private IIcon brokenIcon;
@Override
@@ -1,6 +1,7 @@
package tconstruct.weaponry.items;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -8,11 +9,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.StatCollector;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.util.Reference;
import tconstruct.weaponry.ammo.ArrowAmmo;
public class GlassArrows extends ArrowAmmo {
public GlassArrows() {
super();
this.setUnlocalizedName(Reference.prefix("glassArrows"));
@@ -29,8 +32,8 @@ public class GlassArrows extends ArrowAmmo {
ItemStack handleStack = new ItemStack(getHandleItem(), 1, 0); // wooden shaft
ItemStack accessoryStack = new ItemStack(getAccessoryItem(), 1, 0); // feather fletchling
ItemStack tool = ToolBuilder.instance.buildTool(
headStack, handleStack, accessoryStack, null, this.getLocalizedToolName());
ItemStack tool = ToolBuilder.instance
.buildTool(headStack, handleStack, accessoryStack, null, this.getLocalizedToolName());
if (tool != null) {
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
} else return;
@@ -1,14 +1,17 @@
package tconstruct.weaponry.items;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import tconstruct.tools.items.Pattern;
import tconstruct.util.Reference;
public class WeaponryPattern extends Pattern {
private static final String[] patternName = new String[] {"shuriken", "crossbowlimb", "crossbowbody", "bowlimb"};
private static final String[] patternName = new String[] { "shuriken", "crossbowlimb", "crossbowbody", "bowlimb" };
public WeaponryPattern(String patternType, String name) {
super(patternName, getPatternNames(patternName, patternType), "patterns/");
@@ -1,14 +1,17 @@
package tconstruct.weaponry.items;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import tconstruct.tools.items.Pattern;
import tconstruct.util.Reference;
public class WeaponryPatternClay extends Pattern {
private static final String[] patternName = new String[] {"", "", "", "bowlimb"};
private static final String[] patternName = new String[] { "", "", "", "bowlimb" };
public WeaponryPatternClay(String patternType, String name) {
super(patternName, getPatternNames(patternName, patternType), "patterns/");
@@ -1,8 +1,9 @@
package tconstruct.weaponry.weapons;
import cpw.mods.fml.common.Loader;
import java.util.List;
import mods.battlegear2.api.core.InventoryPlayerBattle;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@@ -11,6 +12,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.AbilityHelper;
@@ -22,16 +24,17 @@ import tconstruct.util.Reference;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.ammo.BoltAmmo;
import tconstruct.weaponry.entity.BoltEntity;
import cpw.mods.fml.common.Loader;
public class Crossbow extends ProjectileWeapon {
public Crossbow() {
super(0, "Crossbow");
this.setMaxDamage(100);
}
public boolean isLoaded(ItemStack itemStack) {
if (itemStack.hasTagCompound())
return isLoaded(itemStack.getTagCompound().getCompoundTag("InfiTool"));
if (itemStack.hasTagCompound()) return isLoaded(itemStack.getTagCompound().getCompoundTag("InfiTool"));
return false;
}
@@ -116,10 +119,9 @@ public class Crossbow extends ProjectileWeapon {
if (tags.getBoolean("Broken")) return;
// has ammo?
if (searchForAmmo(player, stack) != null)
if (!tags.hasKey("Reloading"))
// start reloading
tags.setInteger("Reloading", getWindupTime(stack));
if (searchForAmmo(player, stack) != null) if (!tags.hasKey("Reloading"))
// start reloading
tags.setInteger("Reloading", getWindupTime(stack));
}
// called after the reloading is done. Does the actual loading
@@ -223,8 +225,7 @@ public class Crossbow extends ProjectileWeapon {
// arrow priority: hotbar > inventory, tinker arrows > regular arrows
if (Loader.isModLoaded("battlegear2")) {
ItemStack offhand = ((InventoryPlayerBattle) player.inventory).getCurrentOffhandWeapon();
if (offhand != null
&& (offhand.getItem() instanceof BoltAmmo)
if (offhand != null && (offhand.getItem() instanceof BoltAmmo)
&& ((IAmmo) offhand.getItem()).getAmmoCount(offhand) > 0) {
return offhand;
}
@@ -247,8 +248,8 @@ public class Crossbow extends ProjectileWeapon {
}
@Override
protected Entity createProjectile(
ItemStack ammo, World world, EntityPlayer player, float speed, float accuracy, float windup) {
protected Entity createProjectile(ItemStack ammo, World world, EntityPlayer player, float speed, float accuracy,
float windup) {
EntityArrow arrow;
ItemStack reference = ammo.copy();
@@ -276,8 +277,8 @@ public class Crossbow extends ProjectileWeapon {
}
@Override
public void playFiringSound(
World world, EntityPlayer player, ItemStack weapon, ItemStack ammo, float speed, float accuracy) {
public void playFiringSound(World world, EntityPlayer player, ItemStack weapon, ItemStack ammo, float speed,
float accuracy) {
world.playSoundAtEntity(player, "random.bow", 1.0F, 0.5F);
}
@@ -386,7 +387,7 @@ public class Crossbow extends ProjectileWeapon {
@Override
public String[] getTraits() {
return new String[] {"weapon", "bow", "windup"};
return new String[] { "weapon", "bow", "windup" };
}
@Override
@@ -1,21 +1,23 @@
package tconstruct.weaponry.weapons;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.library.tools.AbilityHelper;
import tconstruct.library.weaponry.AmmoWeapon;
import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.client.CrosshairType;
import tconstruct.weaponry.entity.JavelinEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Javelin extends AmmoWeapon {
public Javelin() {
super(3, "Javelin");
}
@@ -158,7 +160,7 @@ public class Javelin extends AmmoWeapon {
@Override
public String[] getTraits() {
return new String[] {"weapon", "thrown", "ammo", "windup"};
return new String[] { "weapon", "thrown", "ammo", "windup" };
}
@Override
@@ -6,12 +6,14 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.library.weaponry.BowBaseAmmo;
import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.ammo.ArrowAmmo;
public class LongBow extends BowBaseAmmo {
public LongBow() {
super(0, "Longbow");
}
@@ -32,8 +34,8 @@ public class LongBow extends BowBaseAmmo {
}
@Override
protected Entity createProjectile(
ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy, float windup) {
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy,
float windup) {
if (arrows.getItem() instanceof ArrowAmmo) {
// modify accuraccy of the arrow depending on its accuraccy and weight
NBTTagCompound tags = arrows.getTagCompound().getCompoundTag("InfiTool");
@@ -1,7 +1,5 @@
package tconstruct.weaponry.weapons;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -9,11 +7,15 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.library.weaponry.BowBaseAmmo;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.ammo.ArrowAmmo;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ShortBow extends BowBaseAmmo {
public ShortBow() {
super(0, "Shortbow");
}
@@ -29,8 +31,8 @@ public class ShortBow extends BowBaseAmmo {
}
@Override
protected Entity createProjectile(
ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy, float windup) {
protected Entity createProjectile(ItemStack arrows, World world, EntityPlayer player, float speed, float accuracy,
float windup) {
if (arrows.getItem() instanceof ArrowAmmo) {
// modify accuraccy of the arrow depending on its accuraccy and weight
NBTTagCompound tags = arrows.getTagCompound().getCompoundTag("InfiTool");
@@ -1,9 +1,8 @@
package tconstruct.weaponry.weapons;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -12,11 +11,14 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import tconstruct.client.IconFlipped;
import tconstruct.library.weaponry.AmmoWeapon;
import tconstruct.weaponry.TinkerWeaponry;
import tconstruct.weaponry.client.CrosshairType;
import tconstruct.weaponry.entity.ShurikenEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class Shuriken extends AmmoWeapon {
@@ -1,20 +1,22 @@
package tconstruct.weaponry.weapons;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import tconstruct.library.entity.ProjectileBase;
import tconstruct.library.weaponry.AmmoWeapon;
import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.client.CrosshairType;
import tconstruct.weaponry.entity.ThrowingKnifeEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ThrowingKnife extends AmmoWeapon {
public ThrowingKnife() {
super(1, "throwingknife");
}