mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 20:22:36 +00:00
Merge branch 'master' into weaponry
Conflicts: src/main/java/tconstruct/items/tools/Arrow.java src/main/java/tconstruct/tools/TinkerTools.java
This commit is contained in:
commit
f31e41447c
11 files changed
+85
-79
No files matched your search
@@ -37,6 +37,7 @@ public class TravelWings extends TravelGear
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
super.onArmorTick(world, player, itemStack);
|
||||
NBTTagCompound tag = itemStack.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
int feather = tag.getInteger("Feather Fall");
|
||||
if (feather > 0)
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.tools.CustomMaterial;
|
||||
import tconstruct.library.tools.FletchingMaterial;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
@@ -47,8 +48,11 @@ public class Arrow extends ToolCore
|
||||
@Override
|
||||
protected int getDefaultColor(int renderPass, int materialID) {
|
||||
// fletchling uses custom material
|
||||
if(renderPass == 2)
|
||||
return TConstructRegistry.getCustomMaterial(materialID, FletchingMaterial.class).color;
|
||||
if(renderPass == 2) {
|
||||
CustomMaterial mat = TConstructRegistry.getCustomMaterial(materialID, FletchingMaterial.class);
|
||||
if(mat != null)
|
||||
return mat.color;
|
||||
}
|
||||
|
||||
return super.getDefaultColor(renderPass, materialID);
|
||||
}
|
||||
|
||||
@@ -221,6 +221,7 @@ public class TConstructRegistry
|
||||
public static HashMap<Integer, ToolMaterial> toolMaterials = new HashMap<Integer, ToolMaterial>(40);
|
||||
public static HashMap<String, ToolMaterial> toolMaterialStrings = new HashMap<String, ToolMaterial>(40);
|
||||
public static List<Integer> defaultToolPartMaterials = new LinkedList<Integer>();
|
||||
public static List<Integer> defaultShardMaterials = new LinkedList<Integer>();
|
||||
|
||||
public static void addDefaultToolPartMaterial(int materialID)
|
||||
{
|
||||
@@ -230,6 +231,14 @@ public class TConstructRegistry
|
||||
defaultToolPartMaterials.add(materialID);
|
||||
}
|
||||
|
||||
public static void addDefaultShardMaterial(int materialID)
|
||||
{
|
||||
if(!toolMaterials.containsKey(materialID))
|
||||
logger.error("[TCon API] Can't add default shard: Material ID " + materialID + " is unknown.");
|
||||
else
|
||||
defaultShardMaterials.add(materialID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tool material to the registry
|
||||
*
|
||||
|
||||
@@ -66,7 +66,9 @@ public abstract class AOEHarvestTool extends HarvestTool {
|
||||
// don't break the originally already broken block, duh
|
||||
if (xPos == x && yPos == y && zPos == z)
|
||||
continue;
|
||||
breakExtraBlock(player.worldObj, xPos, yPos, zPos, sideHit, player, x,y,z);
|
||||
|
||||
if(!super.onBlockStartBreak(stack, xPos, yPos, zPos, player))
|
||||
breakExtraBlock(player.worldObj, xPos, yPos, zPos, sideHit, player, x,y,z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package tconstruct.modifiers.armor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.library.modifier.ItemModifier;
|
||||
|
||||
public class TravelModRepair extends ItemModifier
|
||||
@@ -110,4 +111,9 @@ public class TravelModRepair extends ItemModifier
|
||||
{
|
||||
//Nope
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validType(IModifyable input) {
|
||||
return input.getModifyType().equals("Clothing");
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,9 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl
|
||||
{
|
||||
// Check that the drain is coming from the from the front of the block
|
||||
// and that the fluid to be drained is in the smeltery.
|
||||
if(!hasValidMaster())
|
||||
return false;
|
||||
|
||||
boolean containsFluid = fluid == null;
|
||||
if (fluid != null)
|
||||
{
|
||||
|
||||
@@ -174,7 +174,7 @@ public class TinkerTools
|
||||
|
||||
TinkerTools.materials = new MaterialItem().setUnlocalizedName("tconstruct.Materials");
|
||||
TinkerTools.toolRod = new DynamicToolPart("_rod", "ToolRod");
|
||||
TinkerTools.toolShard = new ToolShard("_chunk").setUnlocalizedName("tconstruct.ToolShard");
|
||||
TinkerTools.toolShard = new ToolShard("_chunk", "ToolShard");
|
||||
TinkerTools.woodPattern = new Pattern("pattern_", "materials/").setUnlocalizedName("tconstruct.Pattern");
|
||||
GameRegistry.registerItem(TinkerTools.materials, "materials");
|
||||
GameRegistry.registerItem(TinkerTools.woodPattern, "woodPattern");
|
||||
@@ -692,6 +692,9 @@ public class TinkerTools
|
||||
TConstructRegistry.addBowstringMaterial(1, 2, new ItemStack((Item) obj, 1, 7), new ItemStack(TinkerWeaponry.bowstring, 1, 1), 1F, 1F, 0.9f, 0x63bcd9);
|
||||
TConstructRegistry.addBowMaterial(31, 40, 1.2f);
|
||||
TConstructRegistry.addArrowMaterial(31, 1.8F, 0.5F);
|
||||
|
||||
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Thaumium);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Thaumium);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -755,6 +758,31 @@ public class TinkerTools
|
||||
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.BlueSlime );
|
||||
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.PigIron);
|
||||
|
||||
// Register all the materials for default toolparts
|
||||
//TConstructRegistry.addDefaultShardMaterial(MaterialID.Wood);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Stone);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Flint);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Cactus);
|
||||
//TConstructRegistry.addDefaultShardMaterial(MaterialID.Bone);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Obsidian);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Netherrack);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Slime);
|
||||
//TConstructRegistry.addDefaultShardMaterial(MaterialID.Paper);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.BlueSlime );
|
||||
|
||||
if(PHConstruct.craftMetalTools)
|
||||
{
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Iron);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Cobalt);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Ardite);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Manyullyn);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Copper);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Bronze);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Alumite);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.Steel);
|
||||
TConstructRegistry.addDefaultShardMaterial(MaterialID.PigIron);
|
||||
}
|
||||
|
||||
PatternBuilder pb = PatternBuilder.instance;
|
||||
if (PHConstruct.enableTWood)
|
||||
pb.registerFullMaterial(Blocks.planks, 2, "Wood", new ItemStack(Items.stick), new ItemStack(Items.stick), 0);
|
||||
|
||||
@@ -1,68 +1,29 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.*;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.DynamicToolPart;
|
||||
|
||||
public class ToolShard extends ToolPart
|
||||
import java.util.List;
|
||||
|
||||
public class ToolShard extends DynamicToolPart
|
||||
{
|
||||
|
||||
public ToolShard(String tex)
|
||||
public ToolShard(String tex, String name)
|
||||
{
|
||||
super(tex, "ToolShard");
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (!toolTextureNames[i].equals(""))
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
super(tex, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
public void getSubItems (Item item, CreativeTabs tab, List list)
|
||||
{
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
// material id == metadata
|
||||
for(Integer matID : TConstructRegistry.defaultShardMaterials) {
|
||||
ItemStack stack = new ItemStack(item, 1, matID);
|
||||
if (this.getMaterialID(stack) != -1)
|
||||
list.add(stack);
|
||||
}
|
||||
icons[5] = icons[4];
|
||||
for (int i = 6; i < 9; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
icons[9] = icons[8];
|
||||
for (int i = 10; i < icons.length; ++i)
|
||||
{
|
||||
if (!toolTextureNames[i].equals(""))
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 1; i < 5; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
for (int i = 6; i < 9; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
for (int i = 10; i < 19; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
|
||||
if (TinkerTools.thaumcraftAvailable)
|
||||
list.add(new ItemStack(b, 1, 31));
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,13 @@ public final class IMCHandler {
|
||||
ItemStack shard = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Shard")); // optional
|
||||
ItemStack rod = new ItemStack(TinkerTools.toolRod, 1, matID);
|
||||
|
||||
// default shard if none present. Has to exist because old code.
|
||||
if(shard == null)
|
||||
{
|
||||
TConstructRegistry.addDefaultShardMaterial(matID);
|
||||
shard = new ItemStack(TinkerTools.toolShard, 1, matID);
|
||||
}
|
||||
|
||||
// register the material
|
||||
PatternBuilder.instance.registerFullMaterial(item, value, TConstructRegistry.getMaterial(matID).materialName, shard, rod, matID);
|
||||
|
||||
|
||||
Reference in new issue
Block a user