diff --git a/dependencies.gradle b/dependencies.gradle index efeb404f..86323b5c 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,14 +1,14 @@ // Add your dependencies here dependencies { - compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta40:api') + compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta44:api') api("com.github.GTNewHorizons:Mantle:0.5.0:dev") - api("com.github.GTNewHorizons:ForgeMultipart:1.6.2:dev") - implementation("com.github.GTNewHorizons:NotEnoughItems:2.7.34-GTNH:dev") + api("com.github.GTNewHorizons:ForgeMultipart:1.6.3:dev") + implementation("com.github.GTNewHorizons:NotEnoughItems:2.7.49-GTNH:dev") compileOnlyApi("curse.maven:cofh-core-69162:2388751") compileOnly("com.github.GTNewHorizons:inventory-tweaks:1.7.1:api") compileOnly("com.github.GTNewHorizons:WDMla:2.5.0:dev") - compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.2:api") + compileOnly("com.github.GTNewHorizons:Battlegear2:1.4.3:api") compileOnly("curse.maven:minefactory-reloaded-66672:2366150") compileOnly("curse.maven:zelda-sword-skills-220540:2384889") compileOnly("curse.maven:dynamic-sword-skills-226360:2495462") @@ -16,13 +16,13 @@ dependencies { compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") compileOnly("com.github.GTNewHorizons:Mobs-Info:0.5.2-GTNH:dev") compileOnlyApi("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") - compileOnlyApi("com.github.GTNewHorizons:Natura:2.8.5:dev") + compileOnlyApi("com.github.GTNewHorizons:Natura:2.8.7:dev") // For testing scythe crop harvesting // devOnlyNonPublishable("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") - // devOnlyNonPublishable("com.github.GTNewHorizons:harvestcraft:1.3.1-GTNH:dev") + // devOnlyNonPublishable("com.github.GTNewHorizons:harvestcraft:1.3.2-GTNH:dev") // devOnlyNonPublishable(deobfCurse("pams-harvest-the-nether-231262:2241397")) - // devOnlyNonPublishable("com.github.GTNewHorizons:Natura:2.8.5:dev") - // devOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.4.6") + // devOnlyNonPublishable("com.github.GTNewHorizons:Natura:2.8.7:dev") + // devOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.4.8") } diff --git a/src/main/java/tconstruct/armor/TinkerArmor.java b/src/main/java/tconstruct/armor/TinkerArmor.java index 16898475..afeebeb3 100644 --- a/src/main/java/tconstruct/armor/TinkerArmor.java +++ b/src/main/java/tconstruct/armor/TinkerArmor.java @@ -50,6 +50,7 @@ import tconstruct.modifiers.armor.TravelModDoubleJump; import tconstruct.modifiers.armor.TravelModRepair; import tconstruct.modifiers.tools.ModAttack; import tconstruct.tools.TinkerTools; +import tconstruct.util.config.PHConstruct; import tconstruct.world.TinkerWorld; @ObjectHolder(TConstruct.modID) @@ -146,9 +147,11 @@ public class TinkerArmor { @Handler public void init(FMLInitializationEvent event) { - craftingTableRecipes(); + if (!PHConstruct.disableAllRecipes) { + craftingTableRecipes(); + addRecipesForDryingRack(); + } registerModifiers(); - addRecipesForDryingRack(); TConstructRegistry.equipableTab.init(travelGoggles.getDefaultItem()); proxy.initialize(); } diff --git a/src/main/java/tconstruct/client/BlockSkinRenderHelper.java b/src/main/java/tconstruct/client/BlockSkinRenderHelper.java index 11cf9eed..a18a85a6 100644 --- a/src/main/java/tconstruct/client/BlockSkinRenderHelper.java +++ b/src/main/java/tconstruct/client/BlockSkinRenderHelper.java @@ -981,8 +981,8 @@ public class BlockSkinRenderHelper { } // safety + if (flowingIcon == null) flowingIcon = stillIcon != null ? stillIcon : FluidRegistry.WATER.getFlowingIcon(); if (stillIcon == null) stillIcon = FluidRegistry.WATER.getStillIcon(); - if (flowingIcon == null) flowingIcon = FluidRegistry.WATER.getFlowingIcon(); boolean raf = renderer.renderAllFaces; renderer.renderAllFaces = true; diff --git a/src/main/java/tconstruct/compat/Battlegear2Compat.java b/src/main/java/tconstruct/compat/Battlegear2Compat.java new file mode 100644 index 00000000..f3ad7075 --- /dev/null +++ b/src/main/java/tconstruct/compat/Battlegear2Compat.java @@ -0,0 +1,17 @@ +package tconstruct.compat; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; + +import mods.battlegear2.api.core.IInventoryPlayerBattle; + +/** + * This class exists to isolate classes that exist in Battlegear 2 but not in Battlegear 2 for Backhand in order to + * avoid class loading exceptions. + */ +public class Battlegear2Compat { + + public static ItemStack getBattlegear2Offhand(EntityPlayer player) { + return ((IInventoryPlayerBattle) player.inventory).battlegear2$getCurrentOffhandWeapon(); + } +} diff --git a/src/main/java/tconstruct/gadgets/TinkerGadgets.java b/src/main/java/tconstruct/gadgets/TinkerGadgets.java index bee25e87..20a720f2 100644 --- a/src/main/java/tconstruct/gadgets/TinkerGadgets.java +++ b/src/main/java/tconstruct/gadgets/TinkerGadgets.java @@ -22,6 +22,7 @@ import tconstruct.TConstruct; import tconstruct.gadgets.item.ItemSlimeBoots; import tconstruct.gadgets.item.ItemSlimeSling; import tconstruct.library.TConstructRegistry; +import tconstruct.util.config.PHConstruct; import tconstruct.world.TinkerWorld; @Pulse(id = "Tinkers' Gadgets", description = "All the fun toys.", forced = true) @@ -42,7 +43,7 @@ public class TinkerGadgets { @Handler public void init(FMLInitializationEvent event) { - if (!Loader.isModLoaded("dreamcraft")) { + if (!(Loader.isModLoaded("dreamcraft") || PHConstruct.disableAllRecipes)) { ItemStack slimeBlockGreen = new ItemStack(TinkerWorld.slimeGel, 1, 1); GameRegistry.addShapedRecipe( diff --git a/src/main/java/tconstruct/library/crafting/ToolBuilder.java b/src/main/java/tconstruct/library/crafting/ToolBuilder.java index 3d0ef5dc..8946f16a 100644 --- a/src/main/java/tconstruct/library/crafting/ToolBuilder.java +++ b/src/main/java/tconstruct/library/crafting/ToolBuilder.java @@ -268,12 +268,7 @@ public class ToolBuilder { if (name != null && !name.equals("")) { compound.setTag("display", new NBTTagCompound()); - compound.getCompoundTag("display").setString("Name", "\u00A7f" + name); - } - // set a nice default name - else { - compound.setTag("display", new NBTTagCompound()); - compound.getCompoundTag("display").setString("Name", "\u00A7f" + defaultToolName(headMat, item)); + compound.getCompoundTag("display").setString("Name", name); } ToolCraftEvent.NormalTool event = new ToolCraftEvent.NormalTool( diff --git a/src/main/java/tconstruct/library/tools/ToolCore.java b/src/main/java/tconstruct/library/tools/ToolCore.java index 10a9696f..a97bce88 100644 --- a/src/main/java/tconstruct/library/tools/ToolCore.java +++ b/src/main/java/tconstruct/library/tools/ToolCore.java @@ -439,7 +439,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq for (Map.Entry integerToolMaterialEntry : TConstructRegistry.toolMaterials .entrySet()) { tconstruct.library.tools.ToolMaterial material = integerToolMaterialEntry.getValue(); - buildTool(integerToolMaterialEntry.getKey(), ToolBuilder.defaultToolName(material, this), list); + buildTool(integerToolMaterialEntry.getKey(), null, list); } } @@ -822,4 +822,10 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IEq return curTags.equals(prevTags); } // end of TE support section + + @Override + public String getItemStackDisplayName(ItemStack stack) { + String name = ToolBuilder.defaultToolName(stack); + return name != null ? name : super.getItemStackDisplayName(stack); + } } diff --git a/src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java b/src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java index d234389b..40a39db2 100644 --- a/src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java +++ b/src/main/java/tconstruct/library/weaponry/BowBaseAmmo.java @@ -13,7 +13,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import cpw.mods.fml.common.Loader; -import mods.battlegear2.api.core.IInventoryPlayerBattle; +import mods.battlegear2.api.core.IBattlePlayer; +import tconstruct.compat.Battlegear2Compat; import tconstruct.library.TConstructRegistry; import tconstruct.library.crafting.ToolBuilder; import tconstruct.library.tools.BowstringMaterial; @@ -62,8 +63,9 @@ public abstract class BowBaseAmmo extends ProjectileWeapon { @Override public ItemStack searchForAmmo(EntityPlayer player, ItemStack weapon) { // arrow priority: hotbar > inventory, tinker arrows > regular arrows - if (isBattlegear2Loaded) { - ItemStack offhand = ((IInventoryPlayerBattle) player.inventory).battlegear2$getCurrentOffhandWeapon(); + if (isBattlegear2Loaded && player instanceof IBattlePlayer battlePlayer + && battlePlayer.battlegear2$isBattlemode()) { + ItemStack offhand = Battlegear2Compat.getBattlegear2Offhand(player); if (checkTinkerArrow(offhand) || checkVanillaArrow(offhand)) { return offhand; } diff --git a/src/main/java/tconstruct/mechworks/TinkerMechworks.java b/src/main/java/tconstruct/mechworks/TinkerMechworks.java index c311cb5b..901383b2 100644 --- a/src/main/java/tconstruct/mechworks/TinkerMechworks.java +++ b/src/main/java/tconstruct/mechworks/TinkerMechworks.java @@ -23,6 +23,7 @@ import tconstruct.mechworks.entity.item.ExplosivePrimed; import tconstruct.mechworks.itemblocks.ItemBlockLandmine; import tconstruct.mechworks.logic.TileEntityLandmine; import tconstruct.tools.TinkerTools; +import tconstruct.util.config.PHConstruct; @ObjectHolder(TConstruct.modID) // TODO handle migration of all items/blocks that were owned by the previously seperate mod @@ -46,58 +47,60 @@ public class TinkerMechworks { GameRegistry.registerTileEntity(TileEntityLandmine.class, "Landmine"); // Landmine Recipes - GameRegistry.addRecipe( - new ShapedOreRecipe( - new ItemStack(TinkerMechworks.landmine, 1, 0), - "mcm", - "rpr", - 'm', - "plankWood", - 'c', - new ItemStack(TinkerTools.blankPattern, 1, 1), - 'r', - "dustRedstone", - 'p', - Blocks.stone_pressure_plate)); - GameRegistry.addRecipe( - new ShapedOreRecipe( - new ItemStack(TinkerMechworks.landmine, 1, 1), - "mcm", - "rpr", - 'm', - Blocks.stone, - 'c', - new ItemStack(TinkerTools.blankPattern, 1, 1), - 'r', - "dustRedstone", - 'p', - Blocks.stone_pressure_plate)); - GameRegistry.addRecipe( - new ShapedOreRecipe( - new ItemStack(TinkerMechworks.landmine, 1, 2), - "mcm", - "rpr", - 'm', - Blocks.obsidian, - 'c', - new ItemStack(TinkerTools.blankPattern, 1, 1), - 'r', - "dustRedstone", - 'p', - Blocks.stone_pressure_plate)); - GameRegistry.addRecipe( - new ShapedOreRecipe( - new ItemStack(TinkerMechworks.landmine, 1, 3), - "mcm", - "rpr", - 'm', - Items.repeater, - 'c', - new ItemStack(TinkerTools.blankPattern, 1, 1), - 'r', - "dustRedstone", - 'p', - Blocks.stone_pressure_plate)); + if (!PHConstruct.disableAllRecipes) { + GameRegistry.addRecipe( + new ShapedOreRecipe( + new ItemStack(TinkerMechworks.landmine, 1, 0), + "mcm", + "rpr", + 'm', + "plankWood", + 'c', + new ItemStack(TinkerTools.blankPattern, 1, 1), + 'r', + "dustRedstone", + 'p', + Blocks.stone_pressure_plate)); + GameRegistry.addRecipe( + new ShapedOreRecipe( + new ItemStack(TinkerMechworks.landmine, 1, 1), + "mcm", + "rpr", + 'm', + Blocks.stone, + 'c', + new ItemStack(TinkerTools.blankPattern, 1, 1), + 'r', + "dustRedstone", + 'p', + Blocks.stone_pressure_plate)); + GameRegistry.addRecipe( + new ShapedOreRecipe( + new ItemStack(TinkerMechworks.landmine, 1, 2), + "mcm", + "rpr", + 'm', + Blocks.obsidian, + 'c', + new ItemStack(TinkerTools.blankPattern, 1, 1), + 'r', + "dustRedstone", + 'p', + Blocks.stone_pressure_plate)); + GameRegistry.addRecipe( + new ShapedOreRecipe( + new ItemStack(TinkerMechworks.landmine, 1, 3), + "mcm", + "rpr", + 'm', + Items.repeater, + 'c', + new ItemStack(TinkerTools.blankPattern, 1, 1), + 'r', + "dustRedstone", + 'p', + Blocks.stone_pressure_plate)); + } EntityRegistry.registerModEntity( EntityLandmineFirework.class, diff --git a/src/main/java/tconstruct/mechworks/model/CartRender.java b/src/main/java/tconstruct/mechworks/model/CartRender.java deleted file mode 100644 index 2bb38fb5..00000000 --- a/src/main/java/tconstruct/mechworks/model/CartRender.java +++ /dev/null @@ -1,132 +0,0 @@ -package tconstruct.mechworks.model; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import tconstruct.world.entity.CartEntity; - -@SideOnly(Side.CLIENT) -public class CartRender extends Render { - - protected ModelBase modelCart; - RenderBlocks renderblocks; - - public CartRender() { - this.shadowSize = 0.5F; - this.modelCart = new ModelPullcart(); - renderblocks = new RenderBlocks(); - } - - public void renderPullcart(CartEntity cart, double posX, double posY, double posZ, float par8, float par9) { - GL11.glPushMatrix(); - long var10 = (long) cart.hashCode() * 493286711L; - var10 = var10 * var10 * 4392167121L + var10 * 98761L; - float var12 = (((float) (var10 >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - float var13 = (((float) (var10 >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - float var14 = (((float) (var10 >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - GL11.glTranslatef(var12, var13, var14); - double var15 = cart.lastTickPosX + (cart.posX - cart.lastTickPosX) * (double) par9; - double var17 = cart.lastTickPosY + (cart.posY - cart.lastTickPosY) * (double) par9; - double var19 = cart.lastTickPosZ + (cart.posZ - cart.lastTickPosZ) * (double) par9; - double var21 = 0.30000001192092896D; - Vec3 var23 = cart.func_70489_a(var15, var17, var19); - float var24 = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * par9; - - if (var23 != null) { - Vec3 var25 = cart.func_70495_a(var15, var17, var19, var21); - Vec3 var26 = cart.func_70495_a(var15, var17, var19, -var21); - - if (var25 == null) { - var25 = var23; - } - - if (var26 == null) { - var26 = var23; - } - - posX += var23.xCoord - var15; - posY += (var25.yCoord + var26.yCoord) / 2.0D - var17; - posZ += var23.zCoord - var19; - Vec3 var27 = var26.addVector(-var25.xCoord, -var25.yCoord, -var25.zCoord); - - if (var27.lengthVector() != 0.0D) { - var27 = var27.normalize(); - par8 = (float) (Math.atan2(var27.zCoord, var27.xCoord) * 180.0D / Math.PI); - var24 = (float) (Math.atan(var27.yCoord) * 73.0D); - } - } - - GL11.glTranslatef((float) posX, (float) posY + 0.3125f, (float) posZ); - GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F); - float var28 = (float) cart.getRollingAmplitude() - par9; - float var30 = (float) cart.getDamage() - par9; - - if (var30 < 0.0F) { - var30 = 0.0F; - } - - if (var28 > 0.0F) { - GL11.glRotatef( - MathHelper.sin(var28) * var28 * var30 / 10.0F * (float) cart.getRollingDirection(), - 1.0F, - 0.0F, - 0.0F); - } - - if (cart.getCartType() != 0) { - // this.loadTexture("/terrain.png"); - float var29 = 0.75F; - GL11.glScalef(var29, var29, var29); - - if (cart.getCartType() == 1) { - GL11.glTranslatef(0.0F, 0.5F, 0.0F); - renderblocks.renderBlockAsItem(Blocks.chest, 0, cart.getBrightness(par9)); - GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(0.5F, 0.0F, -0.5F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } else if (cart.getCartType() == 2) { - GL11.glTranslatef(0.0F, 0.3125F, 0.0F); - renderblocks.renderBlockAsItem(Blocks.furnace, 0, cart.getBrightness(par9)); - GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); - GL11.glTranslatef(0.0F, -0.3125F, 0.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } - - // GL11.glScalef(1.0F / var29, 1.0F / var29, 1.0F / var29); - } - - // this.loadTexture("/tinkertextures/entity/pullcart.png"); - GL11.glScalef(-1.0F, -1.0F, 1.0F); - this.modelCart.render(cart, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - GL11.glPopMatrix(); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render gears = OreDictionary.getOres(oreName); + List gears = OreDictionary.getOres(oreName); - // register every gear besides wooden gear for creating a gear cast - if (!oreName.equals("gearWood")) { - for (ItemStack g : gears) { - TConstructRegistry.getTableCasting().addCastingRecipe(cast, aluCastLiquid, g, false, 50); - if (!PHConstruct.removeGoldCastRecipes) - TConstructRegistry.getTableCasting().addCastingRecipe(cast, goldCastLiquid, g, false, 50); + // register every gear besides wooden gear for creating a gear cast + if (!oreName.equals("gearWood")) { + for (ItemStack g : gears) { + TConstructRegistry.getTableCasting().addCastingRecipe(cast, aluCastLiquid, g, false, 50); + if (!PHConstruct.removeGoldCastRecipes) + TConstructRegistry.getTableCasting().addCastingRecipe(cast, goldCastLiquid, g, false, 50); + } } - } - // find a fluid that fits the gear - String material = oreName.substring(4); - // try the oredict name directly - Fluid fluid = FluidRegistry.getFluid(material); - // or lowercased - if (fluid == null) fluid = FluidRegistry.getFluid(material.toLowerCase()); - // or in the tinkers liquid format - if (fluid == null) fluid = FluidRegistry.getFluid(material.toLowerCase() + ".molten"); + // find a fluid that fits the gear + String material = oreName.substring(4); + // try the oredict name directly + Fluid fluid = FluidRegistry.getFluid(material); + // or lowercased + if (fluid == null) fluid = FluidRegistry.getFluid(material.toLowerCase()); + // or in the tinkers liquid format + if (fluid == null) fluid = FluidRegistry.getFluid(material.toLowerCase() + ".molten"); - // found one? - if (fluid != null) { - ItemStack gear = gears.get(0); - FluidStack liquid = new FluidStack(fluid.getID(), TConstruct.ingotLiquidValue * 4); - // gear casting - TConstructRegistry.getTableCasting().addCastingRecipe(gear, liquid, cast, 55); - // and melting it back - FluidType ft = FluidType.getFluidType(fluid); - if (ft != null) Smeltery.addMelting(ft, gear, 100, TConstruct.ingotLiquidValue * 4); - else Smeltery.addMelting(gear, TinkerSmeltery.glueBlock, 0, 100, liquid); + // found one? + if (fluid != null) { + ItemStack gear = gears.get(0); + FluidStack liquid = new FluidStack(fluid.getID(), TConstruct.ingotLiquidValue * 4); + // gear casting + TConstructRegistry.getTableCasting().addCastingRecipe(gear, liquid, cast, 55); + // and melting it back + FluidType ft = FluidType.getFluidType(fluid); + if (ft != null) Smeltery.addMelting(ft, gear, 100, TConstruct.ingotLiquidValue * 4); + else Smeltery.addMelting(gear, TinkerSmeltery.glueBlock, 0, 100, liquid); + } } } } diff --git a/src/main/java/tconstruct/plugins/ic2/Ic2CropHarvestHandler.java b/src/main/java/tconstruct/plugins/ic2/Ic2CropHarvestHandler.java index 86d7dffb..b48ec469 100644 --- a/src/main/java/tconstruct/plugins/ic2/Ic2CropHarvestHandler.java +++ b/src/main/java/tconstruct/plugins/ic2/Ic2CropHarvestHandler.java @@ -16,7 +16,8 @@ public class Ic2CropHarvestHandler implements CropHarvestHandler { @Override public boolean tryHarvest(ItemStack stack, EntityPlayer player, World world, int x, int y, int z) { - return world.getTileEntity(x, y, z) instanceof ICropTile crop && crop.getCrop().canBeHarvested(crop) + return world.getTileEntity(x, y, z) instanceof ICropTile crop && crop.getCrop() != null + && crop.getCrop().canBeHarvested(crop) && crop.harvest(true); } } diff --git a/src/main/java/tconstruct/plugins/ic2/TinkerIC2.java b/src/main/java/tconstruct/plugins/ic2/TinkerIC2.java index 2a67070c..cf8d2c61 100644 --- a/src/main/java/tconstruct/plugins/ic2/TinkerIC2.java +++ b/src/main/java/tconstruct/plugins/ic2/TinkerIC2.java @@ -14,6 +14,7 @@ import tconstruct.TConstruct; import tconstruct.api.harvesting.CropHarvestHandlers; import tconstruct.library.TConstructRegistry; import tconstruct.library.crafting.LiquidCasting; +import tconstruct.util.config.PHConstruct; @ObjectHolder(TConstruct.modID) @Pulse( @@ -38,11 +39,13 @@ public class TinkerIC2 { LiquidCasting basinCasting = TConstructRegistry.getBasinCasting(); // Block casting - basinCasting.addCastingRecipe( - new ItemStack(Blocks.diamond_block), - fluidStackBlock, - new ItemStack(Blocks.dirt), - true, - 50); + if (!PHConstruct.disableAllRecipes) { + basinCasting.addCastingRecipe( + new ItemStack(Blocks.diamond_block), + fluidStackBlock, + new ItemStack(Blocks.dirt), + true, + 50); + } } } diff --git a/src/main/java/tconstruct/plugins/te4/TinkerTE4.java b/src/main/java/tconstruct/plugins/te4/TinkerTE4.java index 2b53aaf0..67c75cc8 100644 --- a/src/main/java/tconstruct/plugins/te4/TinkerTE4.java +++ b/src/main/java/tconstruct/plugins/te4/TinkerTE4.java @@ -18,6 +18,7 @@ import tconstruct.TConstruct; import tconstruct.library.TConstructRegistry; import tconstruct.smeltery.TinkerSmeltery; import tconstruct.tools.TinkerTools; +import tconstruct.util.config.PHConstruct; import tconstruct.world.TinkerWorld; @ObjectHolder(TConstruct.modID) @@ -95,15 +96,17 @@ public class TinkerTE4 { 0); // Dust Recipes - GameRegistry.addRecipe( - new ShapelessOreRecipe(new ItemStack(TinkerTools.materials, 1, 41), "dustArdite", "dustCobalt")); - GameRegistry.addRecipe( - new ShapelessOreRecipe( - new ItemStack(TinkerTools.materials, 4, 42), - "dustAluminum", - "dustAluminum", - "dustAluminum", - "dustCopper")); + if (!PHConstruct.disableAllRecipes) { + GameRegistry.addRecipe( + new ShapelessOreRecipe(new ItemStack(TinkerTools.materials, 1, 41), "dustArdite", "dustCobalt")); + GameRegistry.addRecipe( + new ShapelessOreRecipe( + new ItemStack(TinkerTools.materials, 4, 42), + "dustAluminum", + "dustAluminum", + "dustAluminum", + "dustCopper")); + } } @Handler diff --git a/src/main/java/tconstruct/smeltery/TinkerSmeltery.java b/src/main/java/tconstruct/smeltery/TinkerSmeltery.java index d585ae95..f99a373d 100644 --- a/src/main/java/tconstruct/smeltery/TinkerSmeltery.java +++ b/src/main/java/tconstruct/smeltery/TinkerSmeltery.java @@ -610,11 +610,13 @@ public class TinkerSmeltery { public void init(FMLInitializationEvent event) { proxy.initialize(); loadMetalPatternMaterial(); - craftingTableRecipes(); - addRecipesForSmeltery(); - addRecipesForTableCasting(); - addRecipesForBasinCasting(); - addRecipesForFurnace(); + if (!PHConstruct.disableAllRecipes) { + craftingTableRecipes(); + addRecipesForSmeltery(); + addRecipesForTableCasting(); + addRecipesForBasinCasting(); + addRecipesForFurnace(); + } } @Handler diff --git a/src/main/java/tconstruct/smeltery/logic/CastingBlockLogic.java b/src/main/java/tconstruct/smeltery/logic/CastingBlockLogic.java index 521e843e..123b2097 100644 --- a/src/main/java/tconstruct/smeltery/logic/CastingBlockLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/CastingBlockLogic.java @@ -1,5 +1,6 @@ package tconstruct.smeltery.logic; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -9,6 +10,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.ForgeDirection; @@ -21,6 +23,7 @@ import net.minecraftforge.fluids.IFluidTank; import cpw.mods.fml.common.eventhandler.Event; import mantle.blocks.abstracts.InventoryLogic; +import mantle.blocks.iface.IFacingLogic; import tconstruct.TConstruct; import tconstruct.library.crafting.CastingRecipe; import tconstruct.library.crafting.LiquidCasting; @@ -30,9 +33,11 @@ import tconstruct.library.event.SmelteryEvent; import tconstruct.library.tools.AbilityHelper; import tconstruct.library.util.IPattern; -public abstract class CastingBlockLogic extends InventoryLogic implements IFluidTank, IFluidHandler, ISidedInventory { +public abstract class CastingBlockLogic extends InventoryLogic + implements IFluidTank, IFluidHandler, ISidedInventory, IFacingLogic { public FluidStack liquid; + protected byte direction; protected int maxCastingDelay = 0; protected int castingDelay = 0; protected int renderOffset = 0; @@ -289,7 +294,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid player); MinecraftForge.EVENT_BUS.post(event); - // try to transfer thes tack to the player inventory + // try to transfer the stack to the player inventory ItemStack output = event.item; AbilityHelper.spawnItemAtPlayer(player, output); @@ -431,6 +436,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid this.castingDelay = tags.getInteger("castingDelay"); this.maxCastingDelay = tags.getInteger("maxCastingDelay"); this.renderOffset = tags.getInteger("RenderOffset"); + this.direction = tags.getByte("direction"); } @Override @@ -451,6 +457,7 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid tags.setInteger("castingDelay", castingDelay); tags.setInteger("maxCastingDelay", maxCastingDelay); tags.setInteger("RenderOffset", renderOffset); + tags.setByte("direction", direction); } /* Packets */ @@ -474,4 +481,28 @@ public abstract class CastingBlockLogic extends InventoryLogic implements IFluid return (int) (((maxCastingDelay - castingDelay) / (double) maxCastingDelay) * 100); } + + @Override + public byte getRenderDirection() { + return direction; + } + + @Override + public ForgeDirection getForgeDirection() { + return ForgeDirection.VALID_DIRECTIONS[direction]; + } + + @Override + public void setDirection(int side) {} + + @Override + public void setDirection(float yaw, float pitch, EntityLivingBase player) { + int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3; + switch (facing) { + case 1 -> direction = 5; + case 2 -> direction = 3; + case 3 -> direction = 4; + default -> direction = 2; + } + } } diff --git a/src/main/java/tconstruct/smeltery/logic/FaucetLogic.java b/src/main/java/tconstruct/smeltery/logic/FaucetLogic.java index f8610af4..a272ac71 100644 --- a/src/main/java/tconstruct/smeltery/logic/FaucetLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/FaucetLogic.java @@ -6,6 +6,7 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.MathHelper; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -18,7 +19,7 @@ import tconstruct.TConstruct; public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogic, IFluidHandler { - byte direction; + byte direction = 0; boolean active; public FluidStack liquid; public boolean hasRedstonePower = false; @@ -91,17 +92,20 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi public void setDirection(int side) { if (side != 0 && side != 1) { direction = (byte) side; - } else { - direction = 2; } } @Override public void setDirection(float yaw, float pitch, EntityLivingBase player) { - /* - * int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3; switch (facing) { case 0: direction = - * 2; break; case 1: direction = 5; break; case 2: direction = 3; break; case 3: direction = 4; break; } - */ + if (direction > 1) return; + + int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3; + switch (facing) { + case 1 -> direction = 5; + case 2 -> direction = 3; + case 3 -> direction = 4; + default -> direction = 2; + } } @Override diff --git a/src/main/java/tconstruct/smeltery/model/CastingBasinSpecialRender.java b/src/main/java/tconstruct/smeltery/model/CastingBasinSpecialRender.java index 14c68c9b..a8df2114 100644 --- a/src/main/java/tconstruct/smeltery/model/CastingBasinSpecialRender.java +++ b/src/main/java/tconstruct/smeltery/model/CastingBasinSpecialRender.java @@ -47,11 +47,20 @@ public class CastingBasinSpecialRender extends TileEntitySpecialRenderer { entityitem.hoverStart = 0.0F; GL11.glPushMatrix(); GL11.glTranslatef(1F, 0.675F, 1.0F); - // GL11.glRotatef(90F, 1, 0F, 0F); + + float rotationY = switch (logic.getRenderDirection()) { + case 2 -> 90F; + case 3 -> 270F; + case 4 -> 180F; + default -> 0F; + }; + + GL11.glRotatef(rotationY, 0F, 1F, 0F); GL11.glScalef(1.75F, 1.75F, 1.75F); + if (stack.getItem() instanceof ItemBlock) { GL11.glScalef(1.6F, 1.6F, 1.6F); - GL11.glTranslatef(0F, 0.045F, 0.0f); + GL11.glTranslatef(0F, 0.045F, 0F); } else if (!(stack.getItem() instanceof ItemBlocklike)) { GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glRotatef(90F, 0F, 0F, 1F); diff --git a/src/main/java/tconstruct/smeltery/model/CastingTableSpecialRenderer.java b/src/main/java/tconstruct/smeltery/model/CastingTableSpecialRenderer.java index ac9d44c2..40376c4f 100644 --- a/src/main/java/tconstruct/smeltery/model/CastingTableSpecialRenderer.java +++ b/src/main/java/tconstruct/smeltery/model/CastingTableSpecialRenderer.java @@ -53,11 +53,30 @@ public class CastingTableSpecialRenderer extends TileEntitySpecialRenderer { entityitem.hoverStart = 0.0F; GL11.glPushMatrix(); GL11.glTranslatef(1F, 1.48F, 0.55F); - GL11.glRotatef(90F, 1, 0F, 0F); + + float rotationY = switch (logic.getRenderDirection()) { + case 3 -> 180F; + case 4 -> 90F; + case 5 -> 270F; + default -> 0F; + }; + GL11.glRotatef(rotationY, 0F, 1F, 0F); + + if (logic.getRenderDirection() == 3) { + GL11.glTranslatef(0F, 0F, -0.9F); + } else if (logic.getRenderDirection() == 4) { + GL11.glTranslatef(-0.45F, 0F, -0.45F); + } else if (logic.getRenderDirection() == 5) { + GL11.glTranslatef(0.45F, 0F, -0.45F); + } + + GL11.glRotatef(90F, 1F, 0F, 0F); GL11.glScalef(2F, 2F, 2F); + if (stack.getItem() instanceof ItemBlock || stack.getItem() instanceof ItemBlocklike) { - GL11.glRotatef(90F, -1, 0F, 0F); - GL11.glTranslatef(0F, -0.1F, 0.2275F); + GL11.glRotatef(-90F, 0F, 0F, 1F); + GL11.glRotatef(90F, -1F, 0F, 0F); + GL11.glTranslatef(-0.2275F, -0.1F, 0F); } if (stack.isItemEqual(new ItemStack(TinkerSmeltery.glassPane))) { diff --git a/src/main/java/tconstruct/tools/TinkerTools.java b/src/main/java/tconstruct/tools/TinkerTools.java index f078d15f..6be5689b 100644 --- a/src/main/java/tconstruct/tools/TinkerTools.java +++ b/src/main/java/tconstruct/tools/TinkerTools.java @@ -521,9 +521,11 @@ public class TinkerTools { @Handler public void init(FMLInitializationEvent event) { addPartMapping(); - addRecipesForToolBuilder(); - addRecipesForChisel(); - craftingTableRecipes(); + if (!PHConstruct.disableAllRecipes) { + addRecipesForToolBuilder(); + addRecipesForChisel(); + craftingTableRecipes(); + } setupToolTabs(); proxy.initialize(); } diff --git a/src/main/java/tconstruct/tools/logic/ToolForgeLogic.java b/src/main/java/tconstruct/tools/logic/ToolForgeLogic.java index 5c85edd4..22d4a026 100644 --- a/src/main/java/tconstruct/tools/logic/ToolForgeLogic.java +++ b/src/main/java/tconstruct/tools/logic/ToolForgeLogic.java @@ -6,12 +6,10 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import tconstruct.TConstruct; import tconstruct.library.crafting.ModifyBuilder; import tconstruct.library.crafting.ToolBuilder; import tconstruct.library.modifier.IModifyable; import tconstruct.tools.inventory.ToolForgeContainer; -import tconstruct.util.network.ToolStationPacket; /* * Simple class for storing items in the block @@ -67,15 +65,5 @@ public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory output = tryRenameTool(output, name); } inventory[0] = output; - if (output != null && output.hasDisplayName()) { - TConstruct.packetPipeline - .sendToServer(new ToolStationPacket(xCoord, yCoord, zCoord, output.getDisplayName())); - } } - /* - * public void buildTool (String name) { toolName = name; ItemStack tool = - * ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name); if (inventory[0] == - * null) inventory[0] = tool; else { NBTTagCompound tags = inventory[0].getTagCompound(); if - * (!tags.getCompoundTag("InfiTool").hasKey("Built")) { inventory[0] = tool; } } } - */ } diff --git a/src/main/java/tconstruct/tools/logic/ToolStationLogic.java b/src/main/java/tconstruct/tools/logic/ToolStationLogic.java index 2e9c45ab..9a52bf1d 100644 --- a/src/main/java/tconstruct/tools/logic/ToolStationLogic.java +++ b/src/main/java/tconstruct/tools/logic/ToolStationLogic.java @@ -9,12 +9,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import mantle.blocks.abstracts.InventoryLogic; -import tconstruct.TConstruct; import tconstruct.library.crafting.ModifyBuilder; import tconstruct.library.crafting.ToolBuilder; import tconstruct.library.modifier.IModifyable; import tconstruct.tools.inventory.ToolStationContainer; -import tconstruct.util.network.ToolStationPacket; /* * Simple class for storing items in the block @@ -55,9 +53,25 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory return new ToolStationContainer(inventoryplayer, this); } + @Override + public void setInventorySlotContents(int slot, ItemStack stack) { + super.setInventorySlotContents(slot, stack); + if (slot != 0) { + buildTool(toolName); + } + } + + @Override + public ItemStack decrStackSize(int slot, int amount) { + ItemStack itemstack = super.decrStackSize(slot, amount); + if (slot != 0) { + buildTool(toolName); + } + return itemstack; + } + @Override public void markDirty() { - buildTool(toolName); if (this.worldObj != null) { this.blockMetadata = this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord); this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); @@ -91,10 +105,6 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory output = tryRenameTool(output, name); } inventory[0] = output; - if (output != null && output.hasDisplayName()) { - TConstruct.packetPipeline - .sendToServer(new ToolStationPacket(xCoord, yCoord, zCoord, output.getDisplayName())); - } } public void setToolname(String name) { @@ -107,10 +117,6 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory if (output != null) temp = output; else temp = inventory[1].copy(); - if (temp == null) { - return null; // output is null or not a tool :( - } - NBTTagCompound tags = temp.getTagCompound(); if (tags == null) { tags = new NBTTagCompound(); @@ -118,17 +124,16 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory } NBTTagCompound display = null; - if (!(tags.hasKey("display"))) display = new NBTTagCompound(); - else if (tags.getCompoundTag("display").hasKey("Name")) display = tags.getCompoundTag("display"); - - if (display == null) return output; + if (tags.hasKey("display") && tags.getCompoundTag("display").hasKey("Name")) + display = tags.getCompoundTag("display"); boolean doRename = false; - if (canRename(display, temp)) { + if (display == null) { + display = new NBTTagCompound(); doRename = true; } // we only allow renaming with a nametag otherwise - else if (!("\u00A7f" + name).equals(display.getString("Name")) && !name.equals(display.getString("Name"))) { + else if (!name.equals(display.getString("Name"))) { int nametagCount = 0; for (ItemStack itemStack : inventory) if (itemStack != null && itemStack.getItem() == Items.name_tag) nametagCount++; @@ -138,8 +143,7 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory if (!doRename) return output; - String dName = temp.getItem() instanceof IModifyable ? "\u00A7f" + name : name; - display.setString("Name", dName); + display.setString("Name", name); tags.setTag("display", display); temp.setRepairCost(2); output = temp; diff --git a/src/main/java/tconstruct/util/config/PHConstruct.java b/src/main/java/tconstruct/util/config/PHConstruct.java index 56e9d414..fcb1a698 100644 --- a/src/main/java/tconstruct/util/config/PHConstruct.java +++ b/src/main/java/tconstruct/util/config/PHConstruct.java @@ -226,6 +226,11 @@ public class PHConstruct { true, "Allow stacks of essence berries to be consumed at once when shifting (this does not spawn XP orbs in world).") .getBoolean(); + disableAllRecipes = config.get( + "general", + "Disable All Recipes", + false, + "Disable all TiC recipes (smeltery, drying rack, crafting, etc)").getBoolean(); enableHealthRegen = config.get("Ultra Hardcore Changes", "Passive Health Regen", true).getBoolean(true); goldAppleRecipe = config.get( @@ -431,6 +436,8 @@ public class PHConstruct { public static boolean consumeXPBerryStacks; + public static boolean disableAllRecipes; + // Mobs public static int naturalSlimeSpawn; diff --git a/src/main/java/tconstruct/weaponry/TinkerWeaponry.java b/src/main/java/tconstruct/weaponry/TinkerWeaponry.java index 61b8fdca..9774f723 100644 --- a/src/main/java/tconstruct/weaponry/TinkerWeaponry.java +++ b/src/main/java/tconstruct/weaponry/TinkerWeaponry.java @@ -135,8 +135,10 @@ public class TinkerWeaponry { @Handler public void init(FMLInitializationEvent event) { - addPartRecipies(); - addWeaponRecipies(); + if (!PHConstruct.disableAllRecipes) { + addPartRecipies(); + addWeaponRecipies(); + } setupCreativeTab(); // Modifiers diff --git a/src/main/java/tconstruct/weaponry/weapons/Crossbow.java b/src/main/java/tconstruct/weaponry/weapons/Crossbow.java index ae4d58b5..64fe325b 100644 --- a/src/main/java/tconstruct/weaponry/weapons/Crossbow.java +++ b/src/main/java/tconstruct/weaponry/weapons/Crossbow.java @@ -12,7 +12,8 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import cpw.mods.fml.common.Loader; -import mods.battlegear2.api.core.IInventoryPlayerBattle; +import mods.battlegear2.api.core.IBattlePlayer; +import tconstruct.compat.Battlegear2Compat; import tconstruct.library.TConstructRegistry; import tconstruct.library.crafting.ToolBuilder; import tconstruct.library.tools.AbilityHelper; @@ -224,8 +225,9 @@ public class Crossbow extends ProjectileWeapon { @Override public ItemStack searchForAmmo(EntityPlayer player, ItemStack weapon) { // arrow priority: hotbar > inventory, tinker arrows > regular arrows - if (isBattlegear2Loaded) { - ItemStack offhand = ((IInventoryPlayerBattle) player.inventory).battlegear2$getCurrentOffhandWeapon(); + if (isBattlegear2Loaded && player instanceof IBattlePlayer battlePlayer + && battlePlayer.battlegear2$isBattlemode()) { + ItemStack offhand = Battlegear2Compat.getBattlegear2Offhand(player); if (offhand != null && (offhand.getItem() instanceof BoltAmmo) && ((IAmmo) offhand.getItem()).getAmmoCount(offhand) > 0) { return offhand; diff --git a/src/main/java/tconstruct/world/TinkerWorld.java b/src/main/java/tconstruct/world/TinkerWorld.java index e659a431..3c7f3dad 100644 --- a/src/main/java/tconstruct/world/TinkerWorld.java +++ b/src/main/java/tconstruct/world/TinkerWorld.java @@ -242,8 +242,10 @@ public class TinkerWorld { TinkerWorld.oreGravel.setHarvestLevel("shovel", 1, 4); TinkerWorld.oreGravel.setHarvestLevel("shovel", 4, 5); // Rail - TinkerWorld.woodenRail = new WoodRail().setStepSound(Block.soundTypeWood) - .setCreativeTab(TConstructRegistry.blockTab).setBlockName("rail.wood"); + if (!Loader.isModLoaded("dreamcraft")) { + TinkerWorld.woodenRail = new WoodRail().setStepSound(Block.soundTypeWood) + .setCreativeTab(TConstructRegistry.blockTab).setBlockName("rail.wood"); + } GameRegistry.registerBlock(TinkerWorld.meatBlock, HamboneItemBlock.class, "MeatBlock"); OreDictionary.registerOre("hambone", new ItemStack(TinkerWorld.meatBlock)); @@ -291,7 +293,9 @@ public class TinkerWorld { GameRegistry.registerBlock(TinkerWorld.oreGravel, GravelOreItem.class, "GravelOre"); // Rail - GameRegistry.registerBlock(TinkerWorld.woodenRail, "rail.wood"); + if (TinkerWorld.woodenRail != null) { + GameRegistry.registerBlock(TinkerWorld.woodenRail, "rail.wood"); + } // Items goldHead = new GoldenHead(4, 1.2F, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 10, 0, 1.0F) @@ -315,9 +319,6 @@ public class TinkerWorld { Items.iron_door.setMaxStackSize(16); Items.boat.setMaxStackSize(16); Items.minecart.setMaxStackSize(3); - // Items.minecartEmpty.setMaxStackSize(3); - // Items.minecartCrate.setMaxStackSize(3); - // Items.minecartPowered.setMaxStackSize(3); Items.cake.setMaxStackSize(16); // Block.torchWood.setTickRandomly(false); @@ -331,8 +332,10 @@ public class TinkerWorld { @Handler public void init(FMLInitializationEvent event) { - craftingTableRecipes(); - addRecipesForFurnace(); + if (!PHConstruct.disableAllRecipes) { + craftingTableRecipes(); + addRecipesForFurnace(); + } addLoot(); createEntities(); proxy.initialize(); @@ -350,8 +353,6 @@ public class TinkerWorld { EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 3, true); EntityRegistry.registerModEntity(LaunchedPotion.class, "Launched Potion", 3, TConstruct.instance, 32, 3, true); EntityRegistry.registerModEntity(ArrowEntity.class, "Arrow", 4, TConstruct.instance, 32, 5, true); - // EntityRegistry.registerModEntity(CartEntity.class, "Small Wagon", 1, - // TConstruct.instance, 32, 5, true); EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true); EntityRegistry.registerModEntity(KingBlueSlime.class, "KingSlime", 14, TConstruct.instance, 64, 5, true); @@ -681,17 +682,19 @@ public class TinkerWorld { // Stone Ladder Recipe GameRegistry.addRecipe( new ShapedOreRecipe(new ItemStack(TinkerWorld.stoneLadder, 3), "w w", "www", "w w", 'w', "rodStone")); - // Wooden Rail Recipe - GameRegistry.addRecipe( - new ShapedOreRecipe( - new ItemStack(TinkerWorld.woodenRail, 4, 0), - "b b", - "bxb", - "b b", - 'b', - "plankWood", - 'x', - "stickWood")); + // Wooden Rail (if registered) Recipe + if (TinkerWorld.woodenRail != null) { + GameRegistry.addRecipe( + new ShapedOreRecipe( + new ItemStack(TinkerWorld.woodenRail, 4, 0), + "b b", + "bxb", + "b b", + 'b', + "plankWood", + 'x', + "stickWood")); + } // Stonesticks Recipes GameRegistry.addRecipe(new ItemStack(TinkerTools.toolRod, 4, 1), "c", "c", 'c', new ItemStack(Blocks.stone)); GameRegistry diff --git a/src/main/java/tconstruct/world/TinkerWorldProxyClient.java b/src/main/java/tconstruct/world/TinkerWorldProxyClient.java index 6d8ec0a1..9bed14e8 100644 --- a/src/main/java/tconstruct/world/TinkerWorldProxyClient.java +++ b/src/main/java/tconstruct/world/TinkerWorldProxyClient.java @@ -35,10 +35,8 @@ import net.minecraft.util.ResourceLocation; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.registry.VillagerRegistry; import mantle.lib.client.MantleClientRegistry; -import tconstruct.mechworks.model.CartRender; import tconstruct.tools.TinkerTools; import tconstruct.world.entity.BlueSlime; -import tconstruct.world.entity.CartEntity; import tconstruct.world.entity.KingBlueSlime; import tconstruct.world.model.BarricadeRender; import tconstruct.world.model.OreberryRender; @@ -69,7 +67,6 @@ public class TinkerWorldProxyClient extends TinkerWorldProxyCommon { SlimeRender slimeRender = new SlimeRender(new ModelSlime(16), new ModelSlime(0), 0.25F); RenderingRegistry.registerEntityRenderingHandler(BlueSlime.class, slimeRender); RenderingRegistry.registerEntityRenderingHandler(KingBlueSlime.class, slimeRender); - RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender()); VillagerRegistry.instance() .registerVillagerSkin(78943, new ResourceLocation("tinker", "textures/mob/villagertools.png")); diff --git a/src/main/java/tconstruct/world/entity/CartEntity.java b/src/main/java/tconstruct/world/entity/CartEntity.java deleted file mode 100644 index 97eb3f81..00000000 --- a/src/main/java/tconstruct/world/entity/CartEntity.java +++ /dev/null @@ -1,1237 +0,0 @@ -package tconstruct.world.entity; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockRail; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.monster.EntityIronGolem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; - -import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import io.netty.buffer.ByteBuf; - -public class CartEntity extends Entity implements IInventory, IEntityAdditionalSpawnData { - - /** Array of item stacks stored in minecart (for storage minecarts). */ - protected ItemStack[] cargoItems; - - protected int fuel; - protected boolean isInReverse; - - /** The type of minecart, 2 for powered, 1 for storage. */ - private int pullcartType; - - public double pushX; - public double pushZ; - protected boolean field_82345_h; - - /** Minecart rotational logic matrix */ - protected static final int[][][] matrix = new int[][][] { { { 0, 0, -1 }, { 0, 0, 1 } }, - { { -1, 0, 0 }, { 1, 0, 0 } }, { { -1, -1, 0 }, { 1, 0, 0 } }, { { -1, 0, 0 }, { 1, -1, 0 } }, - { { 0, 0, -1 }, { 0, -1, 1 } }, { { 0, -1, -1 }, { 0, 0, 1 } }, { { 0, 0, 1 }, { 1, 0, 0 } }, - { { 0, 0, 1 }, { -1, 0, 0 } }, { { 0, 0, -1 }, { -1, 0, 0 } }, { { 0, 0, -1 }, { 1, 0, 0 } } }; - - /** appears to be the progress of the turn */ - protected int turnProgress; - - protected double minecartX; - protected double minecartY; - protected double minecartZ; - protected double minecartYaw; - protected double minecartPitch; - - @SideOnly(Side.CLIENT) - protected double velocityX; - - @SideOnly(Side.CLIENT) - protected double velocityY; - - @SideOnly(Side.CLIENT) - protected double velocityZ; - - /* Forge: Minecart Compatibility Layer Integration. */ - public static float defaultMaxSpeedRail = 0.4f; - public static float defaultMaxSpeedGround = 0.4f; - public static float defaultMaxSpeedAirLateral = 0.4f; - public static float defaultMaxSpeedAirVertical = -1f; - public static double defaultDragRidden = 0.996999979019165D; - public static double defaultDragEmpty = 0.9599999785423279D; - public static double defaultDragAir = 0.94999998807907104D; - protected boolean canUseRail = true; - protected boolean canBePushed = true; - - /* Instance versions of the above physics properties */ - protected float maxSpeedRail; - protected float maxSpeedGround; - protected float maxSpeedAirLateral; - protected float maxSpeedAirVertical; - protected double dragAir; - - Entity entityFollowing; - - public CartEntity(World par1World) { - super(par1World); - this.cargoItems = new ItemStack[36]; - this.fuel = 0; - this.isInReverse = false; - this.field_82345_h = true; - this.preventEntitySpawning = true; - this.setSize(0.98F, 0.7F); - this.yOffset = this.height / 2.0F; - this.stepHeight = 1.0f; - - maxSpeedRail = defaultMaxSpeedRail; - maxSpeedGround = defaultMaxSpeedGround; - maxSpeedAirLateral = defaultMaxSpeedAirLateral; - maxSpeedAirVertical = defaultMaxSpeedAirVertical; - dragAir = defaultDragAir; - } - - public CartEntity(World world, int type) { - this(world); - pullcartType = type; - } - - public CartEntity(World world, double x, double y, double z, int type) { - this(world); - this.setPosition(x, y + (double) this.yOffset, z); - this.motionX = 0.0D; - this.motionY = 0.0D; - this.motionZ = 0.0D; - this.prevPosX = x; - this.prevPosY = y; - this.prevPosZ = z; - this.pullcartType = type; - this.stepHeight = 1.0f; - } - - /** - * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to - * prevent them from trampling crops - */ - @Override - protected boolean canTriggerWalking() { - return false; - } - - @Override - protected void entityInit() { - this.dataWatcher.addObject(16, (byte) 0); - this.dataWatcher.addObject(17, 0); - this.dataWatcher.addObject(18, 1); - this.dataWatcher.addObject(19, 0); - } - - /** - * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be - * pushable on contact, like boats or minecarts. - */ - @Override - public AxisAlignedBB getCollisionBox(Entity par1Entity) { - return par1Entity.boundingBox; - } - - /** - * returns the bounding box for this entity - */ - @Override - public AxisAlignedBB getBoundingBox() { - return this.boundingBox; - } - - /** - * Returns true if this entity should push and be pushed by other entities when colliding. - */ - @Override - public boolean canBePushed() { - return canBePushed; - } - - /** - * Returns the Y offset from the entity's position for any entity riding this one. - */ - @Override - public double getMountedYOffset() { - return (double) this.height * 0.0D - 0.30000001192092896D; - } - - /** - * Called when the entity is attacked. - */ - public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) { - if (!this.worldObj.isRemote && !this.isDead) { - if (this.isEntityInvulnerable()) { - return false; - } else { - this.setRollingDirection(-this.getRollingDirection()); - this.setRollingAmplitude(10); - this.setBeenAttacked(); - this.setDamage(this.getDamage() + par2 * 10); - - if (par1DamageSource.getEntity() instanceof EntityPlayer - && ((EntityPlayer) par1DamageSource.getEntity()).capabilities.isCreativeMode) { - this.setDamage(100); - } - - if (this.getDamage() > 40) { - if (this.riddenByEntity != null) { - this.riddenByEntity.mountEntity(this); - } - - this.setDead(); - dropCartAsItem(); - } - - return true; - } - } else { - return true; - } - } - - @Override - @SideOnly(Side.CLIENT) - /** - * Setups the entity to do the hurt animation. Only used by packets in multiplayer. - */ - public void performHurtAnimation() { - this.setRollingDirection(-this.getRollingDirection()); - this.setRollingAmplitude(10); - this.setDamage(this.getDamage() + this.getDamage() * 10); - } - - /** - * Returns true if other Entities should be prevented from moving through this Entity. - */ - @Override - public boolean canBeCollidedWith() { - return !this.isDead; - } - - /** - * Will get destroyed next tick. - */ - @Override - public void setDead() { - if (this.field_82345_h) { - for (int var1 = 0; var1 < this.getSizeInventory(); ++var1) { - ItemStack var2 = this.getStackInSlot(var1); - - if (var2 != null) { - float var3 = this.rand.nextFloat() * 0.8F + 0.1F; - float var4 = this.rand.nextFloat() * 0.8F + 0.1F; - float var5 = this.rand.nextFloat() * 0.8F + 0.1F; - - while (var2.stackSize > 0) { - int var6 = this.rand.nextInt(21) + 10; - - if (var6 > var2.stackSize) { - var6 = var2.stackSize; - } - - var2.stackSize -= var6; - EntityItem entityitem = new EntityItem( - this.worldObj, - this.posX + (double) var3, - this.posY + (double) var4, - this.posZ + (double) var5, - new ItemStack(var2.getItem(), var6, var2.getItemDamage())); - - if (var2.hasTagCompound()) { - entityitem.getEntityItem().setTagCompound((NBTTagCompound) var2.getTagCompound().copy()); - } - - float var8 = 0.05F; - entityitem.motionX = (float) this.rand.nextGaussian() * var8; - entityitem.motionY = (float) this.rand.nextGaussian() * var8 + 0.2F; - entityitem.motionZ = (float) this.rand.nextGaussian() * var8; - this.worldObj.spawnEntityInWorld(entityitem); - } - } - } - } - - super.setDead(); - } - - /** - * Teleports the entity to another dimension. Params: Dimension number to teleport to - */ - @Override - public void travelToDimension(int par1) { - this.field_82345_h = false; - super.travelToDimension(par1); - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() { - if (this.getRollingAmplitude() > 0) { - this.setRollingAmplitude(this.getRollingAmplitude() - 1); - } - - if (this.getDamage() > 0) { - this.setDamage(this.getDamage() - 1); - } - - if (this.posY < -64.0D) { - this.kill(); - } - - if (this.isMinecartPowered() && this.rand.nextInt(4) == 0 - && pullcartType == 2 - && getClass() == CartEntity.class) { - this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D); - } - - int var2; - - if (!this.worldObj.isRemote && this.worldObj instanceof WorldServer) { - this.worldObj.theProfiler.startSection("portal"); - MinecraftServer var1 = ((WorldServer) this.worldObj).func_73046_m(); - var2 = this.getMaxInPortalTime(); - - // if (this.inPortal) { - // if (var1.getAllowNether()) { - // /* - // * if (this.ridingEntity == null && this.timeInPortal++ >= - // * var2) { this.timeInPortal = var2; this.timeUntilPortal = - // * this.getPortalCooldown(); byte var3; - // * - // * if (this.worldObj.provider.dimensionId == -1) { var3 = 0; - // * } else { var3 = -1; } - // * - // * this.travelToDimension(var3); } - // * - // * this.inPortal = false; - // */ - // } - // } else { - // /* - // * if (this.timeInPortal > 0) { this.timeInPortal -= 4; } - // * - // * if (this.timeInPortal < 0) { this.timeInPortal = 0; } - // */ - // } - - if (this.timeUntilPortal > 0) { - --this.timeUntilPortal; - } - - this.worldObj.theProfiler.endSection(); - } - - if (this.worldObj.isRemote) { - if (this.turnProgress > 0) { - double var46 = this.posX + (this.minecartX - this.posX) / (double) this.turnProgress; - double var48 = this.posY + (this.minecartY - this.posY) / (double) this.turnProgress; - double var5 = this.posZ + (this.minecartZ - this.posZ) / (double) this.turnProgress; - double var7 = MathHelper.wrapAngleTo180_double(this.minecartYaw - (double) this.rotationYaw); - this.rotationYaw = (float) ((double) this.rotationYaw + var7 / (double) this.turnProgress); - this.rotationPitch = (float) ((double) this.rotationPitch - + (this.minecartPitch - (double) this.rotationPitch) / (double) this.turnProgress); - --this.turnProgress; - this.setPosition(var46, var48, var5); - } else { - this.setPosition(this.posX, this.posY, this.posZ); - } - this.setRotation(this.rotationYaw, this.rotationPitch); - } else { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.motionY -= 0.03999999910593033D; - int var45 = MathHelper.floor_double(this.posX); - var2 = MathHelper.floor_double(this.posY); - int var47 = MathHelper.floor_double(this.posZ); - - if (BlockRail.func_150049_b_(this.worldObj, var45, var2 - 1, var47)) { - --var2; - } - - double var4 = 0.4D; - double var6 = 0.0078125D; - Block var8 = this.worldObj.getBlock(var45, var2, var47); - - moveMinecartOffRail(var45, var2, var47); - if (entityFollowing != null) moveTowardsEntity(entityFollowing); - - this.func_145775_I(); - this.rotationPitch = 0.0F; - double var49 = this.prevPosX - this.posX; - double var50 = this.prevPosZ - this.posZ; - - if (var49 * var49 + var50 * var50 > 0.001D) { - this.rotationYaw = (float) (Math.atan2(var50, var49) * 180.0D / Math.PI); - - if (this.isInReverse) { - this.rotationYaw += 180.0F; - } - } - - double var51 = MathHelper.wrapAngleTo180_float(this.rotationYaw - this.prevRotationYaw); - - if (var51 < -170.0D || var51 >= 170.0D) { - this.rotationYaw += 180.0F; - this.isInReverse = !this.isInReverse; - } - - this.setRotation(this.rotationYaw, this.rotationPitch); - - AxisAlignedBB box = boundingBox.expand(0.2D, 0.0D, 0.2D); - - List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box); - - if (var15 != null && !var15.isEmpty()) { - for (Entity var17 : var15) { - if (var17 != this.riddenByEntity && var17.canBePushed() && var17 instanceof CartEntity) { - var17.applyEntityCollision(this); - } - } - } - - if (this.riddenByEntity != null && this.riddenByEntity.isDead) { - if (this.riddenByEntity.ridingEntity == this) { - this.riddenByEntity.ridingEntity = null; - } - - this.riddenByEntity = null; - } - - updateFuel(); - } - } - - void moveTowardsEntity(Entity entity) { - // TConstruct.logger.info("Moving towards entity"); - /* - * double distX = this.posX - entity.posX; double distZ = this.posZ - entity.posZ; //posY = posY + 0.1; if - * (entity.posY > this.posY) motionY += 0.1; if (distX > 0.5 && distZ > 0.5) { motionX = -distX; motionZ = - * -distZ; } - */ - - double var15 = entity.posX; - double var19 = entity.posZ; - - if (this.calculateDistance(this.prevPosX, var15) > 1.5D - || this.calculateDistance(this.prevPosZ, var19) > 1.5D) { - double var28 = this.prevPosX; - double var30 = this.prevPosZ; - double var36 = this.calculateDistance(var28, var15); - double var38 = this.calculateDistance(var30, var19); - double var40 = 1.0D; - double var42 = 1.0D; - double var46; - double var44; - - if (var36 > var38) { - var46 = 1.0D; - var44 = var38 / var36; - var42 = var44 / 3.0D; - var40 = var46 / 3.0D; - } else if (var38 > var36) { - var44 = 1.0D; - var46 = var36 / var38; - var40 = var46 / 3.0D; - var42 = var44 / 3.0D; - } - - if (var15 > var28) { - this.motionX = var40; // * var26; - } else { - this.motionX = -var40; // * var26; - } - - if (var19 > var30) { - this.motionZ = var42; // * var26; - } else { - this.motionZ = -var42; // * var26; - } - } - - /* - * if (entity.posY > this.posY) motionY += 0.1; - */ - } - - public double calculateDistance(double pos1, double pos2) { - double distance = Math.abs(pos1 - pos2); // 0.0D; - /* - * double absPos1 = Math.abs(pos1); double absPos2 = Math.abs(pos2); if ((pos1 <= 0.0D || pos2 <= 0.0D) && (pos1 - * >= 0.0D || pos2 >= 0.0D)) { distance = absPos1 + absPos2; } else if (absPos1 > absPos2) { distance = absPos1 - * - absPos2; } else if (absPos2 > absPos1) { distance = absPos2 - absPos1; } - */ - - return distance; - } - - @SideOnly(Side.CLIENT) - public Vec3 func_70495_a(double par1, double par3, double par5, double par7) { - int var9 = MathHelper.floor_double(par1); - int var10 = MathHelper.floor_double(par3); - int var11 = MathHelper.floor_double(par5); - - if (BlockRail.func_150049_b_(this.worldObj, var9, var10 - 1, var11)) { - --var10; - } - - Block var12 = this.worldObj.getBlock(var9, var10, var11); - - return null; - } - - public Vec3 func_70489_a(double par1, double par3, double par5) { - int var7 = MathHelper.floor_double(par1); - int var8 = MathHelper.floor_double(par3); - int var9 = MathHelper.floor_double(par5); - - if (BlockRail.func_150049_b_(this.worldObj, var7, var8 - 1, var9)) { - --var8; - } - - Block var10 = this.worldObj.getBlock(var7, var8, var9); - - if (BlockRail.func_150051_a(var10)) { - int var11 = 0; - par3 = var8; - - if (var11 >= 2 && var11 <= 5) { - par3 = var8 + 1; - } - - int[][] var12 = matrix[var11]; - double var13; - double var15 = (double) var7 + 0.5D + (double) var12[0][0] * 0.5D; - double var17 = (double) var8 + 0.5D + (double) var12[0][1] * 0.5D; - double var19 = (double) var9 + 0.5D + (double) var12[0][2] * 0.5D; - double var21 = (double) var7 + 0.5D + (double) var12[1][0] * 0.5D; - double var23 = (double) var8 + 0.5D + (double) var12[1][1] * 0.5D; - double var25 = (double) var9 + 0.5D + (double) var12[1][2] * 0.5D; - double var27 = var21 - var15; - double var29 = (var23 - var17) * 2.0D; - double var31 = var25 - var19; - - if (var27 == 0.0D) { - par1 = (double) var7 + 0.5D; - var13 = par5 - (double) var9; - } else if (var31 == 0.0D) { - par5 = (double) var9 + 0.5D; - var13 = par1 - (double) var7; - } else { - double var33 = par1 - var15; - double var35 = par5 - var19; - var13 = (var33 * var27 + var35 * var31) * 2.0D; - } - - par1 = var15 + var27 * var13; - par3 = var17 + var29 * var13; - par5 = var19 + var31 * var13; - - if (var29 < 0.0D) { - ++par3; - } - - if (var29 > 0.0D) { - par3 += 0.5D; - } - - return Vec3.createVectorHelper(par1, par3, par5); - } else { - return null; - } - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { - par1NBTTagCompound.setInteger("Type", pullcartType); - - if (isPoweredCart()) { - par1NBTTagCompound.setDouble("PushX", this.pushX); - par1NBTTagCompound.setDouble("PushZ", this.pushZ); - par1NBTTagCompound.setInteger("Fuel", this.fuel); - } - - if (getSizeInventory() > 0) { - NBTTagList var2 = new NBTTagList(); - - for (int var3 = 0; var3 < this.cargoItems.length; ++var3) { - if (this.cargoItems[var3] != null) { - NBTTagCompound var4 = new NBTTagCompound(); - var4.setByte("Slot", (byte) var3); - this.cargoItems[var3].writeToNBT(var4); - var2.appendTag(var4); - } - } - - par1NBTTagCompound.setTag("Items", var2); - } - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { - pullcartType = par1NBTTagCompound.getInteger("Type"); - - if (isPoweredCart()) { - this.pushX = par1NBTTagCompound.getDouble("PushX"); - this.pushZ = par1NBTTagCompound.getDouble("PushZ"); - try { - this.fuel = par1NBTTagCompound.getInteger("Fuel"); - } catch (ClassCastException e) { - this.fuel = par1NBTTagCompound.getShort("Fuel"); - } - } - - if (getSizeInventory() > 0) { - NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); - this.cargoItems = new ItemStack[this.getSizeInventory()]; - - for (int var3 = 0; var3 < var2.tagCount(); ++var3) { - NBTTagCompound var4 = var2.getCompoundTagAt(var3); - int var5 = var4.getByte("Slot") & 255; - - if (var5 >= 0 && var5 < this.cargoItems.length) { - this.cargoItems[var5] = ItemStack.loadItemStackFromNBT(var4); - } - } - } - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.5F; - } - - /** - * Applies a velocity to each of the entities pushing them away from each other. Args: entity - */ - @Override - public void applyEntityCollision(Entity par1Entity) { - if (!this.worldObj.isRemote) { - if (par1Entity != this.riddenByEntity) { - if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityIronGolem) - && canBeRidden() - && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D - && this.riddenByEntity == null - && par1Entity.ridingEntity == null) { - par1Entity.mountEntity(this); - } - - double var2 = par1Entity.posX - this.posX; - double var4 = par1Entity.posZ - this.posZ; - double var6 = var2 * var2 + var4 * var4; - - if (var6 >= 9.999999747378752E-5D) { - var6 = MathHelper.sqrt_double(var6); - var2 /= var6; - var4 /= var6; - double var8 = 1.0D / var6; - - if (var8 > 1.0D) { - var8 = 1.0D; - } - - var2 *= var8; - var4 *= var8; - var2 *= 0.10000000149011612D; - var4 *= 0.10000000149011612D; - var2 *= 1.0F - this.entityCollisionReduction; - var4 *= 1.0F - this.entityCollisionReduction; - var2 *= 0.5D; - var4 *= 0.5D; - - if (par1Entity instanceof CartEntity) { - double var10 = par1Entity.posX - this.posX; - double var12 = par1Entity.posZ - this.posZ; - Vec3 var14 = Vec3.createVectorHelper(var10, 0.0D, var12).normalize(); - Vec3 var15 = Vec3.createVectorHelper( - MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F), - 0.0D, - MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F)).normalize(); - double var16 = Math.abs(var14.dotProduct(var15)); - - if (var16 < 0.8D) { - return; - } - - double var18 = par1Entity.motionX + this.motionX; - double var20 = par1Entity.motionZ + this.motionZ; - - if (((CartEntity) par1Entity).isPoweredCart() && !isPoweredCart()) { - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; - this.addVelocity(par1Entity.motionX - var2, 0.0D, par1Entity.motionZ - var4); - par1Entity.motionX *= 0.949999988079071D; - par1Entity.motionZ *= 0.949999988079071D; - } else if (!((CartEntity) par1Entity).isPoweredCart() && isPoweredCart()) { - par1Entity.motionX *= 0.20000000298023224D; - par1Entity.motionZ *= 0.20000000298023224D; - par1Entity.addVelocity(this.motionX + var2, 0.0D, this.motionZ + var4); - this.motionX *= 0.949999988079071D; - this.motionZ *= 0.949999988079071D; - } else { - var18 /= 2.0D; - var20 /= 2.0D; - this.motionX *= 0.20000000298023224D; - this.motionZ *= 0.20000000298023224D; - this.addVelocity(var18 - var2, 0.0D, var20 - var4); - par1Entity.motionX *= 0.20000000298023224D; - par1Entity.motionZ *= 0.20000000298023224D; - par1Entity.addVelocity(var18 + var2, 0.0D, var20 + var4); - } - } else { - this.addVelocity(-var2, 0.0D, -var4); - par1Entity.addVelocity(var2 / 4.0D, 0.0D, var4 / 4.0D); - } - } - } - } - } - - /** - * Returns the number of slots in the inventory. - */ - @Override - public int getSizeInventory() { - return (pullcartType == 1 && getClass() == CartEntity.class ? 27 : 0); - } - - /** - * Returns the stack in slot i - */ - @Override - public ItemStack getStackInSlot(int par1) { - return this.cargoItems[par1]; - } - - /** - * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a - * new stack. - */ - @Override - public ItemStack decrStackSize(int par1, int par2) { - if (this.cargoItems[par1] != null) { - ItemStack var3; - if (this.cargoItems[par1].stackSize <= par2) { - var3 = this.cargoItems[par1]; - this.cargoItems[par1] = null; - } else { - var3 = this.cargoItems[par1].splitStack(par2); - if (this.cargoItems[par1].stackSize == 0) { - this.cargoItems[par1] = null; - } - } - return var3; - } else { - return null; - } - } - - /** - * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - - * like when you close a workbench GUI. - */ - @Override - public ItemStack getStackInSlotOnClosing(int par1) { - if (this.cargoItems[par1] != null) { - ItemStack var2 = this.cargoItems[par1]; - this.cargoItems[par1] = null; - return var2; - } else { - return null; - } - } - - /** - * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). - */ - @Override - public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { - this.cargoItems[par1] = par2ItemStack; - - if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) { - par2ItemStack.stackSize = this.getInventoryStackLimit(); - } - } - - /** - * Returns the name of the inventory. - */ - public String getInvName() { - return "container.minecart"; - } - - /** - * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't - * this more of a set than a get?* - */ - @Override - public int getInventoryStackLimit() { - return 64; - } - - /** - * Called when an the contents of an Inventory change, usually - */ - @Override - public void markDirty() {} - - /** - * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig. - */ - public boolean interact(EntityPlayer player) { - if (player.isSneaking()) { - if (entityFollowing == null) { - entityFollowing = player; - } else { - entityFollowing = null; - } - return true; - } - if (canBeRidden()) { - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer - && this.riddenByEntity != player) { - return true; - } - - if (!this.worldObj.isRemote) { - player.mountEntity(this); - } - } else if (getSizeInventory() > 0) { - if (!this.worldObj.isRemote) { - player.displayGUIChest(this); - } - } else if (this.pullcartType == 2 && getClass() == CartEntity.class) { - ItemStack var2 = player.inventory.getCurrentItem(); - - if (var2 != null && var2.getItem() == Items.coal) { - if (--var2.stackSize == 0) { - player.inventory.setInventorySlotContents(player.inventory.currentItem, null); - } - - this.fuel += 3600; - } - - this.pushX = this.posX - player.posX; - this.pushZ = this.posZ - player.posZ; - } - - return true; - } - - @Override - @SideOnly(Side.CLIENT) - /** - * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, - * posY, posZ, yaw, pitch - */ - public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { - this.minecartX = par1; - this.minecartY = par3; - this.minecartZ = par5; - this.minecartYaw = par7; - this.minecartPitch = par8; - this.turnProgress = par9 + 2; - this.motionX = this.velocityX; - this.motionY = this.velocityY; - this.motionZ = this.velocityZ; - } - - @Override - @SideOnly(Side.CLIENT) - /** - * Sets the velocity to the args. Args: x, y, z - */ - public void setVelocity(double par1, double par3, double par5) { - this.velocityX = this.motionX = par1; - this.velocityY = this.motionY = par3; - this.velocityZ = this.motionZ = par5; - } - - /** - * Do not make give this method the name canInteractWith because it clashes with Container - */ - @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { - return !this.isDead && par1EntityPlayer.getDistanceSqToEntity(this) <= 64.0D; - } - - /** - * Is this minecart powered (Fuel > 0) - */ - public boolean isMinecartPowered() { - return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; - } - - /** - * Set if this minecart is powered (Fuel > 0) - */ - protected void setMinecartPowered(boolean par1) { - if (par1) { - this.dataWatcher.updateObject(16, (byte) (this.dataWatcher.getWatchableObjectByte(16) | 1)); - } else { - this.dataWatcher.updateObject(16, (byte) (this.dataWatcher.getWatchableObjectByte(16) & -2)); - } - } - - public void openChest() {} - - public void closeChest() {} - - /** - * Sets the current amount of damage the minecart has taken. Decreases over time. The cart breaks when this is over - * 40. - */ - public void setDamage(int par1) { - this.dataWatcher.updateObject(19, par1); - } - - /** - * Gets the current amount of damage the minecart has taken. Decreases over time. The cart breaks when this is over - * 40. - */ - public int getDamage() { - return this.dataWatcher.getWatchableObjectInt(19); - } - - public void setRollingAmplitude(int par1) { - this.dataWatcher.updateObject(17, par1); - } - - public int getRollingAmplitude() { - return this.dataWatcher.getWatchableObjectInt(17); - } - - public void setRollingDirection(int par1) { - this.dataWatcher.updateObject(18, par1); - } - - public int getRollingDirection() { - return this.dataWatcher.getWatchableObjectInt(18); - } - - /** - * Drops the cart as a item. The exact item dropped is defined by getItemDropped(). - */ - public void dropCartAsItem() { - for (ItemStack item : getItemsDropped()) { - entityDropItem(item, 0); - } - } - - /** - * Override this to define which items your cart drops when broken. This does not include items contained in the - * inventory, that is handled elsewhere. - * - * @return A list of items dropped. - */ - public List getItemsDropped() { - /* - * List items = new ArrayList(); items.add(new ItemStack(Item.minecartEmpty)); - * switch(cartType) { case 1: items.add(new ItemStack(Block.chest)); break; case 2: items.add(new - * ItemStack(Block.stoneOvenIdle)); break; } return items; - */ - return new ArrayList<>(); - } - - /** - * This function returns an ItemStack that represents this cart. This should be an ItemStack that can be used by the - * player to place the cart. This is the item that was registered with the cart via the registerMinecart function, - * but is not necessary the item the cart drops when destroyed. - * - * @return An ItemStack that can be used to place the cart. - */ - public ItemStack getCartItem() { - return null; - // return MinecartRegistry.getItemForCart(this); - } - - /** - * Returns true if this cart is self propelled. - * - * @return True if powered. - */ - public boolean isPoweredCart() { - return pullcartType == 2 && getClass() == CartEntity.class; - } - - /** - * Returns true if this cart is a storage cart Some carts may have inventories but not be storage carts and some - * carts without inventories may be storage carts. - * - * @return True if this cart should be classified as a storage cart. - */ - public boolean isStorageCart() { - return pullcartType == 1 && getClass() == CartEntity.class; - } - - /** - * Returns true if this cart can be ridden by an Entity. - * - * @return True if this cart can be ridden. - */ - public boolean canBeRidden() { - return pullcartType == 0 && getClass() == CartEntity.class; - } - - /** - * Returns true if this cart can currently use rails. This function is mainly used to gracefully detach a minecart - * from a rail. - * - * @return True if the minecart can use rails. - */ - public boolean canUseRail() { - return false; - } - - /** - * Set whether the minecart can use rails. This function is mainly used to gracefully detach a minecart from a rail. - * - * @param use Whether the minecart can currently use rails. - */ - public void setCanUseRail(boolean use) { - canUseRail = use; - } - - /** - * Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails. - * - * @return True if this cart should call IRail.onMinecartPass(). - */ - public boolean shouldDoRailFunctions() { - return true; - } - - /** - * Simply returns the minecartType variable. - * - * @return minecartType - */ - public int getCartType() { - return pullcartType; - } - - /** - * Carts should return their drag factor here - * - * @return The drag rate. - */ - protected double getDrag() { - return riddenByEntity != null ? defaultDragRidden : defaultDragEmpty; - } - - /** - * Moved to allow overrides. This code applies drag and updates push forces. - */ - protected void applyDragAndPushForces() { - if (isPoweredCart()) { - double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ); - if (d27 > 0.01D) { - pushX /= d27; - pushZ /= d27; - double d29 = 0.04; - motionX *= 0.8D; - motionY *= 0.0D; - motionZ *= 0.8D; - motionX += pushX * d29; - motionZ += pushZ * d29; - } else { - motionX *= 0.9D; - motionY *= 0.0D; - motionZ *= 0.9D; - } - } - motionX *= getDrag(); - motionY *= 0.0D; - motionZ *= getDrag(); - } - - /** - * Moved to allow overrides. This code updates push forces. - */ - protected void updatePushForces() { - if (isPoweredCart()) { - double push = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ); - if (push > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D) { - pushX /= push; - pushZ /= push; - if (pushX * motionX + pushZ * motionZ < 0.0D) { - pushX = 0.0D; - pushZ = 0.0D; - } else { - pushX = motionX; - pushZ = motionZ; - } - } - } - } - - /** - * Moved to allow overrides. This code handles minecart movement and speed capping when not on a rail. - */ - protected void moveMinecartOffRail(int i, int j, int k) { - double d2 = getMaxSpeedGround(); - if (!onGround) { - d2 = getMaxSpeedAirLateral(); - } - if (motionX < -d2) motionX = -d2; - if (motionX > d2) motionX = d2; - if (motionZ < -d2) motionZ = -d2; - if (motionZ > d2) motionZ = d2; - double moveY = motionY; - if (getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical()) { - moveY = getMaxSpeedAirVertical(); - if (Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f) { - moveY = 0.15f; - motionY = moveY; - } - } - if (onGround) { - motionX *= 0.5D; - motionY *= 0.5D; - motionZ *= 0.5D; - } - moveEntity(motionX, moveY, motionZ); - if (!onGround) { - motionX *= getDragAir(); - motionY *= getDragAir(); - motionZ *= getDragAir(); - } - } - - /** - * Moved to allow overrides. This code applies fuel consumption. - */ - protected void updateFuel() { - if (fuel > 0) fuel--; - if (fuel <= 0) pushX = pushZ = 0.0D; - setMinecartPowered(fuel > 0); - } - - /** - * Moved to allow overrides, This code handle slopes affecting velocity. - * - * @param metadata The blocks position metadata - */ - protected void adjustSlopeVelocities(int metadata) { - double acceleration = 0.0078125D; - if (metadata == 2) { - motionX -= acceleration; - } else if (metadata == 3) { - motionX += acceleration; - } else if (metadata == 4) { - motionZ += acceleration; - } else if (metadata == 5) { - motionZ -= acceleration; - } - } - - /** - * Getters/setters for physics variables - */ - - /** - * Returns the carts max speed. Carts going faster than 1.1 cause issues with chunk loading. Carts cant traverse - * slopes or corners at greater than 0.5 - 0.6. This value is compared with the rails max speed to determine the - * carts current max speed. A normal rails max speed is 0.4. - * - * @return Carts max speed. - */ - public float getMaxSpeedRail() { - return maxSpeedRail; - } - - public void setMaxSpeedRail(float value) { - maxSpeedRail = value; - } - - public float getMaxSpeedGround() { - return maxSpeedGround; - } - - public void setMaxSpeedGround(float value) { - maxSpeedGround = value; - } - - public float getMaxSpeedAirLateral() { - return maxSpeedAirLateral; - } - - public void setMaxSpeedAirLateral(float value) { - maxSpeedAirLateral = value; - } - - public float getMaxSpeedAirVertical() { - return maxSpeedAirVertical; - } - - public void setMaxSpeedAirVertical(float value) { - maxSpeedAirVertical = value; - } - - public double getDragAir() { - return dragAir; - } - - public void setDragAir(double value) { - dragAir = value; - } - - @Override - public void writeSpawnData(ByteBuf data) { - data.writeInt(pullcartType); - } - - @Override - public void readSpawnData(ByteBuf data) { - pullcartType = data.readInt(); - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return false; - } - - @Override - public String getInventoryName() { - // TODO get inventory name - return null; - } - - @Override - public boolean hasCustomInventoryName() { - return false; - } - - @Override - public void openInventory() {} - - @Override - public void closeInventory() {} -} diff --git a/src/main/resources/assets/tinker/manuals/en_US/diary.xml b/src/main/resources/assets/tinker/manuals/en_US/diary.xml index 01beed1c..2f6416e7 100644 --- a/src/main/resources/assets/tinker/manuals/en_US/diary.xml +++ b/src/main/resources/assets/tinker/manuals/en_US/diary.xml @@ -4,7 +4,7 @@ Tinker's Log #1: -Today is a new day. I finally left home and decided to wander around in the wilderness until I find a good place to call my home. +Today is a new day. I finally left home and decided to wander around in the wilderness until I find a good place to call my home. Tinker's Log #2: @@ -66,7 +66,7 @@ Perhaps making a tool completely out of stone wasn't the best idea. It didn't la Tinker's Log #13: -I wanted to make a few more tools, but the boards with tool shapes in them went everywhere! I ended up breaking a few out of frustration. They don't fit very well in my chest either. I took a few of them, added a few slots to the bottom of the chest, placed it by my table and called it good. +I wanted to make a few more tools, but the boards with tool shapes in them went everywhere! I ended up breaking a few out of frustration. They don't fit very well in my chest either. I took a few of them, added a few slots to the bottom of the chest, placed it by my table and called it good. I also named them "Patterns", the chest a "Pattern Chest". I'm still angry at them, and it took so long to make new ones... @@ -74,7 +74,7 @@ I also named them "Patterns", the chest a "Pattern Chest". I'm still angry at th Tinker's Log #14 -Today I learned just how hard it was to shape iron. First you have to dig it out of the earth. A wooden pickaxe will shatter the ore; this I found out the hard way. Once you do get that ore there isn't much to do with it besides throw it in the furnace. Melting the iron and the stone seems inefficient, but I do need the metal more than I care about the waste. +Today I learned just how hard it was to shape iron. First you have to dig it out of the earth. A wooden pickaxe will shatter the ore; this I found out the hard way. Once you do get that ore there isn't much to do with it besides throw it in the furnace. Melting the iron and the stone seems inefficient, but I do need the metal more than I care about the waste. I shaped a few of the bars into tools, and they felt strong. Much stronger, in fact, than the ones back at the village. I've named the pickaxe "Krug" after some of the stories Nana used to tell me at night. How I miss her... @@ -92,7 +92,7 @@ A week later and I've finally found some others to visit. Some of them seem nice Tinker's Log #17: -After three days and nights of fending off zombies, I've finally created a house. It has a few rooms, a basement, but most importantly a workshop. All of the tables and patterns I had before are here, as well as a few others I wanted to try out from the trip. +After three days and nights of fending off zombies, I've finally created a house. It has a few rooms, a basement, but most importantly a workshop. All of the tables and patterns I had before are here, as well as a few others I wanted to try out from the trip. There's a round one I can cook food with and one that's just as good as any hoe, but can chop trees or actually dig the ground up. The villagers tell me these are named "Frying Pan" and "Mattock". The Frying Pan seems heavy enough to smack creepers with. I have a sword named "Shimmer" that I want to alter somehow. @@ -106,7 +106,7 @@ One of the villagers was kind enough to give me some random things. Each one loo Tinker's Log #19: -After some heavy experimentation, I've ended up with some things that look amazing and others that look less useful than they actually are. A diamond tip on a pickaxe makes for a wonderfully hard mining tool, and an emerald on a sword hilt somehow makes it stay together longer, but some things don't do anything. +After some heavy experimentation, I've ended up with some things that look amazing and others that look less useful than they actually are. A diamond tip on a pickaxe makes for a wonderfully hard mining tool, and an emerald on a sword hilt somehow makes it stay together longer, but some things don't do anything. Adding flowers to a tool does nothing; they don't even stay on the thing. Mushrooms have a similar effect, and adding more material to a tool just makes it heavier. You wouldn't think redstone would do anything. I've coated a shovel so much that it looks deep red. However, it slides through dirt as if the dirt wasn't there. @@ -132,36 +132,23 @@ I have some ideas for creating tools, but for that I need a large place to creat Tinker's Log #23: -Today I made something strange. It's round, wooden, and doesn't look like anything I've ever seen. Someone came by and said it was a "wheel" and that they were great fun to roll around. I wonder what else it could be used for? +I have all these tools laying around with little notes on what each one does. Instead of leaving them scattered about, I think I will create one place to store them. Tinker's Log #24: -I made a few more of the wheels to get some practice in. I had some fun rolling them around, rolling them in pairs, and then one ended up beside my boat. It just looked so natural I had to start putting them together. +I went exploring and found some new ores today. They're colors I've never seen before, and they don't shatter on impact like iron does. I wonder what I can do with these? Tinker's Log #25: -I think I'm on to something here. Combining the boat with the wheel made it work something like a minecart, only I can pull it around places. It feels a little small though. - -Tinker's Log #26: - -I have all these tools laying around with little notes on what each one does. Instead of leaving them scattered about, I think I will create one place to store them. - - - -Tinker's Log #27: - -I went exploring and found some new ores today. They're colors I've never seen before, and they don't shatter on impact like iron does. I wonder what I can do with these? - -Tinker's Log #28: - The normal furnace is nice for keeping warm, but it leaves something to be desired for processing metal. I've dug a pit and lined it with some clay, gathered lava nearby, and put ore in the center in an attempt to improve on the design. The results were quite interesting. -The more lava I fed into the pit the hotter the material became. Eventually the whole thing liquified. I broke open the side of the pit with a cauldron in an attempt to catch the material, but it went everywhere. There were some remnants left in the pit as well. + +The more lava I fed into the pit the hotter the material became. Eventually the whole thing liquified. I broke open the side of the pit with a cauldron in an attempt to catch the material, but it went everywhere. There were some remnants left in the pit as well. Raw ore still has parts of stone in it. There must be a way to remove the excess. - \ No newline at end of file +