Merge pull request #2247 from abel1502/abel-trapdoors

Add a steel trapdoor
This commit is contained in:
HbmMods 2025-07-01 08:34:04 +02:00 committed by GitHub
commit 8685831c04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 75 additions and 1 deletions

View File

@ -846,6 +846,8 @@ public class ModBlocks {
public static Block ladder_steel;
public static Block ladder_tungsten;
public static Block trapdoor_steel;
public static Block barrel_plastic;
public static Block barrel_corroded;
public static Block barrel_iron;
@ -1974,6 +1976,8 @@ public class ModBlocks {
ladder_cobalt = new BlockNTMLadder().setBlockName("ladder_cobalt").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_cobalt");
ladder_steel = new BlockNTMLadder().setBlockName("ladder_steel").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_steel");
ladder_tungsten = new BlockNTMLadder().setBlockName("ladder_tungsten").setHardness(0.25F).setResistance(2.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":ladder_tungsten");
trapdoor_steel = new BlockNTMTrapdoor(Material.iron).setBlockName("trapdoor_steel").setHardness(3F).setResistance(8.0F).setStepSound(Block.soundTypeMetal).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":trapdoor_steel");
barrel_plastic = new BlockFluidBarrel(Material.iron, 12000).setBlockName("barrel_plastic").setStepSound(Block.soundTypeStone).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_plastic");
barrel_corroded = new BlockFluidBarrel(Material.iron, 6000).setBlockName("barrel_corroded").setStepSound(Block.soundTypeMetal).setHardness(2.0F).setResistance(5.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":barrel_corroded");
@ -3239,6 +3243,7 @@ public class ModBlocks {
GameRegistry.registerBlock(ladder_steel, ladder_steel.getUnlocalizedName());
GameRegistry.registerBlock(ladder_lead, ladder_lead.getUnlocalizedName());
GameRegistry.registerBlock(ladder_cobalt, ladder_cobalt.getUnlocalizedName());
GameRegistry.registerBlock(trapdoor_steel, trapdoor_steel.getUnlocalizedName());
register(barrel_plastic);
register(barrel_corroded);

View File

@ -0,0 +1,60 @@
package com.hbm.blocks.generic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTrapDoor;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockNTMTrapdoor extends BlockTrapDoor {
public BlockNTMTrapdoor(Material material) {
super(material);
}
@Override
public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity) {
int meta = world.getBlockMetadata(x, y, z);
// isOpen
if (!func_150118_d(meta))
return false;
Block blockBelow = world.getBlock(x, y - 1, z);
return blockBelow != null && blockBelow.isLadder(world, x, y - 1, z, entity);
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
// Make the hitbox in-line with ladders, if relevant
if (isLadder(world, x, y, z, null)) {
int meta = world.getBlockMetadata(x, y, z);
float thickness = 0.125F;
if ((meta & 3) == 0)
return AxisAlignedBB.getBoundingBox(x, y, z + 1F - thickness, x + 1F, y + 1F, z + 1F);
if ((meta & 3) == 1)
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1F, y + 1F, z + thickness);
if ((meta & 3) == 2)
return AxisAlignedBB.getBoundingBox(x + 1F - thickness, y, z, x + 1F, y + 1F, z + 1F);
if ((meta & 3) == 3)
return AxisAlignedBB.getBoundingBox(x, y, z, x + thickness, y + 1F, z + 1F);
}
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
// The original code prevented manual operation of Material.iron trapdoors. This bypasses that behavior
int meta = world.getBlockMetadata(x, y, z);
world.setBlockMetadataWithNotify(x, y, z, meta ^ 4, 2);
world.playAuxSFXAtEntity(player, 1003, x, y, z, 0);
return true;
}
}

View File

@ -882,6 +882,8 @@ public class CraftingManager {
addRecipeAuto(new ItemStack(ModBlocks.ladder_steel, 8), new Object[] { "LLL", "L#L", "LLL", 'L', Blocks.ladder, '#', STEEL.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.ladder_tungsten, 8), new Object[] { "LLL", "L#L", "LLL", 'L', Blocks.ladder, '#', W.ingot() });
addShapelessAuto(new ItemStack(ModBlocks.trapdoor_steel, 1), new Object[] { Blocks.trapdoor, STEEL.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.machine_storage_drum), new Object[] { "LLL", "L#L", "LLL", 'L', PB.plate(), '#', ModItems.tank_steel });
addRecipeAuto(new ItemStack(ModBlocks.deco_pipe, 6), new Object[] { "PP", 'P', STEEL.pipe() });

View File

@ -127,7 +127,7 @@ public class BunkerComponents {
fillWithMetadataBlocks(world, box, 1, hpos, 4, 1, hpos, 6, ModBlocks.concrete_smooth_stairs, getStairMeta(0));
placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 1, 2, hpos, 3, box);
placeBlockAtCurrentPosition(world, ModBlocks.concrete_smooth_stairs, getStairMeta(2), 2, hpos, 4, box);
placeBlockAtCurrentPosition(world, Blocks.trapdoor, getDecoModelMeta(8) >> 2, 2, hpos, 5, box);
placeBlockAtCurrentPosition(world, ModBlocks.trapdoor_steel, getDecoModelMeta(8) >> 2, 2, hpos, 5, box);
placeBlockAtCurrentPosition(world, ModBlocks.concrete_smooth_stairs, getStairMeta(3), 2, hpos, 6, box);
placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 1, 2, hpos, 7, box);
fillWithMetadataBlocks(world, box, 3, hpos, 4, 3, hpos, 6, ModBlocks.concrete_smooth_stairs, getStairMeta(1));

