diff options
Diffstat (limited to 'src/main')
19 files changed, 898 insertions, 1009 deletions
diff --git a/src/main/java/lance5057/tDefense/TinkersDefense.java b/src/main/java/lance5057/tDefense/TinkersDefense.java index 515223c..b57de06 100644 --- a/src/main/java/lance5057/tDefense/TinkersDefense.java +++ b/src/main/java/lance5057/tDefense/TinkersDefense.java @@ -327,6 +327,7 @@ public class TinkersDefense { core.preInit(e); armor.preInit(e); holiday.preInit(e); + mats.registerMaterials(); tools.preInit(e); baubles.preInit(e); proxy.preInit(); diff --git a/src/main/java/lance5057/tDefense/armor/ArmorBase.java b/src/main/java/lance5057/tDefense/armor/ArmorBase.java index 7c64347..f89a96a 100644 --- a/src/main/java/lance5057/tDefense/armor/ArmorBase.java +++ b/src/main/java/lance5057/tDefense/armor/ArmorBase.java @@ -36,7 +36,7 @@ import slimeknights.tconstruct.tools.TinkerTools; public class ArmorBase extends ModuleBase { public static CreativeTabs tabName; - private static List<ToolCore> tools = Lists.newLinkedList(); + private static List<Item> tools = Lists.newLinkedList(); private static List<ToolPart> toolParts = Lists.newLinkedList(); private static List<IModifier> modifiers = Lists.newLinkedList(); private static List<Pair<Item, ToolPart>> toolPartPatterns = Lists.newLinkedList(); @@ -64,7 +64,7 @@ public class ArmorBase extends ModuleBase { public static Material orange; public static Material white; - public static ToolCore armor_TinkerHood; + public static ArmorCore armor_TinkerHood; public static ToolCore armor_TinkerShawl; public static ToolCore armor_TinkerRobe; public static ToolCore armor_TinkerShoes; @@ -103,14 +103,13 @@ public class ArmorBase extends ModuleBase { registerStencil(toolPartPattern.getLeft(), toolPartPattern.getRight()); } - + //regTool(armor_TinkerHood, "tinkerhood"); registerTools(); } @Override public void init(FMLInitializationEvent e) { - // TODO Auto-generated method stub - + regToolBuilding(); } @Override @@ -238,10 +237,14 @@ public class ArmorBase extends ModuleBase { { armor_TinkerHood = new TinkersHood(); regTool(armor_TinkerHood, "tinkerhood"); - TinkerRegistry.registerToolCrafting(armor_TinkerHood); + //TinkerRegistry.registerToolCrafting(armor_TinkerHood); } - private static <T extends ToolCore> T registerTool(T item, String name) { + private void regToolBuilding() { + TinkerRegistry.registerToolCrafting(armor_TinkerHood); + } + + private static <T extends Item> T registerTool(T item, String name) { tools.add(item); return registerItem(item, name); } diff --git a/src/main/java/lance5057/tDefense/armor/ArmorCore.java b/src/main/java/lance5057/tDefense/armor/ArmorCore.java index f42fc11..6feb85b 100644 --- a/src/main/java/lance5057/tDefense/armor/ArmorCore.java +++ b/src/main/java/lance5057/tDefense/armor/ArmorCore.java @@ -16,14 +16,13 @@ import gnu.trove.set.hash.THashSet; import lance5057.tDefense.armor.events.ArmorBaseEvents; import lance5057.tDefense.armor.materials.MaterialArmor; import lance5057.tDefense.armor.materials.MaterialCloth; -import lance5057.tDefense.armor.util.ArmorBuilder; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemArmor; +import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -50,20 +49,18 @@ import slimeknights.tconstruct.library.tinkering.ITinkerable; import slimeknights.tconstruct.library.tinkering.IToolStationDisplay; import slimeknights.tconstruct.library.tinkering.IndestructibleEntityItem; import slimeknights.tconstruct.library.tinkering.PartMaterialType; +import slimeknights.tconstruct.library.tools.ToolCore; +import slimeknights.tconstruct.library.tools.ToolNBT; import slimeknights.tconstruct.library.traits.ITrait; import slimeknights.tconstruct.library.utils.TagUtil; import slimeknights.tconstruct.library.utils.Tags; import slimeknights.tconstruct.library.utils.TinkerUtil; -import slimeknights.tconstruct.library.utils.ToolBuilder; +import slimeknights.tconstruct.library.utils.ToolBuilder; import slimeknights.tconstruct.library.utils.ToolHelper; import slimeknights.tconstruct.library.utils.TooltipBuilder; -//@Optional.InterfaceList({@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.IRunicArmor", striprefs = true), @Optional.Interface(modid = "Botania", iface = "vazkii.botania.api.item.IPixieSpawner", striprefs = true)}) -public abstract class ArmorCore extends ItemArmor implements ISpecialArmor, ITinkerable, IModifyable, IRepairable, IToolStationDisplay// , - // IRunicArmor, - // IPixieSpawner +public abstract class ArmorCore extends ToolCore { - public final EntityEquipmentSlot armorType; public float reductionPercent = 0f; public int maxReduction = 100; @@ -74,493 +71,14 @@ public abstract class ArmorCore extends ItemArmor implements ISpecialArmor, ITin protected static PartMaterialType ClothMat = new PartMaterialType(ArmorBase.cloth, MaterialCloth.TYPE); - ArmorProperties armorp;// = new ArmorProperties(0,0,0); - /// public String[] renderParts; - - // Thaumcraft - boolean Charge = false; - -// public ArmorCore(EntityEquipmentSlot slot, PartMaterialType... requiredComponents) { -// //super(requiredComponents); -// armorType = slot; -// //armorp = prop; -// -// //MinecraftForge.EVENT_BUS.register(this); -// } - - @SideOnly(Side.CLIENT) - public EntityEquipmentSlot getEquipmentSlot() { - return this.armorType; - } - - @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, - int slot) { - - if (!source.isUnblockable()) { - return armorp; - } else { - return new ArmorProperties(0, 0, 0); - } - - + public ArmorCore(PartMaterialType... rc) { + super(rc); } @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - return (int) ((int) reductionPercent / 0.04); - } - - protected final PartMaterialType[] requiredComponents; - // used to classify what the thing can do - protected final Set<Category> categories = new THashSet<Category>(); - - public ArmorCore(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn, ArmorProperties prop, PartMaterialType... requiredComponents) { - super(materialIn, renderIndexIn, equipmentSlotIn); - - this.requiredComponents = requiredComponents; - - this.setMaxStackSize(1); - - - armorp = prop; - armorType = equipmentSlotIn; - //this.setHasSubtypes(true); - } - - /* Tool Information */ - public List<PartMaterialType> getRequiredComponents() { - return ImmutableList.copyOf(requiredComponents); - } - - public List<PartMaterialType> getToolBuildComponents() { - return getRequiredComponents(); - } - - protected void addCategory(Category... categories) { - Collections.addAll(this.categories, categories); - } - - public boolean hasCategory(Category category) { - return categories.contains(category); - } - - protected Category[] getCategories() { - Category[] out = new Category[categories.size()]; - int i = 0; - for(Category category : categories) { - out[i++] = category; - } - - return out; - } - - /* INDESTRUCTIBLE */ - - @Override - public boolean hasCustomEntity(ItemStack stack) { - return true; - } - - @Nonnull - @Override - public Entity createEntity(World world, Entity location, ItemStack itemstack) { - EntityItem entity = new IndestructibleEntityItem(world, location.posX, location.posY, location.posZ, itemstack); - if(location instanceof EntityItem) { - // workaround for private access on that field >_> - NBTTagCompound tag = new NBTTagCompound(); - location.writeToNBT(tag); - entity.setPickupDelay(tag.getShort("PickupDelay")); - } - entity.motionX = location.motionX; - entity.motionY = location.motionY; - entity.motionZ = location.motionZ; - return entity; - } - - /* Building the Item */ - public boolean validComponent(int slot, ItemStack stack) { - if(slot > requiredComponents.length || slot < 0) { - return false; - } - - return requiredComponents[slot].isValid(stack); - } - - - /** - * Builds an Itemstack of this tool with the given materials, if applicable. - * - * @param stacks Items to build with. Have to be in the correct order and have exact length. No nulls! - * @return The built item or null if invalid input. - */ - public ItemStack buildItemFromStacks(ItemStack[] stacks) { - List<Material> materials = new ArrayList<Material>(stacks.length); - - if(stacks.length != requiredComponents.length) { - return null; - } - - // not a valid part arrangement for this tool - for(int i = 0; i < stacks.length; i++) { - if(!validComponent(i, stacks[i])) { - return null; - } - - materials.add(TinkerUtil.getMaterialFromStack(stacks[i])); - } - - return buildItem(materials); - } - - /** - * Builds an Itemstack of this tool with the given materials. - * - * @param materials Materials to build with. Have to be in the correct order. No nulls! - * @return The built item or null if invalid input. - */ - public ItemStack buildItem(List<Material> materials) { - ItemStack tool = new ItemStack(this); - tool.setTagCompound(buildItemNBT(materials)); - - return tool; - } - - /** - * Builds the NBT for a new tinker item with the given data. - * - * @param materials Materials to build with. Have to be in the correct order. No nulls! - * @return The built nbt - */ - public NBTTagCompound buildItemNBT(List<Material> materials) { - NBTTagCompound basetag = new NBTTagCompound(); - NBTTagCompound toolTag = buildTag(materials); - NBTTagCompound dataTag = buildData(materials); - - basetag.setTag(Tags.BASE_DATA, dataTag); - basetag.setTag(Tags.TOOL_DATA, toolTag); - // copy of the original tool data - basetag.setTag(Tags.TOOL_DATA_ORIG, toolTag.copy()); - - // save categories on the tool - TagUtil.setCategories(basetag, getCategories()); - - // add traits - addMaterialTraits(basetag, materials); - - // fire toolbuilding event - ArmorBaseEvents.OnArmorBuilding.fireEvent(basetag, ImmutableList.copyOf(materials), this); - - return basetag; - } - - /** - * Creates an NBT Tag with the materials that were used to build the item. - */ - private NBTTagCompound buildData(List<Material> materials) { - NBTTagCompound base = new NBTTagCompound(); - NBTTagList materialList = new NBTTagList(); - - for(Material material : materials) { - materialList.appendTag(new NBTTagString(material.identifier)); - } - - // pre-type base-modifier list - NBTTagList modifierList = new NBTTagList(); - // we cannot set the type directly, but it gets typed by adding a tag, so we add and remove one - modifierList.appendTag(new NBTTagString()); - modifierList.removeTag(0); - - base.setTag(Tags.BASE_MATERIALS, materialList); - base.setTag(Tags.BASE_MODIFIERS, modifierList); - - return base; - } - - /** - * Builds an unusable tool that only has the rendering info - */ - public ItemStack buildItemForRendering(List<Material> materials) { - ItemStack tool = new ItemStack(this); - NBTTagCompound base = new NBTTagCompound(); - base.setTag(Tags.BASE_DATA, buildData(materials)); - tool.setTagCompound(base); - - return tool; - } - - public ItemStack buildItemForRenderingInGui() { - List<Material> materials = IntStream.range(0, getRequiredComponents().size()) - .mapToObj(this::getMaterialForPartForGuiRendering) - .collect(Collectors.toList()); - - return buildItemForRendering(materials); - } - - @SideOnly(Side.CLIENT) - public Material getMaterialForPartForGuiRendering(int index) { - return ClientProxy.RenderMaterials[index % ClientProxy.RenderMaterials.length]; - } - - public abstract NBTTagCompound buildTag(List<Material> materials); - - /** Checks whether an Item built from materials has only valid materials. Uses the standard NBT to determine materials. */ - public boolean hasValidMaterials(ItemStack stack) { - // checks if the materials used support all stats needed - NBTTagList list = TagUtil.getBaseMaterialsTagList(stack); - List<Material> materials = TinkerUtil.getMaterialsFromTagList(list); - - // something went wrooooong - if(materials.size() != requiredComponents.length) { - return false; - } - - // check if all materials used have the stats needed - for(int i = 0; i < materials.size(); i++) { - Material material = materials.get(i); - PartMaterialType required = requiredComponents[i]; - if(!required.isValidMaterial(material)) { - return false; - } - } - - return true; - } - - public void addMaterialTraits(NBTTagCompound root, List<Material> materials) { - int size = requiredComponents.length; - // safety - if(materials.size() < size) { - size = materials.size(); - } - // add corresponding traits per material usage - for(int i = 0; i < size; i++) { - PartMaterialType required = requiredComponents[i]; - Material material = materials.get(i); - for(ITrait trait : required.getApplicableTraitsForMaterial(material)) { - ToolBuilder.addTrait(root, trait, material.materialTextColor); - } - } - } - - /* Repairing */ - - /** Returns indices of the parts that are used for repairing */ - public int[] getRepairParts() { - return new int[]{1}; // index 1 usually is the head. 0 is handle. - } - - public float getRepairModifierForPart(int index) { - return 1f; - } - - @Override - public ItemStack repair(ItemStack repairable, ItemStack[] repairItems) { - if(repairable.getItemDamage() == 0 && !ToolHelper.isBroken(repairable)) { - // undamaged and not broken - no need to repair - return null; - } - - // we assume the first required part exclusively determines repair material - List<Material> materials = TinkerUtil.getMaterialsFromTagList(TagUtil.getBaseMaterialsTagList(repairable)); - if(materials.isEmpty()) { - return null; - } - - // ensure the items only contain valid items - ItemStack[] items = Util.copyItemStackArray(repairItems); - boolean foundMatch = false; - for(int index : getRepairParts()) { - Material material = materials.get(index); - - if(repairCustom(material, items) > 0) { - foundMatch = true; - } - - RecipeMatch.Match match = material.matches(items); - - // not a single match -> nothing to repair with - if(match == null) { - continue; - } - foundMatch = true; - - while((match = material.matches(items)) != null) { - RecipeMatch.removeMatch(items, match); - } - } - - if(!foundMatch) { - return null; - } - - // check if all items were used - for(int i = 0; i < repairItems.length; i++) { - // was non-null and did not get modified (stacksize changed or null now, usually) - if(repairItems[i] != null && ItemStack.areItemStacksEqual(repairItems[i], items[i])) { - // found an item that was not touched - return null; - } - } - - // now do it all over again with the real items, to actually repair \o/ - ItemStack item = repairable.copy(); - - while(item.getItemDamage() > 0) { - int amount = calculateRepairAmount(materials, repairItems); - - // nothing to repair with, we're therefore done - if(amount <= 0) { - break; - } - - ToolHelper.repairTool(item, calculateRepair(item, amount)); - // save that we repaired it :I - NBTTagCompound tag = TagUtil.getExtraTag(item); - TagUtil.addInteger(tag, Tags.REPAIR_COUNT, 1); - TagUtil.setExtraTag(item, tag); - } - - return item; - } - - /** Allows for custom repair items. Remove used items from the array. */ - protected int repairCustom(Material material, ItemStack[] repairItems) { - return 0; - } - - protected int calculateRepairAmount(List<Material> materials, ItemStack[] repairItems) { - Set<Material> materialsMatched = Sets.newHashSet(); - float durability = 0f; - // try to match each material once - for(int index : getRepairParts()) { - Material material = materials.get(index); - - if(materialsMatched.contains(material)) { - continue; - } - - // custom repairing - durability += repairCustom(material, repairItems) * getRepairModifierForPart(index); - - RecipeMatch.Match match = material.matches(repairItems); - if(match != null) { - HeadMaterialStats stats = material.getStats(MaterialTypes.HEAD); - if(stats != null) { - materialsMatched.add(material); - durability += ((float) stats.durability * (float) match.amount * getRepairModifierForPart(index)) / 144f; - RecipeMatch.removeMatch(repairItems, match); - } - } - } - - durability *= 1f + ((float) materialsMatched.size() - 1) / 9f; - - return (int) durability; - } - - protected int calculateRepair(ItemStack tool, int amount) { - float origDur = TagUtil.getOriginalToolStats(tool).durability; - float actualDur = ToolHelper.getDurabilityStat(tool); - - // calculate in modifiers that change the total durability of a tool, like diamond - // they should not punish the player with higher repair costs - float durabilityFactor = actualDur / origDur; - float increase = (float) amount * Math.min(10f, durabilityFactor); - - increase = Math.max(increase, actualDur / 64f); - //increase = Math.max(50, increase); - - - int modifiersUsed = TagUtil.getBaseModifiersUsed(tool.getTagCompound()); - float mods = 1.0f; - if(modifiersUsed == 1) { - mods = 0.95f; - } - else if(modifiersUsed == 2) { - mods = 0.9f; - } - else if(modifiersUsed >= 3) { - mods = 0.85f; - } - - increase *= mods; - - NBTTagCompound tag = TagUtil.getExtraTag(tool); - int repair = tag.getInteger(Tags.REPAIR_COUNT); - float repairDimishingReturns = (100 - repair / 2) / 100f; - if(repairDimishingReturns < 0.5f) { - repairDimishingReturns = 0.5f; - } - increase *= repairDimishingReturns; - - return (int) Math.ceil(increase); - } - - /* Information */ - - @Override - public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, - boolean advanced) { - boolean shift = Util.isShiftKeyDown(); - boolean ctrl = Util.isCtrlKeyDown(); - // modifiers - if(!shift && !ctrl) { - getTooltip(stack, tooltip); - - tooltip.add(""); - // info tooltip for detailed and componend info - tooltip.add(Util.translate("tooltip.tool.holdShift")); - tooltip.add(Util.translate("tooltip.tool.holdCtrl")); - - tooltip.add(TextFormatting.BLUE + - I18n.translateToLocalFormatted("attribute.modifier.plus.0", - Util.df.format(ToolHelper.getActualDamage(stack, playerIn)), - I18n - .translateToLocal("attribute.name.generic.attackDamage"))); - } - // detailed data - else if(Config.extraTooltips && shift) { - getTooltipDetailed(stack, tooltip); - } - // component data - else if(Config.extraTooltips && ctrl) { - getTooltipComponents(stack, tooltip); - } - } - - @Override - public void getTooltip(ItemStack stack, List<String> tooltips) { - // Default tooltip: modifiers - TooltipBuilder.addModifierTooltips(stack,tooltips); - } - - @Nonnull - @Override - public EnumRarity getRarity(ItemStack stack) { - // prevents enchanted items to have a different name color - return EnumRarity.COMMON; - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - /* NBT loading */ - - @Override - public boolean updateItemStackNBT(NBTTagCompound nbt) { - // when the itemstack is loaded from NBT we recalculate all the data - if(nbt.hasKey(Tags.BASE_DATA)) { - try { - ArmorBuilder.rebuildTool(nbt, this); - } catch(TinkerGuiException e) { - // nothing to do - } - } - - // return value shouldn't matter since it's never checked - return true; + public NBTTagCompound buildTag(List<Material> materials) { + ToolNBT data = buildDefaultTag(materials); + data.durability *= 1; + return data.get(); } } diff --git a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersHood.java b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersHood.java index 2420459..5ae23e0 100644 --- a/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersHood.java +++ b/src/main/java/lance5057/tDefense/armor/items/cloth/TinkersHood.java @@ -2,9 +2,7 @@ package lance5057.tDefense.armor.items.cloth; import java.util.List; -import lance5057.tDefense.armor.ArmorBase; import lance5057.tDefense.armor.ArmorCore; -import lance5057.tDefense.armor.materials.MaterialArmor; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.inventory.EntityEquipmentSlot; @@ -13,8 +11,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import slimeknights.tconstruct.library.materials.Material; -import slimeknights.tconstruct.library.tinkering.PartMaterialType; -import slimeknights.tconstruct.tools.TinkerTools; public class TinkersHood extends ArmorCore { @@ -23,8 +19,7 @@ public class TinkersHood extends ArmorCore public TinkersHood() { - super(EntityEquipmentSlot.CHEST, - ClothMat, + super(ClothMat, ClothMat, RivetMat); setUnlocalizedName("tinkerhood"); @@ -38,7 +33,7 @@ public class TinkersHood extends ArmorCore } @Override - public float damagePotential() { + public float damagePotential() { // TODO Auto-generated method stub return 0; } @@ -49,9 +44,5 @@ public class TinkersHood extends ArmorCore return 0; } - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - // TODO Auto-generated method stub - - } + } diff --git a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersBreastplate.java b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersBreastplate.java index 07905a4..d738cac 100644 --- a/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersBreastplate.java +++ b/src/main/java/lance5057/tDefense/armor/items/heavy/TinkersBreastplate.java @@ -1,64 +1,64 @@ -package lance5057.tDefense.armor.items.heavy; - -import java.util.List; - -import lance5057.tDefense.armor.ArmorCore; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.inventory.EntityEquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.DamageSource; -import slimeknights.tconstruct.library.materials.Material; -import slimeknights.tconstruct.library.tinkering.PartMaterialType; -import slimeknights.tconstruct.tools.TinkerTools; - -public class TinkersBreastplate extends ArmorCore -{ - public TinkersBreastplate() - { - super(EntityEquipmentSlot.CHEST, - PartMaterialType.head(TinkerTools.largePlate), - PartMaterialType.head(TinkerTools.largePlate), - PartMaterialType.handle(TinkerTools.toughToolRod), - PartMaterialType.extra(TinkerTools.bowString)); - setUnlocalizedName("tinkersbreastplate"); - maxReduction = 100; - reductionPercent = 8 * 0.04f; - } - - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - // TODO Auto-generated method stub - - } - - @Override - public float damagePotential() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public double attackSpeed() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public NBTTagCompound buildTag(List<Material> materials) { - // TODO Auto-generated method stub - return null; - } - -// @Override -// public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) +//package lance5057.tDefense.armor.items.heavy; +// +//import java.util.List; +// +//import lance5057.tDefense.armor.ArmorCore; +//import net.minecraft.entity.EntityLivingBase; +//import net.minecraft.inventory.EntityEquipmentSlot; +//import net.minecraft.item.ItemStack; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.util.DamageSource; +//import slimeknights.tconstruct.library.materials.Material; +//import slimeknights.tconstruct.library.tinkering.PartMaterialType; +//import slimeknights.tconstruct.tools.TinkerTools; +// +//public class TinkersBreastplate extends ArmorCore +//{ +// public TinkersBreastplate() // { -// return "tinkersdefense:textures/armor/Tinkersbreastplate.png"; +// super(EntityEquipmentSlot.CHEST, +// PartMaterialType.head(TinkerTools.largePlate), +// PartMaterialType.head(TinkerTools.largePlate), +// PartMaterialType.handle(TinkerTools.toughToolRod), +// PartMaterialType.extra(TinkerTools.bowString)); +// setUnlocalizedName("tinkersbreastplate"); +// maxReduction = 100; +// reductionPercent = 8 * 0.04f; // } // // @Override -// public ArmorRenderer getRenderer() -// { -// return ClientProxy.breastplate; +// public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { +// // TODO Auto-generated method stub +// +// } +// +// @Override +// public float damagePotential() { +// // TODO Auto-generated method stub +// return 0; // } -} +// +// @Override +// public double attackSpeed() { +// // TODO Auto-generated method stub +// return 0; +// } +// +// @Override +// public NBTTagCompound buildTag(List<Material> materials) { +// // TODO Auto-generated method stub +// return null; +// } +// +//// @Override +//// public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) +//// { +//// return "tinkersdefense:textures/armor/Tinkersbreastplate.png"; +//// } +//// +//// @Override +//// public ArmorRenderer getRenderer() +//// { +//// return ClientProxy.breastplate; +//// } +//} diff --git a/src/main/java/lance5057/tDefense/armor/proxy/ArmorClientProxy.java b/src/main/java/lance5057/tDefense/armor/proxy/ArmorClientProxy.java index cf92bd6..996822e 100644 --- a/src/main/java/lance5057/tDefense/armor/proxy/ArmorClientProxy.java +++ b/src/main/java/lance5057/tDefense/armor/proxy/ArmorClientProxy.java @@ -1,46 +1,46 @@ -package lance5057.tDefense.armor.proxy; - -import lance5057.tDefense.armor.ArmorBase; -import slimeknights.tconstruct.common.ModelRegisterUtil; -import slimeknights.tconstruct.library.TinkerRegistryClient; -import slimeknights.tconstruct.library.client.ToolBuildGuiInfo; - -public class ArmorClientProxy { - - ToolBuildGuiInfo hoodGUI; - - public void preInit() - { - registerToolRenderers(); - } - public void init() - { - createToolGuis(); - setupToolGuis(); - registerToolGuis(); - } - public void postInit(){} - - public void createToolGuis() - { - hoodGUI = new ToolBuildGuiInfo(ArmorBase.armor_TinkerHood); - } - - public void registerToolRenderers() - { - ModelRegisterUtil.registerToolModel(ArmorBase.armor_TinkerHood); - - } - public void setupToolGuis() - { - hoodGUI.positions.clear(); - hoodGUI.addSlotPosition(34, 15+8); - hoodGUI.addSlotPosition(34, 33+8); - hoodGUI.addSlotPosition(34, 51+8); - } - - public void registerToolGuis() - { - TinkerRegistryClient.addToolBuilding(hoodGUI); - } -} +//package lance5057.tDefense.armor.proxy; +// +//import lance5057.tDefense.armor.ArmorBase; +//import slimeknights.tconstruct.common.ModelRegisterUtil; +//import slimeknights.tconstruct.library.TinkerRegistryClient; +//import slimeknights.tconstruct.library.client.ToolBuildGuiInfo; +// +//public class ArmorClientProxy { +// +// ToolBuildGuiInfo hoodGUI; +// +// public void preInit() +// { +// registerToolRenderers(); +// } +// public void init() +// { +// createToolGuis(); +// setupToolGuis(); +// registerToolGuis(); +// } +// public void postInit(){} +// +// public void createToolGuis() +// { +// hoodGUI = new ToolBuildGuiInfo(ArmorBase.armor_TinkerHood); +// } +// +// public void registerToolRenderers() +// { +// ModelRegisterUtil.registerToolModel(ArmorBase.armor_TinkerHood); +// +// } +// public void setupToolGuis() +// { +// hoodGUI.positions.clear(); +// hoodGUI.addSlotPosition(34, 15+8); +// hoodGUI.addSlotPosition(34, 33+8); +// hoodGUI.addSlotPosition(34, 51+8); +// } +// +// public void registerToolGuis() +// { +// TinkerRegistryClient.addToolBuilding(hoodGUI); +// } +//} diff --git a/src/main/java/lance5057/tDefense/armor/renderers/ArmorRenderer.java b/src/main/java/lance5057/tDefense/armor/renderers/ArmorRenderer.java index 36226ed..f16df63 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/ArmorRenderer.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/ArmorRenderer.java @@ -1,98 +1,98 @@ -package lance5057.tDefense.armor.renderers; - -import java.util.ArrayList; -import java.util.List; - -import lance5057.tDefense.TinkersDefense; -import lance5057.tDefense.armor.ArmorCore; -import net.minecraft.client.model.ModelBiped; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import org.lwjgl.opengl.GL11; - -public class ArmorRenderer extends ModelBiped -{ - public String[] colors; - - public ItemStack stack; - public String defaultFolder; - - private final int[] order = new int[] {1, 2, 3, 0, 4, 5, 6, 7, 8, 9}; - - public List<ModelRenderer> boxes = new ArrayList<ModelRenderer>(); - - public NBTTagCompound defaultTags = new NBTTagCompound(); - - public ArmorRenderer(float a, float b, int c, int d) - { - super(a, b, c, d); - } - - public void init() - { - defaultTags.getCompoundTag("ArmorRenderer"); - - for(int i = 0; i < boxList.size(); i++) - { - final String rendertag = ((ModelRenderer) boxList.get(i)).boxName; - if(rendertag != null) - { - defaultTags.setBoolean(rendertag, ((ModelRenderer) boxList.get(i)).isHidden); - } - } - } - - public void SetColors(String[] colors, String defaultFolder, ItemStack stack) - { - this.colors = colors; - this.stack = stack; - this.defaultFolder = defaultFolder; - } - - @Override - public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - GL11.glPushMatrix(); - - if(TinkersDefense.config.transparency) - { - GL11.glEnable(GL11.GL_BLEND); - } - - final NBTTagCompound tags = stack.getTagCompound().getCompoundTag("ArmorRenderer"); - - for(int j = 0; j < boxList.size(); j++) - { - final ModelRenderer box = (ModelRenderer) boxList.get(j); - if(tags.hasKey(box.boxName)) - { - box.isHidden = tags.getBoolean(box.boxName); - } - } - - for(int i = 0; i < 10; i++) - { - //final String texture = ((ArmorCore) stack.getItem()).getTexture(order[i], stack); -// if(texture != "") +//package lance5057.tDefense.armor.renderers; +// +//import java.util.ArrayList; +//import java.util.List; +// +//import lance5057.tDefense.TinkersDefense; +//import lance5057.tDefense.armor.ArmorCore; +//import net.minecraft.client.model.ModelBiped; +//import net.minecraft.client.model.ModelRenderer; +//import net.minecraft.entity.Entity; +//import net.minecraft.item.ItemStack; +//import net.minecraft.nbt.NBTTagCompound; +// +//import org.lwjgl.opengl.GL11; +// +//public class ArmorRenderer extends ModelBiped +//{ +// public String[] colors; +// +// public ItemStack stack; +// public String defaultFolder; +// +// private final int[] order = new int[] {1, 2, 3, 0, 4, 5, 6, 7, 8, 9}; +// +// public List<ModelRenderer> boxes = new ArrayList<ModelRenderer>(); +// +// public NBTTagCompound defaultTags = new NBTTagCompound(); +// +// public ArmorRenderer(float a, float b, int c, int d) +// { +// super(a, b, c, d); +// } +// +// public void init() +// { +// defaultTags.getCompoundTag("ArmorRenderer"); +// +// for(int i = 0; i < boxList.size(); i++) +// { +// final String rendertag = ((ModelRenderer) boxList.get(i)).boxName; +// if(rendertag != null) // { -// GL11.glPushMatrix(); +// defaultTags.setBoolean(rendertag, ((ModelRenderer) boxList.get(i)).isHidden); +// } +// } +// } +// +// public void SetColors(String[] colors, String defaultFolder, ItemStack stack) +// { +// this.colors = colors; +// this.stack = stack; +// this.defaultFolder = defaultFolder; +// } +// +// @Override +// public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) +// { +// GL11.glPushMatrix(); +// +// if(TinkersDefense.config.transparency) +// { +// GL11.glEnable(GL11.GL_BLEND); +// } // -// //((ArmorCore) stack.getItem()).renderArmor(entity, f, f1, f2, f3, f4, f5, colors, stack, order[i]); -// super.render(entity, f, f1, f2, f3, f4, f5); +// final NBTTagCompound tags = stack.getTagCompound().getCompoundTag("ArmorRenderer"); // -// GL11.glPopMatrix(); +// for(int j = 0; j < boxList.size(); j++) +// { +// final ModelRenderer box = (ModelRenderer) boxList.get(j); +// if(tags.hasKey(box.boxName)) +// { +// box.isHidden = tags.getBoolean(box.boxName); // } - } - - if(TinkersDefense.config.transparency) - { - GL11.glDisable(GL11.GL_BLEND); - } - - GL11.glPopMatrix(); - GL11.glColor3d(1.0, 1.0, 1.0); - } -} +// } +// +// for(int i = 0; i < 10; i++) +// { +// //final String texture = ((ArmorCore) stack.getItem()).getTexture(order[i], stack); +//// if(texture != "") +//// { +//// GL11.glPushMatrix(); +//// +//// //((ArmorCore) stack.getItem()).renderArmor(entity, f, f1, f2, f3, f4, f5, colors, stack, order[i]); +//// super.render(entity, f, f1, f2, f3, f4, f5); +//// +//// GL11.glPopMatrix(); +//// } +// } +// +// if(TinkersDefense.config.transparency) +// { +// GL11.glDisable(GL11.GL_BLEND); +// } +// +// GL11.glPopMatrix(); +// GL11.glColor3d(1.0, 1.0, 1.0); +// } +//} diff --git a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersBreastplate.java b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersBreastplate.java index 3ef43ba..fded61d 100644 --- a/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersBreastplate.java +++ b/src/main/java/lance5057/tDefense/armor/renderers/heavy/ModelTinkersBreastplate.java @@ -1,176 +1,176 @@ -package lance5057.tDefense.armor.renderers.heavy; - -import lance5057.tDefense.armor.renderers.ArmorRenderer; -import net.minecraft.client.model.ModelRenderer; - -/** - * ModelBiped - Either Mojang or a mod author - * Created using Tabula 4.1.1 - */ -public class ModelTinkersBreastplate extends ArmorRenderer -{ - public ModelRenderer BackPlate; - public ModelRenderer BreastPlate; - public ModelRenderer Plackart; - public ModelRenderer WingR; - public ModelRenderer WingL; - public ModelRenderer PauldronR; - public ModelRenderer PauldronL; - public ModelRenderer ArmR; - public ModelRenderer ArmL; - public ModelRenderer PauldronExtraR; - public ModelRenderer PauldronExtraL; - public ModelRenderer PauldronR_1; - public ModelRenderer ArmR_1; - public ModelRenderer PauldronL_1; - public ModelRenderer ArmL_1; - - public ModelTinkersBreastplate() - { - super(0.1f, 0, 128, 64); - - textureWidth = 128; - textureHeight = 64; - - bipedBody = new ModelRenderer(this, "Body"); - bipedBody.setTextureOffset(16, 16); - bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.1f); - bipedBody.setRotationPoint(0.0F, 0.0F + 0, 0.0F); - - bipedRightArm = new ModelRenderer(this, "Right Arm"); - bipedRightArm.setTextureOffset(40, 16); - bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.1f); - bipedRightArm.setRotationPoint(-5.0F, 2.0F + 0, 0.0F); - - bipedLeftArm = new ModelRenderer(this, "Left Arm"); - bipedLeftArm.setTextureOffset(40, 16); - bipedLeftArm.mirror = true; - bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.1f); - bipedLeftArm.setRotationPoint(5.0F, 2.0F + 0, 0.0F); - - ArmR = new ModelRenderer(this, "Arm Right Overlay"); - ArmR.setTextureOffset(28, 44); - ArmR.mirror = true; - ArmR.setRotationPoint(0.0F, 0.0F, 0.0F); - ArmR.addBox(-4.0F, -2.2F, -3.0F, 5, 6, 6, 0.0F); - bipedRightArm.addChild(ArmR); - - ArmR_1 = new ModelRenderer(this, "Arm Overlay Right 2"); - ArmR_1.setTextureOffset(94, 0); - ArmR_1.mirror = true; - ArmR_1.setRotationPoint(-0.0F, 0.0F, 0.0F); - ArmR_1.addBox(-4.5F, -2.0F, -3.0F, 6, 7, 6, 0.1F); - setRotateAngle(ArmR_1, 0.0F, -0.0F, -0.17453292519943295F); - bipedRightArm.addChild(ArmR_1); - - ArmL = new ModelRenderer(this, "Arm Overlay Left"); - ArmL.setTextureOffset(28, 44); - ArmL.setRotationPoint(0.0F, 0.0F, 0.0F); - ArmL.addBox(-1.0F, -2.2F, -3.0F, 5, 6, 6, 0.0F); - bipedLeftArm.addChild(ArmL); - - ArmL_1 = new ModelRenderer(this, "Arm Left Overlay 2"); - ArmL_1.setTextureOffset(94, 0); - ArmL_1.setRotationPoint(0.0F, 0.0F, 0.0F); - ArmL_1.addBox(-1.0F, -2.0F, -3.0F, 6, 7, 6, 0.1F); - setRotateAngle(ArmL_1, 0.0F, -0.0F, 0.17453292519943295F); - bipedLeftArm.addChild(ArmL_1); - - PauldronL = new ModelRenderer(this, "Pauldron Left"); - PauldronL.setTextureOffset(24, 32); - PauldronL.setRotationPoint(0.0F, 0.0F, 0.0F); - PauldronL.addBox(0.6F, -2.0F, -3.5F, 4, 5, 7, 0.0F); - setRotateAngle(PauldronL, 0.0F, -0.0F, -0.4363323129985824F); - bipedLeftArm.addChild(PauldronL); - - PauldronR = new ModelRenderer(this, "Pauldron Right"); - PauldronR.setTextureOffset(24, 32); - PauldronR.mirror = true; - PauldronR.setRotationPoint(-0.0F, 0.0F, 0.0F); - PauldronR.addBox(-4.8F, -2.0F, -3.5F, 4, 5, 7, 0.0F); - setRotateAngle(PauldronR, 0.0F, -0.0F, 0.4363323129985824F); - bipedRightArm.addChild(PauldronR); - - PauldronExtraL = new ModelRenderer(this, "Pauldron Extra Left"); - PauldronExtraL.setTextureOffset(56, 19); - PauldronExtraL.setRotationPoint(0.0F, 0.0F, 0.0F); - PauldronExtraL.addBox(0.0F, -12.0F, 0.0F, 13, 18, 0, 0.0F); - bipedLeftArm.addChild(PauldronExtraL); - - PauldronExtraR = new ModelRenderer(this, "Pauldron Extra Right"); - PauldronExtraR.setTextureOffset(56, 19); - PauldronExtraR.mirror = true; - PauldronExtraR.setRotationPoint(0.0F, 0.0F, 0.0F); - PauldronExtraR.addBox(-12.0F, -12.0F, 0.0F, 13, 18, 0, 0.0F); - bipedRightArm.addChild(PauldronExtraR); - - PauldronR_1 = new ModelRenderer(this, "Pauldron Right 2"); - PauldronR_1.setTextureOffset(64, 0); - PauldronR_1.mirror = true; - PauldronR_1.setRotationPoint(-0.0F, 0.0F, 0.0F); - PauldronR_1.addBox(-5.5F, -8.0F, -4.0F, 7, 11, 8, 0.1F); - setRotateAngle(PauldronR_1, 0.0F, -0.0F, 0.2617993877991494F); - bipedRightArm.addChild(PauldronR_1); - - PauldronL_1 = new ModelRenderer(this, "Pauldron Left 2"); - PauldronL_1.setTextureOffset(64, 0); - PauldronL_1.setRotationPoint(0.0F, 0.0F, 0.0F); - PauldronL_1.addBox(-1.5F, -8.0F, -4.0F, 7, 11, 8, 0.1F); - setRotateAngle(PauldronL_1, 0.0F, -0.0F, -0.2617993877991494F); - bipedLeftArm.addChild(PauldronL_1); - - WingL = new ModelRenderer(this, "Wing Left"); - WingL.setTextureOffset(82, 5); - WingL.setRotationPoint(0.0F, 0.0F, 0.0F); - WingL.addBox(0.0F, -6.0F, 3.0F, 0, 28, 14, 0.0F); - setRotateAngle(WingL, 0.0F, -0.2617993877991494F, 0.0F); - bipedBody.addChild(WingL); - - WingR = new ModelRenderer(this, "Wing Right"); - WingR.setTextureOffset(82, 5); - WingR.setRotationPoint(0.0F, 0.0F, 0.0F); - WingR.addBox(0.0F, -6.0F, 3.0F, 0, 28, 14, 0.0F); - setRotateAngle(WingR, 0.0F, 0.2617993877991494F, 0.0F); - bipedBody.addChild(WingR); - - Plackart = new ModelRenderer(this, "Plackart"); - Plackart.setTextureOffset(0, 42); - Plackart.setRotationPoint(0.0F, 0.0F, 0.0F); - Plackart.addBox(-4.0F, 5.0F, -3.0F, 8, 7, 6, 0.0F); - bipedBody.addChild(Plackart); - - BreastPlate = new ModelRenderer(this, "BreastPlate"); - BreastPlate.setTextureOffset(0, 32); - BreastPlate.setRotationPoint(0.0F, 0.0F, 0.0F); - BreastPlate.addBox(-4.0F, 0.1F, -3.6F, 8, 6, 4, 0.1F); - bipedBody.addChild(BreastPlate); - - BackPlate = new ModelRenderer(this, "Back Plate"); - BackPlate.setTextureOffset(0, 56); - BackPlate.setRotationPoint(0.0F, 0.0F, 0.0F); - BackPlate.addBox(-4.0F, 0.0F, 1.0F, 8, 5, 3, 0.0F); - setRotateAngle(BackPlate, -0.08726646006107329F, -0.0F, 0.0F); - bipedBody.addChild(BackPlate); - - WingL.isHidden = true; - WingR.isHidden = true; - PauldronL_1.isHidden = true; - PauldronR_1.isHidden = true; - ArmL_1.isHidden = true; - ArmR_1.isHidden = true; - PauldronExtraL.isHidden = true; - PauldronExtraR.isHidden = true; - - init(); - } - - /** - * This is a helper function from Tabula to set the rotation of model parts - */ - public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) - { - modelRenderer.rotateAngleX = x; - modelRenderer.rotateAngleY = y; - modelRenderer.rotateAngleZ = z; - } -} +//package lance5057.tDefense.armor.renderers.heavy; +// +//import lance5057.tDefense.armor.renderers.ArmorRenderer; +//import net.minecraft.client.model.ModelRenderer; +// +///** +// * ModelBiped - Either Mojang or a mod author +// * Created using Tabula 4.1.1 +// */ +//public class ModelTinkersBreastplate extends ArmorRenderer +//{ +// public ModelRenderer BackPlate; +// public ModelRenderer BreastPlate; +// public ModelRenderer Plackart; +// public ModelRenderer WingR; +// public ModelRenderer WingL; +// public ModelRenderer PauldronR; +// public ModelRenderer PauldronL; +// public ModelRenderer ArmR; +// public ModelRenderer ArmL; +// public ModelRenderer PauldronExtraR; +// public ModelRenderer PauldronExtraL; +// public ModelRenderer PauldronR_1; +// public ModelRenderer ArmR_1; +// public ModelRenderer PauldronL_1; +// public ModelRenderer ArmL_1; +// +// public ModelTinkersBreastplate() +// { +// super(0.1f, 0, 128, 64); +// +// textureWidth = 128; +// textureHeight = 64; +// +// bipedBody = new ModelRenderer(this, "Body"); +// bipedBody.setTextureOffset(16, 16); +// bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.1f); +// bipedBody.setRotationPoint(0.0F, 0.0F + 0, 0.0F); +// +// bipedRightArm = new ModelRenderer(this, "Right Arm"); +// bipedRightArm.setTextureOffset(40, 16); +// bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.1f); +// bipedRightArm.setRotationPoint(-5.0F, 2.0F + 0, 0.0F); +// +// bipedLeftArm = new ModelRenderer(this, "Left Arm"); +// bipedLeftArm.setTextureOffset(40, 16); +// bipedLeftArm.mirror = true; +// bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.1f); +// bipedLeftArm.setRotationPoint(5.0F, 2.0F + 0, 0.0F); +// +// ArmR = new ModelRenderer(this, "Arm Right Overlay"); +// ArmR.setTextureOffset(28, 44); +// ArmR.mirror = true; +// ArmR.setRotationPoint(0.0F, 0.0F, 0.0F); +// ArmR.addBox(-4.0F, -2.2F, -3.0F, 5, 6, 6, 0.0F); +// bipedRightArm.addChild(ArmR); +// +// ArmR_1 = new ModelRenderer(this, "Arm Overlay Right 2"); +// ArmR_1.setTextureOffset(94, 0); +// ArmR_1.mirror = true; +// ArmR_1.setRotationPoint(-0.0F, 0.0F, 0.0F); +// ArmR_1.addBox(-4.5F, -2.0F, -3.0F, 6, 7, 6, 0.1F); +// setRotateAngle(ArmR_1, 0.0F, -0.0F, -0.17453292519943295F); +// bipedRightArm.addChild(ArmR_1); +// +// ArmL = new ModelRenderer(this, "Arm Overlay Left"); +// ArmL.setTextureOffset(28, 44); +// ArmL.setRotationPoint(0.0F, 0.0F, 0.0F); +// ArmL.addBox(-1.0F, -2.2F, -3.0F, 5, 6, 6, 0.0F); +// bipedLeftArm.addChild(ArmL); +// +// ArmL_1 = new ModelRenderer(this, "Arm Left Overlay 2"); +// ArmL_1.setTextureOffset(94, 0); +// ArmL_1.setRotationPoint(0.0F, 0.0F, 0.0F); +// ArmL_1.addBox(-1.0F, -2.0F, -3.0F, 6, 7, 6, 0.1F); +// setRotateAngle(ArmL_1, 0.0F, -0.0F, 0.17453292519943295F); +// bipedLeftArm.addChild(ArmL_1); +// +// PauldronL = new ModelRenderer(this, "Pauldron Left"); +// PauldronL.setTextureOffset(24, 32); +// PauldronL.setRotationPoint(0.0F, 0.0F, 0.0F); +// PauldronL.addBox(0.6F, -2.0F, -3.5F, 4, 5, 7, 0.0F); +// setRotateAngle(PauldronL, 0.0F, -0.0F, -0.4363323129985824F); +// bipedLeftArm.addChild(PauldronL); +// +// PauldronR = new ModelRenderer(this, "Pauldron Right"); +// PauldronR.setTextureOffset(24, 32); +// PauldronR.mirror = true; +// PauldronR.setRotationPoint(-0.0F, 0.0F, 0.0F); +// PauldronR.addBox(-4.8F, -2.0F, -3.5F, 4, 5, 7, 0.0F); +// setRotateAngle(PauldronR, 0.0F, -0.0F, 0.4363323129985824F); +// bipedRightArm.addChild(PauldronR); +// +// PauldronExtraL = new ModelRenderer(this, "Pauldron Extra Left"); +// PauldronExtraL.setTextureOffset(56, 19); +// PauldronExtraL.setRotationPoint(0.0F, 0.0F, 0.0F); +// PauldronExtraL.addBox(0.0F, -12.0F, 0.0F, 13, 18, 0, 0.0F); +// bipedLeftArm.addChild(PauldronExtraL); +// +// PauldronExtraR = new ModelRenderer(this, "Pauldron Extra Right"); +// PauldronExtraR.setTextureOffset(56, 19); +// PauldronExtraR.mirror = true; +// PauldronExtraR.setRotationPoint(0.0F, 0.0F, 0.0F); +// PauldronExtraR.addBox(-12.0F, -12.0F, 0.0F, 13, 18, 0, 0.0F); +// bipedRightArm.addChild(PauldronExtraR); +// +// PauldronR_1 = new ModelRenderer(this, "Pauldron Right 2"); +// PauldronR_1.setTextureOffset(64, 0); +// PauldronR_1.mirror = true; +// PauldronR_1.setRotationPoint(-0.0F, 0.0F, 0.0F); +// PauldronR_1.addBox(-5.5F, -8.0F, -4.0F, 7, 11, 8, 0.1F); +// setRotateAngle(PauldronR_1, 0.0F, -0.0F, 0.2617993877991494F); +// bipedRightArm.addChild(PauldronR_1); +// +// PauldronL_1 = new ModelRenderer(this, "Pauldron Left 2"); +// PauldronL_1.setTextureOffset(64, 0); +// PauldronL_1.setRotationPoint(0.0F, 0.0F, 0.0F); +// PauldronL_1.addBox(-1.5F, -8.0F, -4.0F, 7, 11, 8, 0.1F); +// setRotateAngle(PauldronL_1, 0.0F, -0.0F, -0.2617993877991494F); +// bipedLeftArm.addChild(PauldronL_1); +// +// WingL = new ModelRenderer(this, "Wing Left"); +// WingL.setTextureOffset(82, 5); +// WingL.setRotationPoint(0.0F, 0.0F, 0.0F); +// WingL.addBox(0.0F, -6.0F, 3.0F, 0, 28, 14, 0.0F); +// setRotateAngle(WingL, 0.0F, -0.2617993877991494F, 0.0F); +// bipedBody.addChild(WingL); +// +// WingR = new ModelRenderer(this, "Wing Right"); +// WingR.setTextureOffset(82, 5); +// WingR.setRotationPoint(0.0F, 0.0F, 0.0F); +// WingR.addBox(0.0F, -6.0F, 3.0F, 0, 28, 14, 0.0F); +// setRotateAngle(WingR, 0.0F, 0.2617993877991494F, 0.0F); +// bipedBody.addChild(WingR); +// +// Plackart = new ModelRenderer(this, "Plackart"); +// Plackart.setTextureOffset(0, 42); +// Plackart.setRotationPoint(0.0F, 0.0F, 0.0F); +// Plackart.addBox(-4.0F, 5.0F, -3.0F, 8, 7, 6, 0.0F); +// bipedBody.addChild(Plackart); +// +// BreastPlate = new ModelRenderer(this, "BreastPlate"); +// BreastPlate.setTextureOffset(0, 32); +// BreastPlate.setRotationPoint(0.0F, 0.0F, 0.0F); +// BreastPlate.addBox(-4.0F, 0.1F, -3.6F, 8, 6, 4, 0.1F); +// bipedBody.addChild(BreastPlate); +// +// BackPlate = new ModelRenderer(this, "Back Plate"); +// BackPlate.setTextureOffset(0, 56); +// BackPlate.setRotationPoint(0.0F, 0.0F, 0.0F); +// BackPlate.addBox(-4.0F, 0.0F, 1.0F, 8, 5, 3, 0.0F); +// setRotateAngle(BackPlate, -0.08726646006107329F, -0.0F, 0.0F); +// bipedBody.addChild(BackPlate); +// +// WingL.isHidden = true; +// WingR.isHidden = true; +// PauldronL_1.isHidden = true; +// PauldronR_1.isHidden = true; +// ArmL_1.isHidden = true; +// ArmR_1.isHidden = true; +// PauldronExtraL.isHidden = true; +// PauldronExtraR.isHidden = true; +// +// init(); +// } +// +// /** +// * This is a helper function from Tabula to set the rotation of model parts +// */ +// public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) +// { +// modelRenderer.rotateAngleX = x; +// modelRenderer.rotateAngleY = y; +// modelRenderer.rotateAngleZ = z; +// } +//} diff --git a/src/main/java/lance5057/tDefense/armor/util/ArmorBuilder.java b/src/main/java/lance5057/tDefense/armor/util/ArmorBuilder.java index bdbece5..eaeec88 100644 --- a/src/main/java/lance5057/tDefense/armor/util/ArmorBuilder.java +++ b/src/main/java/lance5057/tDefense/armor/util/ArmorBuilder.java @@ -1,115 +1,115 @@ -package lance5057.tDefense.armor.util; - -import java.util.List; - -import org.apache.logging.log4j.Logger; - -import com.google.common.collect.ImmutableList; - -import lance5057.tDefense.armor.ArmorCore; -import lance5057.tDefense.armor.events.ArmorBaseEvents; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import slimeknights.tconstruct.library.TinkerRegistry; -import slimeknights.tconstruct.library.Util; -import slimeknights.tconstruct.library.materials.Material; -import slimeknights.tconstruct.library.modifiers.IModifier; -import slimeknights.tconstruct.library.modifiers.TinkerGuiException; -import slimeknights.tconstruct.library.tinkering.PartMaterialType; -import slimeknights.tconstruct.library.utils.TagUtil; -import slimeknights.tconstruct.library.utils.Tags; -import slimeknights.tconstruct.library.utils.TinkerUtil; - -public final class ArmorBuilder { - private static Logger log = Util.getLogger("ToolBuilder"); - - public static void rebuildTool(NBTTagCompound rootNBT, ArmorCore tinkersItem) throws TinkerGuiException { - boolean broken = TagUtil.getToolTag(rootNBT).getBoolean(Tags.BROKEN); - // Recalculate tool base stats from material stats - NBTTagList materialTag = TagUtil.getBaseMaterialsTagList(rootNBT); - List<Material> materials = TinkerUtil.getMaterialsFromTagList(materialTag); - List<PartMaterialType> pms = tinkersItem.getRequiredComponents(); - - // ensure all needed Stats are present - while(materials.size() < pms.size()) { - materials.add(Material.UNKNOWN); - } - for(int i = 0; i < pms.size(); i++) { - if(!pms.get(i).isValidMaterial(materials.get(i))) { - materials.set(i, Material.UNKNOWN); - } - } - - // the base stats of the tool - NBTTagCompound toolTag = tinkersItem.buildTag(materials); - TagUtil.setToolTag(rootNBT, toolTag); - // and its copy for reference - rootNBT.setTag(Tags.TOOL_DATA_ORIG, toolTag.copy()); - - // save the old modifiers list and clean up all tags that get set by modifiers/traits - NBTTagList modifiersTagOld = TagUtil.getModifiersTagList(rootNBT); - rootNBT.removeTag(Tags.TOOL_MODIFIERS); // the active-modifiers tag - rootNBT.setTag(Tags.TOOL_MODIFIERS, new NBTTagList()); - rootNBT.removeTag("ench"); // and the enchantments tag - rootNBT.removeTag(Tags.ENCHANT_EFFECT); // enchant effect too, will be readded by a trait either way - - // clean up traits - rootNBT.removeTag(Tags.TOOL_TRAITS); - tinkersItem.addMaterialTraits(rootNBT, materials); - - // fire event - ArmorBaseEvents.OnArmorBuilding.fireEvent(rootNBT, ImmutableList.copyOf(materials), tinkersItem); - - // reapply modifiers - NBTTagList modifiers = TagUtil.getBaseModifiersTagList(rootNBT); - NBTTagList modifiersTag = TagUtil.getModifiersTagList(rootNBT); - // copy over and reapply all relevant modifiers - for(int i = 0; i < modifiers.tagCount(); i++) { - String identifier = modifiers.getStringTagAt(i); - IModifier modifier = TinkerRegistry.getModifier(identifier); - if(modifier == null) { - log.debug("Missing modifier: {}", identifier); - continue; - } - - NBTTagCompound tag; - int index = TinkerUtil.getIndexInList(modifiersTagOld, modifier.getIdentifier()); - - if(index >= 0) { - tag = modifiersTagOld.getCompoundTagAt(index); - } - else { - tag = new NBTTagCompound(); - } - - modifier.applyEffect(rootNBT, tag); - if(!tag.hasNoTags()) { - int indexNew = TinkerUtil.getIndexInList(modifiersTag, modifier.getIdentifier()); - if(indexNew >= 0) { - modifiersTag.set(indexNew, tag); - } - else { - modifiersTag.appendTag(tag); - } - } - } - - // remaining info, get updated toolTag - toolTag = TagUtil.getToolTag(rootNBT); - // adjust free modifiers - int freeModifiers = toolTag.getInteger(Tags.FREE_MODIFIERS); - freeModifiers -= TagUtil.getBaseModifiersUsed(rootNBT); - toolTag.setInteger(Tags.FREE_MODIFIERS, Math.max(0, freeModifiers)); - - // broken? - if(broken) { - toolTag.setBoolean(Tags.BROKEN, true); - } - - TagUtil.setToolTag(rootNBT, toolTag); - - if(freeModifiers < 0) { - throw new TinkerGuiException(Util.translateFormatted("gui.error.not_enough_modifiers", -freeModifiers)); - } - } -} +//package lance5057.tDefense.armor.util; +// +//import java.util.List; +// +//import org.apache.logging.log4j.Logger; +// +//import com.google.common.collect.ImmutableList; +// +//import lance5057.tDefense.armor.ArmorCore; +//import lance5057.tDefense.armor.events.ArmorBaseEvents; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.nbt.NBTTagList; +//import slimeknights.tconstruct.library.TinkerRegistry; +//import slimeknights.tconstruct.library.Util; +//import slimeknights.tconstruct.library.materials.Material; +//import slimeknights.tconstruct.library.modifiers.IModifier; +//import slimeknights.tconstruct.library.modifiers.TinkerGuiException; +//import slimeknights.tconstruct.library.tinkering.PartMaterialType; +//import slimeknights.tconstruct.library.utils.TagUtil; +//import slimeknights.tconstruct.library.utils.Tags; +//import slimeknights.tconstruct.library.utils.TinkerUtil; +// +//public final class ArmorBuilder { +// private static Logger log = Util.getLogger("ToolBuilder"); +// +// public static void rebuildTool(NBTTagCompound rootNBT, ArmorCore tinkersItem) throws TinkerGuiException { +// boolean broken = TagUtil.getToolTag(rootNBT).getBoolean(Tags.BROKEN); +// // Recalculate tool base stats from material stats +// NBTTagList materialTag = TagUtil.getBaseMaterialsTagList(rootNBT); +// List<Material> materials = TinkerUtil.getMaterialsFromTagList(materialTag); +// List<PartMaterialType> pms = tinkersItem.getRequiredComponents(); +// +// // ensure all needed Stats are present +// while(materials.size() < pms.size()) { +// materials.add(Material.UNKNOWN); +// } +// for(int i = 0; i < pms.size(); i++) { +// if(!pms.get(i).isValidMaterial(materials.get(i))) { +// materials.set(i, Material.UNKNOWN); +// } +// } +// +// // the base stats of the tool +// NBTTagCompound toolTag = tinkersItem.buildTag(materials); +// TagUtil.setToolTag(rootNBT, toolTag); +// // and its copy for reference +// rootNBT.setTag(Tags.TOOL_DATA_ORIG, toolTag.copy()); +// +// // save the old modifiers list and clean up all tags that get set by modifiers/traits +// NBTTagList modifiersTagOld = TagUtil.getModifiersTagList(rootNBT); +// rootNBT.removeTag(Tags.TOOL_MODIFIERS); // the active-modifiers tag +// rootNBT.setTag(Tags.TOOL_MODIFIERS, new NBTTagList()); +// rootNBT.removeTag("ench"); // and the enchantments tag +// rootNBT.removeTag(Tags.ENCHANT_EFFECT); // enchant effect too, will be readded by a trait either way +// +// // clean up traits +// rootNBT.removeTag(Tags.TOOL_TRAITS); +// tinkersItem.addMaterialTraits(rootNBT, materials); +// +// // fire event +// ArmorBaseEvents.OnArmorBuilding.fireEvent(rootNBT, ImmutableList.copyOf(materials), tinkersItem); +// +// // reapply modifiers +// NBTTagList modifiers = TagUtil.getBaseModifiersTagList(rootNBT); +// NBTTagList modifiersTag = TagUtil.getModifiersTagList(rootNBT); +// // copy over and reapply all relevant modifiers +// for(int i = 0; i < modifiers.tagCount(); i++) { +// String identifier = modifiers.getStringTagAt(i); +// IModifier modifier = TinkerRegistry.getModifier(identifier); +// if(modifier == null) { +// log.debug("Missing modifier: {}", identifier); +// continue; +// } +// +// NBTTagCompound tag; +// int index = TinkerUtil.getIndexInList(modifiersTagOld, modifier.getIdentifier()); +// +// if(index >= 0) { +// tag = modifiersTagOld.getCompoundTagAt(index); +// } +// else { +// tag = new NBTTagCompound(); +// } +// +// modifier.applyEffect(rootNBT, tag); +// if(!tag.hasNoTags()) { +// int indexNew = TinkerUtil.getIndexInList(modifiersTag, modifier.getIdentifier()); +// if(indexNew >= 0) { +// modifiersTag.set(indexNew, tag); +// } +// else { +// modifiersTag.appendTag(tag); +// } +// } +// } +// +// // remaining info, get updated toolTag +// toolTag = TagUtil.getToolTag(rootNBT); +// // adjust free modifiers +// int freeModifiers = toolTag.getInteger(Tags.FREE_MODIFIERS); +// freeModifiers -= TagUtil.getBaseModifiersUsed(rootNBT); +// toolTag.setInteger(Tags.FREE_MODIFIERS, Math.max(0, freeModifiers)); +// +// // broken? +// if(broken) { +// toolTag.setBoolean(Tags.BROKEN, true); +// } +// +// TagUtil.setToolTag(rootNBT, toolTag); +// +// if(freeModifiers < 0) { +// throw new TinkerGuiException(Util.translateFormatted("gui.error.not_enough_modifiers", -freeModifiers)); +// } +// } +//} diff --git a/src/main/java/lance5057/tDefense/core/blocks/Stations.java b/src/main/java/lance5057/tDefense/core/blocks/Stations.java new file mode 100644 index 0000000..eea9afb --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/blocks/Stations.java @@ -0,0 +1,243 @@ +//package lance5057.tDefense.core.blocks; +// +//import java.util.List; +//import java.util.Locale; +// +//import javax.annotation.Nonnull; +// +//import com.google.common.collect.Lists; +// +//import net.minecraft.block.Block; +//import net.minecraft.block.SoundType; +//import net.minecraft.block.material.Material; +//import net.minecraft.block.properties.IProperty; +//import net.minecraft.block.properties.PropertyEnum; +//import net.minecraft.block.state.BlockStateContainer; +//import net.minecraft.block.state.IBlockState; +//import net.minecraft.creativetab.CreativeTabs; +//import net.minecraft.entity.player.EntityPlayer; +//import net.minecraft.entity.player.EntityPlayerMP; +//import net.minecraft.item.Item; +//import net.minecraft.item.ItemStack; +//import net.minecraft.tileentity.TileEntity; +//import net.minecraft.util.IStringSerializable; +//import net.minecraft.util.math.AxisAlignedBB; +//import net.minecraft.util.math.BlockPos; +//import net.minecraft.util.math.RayTraceResult; +//import net.minecraft.util.math.Vec3d; +//import net.minecraft.world.IBlockAccess; +//import net.minecraft.world.World; +//import net.minecraftforge.common.property.ExtendedBlockState; +//import net.minecraftforge.common.property.IUnlistedProperty; +//import net.minecraftforge.fml.relauncher.Side; +//import net.minecraftforge.fml.relauncher.SideOnly; +//import net.minecraftforge.oredict.OreDictionary; +//import slimeknights.mantle.inventory.BaseContainer; +//import slimeknights.tconstruct.TConstruct; +//import slimeknights.tconstruct.common.config.Config; +//import slimeknights.tconstruct.library.TinkerRegistry; +//import slimeknights.tconstruct.shared.block.BlockTable; +//import slimeknights.tconstruct.tools.common.block.ITinkerStationBlock; +//import slimeknights.tconstruct.tools.common.tileentity.TileCraftingStation; +//import slimeknights.tconstruct.tools.common.tileentity.TilePartBuilder; +//import slimeknights.tconstruct.tools.common.tileentity.TilePartChest; +//import slimeknights.tconstruct.tools.common.tileentity.TilePatternChest; +//import slimeknights.tconstruct.tools.common.tileentity.TileStencilTable; +//import slimeknights.tconstruct.tools.common.tileentity.TileToolStation; +// +//public class Stations extends BlockTable implements ITinkerStationBlock { +// +// public static final PropertyEnum<TableTypes> TABLES = PropertyEnum.func_177709_a("type", TableTypes.class); +// +// public Stations() { +// super(Material.field_151575_d); +// this.func_149647_a(TinkerRegistry.tabGeneral); +// +// this.func_149672_a(SoundType.field_185848_a); +// this.func_149752_b(5f); +// this.func_149711_c(1f); +// +// // set axe as effective tool for all variants +// this.setHarvestLevel("axe", 0); +// } +// +// +// @Nonnull +// @Override +// public TileEntity func_149915_a(@Nonnull World worldIn, int meta) { +// switch(TableTypes.fromMeta(meta)) { +// case CraftingStation: +// return new TileCraftingStation(); +// case StencilTable: +// return new TileStencilTable(); +// case PartBuilder: +// return new TilePartBuilder(); +// case ToolStation: +// return new TileToolStation(); +// case PatternChest: +// return new TilePatternChest(); +// case PartChest: +// return new TilePartChest(); +// default: +// return super.func_149915_a(worldIn, meta); +// } +// } +// +// @Override +// public boolean openGui(EntityPlayer player, World world, BlockPos pos) { +// if(!world.field_72995_K) { +// player.openGui(TConstruct.instance, 0, world, pos.func_177958_n(), pos.func_177956_o(), pos.func_177952_p()); +// if(player.field_71070_bA instanceof BaseContainer) { +// ((BaseContainer) player.field_71070_bA).syncOnOpen((EntityPlayerMP) player); +// } +// } +// return true; +// } +// +// @SideOnly(Side.CLIENT) +// @Override +// public void func_149666_a(@Nonnull Item itemIn, CreativeTabs tab, List<ItemStack> list) { +// // crafting station is boring +// list.add(new ItemStack(this, 1, TableTypes.CraftingStation.meta)); +// +// // planks for the stencil table +// addBlocksFromOredict("plankWood", TableTypes.StencilTable.meta, list); +// +// list.add(new ItemStack(this, 1, TableTypes.PatternChest.meta)); +// +// // logs for the part builder +// addBlocksFromOredict("logWood", TableTypes.PartBuilder.meta, list); +// +// list.add(new ItemStack(this, 1, TableTypes.PartChest.meta)); +// +// // stencil table is boring +// //addBlocksFromOredict("workbench", TableTypes.ToolStation.ordinal(), list); +// list.add(new ItemStack(this, 1, TableTypes.ToolStation.meta)); +// +// } +// +// private void addBlocksFromOredict(String oredict, int meta, List<ItemStack> list) { +// for(ItemStack stack : OreDictionary.getOres(oredict)) { +// Block block = func_149634_a(stack.func_77973_b()); +// int blockMeta = stack.func_77952_i(); +// +// if(blockMeta == OreDictionary.WILDCARD_VALUE) { +// List<ItemStack> subBlocks = Lists.newLinkedList(); +// block.func_149666_a(stack.func_77973_b(), null, subBlocks); +// +// for(ItemStack subBlock : subBlocks) { +// list.add(createItemstack(this, meta, func_149634_a(subBlock.func_77973_b()), subBlock.func_77952_i())); +// if(!Config.listAllTables) { +// return; +// } +// } +// } +// else { +// list.add(createItemstack(this, meta, block, blockMeta)); +// if(!Config.listAllTables) { +// return; +// } +// } +// } +// } +// +// @Override +// protected boolean keepInventory(IBlockState state) { +// return Config.chestsKeepInventory && +// (state.func_177229_b(TABLES) == TableTypes.PatternChest || state.func_177229_b(TABLES) == TableTypes.PartChest); +// } +// +// @Nonnull +// @Override +// protected BlockStateContainer func_180661_e() { +// return new ExtendedBlockState(this, new IProperty[]{TABLES}, new IUnlistedProperty[]{TEXTURE, INVENTORY, FACING}); +// } +// +// @Nonnull +// @Override +// public IBlockState func_176203_a(int meta) { +// return this.func_176223_P().func_177226_a(TABLES, TableTypes.fromMeta(meta)); +// } +// +// @Override +// public int func_176201_c(IBlockState state) { +// return (state.func_177229_b(TABLES)).meta; +// } +// +// /* Bounds */ +// private static AxisAlignedBB BOUNDS_Chest = new AxisAlignedBB(0, 0, 0, 1, 0.875, 1); +// +// @Nonnull +// @Override +// public AxisAlignedBB func_185496_a(IBlockState state, IBlockAccess source, BlockPos pos) { +// if(state.func_177229_b(TABLES).isChest) { +// return BOUNDS_Chest; +// } +// +// return super.func_185496_a(state, source, pos); +// } +// +// @Override +// public RayTraceResult func_180636_a(IBlockState blockState, @Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Vec3d start, @Nonnull Vec3d end) { +// if(blockState.func_177229_b(TABLES).isChest) { +// return func_185503_a(pos, start, end, BOUNDS_Chest); +// } +// +// return super.func_180636_a(blockState, worldIn, pos, start, end); +// } +// +// @Override +// public int getGuiNumber(IBlockState state) { +// switch(state.func_177229_b(TABLES)) { +// case StencilTable: +// return 10; +// case PatternChest: +// return 15; +// case PartChest: +// return 16; +// case PartBuilder: +// return 20; +// case ToolStation: +// return 25; +// case CraftingStation: +// return 50; +// default: +// return 0; +// } +// } +// +// public enum TableTypes implements IStringSerializable { +// CraftingStation, +// StencilTable, +// PartBuilder, +// ToolStation, +// PatternChest(true), +// PartChest(true); +// +// TableTypes() { +// meta = this.ordinal(); +// this.isChest = false; +// } +// +// TableTypes(boolean chest) { +// meta = this.ordinal(); +// this.isChest = chest; +// } +// +// public final int meta; +// public final boolean isChest; +// +// public static TableTypes fromMeta(int meta) { +// if(meta < 0 || meta >= values().length) { +// meta = 0; +// } +// +// return values()[meta]; +// } +// +// @Override +// public String func_176610_l() { +// return this.toString().toLowerCase(Locale.US); +// } +// } +//} diff --git a/src/main/java/lance5057/tDefense/core/materials/FluidColor.java b/src/main/java/lance5057/tDefense/core/materials/FluidColor.java new file mode 100644 index 0000000..0ade854 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/materials/FluidColor.java @@ -0,0 +1,20 @@ +package lance5057.tDefense.core.materials; + +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.Fluid; + +public class FluidColor extends Fluid +{ + + int color; + public FluidColor(String fluidName, ResourceLocation still, ResourceLocation flowing, int color) { + super(fluidName, still, flowing); + this.color = color; + } + + @Override + public int getColor() + { + return color; + } +} diff --git a/src/main/java/lance5057/tDefense/core/materials/TDMaterials.java b/src/main/java/lance5057/tDefense/core/materials/TDMaterials.java index 7640128..a92a2c3 100644 --- a/src/main/java/lance5057/tDefense/core/materials/TDMaterials.java +++ b/src/main/java/lance5057/tDefense/core/materials/TDMaterials.java @@ -5,22 +5,34 @@ import static slimeknights.tconstruct.library.utils.HarvestLevels.COBALT; import java.util.Collection; import java.util.List; +import com.google.common.collect.Lists; +import com.google.common.eventbus.Subscribe; + +import lance5057.tDefense.Reference; +import lance5057.tDefense.core.CoreBase; import lance5057.tDefense.core.materials.traits.TraitAxeLover; import lance5057.tDefense.core.materials.traits.TraitDulling; import lance5057.tDefense.core.materials.traits.TraitFirestarter; +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.BlockFluidClassic; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLInterModComms; +import net.minecraftforge.fml.common.registry.GameRegistry; import slimeknights.tconstruct.library.TinkerRegistry; import slimeknights.tconstruct.library.materials.ExtraMaterialStats; import slimeknights.tconstruct.library.materials.HandleMaterialStats; import slimeknights.tconstruct.library.materials.HeadMaterialStats; import slimeknights.tconstruct.library.materials.Material; +//import slimeknights.tconstruct.library.materials.Material; import slimeknights.tconstruct.library.materials.MaterialTypes; import slimeknights.tconstruct.library.traits.AbstractTrait; import slimeknights.tconstruct.tools.TinkerMaterials; -import com.google.common.collect.Lists; -import com.google.common.eventbus.Subscribe; - public class TDMaterials { public static final List<Material> materials = Lists.newArrayList(); @@ -31,6 +43,8 @@ public class TDMaterials { public static final Material queensgold = mat("queensgold", 0xdede00); public static final Material dogbearium = mat("dogbearium", 0x604933); + public static FluidColor fluid_aeonsteel; + public static final AbstractTrait axelover = new TraitAxeLover(); public static final AbstractTrait dulling = new TraitDulling(); public static final AbstractTrait firestarter = new TraitFirestarter(); @@ -40,6 +54,11 @@ public class TDMaterials { materials.add(mat); return mat; } + + public void registerMaterials() + { + addMat("aeonsteel", fluid_aeonsteel, 0xd200d1); + } @Subscribe public void setupMaterials(FMLInitializationEvent event) { @@ -150,4 +169,33 @@ public class TDMaterials { } } } + + void addMat(String name, FluidColor myFluid, int color) + { + // create fluid. + // You don't need to add textures for the fluid, just create a Fluid Class that overwrites getColor + // and pass the following as still and flowing ResourceLocation: + // still: "tconstruct:blocks/fluids/molten_metal" + // flowing: "tconstruct:blocks/fluids/molten_metal_flow" + myFluid = new FluidColor(name, new ResourceLocation("tconstruct:blocks/fluids/molten_metal"), new ResourceLocation("tconstruct:blocks/fluids/molten_metal_flow"), color); + //myFluid.setColor(color); + FluidRegistry.registerFluid(myFluid); // fluid has to be registered + FluidRegistry.addBucketForFluid(myFluid); // add a bucket for the fluid + + // add block for fluid (if desired) + ResourceLocation rc = new ResourceLocation(Reference.MOD_ID, "fluid_aeonsteel"); + Block fluidBlock = new BlockFluidClassic(myFluid, net.minecraft.block.material.Material.LAVA).setRegistryName(rc).setUnlocalizedName(rc.toString()).setCreativeTab(CoreBase.tab); + // <register block regularly> + GameRegistry.register(new ItemBlock(fluidBlock), fluidBlock.getRegistryName()); + + // create NBT for the IMC + NBTTagCompound tag = new NBTTagCompound(); + tag.setString("fluid", myFluid.getName()); // name of the fluid + tag.setString("ore", name); // ore-suffix: ingotFoo, blockFoo, oreFoo,... + tag.setBoolean("toolforge", true); // if set to true, blockFoo can be used to build a toolforge + //tag.setTag("alloy", alloysTagList); // you can also send an alloy with the registration (see below) + + // send the NBT to TCon + FMLInterModComms.sendMessage("tconstruct", "integrateSmeltery", tag); + } } diff --git a/src/main/java/lance5057/tDefense/core/tileentities/TileJewelersBench.java b/src/main/java/lance5057/tDefense/core/tileentities/TileJewelersBench.java new file mode 100644 index 0000000..e7c8ca9 --- /dev/null +++ b/src/main/java/lance5057/tDefense/core/tileentities/TileJewelersBench.java @@ -0,0 +1,5 @@ +package lance5057.tDefense.core.tileentities; + +public class TileJewelersBench { + +} diff --git a/src/main/java/lance5057/tDefense/proxy/ClientProxy.java b/src/main/java/lance5057/tDefense/proxy/ClientProxy.java index 7f6aef4..41018a6 100644 --- a/src/main/java/lance5057/tDefense/proxy/ClientProxy.java +++ b/src/main/java/lance5057/tDefense/proxy/ClientProxy.java @@ -2,7 +2,6 @@ package lance5057.tDefense.proxy; import lance5057.tDefense.Reference; import lance5057.tDefense.TD_Commands; -import lance5057.tDefense.armor.proxy.ArmorClientProxy; import lance5057.tDefense.baubles.BaublesClientProxy; import lance5057.tDefense.core.CoreClientProxy; import lance5057.tDefense.core.CoreItems; @@ -51,7 +50,7 @@ public class ClientProxy extends CommonProxy public static CoreClientProxy coreProxy = new CoreClientProxy(); public static HolidayClientProxy holiProxy = new HolidayClientProxy(); - public static ArmorClientProxy armorProxy = new ArmorClientProxy(); + //public static ArmorClientProxy armorProxy = new ArmorClientProxy(); @Override public void preInit() @@ -60,7 +59,7 @@ public class ClientProxy extends CommonProxy registerToolRenderers(); coreProxy.preInit(); - armorProxy.preInit(); + //armorProxy.preInit(); baubles.preInit(); } @@ -80,7 +79,7 @@ public class ClientProxy extends CommonProxy registerItemRenderer(CoreItems.item_queensgoldIngot, 0, CoreItems.item_queensgoldIngot.getUnlocalizedName()); coreProxy.init(); - armorProxy.init(); + //armorProxy.init(); holiProxy.Init(); baubles.init(); } diff --git a/src/main/resources/assets/tinkersdefense/blockstates/redcandyblock.json b/src/main/resources/assets/tinkersdefense/blockstates/redcandyblock.json new file mode 100644 index 0000000..f2cd467 --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/blockstates/redcandyblock.json @@ -0,0 +1,11 @@ +{ + "forge_marker": 1, + "defaults": { + "transform": "forge:default-block", + "model": "cube_all", + "textures": { + "all": "tinkersdefense:blocks/redmintblock", + "particle": "#all" + } + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal.png b/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal.png Binary files differnew file mode 100644 index 0000000..441ff72 --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal.png diff --git a/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal.png.mcmeta b/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal.png.mcmeta new file mode 100644 index 0000000..7ceb363 --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal.png.mcmeta @@ -0,0 +1,45 @@ +{ + "animation": { + "frametime": 2, + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 18, + 17, + 16, + 15, + 14, + 13, + 12, + 11, + 10, + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ] + } +}
\ No newline at end of file diff --git a/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal_flow.png b/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal_flow.png Binary files differnew file mode 100644 index 0000000..0826d00 --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal_flow.png diff --git a/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal_flow.png.mcmeta b/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal_flow.png.mcmeta new file mode 100644 index 0000000..8e55e43 --- /dev/null +++ b/src/main/resources/assets/tinkersdefense/textures/blocks/fluids/molten_metal_flow.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 3 + } +} |
