diff --git a/resources/assets/enderio/lang/en_US.lang b/resources/assets/enderio/lang/en_US.lang index c20d5c76..7d5c1aec 100644 --- a/resources/assets/enderio/lang/en_US.lang +++ b/resources/assets/enderio/lang/en_US.lang @@ -432,6 +432,9 @@ tile.blockDarkSteelAnvil.tooltip.common.line1=Damage Resistant tile.blockDarkSteelAnvil.tooltip.detailed.line1=Lasts much longer than tile.blockDarkSteelAnvil.tooltip.detailed.line2=the vanilla anvil +tile.blockDarkSteelLadder.name=Dark Steel Ladder +tile.blockDarkSteelLadder.tooltip.common.line1=Faster than regular ladders + //Travel tile.blockTravelAnchor.name=Travel Anchor tile.blockTravelAnchor.tooltip.detailed.line1=Allows teleportation between anchors diff --git a/resources/assets/enderio/textures/blocks/blockDarkSteelLadder.png b/resources/assets/enderio/textures/blocks/blockDarkSteelLadder.png new file mode 100644 index 00000000..1e2a2ce9 Binary files /dev/null and b/resources/assets/enderio/textures/blocks/blockDarkSteelLadder.png differ diff --git a/src/main/java/crazypants/enderio/EnderIO.java b/src/main/java/crazypants/enderio/EnderIO.java index 8736a5c1..aa36c2de 100644 --- a/src/main/java/crazypants/enderio/EnderIO.java +++ b/src/main/java/crazypants/enderio/EnderIO.java @@ -38,6 +38,7 @@ import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.relauncher.Side; import crazypants.enderio.api.IMC; import crazypants.enderio.block.BlockDarkSteelAnvil; +import crazypants.enderio.block.BlockDarkSteelLadder; import crazypants.enderio.block.BlockDarkSteelPressurePlate; import crazypants.enderio.block.BlockReinforcedObsidian; import crazypants.enderio.conduit.BlockConduitBundle; @@ -246,6 +247,7 @@ public class EnderIO { //Blocks public static BlockDarkSteelPressurePlate blockDarkSteelPressurePlate; public static BlockDarkSteelAnvil blockDarkSteelAnvil; + public static BlockDarkSteelLadder blockDarkSteelLadder; public static BlockEndermanSkull blockEndermanSkull; public static BlockReinforcedObsidian blockReinforcedObsidian; @@ -346,6 +348,7 @@ public class EnderIO { blockDarkSteelPressurePlate = BlockDarkSteelPressurePlate.create(); blockDarkSteelAnvil = BlockDarkSteelAnvil.create(); + blockDarkSteelLadder = BlockDarkSteelLadder.create(); blockElectricLight = BlockElectricLight.create(); blockLightNode = BlockLightNode.create(); diff --git a/src/main/java/crazypants/enderio/ModObject.java b/src/main/java/crazypants/enderio/ModObject.java index e8f485e4..5a025d69 100644 --- a/src/main/java/crazypants/enderio/ModObject.java +++ b/src/main/java/crazypants/enderio/ModObject.java @@ -71,6 +71,7 @@ public enum ModObject { //Blocks blockDarkSteelPressurePlate, blockDarkSteelAnvil, + blockDarkSteelLadder, blockReinforcedObsidian, blockIngotStorage, diff --git a/src/main/java/crazypants/enderio/block/BlockDarkSteelLadder.java b/src/main/java/crazypants/enderio/block/BlockDarkSteelLadder.java new file mode 100644 index 00000000..fa093596 --- /dev/null +++ b/src/main/java/crazypants/enderio/block/BlockDarkSteelLadder.java @@ -0,0 +1,54 @@ +package crazypants.enderio.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockLadder; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; +import crazypants.enderio.EnderIO; +import crazypants.enderio.EnderIOTab; +import crazypants.enderio.ModObject; +import crazypants.enderio.config.Config; +import crazypants.enderio.gui.IResourceTooltipProvider; + +public class BlockDarkSteelLadder extends BlockLadder implements IResourceTooltipProvider { + + public static BlockDarkSteelLadder create() { + BlockDarkSteelLadder res = new BlockDarkSteelLadder(); + res.init(); + return res; + } + + protected BlockDarkSteelLadder() { + super(); + + setBlockName(ModObject.blockDarkSteelLadder.unlocalisedName); + setBlockTextureName(EnderIO.MODID + ":" + ModObject.blockDarkSteelLadder.unlocalisedName); + setStepSound(Block.soundTypeMetal); + setCreativeTab(EnderIOTab.tabEnderIO); + setHardness(0.4F); + } + + protected void init() { + GameRegistry.registerBlock(this, ModObject.blockDarkSteelLadder.unlocalisedName); + } + + @Override + public Material getMaterial() { + return Material.iron; + } + + @Override + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { + if(entity.motionY >= 0.1) { + entity.setPosition(entity.posX, entity.posY + Config.darkSteelLadderSpeedBoost, entity.posZ); + } + } + + @Override + public String getUnlocalizedNameForTooltip(ItemStack itemStack) { + return getUnlocalizedName(); + } +} diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java index 0934ec08..9315b638 100644 --- a/src/main/java/crazypants/enderio/config/Config.java +++ b/src/main/java/crazypants/enderio/config/Config.java @@ -221,6 +221,8 @@ public final class Config { public static float darkSteelAnvilDamageChance = 0.024f; + public static float darkSteelLadderSpeedBoost = 0.06f; + public static int hootchPowerPerCycleRF = 60; public static int hootchPowerTotalBurnTime = 6000; public static int rocketFuelPowerPerCycleRF = 160; @@ -795,6 +797,8 @@ public final class Config { darkSteelAnvilDamageChance = (float) config.get(sectionDarkSteel.name, "darkSteelAnvilDamageChance", darkSteelAnvilDamageChance, "Chance that the dark steel anvil will take damage after repairing something.").getDouble(); + darkSteelLadderSpeedBoost = (float) config.get(sectionDarkSteel.name, "darkSteelLadderSpeedBoost", darkSteelLadderSpeedBoost, "Speed boost, in blocks per tick, that the DS ladder gives over the vanilla ladder.").getDouble(); + hootchPowerPerCycleRF = config.get(sectionPower.name, "hootchPowerPerCycleRF", hootchPowerPerCycleRF, "The amount of power generated per BC engine cycle. Examples: BC Oil = 30, BC Fuel = 60").getInt(hootchPowerPerCycleRF); hootchPowerTotalBurnTime = config.get(sectionPower.name, "hootchPowerTotalBurnTime", hootchPowerTotalBurnTime, diff --git a/src/main/java/crazypants/enderio/gui/TooltipAddera.java b/src/main/java/crazypants/enderio/gui/TooltipAddera.java index 7dad6232..29429ab8 100644 --- a/src/main/java/crazypants/enderio/gui/TooltipAddera.java +++ b/src/main/java/crazypants/enderio/gui/TooltipAddera.java @@ -1,5 +1,6 @@ package crazypants.enderio.gui; +import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; @@ -150,7 +151,9 @@ public class TooltipAddera { } else { addBasicTooltipFromResources(list, name); addCommonTooltipFromResources(list, name); - addShowDetailsTooltip(list); + if (hasDetailedTooltip(tt, itemstack)) { + addShowDetailsTooltip(list); + } } } @@ -160,10 +163,26 @@ public class TooltipAddera { tt.addDetailedEntries(itemstack, entityplayer, list, flag); } else { tt.addBasicEntries(itemstack, entityplayer, list, flag); - addShowDetailsTooltip(list); + if(hasDetailedTooltip(tt, itemstack, entityplayer, flag)) { + addShowDetailsTooltip(list); + } } } - + + private static final List throwaway = new ArrayList(); + private static boolean hasDetailedTooltip(IResourceTooltipProvider tt, ItemStack stack) { + throwaway.clear(); + String name = tt.getUnlocalizedNameForTooltip(stack); + addDetailedTooltipFromResources(throwaway, name); + return !throwaway.isEmpty(); + } + + private static boolean hasDetailedTooltip(IAdvancedTooltipProvider tt, ItemStack stack, EntityPlayer player, boolean flag) { + throwaway.clear(); + tt.addDetailedEntries(stack, player, throwaway, flag); + return !throwaway.isEmpty(); + } + public static void addShowDetailsTooltip(List list) { list.add(EnumChatFormatting.WHITE + "" + EnumChatFormatting.ITALIC + Lang.localize("item.tooltip.showDetails")); } diff --git a/src/main/java/crazypants/enderio/material/MaterialRecipes.java b/src/main/java/crazypants/enderio/material/MaterialRecipes.java index 18cf58ab..b8d342ce 100644 --- a/src/main/java/crazypants/enderio/material/MaterialRecipes.java +++ b/src/main/java/crazypants/enderio/material/MaterialRecipes.java @@ -169,6 +169,8 @@ public class MaterialRecipes { 'b', "blockDarkSteel", 'i', "ingotDarkSteel" )); + + GameRegistry.addRecipe(new ItemStack(EnderIO.blockDarkSteelLadder, 12), "b", "b", "b", 'b', EnderIO.blockDarkIronBars); for (Alloy alloy : Alloy.values()) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(EnderIO.blockIngotStorage, 1, alloy.ordinal()), "iii", "iii", "iii", 'i', alloy.oredictIngotName));