View File

@ -4321,6 +4321,7 @@ tile.ladder_steel.name=Stahlleiter
tile.ladder_sturdy.name=Feste Holzleiter
tile.ladder_titanium.name=Titanleiter
tile.ladder_tungsten.name=Wolframleiter
tile.trapdoor_steel.name=Stahl-Falltür
tile.lamp_demon.name=Dämonenkernlampe
tile.lamp_tritium_blue_off.name=Blaue Tritiumlampe
tile.lamp_tritium_blue_on.name=Blaue Tritiumlampe

View File

@ -5446,6 +5446,7 @@ tile.ladder_steel.name=Steel Ladder
tile.ladder_sturdy.name=Sturdy Wooden Ladder
tile.ladder_titanium.name=Titanium Ladder
tile.ladder_tungsten.name=Tungsten Ladder
tile.trapdoor_steel.name=Steel Trapdoor
tile.lamp_demon.name=Demon Core Lamp
tile.lamp_tritium_blue_off.name=Blue Tritium Lamp
tile.lamp_tritium_blue_on.name=Blue Tritium Lamp

View File

@ -5513,6 +5513,7 @@ tile.ladder_steel.name=Steel Ladder
tile.ladder_sturdy.name=Sturdy Wooden Ladder
tile.ladder_titanium.name=Titanium Ladder
tile.ladder_tungsten.name=Tungsten Ladder
tile.trapdoor_steel.name=Steel Trapdoor
tile.lamp_demon.name=Demon Core Lamp
tile.lamp_tritium_blue_off.name=Blue Tritium Lamp
tile.lamp_tritium_blue_on.name=Blue Tritium Lamp

View File

@ -4859,6 +4859,7 @@ tile.ladder_steel.name=Steel Ladder
tile.ladder_sturdy.name=Sturdy Wooden Ladder
tile.ladder_titanium.name=Titanium Ladder
tile.ladder_tungsten.name=Tungsten Ladder
tile.trapdoor_steel.name=Steel Trapdoor
tile.lamp_demon.name=Demon Core Lamp
tile.lamp_tritium_blue_off.name=Blue Tritium Lamp
tile.lamp_tritium_blue_on.name=Blue Tritium Lamp

View File

@ -5689,6 +5689,7 @@ tile.ladder_steel.name=Стальная лестница
tile.ladder_sturdy.name=Прочная деревянная лестница
tile.ladder_titanium.name=Титановая лестница
tile.ladder_tungsten.name=Вольфрамовая лестница
tile.trapdoor_steel.name=Стальной люк
tile.lamp_demon.name=Лампа из заряда-демона
tile.lamp_tritium_blue_off.name=Синяя тритиевая лампа
tile.lamp_tritium_blue_on.name=Синяя тритиевая лампа

View File

@ -5445,6 +5445,7 @@ tile.ladder_steel.name=Сталева драбина
tile.ladder_sturdy.name=Міцна дерев'яна драбина
tile.ladder_titanium.name=Титанова драбина
tile.ladder_tungsten.name=Вольфрамова драбина
tile.trapdoor_steel.name=Сталевий люк
tile.lamp_demon.name=Ядро-демон лампа
tile.lamp_tritium_blue_off.name=Синя тритієва лампа
tile.lamp_tritium_blue_on.name=Синя тритієва лампа

View File

@ -5155,6 +5155,7 @@ tile.ladder_steel.name=钢制梯子
tile.ladder_sturdy.name=坚固木头制梯子
tile.ladder_titanium.name=钛制梯子
tile.ladder_tungsten.name=钨制梯子
tile.trapdoor_steel.name=钢制活板门
tile.lamp_demon.name=恶魔核心灯
tile.lamp_tritium_blue_off.name=蓝色氚灯
tile.lamp_tritium_blue_on.name=蓝色氚灯

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B