Restore the wooden rail (#171)

Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com>
This commit is contained in:
AnrDaemonandMaya authored and GitHub committed 2025-05-06 21:53:49 +00:00
1 parent 9633ddce6e
commit 937c322dd3
17 files changed
+123 -13

No files matched your search

@@ -72,6 +72,7 @@ import tconstruct.world.blocks.SlimePad;
import tconstruct.world.blocks.StoneLadder;
import tconstruct.world.blocks.StoneTorch;
import tconstruct.world.blocks.TMetalBlock;
import tconstruct.world.blocks.WoodRail;
import tconstruct.world.entity.BlueSlime;
import tconstruct.world.entity.Crystal;
import tconstruct.world.entity.KingBlueSlime;
@@ -136,6 +137,8 @@ public class TinkerWorld {
public static OreberryBush oreBerry;
public static OreberryBush oreBerrySecond;
public static Item oreBerries;
// Rail-related
public static Block woodenRail;
// Chest hooks
public static ChestGenHooks tinkerHouseChest;
public static ChestGenHooks tinkerHousePatterns;
@@ -238,6 +241,11 @@ public class TinkerWorld {
TinkerWorld.oreGravel.setHarvestLevel("shovel", 1, 3);
TinkerWorld.oreGravel.setHarvestLevel("shovel", 1, 4);
TinkerWorld.oreGravel.setHarvestLevel("shovel", 4, 5);
// Rail
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));
@@ -284,6 +292,11 @@ public class TinkerWorld {
GameRegistry.registerBlock(TinkerWorld.oreSlag, MetalOreItemBlock.class, "SearedBrick");
GameRegistry.registerBlock(TinkerWorld.oreGravel, GravelOreItem.class, "GravelOre");
// Rail
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)
.setUnlocalizedName("goldenhead");
@@ -669,6 +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 (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
@@ -0,0 +1,54 @@
package tconstruct.world.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class WoodRail extends BlockRailBase {
@SideOnly(Side.CLIENT)
private IIcon theIcon;
public WoodRail() {
super(false);
}
@Override
@SideOnly(Side.CLIENT)
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public IIcon getIcon(int par1, int par2) {
return par2 >= 6 ? this.theIcon : this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerBlockIcons(IIconRegister par1IconRegister) {
this.blockIcon = par1IconRegister.registerIcon("tinker:woodrail");
this.theIcon = par1IconRegister.registerIcon("tinker:woodrail_turn");
}
protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, Block par7) {
if (par7 != Blocks.air && par7.canProvidePower()
&& (new Rail(par1World, par2, par3, par4)).func_150650_a() == 3) {
this.func_150052_a(par1World, par2, par3, par4, false);
}
}
@Override
public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) {
return 0.3f;
}
}