Add steel catwalk blocks, and fix recipes

This commit is contained in:
Zontreck 2024-03-01 03:01:52 -07:00
parent 21c459bd95
commit f2ce7d33d6
206 changed files with 4343 additions and 1418 deletions

View file

@ -0,0 +1,22 @@
package dev.zontreck.otemod.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
public class BlockCustomVoxels extends PartialTransparentBlock
{
private VoxelShape superShape;
protected BlockCustomVoxels(Properties p_54120_, VoxelShape shape) {
super(p_54120_);
this.superShape = shape;
}
@Override
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
return superShape;
}
}

View file

@ -7,7 +7,6 @@ import dev.zontreck.otemod.implementation.CreativeModeTabs;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.*;
@ -15,14 +14,18 @@ import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BedPart;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import java.util.stream.Stream;
public class ModBlocks {
private static BlockBehaviour.StatePredicate shulkerState = (p_152653_, p_152654_, p_152655_) -> {
@ -59,11 +62,19 @@ public class ModBlocks {
private static BlockBehaviour.Properties standardBehavior()
{
return BlockBehaviour.Properties.of().requiresCorrectToolForDrops().strength(7F).destroyTime(6);
return BlockBehaviour.Properties.of().requiresCorrectToolForDrops().strength(7F).destroyTime(6).isValidSpawn(ModBlocks::neverSpawn);
}
private static BlockBehaviour.Properties gratingBlock()
{
return standardBehavior()
.noOcclusion()
.strength(0.5f, 2000f)
.isViewBlocking(ModBlocks::never);
}
private static BlockBehaviour.Properties stoneLikeBehavior()
{
return BlockBehaviour.Properties.copy(Blocks.COBBLESTONE);
return BlockBehaviour.Properties.copy(Blocks.COBBLESTONE).isValidSpawn(ModBlocks::neverSpawn);
}
private static BlockBehaviour.Properties explosionResistance()
@ -91,6 +102,8 @@ public class ModBlocks {
private static BlockBehaviour.Properties stone = stoneLikeBehavior();
private static BlockBehaviour.Properties gratingBlock = gratingBlock();
private static BlockBehaviour.Properties poolLightClean = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 15);
private static BlockBehaviour.Properties poolLightDirty = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 12);
private static BlockBehaviour.Properties poolLightFilthy = BlockBehaviour.Properties.copy(Blocks.GLASS).lightLevel((X) -> 4);
@ -244,6 +257,12 @@ public class ModBlocks {
public static final RegistryObject<Block> UNCRAFTER = registerWithItem(BLOCKS.register("uncrafter", ()->new UncrafterBlock(BlockBehaviour.Properties.of().noOcclusion().requiresCorrectToolForDrops().strength(6))), new Item.Properties());
/*
ENGINEERS DECOR BLOCKS
*/
public static final RegistryObject<Block> CLINKER_BRICK_BLOCK = registerWithItem(BLOCKS.register("clinker_brick_block", ()->new StandardBlocks.BaseBlock(
StandardBlocks.CFG_DEFAULT,
BlockBehaviour.Properties.of().strength(0.5f, 7f).sound(SoundType.STONE)
@ -283,6 +302,14 @@ public class ModBlocks {
public static final RegistryObject<Block> CLINKER_BRICK_SASTOR_CORNER_BLOCK = registerWithItem(BLOCKS.register("clinker_brick_sastor_corner_block", ()-> new RotatableBlock(BlockBehaviour.Properties.copy(Blocks.STONE))), new Item.Properties());
/*public static final RegistryObject<Block> CLINKER_BRICK_VERTICAL_SLAB_STRUCTURED = registerWithItem(BLOCKS.register("clinker_brick_vertical_slab_structured", () -> new StandardBlocks.HorizontalWaterLoggable(
StandardBlocks.CFG_CUTOUT | StandardBlocks.CFG_HORIZIONTAL | StandardBlocks.CFG_LOOK_PLACEMENT,
BlockBehaviour.Properties.of().strength(0.5f, 7f).sound(SoundType.STONE),
new AABB[]{
Auxiliaries.getPixeledAABB(0, 0, 0, 16, 16, 8),
}
)), new Item.Properties());*/
public static final RegistryObject<Block> SLAG_BRICK_BLOCK = registerWithItem(BLOCKS.register("slag_brick_block", ()-> new Block(BlockBehaviour.Properties.copy(Blocks.STONE))), new Item.Properties());
public static final RegistryObject<Block> SLAG_BRICK_SLAB = registerWithItem(BLOCKS.register("slag_brick_slab", ()-> new SlabBlock(BlockBehaviour.Properties.copy(Blocks.STONE))), new Item.Properties());
@ -305,11 +332,130 @@ public class ModBlocks {
public static final RegistryObject<Block> REBAR_CONCRETE_TILE_STAIRS = registerWithItem(BLOCKS.register("rebar_concrete_tile_stairs", ()-> new StairBlock(ModBlocks.REBAR_CONCRETE_BLOCK.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.STONE).strength(1f, 2000f).isValidSpawn(ModBlocks::neverSpawn))), new Item.Properties());
/*public static final RegistryObject<Block> REBAR_CONCRETE_HALFSLAB = registerWithItem(BLOCKS.register("halfslab_rebar_concrete", () -> new SlabSliceBlock(
StandardBlocks.CFG_CUTOUT,
BlockBehaviour.Properties.of().strength(1.0f, 2000f).sound(SoundType.STONE).isValidSpawn(ModBlocks::neverSpawn)
)), new Item.Properties());*/
public static final RegistryObject<Block> PANZER_GLASS_BLOCK = registerWithItem(BLOCKS.register("panzerglass_block", ()-> new Block(BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK).noOcclusion().strength(0.5f, 2000f).isValidSpawn(ModBlocks::neverSpawn).sound(SoundType.METAL))), new Item.Properties());
public static final RegistryObject<Block> PANZER_GLASS_BLOCK = registerWithItem(BLOCKS.register("panzerglass_block", ()-> new PartialTransparentBlock(BlockBehaviour.Properties.of().noOcclusion().strength(0.5f, 2000f).isValidSpawn(ModBlocks::neverSpawn).sound(SoundType.METAL))), new Item.Properties());
public static final RegistryObject<Block> PANZER_GLASS_SLAB = registerWithItem(BLOCKS.register("panzerglass_slab", ()-> new SlabBlock(BlockBehaviour.Properties.copy(Blocks.IRON_BLOCK).noOcclusion().strength(0.5f, 2000f).isValidSpawn(ModBlocks::neverSpawn).sound(SoundType.METAL))), new Item.Properties());
public static final RegistryObject<Block> PANZER_GLASS_SLAB = registerWithItem(BLOCKS.register("panzerglass_slab", ()-> new PartialTransparentSlabBlock(BlockBehaviour.Properties.of().noOcclusion().strength(0.5f, 2000f).isValidSpawn(ModBlocks::neverSpawn).sound(SoundType.METAL))), new Item.Properties());
public static final RegistryObject<Block> OLD_INDUSTRIAL_WOOD_PLANKS = registerWithItem(BLOCKS.register("old_industrial_wood_planks", ()-> new Block(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS).strength(0.5f, 6f).sound(SoundType.WOOD))), new Item.Properties());
public static final RegistryObject<Block> OLD_INDUSTRIAL_WOOD_SLAB = registerWithItem(BLOCKS.register("old_industrial_wood_slab", ()-> new SlabBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS).strength(0.5f, 6f).sound(SoundType.WOOD))), new Item.Properties());
public static final RegistryObject<Block> OLD_INDUSTRIAL_WOOD_STAIRS = registerWithItem(BLOCKS.register("old_industrial_wood_stairs", ()-> new StairBlock(ModBlocks.OLD_INDUSTRIAL_WOOD_PLANKS.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS).strength(0.5f, 6f).sound(SoundType.WOOD))), new Item.Properties());
public static final RegistryObject<Block> OLD_INDUSTRIAL_WOOD_DOOR = registerWithItem(BLOCKS.register("old_industrial_wood_door", ()-> new DoorBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS).strength(0.5f, 6f).noOcclusion(), BlockSetType.DARK_OAK)), new Item.Properties());
public static final RegistryObject<Block> STEEL_CATWALK = registerWithItem(BLOCKS.register("steel_catwalk", ()-> new BlockCustomVoxels(gratingBlock, Block.box(0, 0, 0, 16, 2, 16))), new Item.Properties());
public static final RegistryObject<Block> STEEL_CATWALK_TOP = registerWithItem(BLOCKS.register("steel_catwalk_top", ()-> new BlockCustomVoxels(gratingBlock, Block.box(0, 14, 0, 16, 16, 16))), new Item.Properties());
public static final RegistryObject<Block> STEEL_GRATING = registerWithItem(BLOCKS.register("steel_floor_grating", ()-> new BlockCustomVoxels(gratingBlock, Block.box(0, 0, 0, 16, 2, 16))), new Item.Properties());
public static final RegistryObject<Block> STEEL_GRATING_TOP = registerWithItem(BLOCKS.register("steel_floor_grating_top", ()-> new BlockCustomVoxels(gratingBlock, Block.box(0, 14, 0, 16, 16, 16))), new Item.Properties());
public static final RegistryObject<Block> STEEL_TABLE = registerWithItem(BLOCKS.register("steel_table", ()-> new BlockCustomVoxels(gratingBlock, Block.box(0, 0, 0, 16, 16, 16))), new Item.Properties());
private static final VoxelShape STEEL_CATWALK_STAIRS_NORTH = Shapes.join(Block.box(1, 10, 0, 15, 12, 8), Block.box(1, 2, 8, 15, 4, 16), BooleanOp.OR);
private static final VoxelShape STEEL_CATWALK_STAIRS_SOUTH = Shapes.join(Block.box(1, 10, 8, 15, 12, 16), Block.box(1, 2, 0, 15, 4, 8), BooleanOp.OR);
private static final VoxelShape STEEL_CATWALK_STAIRS_EAST = Shapes.join(Block.box(8, 10, 1, 16, 12, 15), Block.box(0, 2, 1, 8, 4, 15), BooleanOp.OR);
private static final VoxelShape STEEL_CATWALK_STAIRS_WEST = Shapes.join(Block.box(0, 10, 1, 8, 12, 15), Block.box(8, 2, 1, 16, 4, 15), BooleanOp.OR);
public static final RegistryObject<Block> STEEL_CATWALK_STAIRS = registerWithItem(BLOCKS.register("steel_catwalk_stairs", ()-> new RotatableBlockCustomVoxels(gratingBlock, STEEL_CATWALK_STAIRS_NORTH, STEEL_CATWALK_STAIRS_SOUTH, STEEL_CATWALK_STAIRS_WEST, STEEL_CATWALK_STAIRS_EAST)), new Item.Properties());
private static final VoxelShape STEEL_CATWALK_STAIRS_LR_NORTH = Stream.of(
Block.box(1, 2, 8, 15, 4, 16),
Block.box(1, 10, 0, 15, 12, 8),
Block.box(0, 0, 0, 1, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_LR_SOUTH = Stream.of(
Block.box(1, 2, 0, 15, 4, 8),
Block.box(1, 10, 8, 15, 12, 16),
Block.box(15, 0, 0, 16, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_LR_EAST = Stream.of(
Block.box(0, 2, 1, 8, 4, 15),
Block.box(8, 10, 1, 16, 12, 15),
Block.box(0, 0, 0, 16, 21, 1)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_LR_WEST = Stream.of(
Block.box(8, 2, 1, 16, 4, 15),
Block.box(0, 10, 1, 8, 12, 15),
Block.box(0, 0, 15, 16, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
public static final RegistryObject<Block> STEEL_CATWALK_STAIRS_LR = registerWithItem(BLOCKS.register("steel_catwalk_stairs_lr", ()-> new RotatableBlockCustomVoxels(gratingBlock, STEEL_CATWALK_STAIRS_LR_NORTH, STEEL_CATWALK_STAIRS_LR_SOUTH, STEEL_CATWALK_STAIRS_LR_WEST, STEEL_CATWALK_STAIRS_LR_EAST)), new Item.Properties());
private static final VoxelShape STEEL_CATWALK_STAIRS_RR_NORTH = Stream.of(
Block.box(1, 2, 8, 15, 4, 16),
Block.box(1, 10, 0, 15, 12, 8),
Block.box(15, 0, 0, 16, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_RR_SOUTH = Stream.of(
Block.box(1, 2, 0, 15, 4, 8),
Block.box(1, 10, 8, 15, 12, 16),
Block.box(0, 0, 0, 1, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_RR_EAST = Stream.of(
Block.box(0, 2, 1, 8, 4, 15),
Block.box(8, 10, 1, 16, 12, 15),
Block.box(0, 0, 15, 16, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_RR_WEST = Stream.of(
Block.box(8, 2, 1, 16, 4, 15),
Block.box(0, 10, 1, 8, 12, 15),
Block.box(0, 0, 0, 16, 21, 1)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
public static final RegistryObject<Block> STEEL_CATWALK_STAIRS_RR = registerWithItem(BLOCKS.register("steel_catwalk_stairs_rr", ()-> new RotatableBlockCustomVoxels(gratingBlock, STEEL_CATWALK_STAIRS_RR_NORTH, STEEL_CATWALK_STAIRS_RR_SOUTH, STEEL_CATWALK_STAIRS_RR_WEST, STEEL_CATWALK_STAIRS_RR_EAST)), new Item.Properties());
private static final VoxelShape STEEL_CATWALK_STAIRS_DR_NORTH = Stream.of(
Block.box(1, 10, 0, 15, 12, 8),
Block.box(1, 2, 8, 15, 4, 16),
Block.box(0, 0, 0, 1, 21, 16),
Block.box(15, 0, 0, 16, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_DR_SOUTH = Stream.of(
Block.box(1, 10, 8, 15, 12, 16),
Block.box(1, 2, 0, 15, 4, 8),
Block.box(15, 0, 0, 16, 21, 16),
Block.box(0, 0, 0, 1, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_DR_WEST = Stream.of(
Block.box(8, 10, 1, 16, 12, 15),
Block.box(0, 2, 1, 8, 4, 15),
Block.box(0, 0, 0, 16, 21, 1),
Block.box(0, 0, 15, 16, 21, 16)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
private static final VoxelShape STEEL_CATWALK_STAIRS_DR_EAST = Stream.of(
Block.box(0, 10, 1, 8, 12, 15),
Block.box(8, 2, 1, 16, 4, 15),
Block.box(0, 0, 15, 16, 21, 16),
Block.box(0, 0, 0, 16, 21, 1)
).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get();
public static final RegistryObject<Block> STEEL_CATWALK_STAIRS_DR = registerWithItem(BLOCKS.register("steel_catwalk_stairs_dr", ()-> new RotatableBlockCustomVoxels(gratingBlock, STEEL_CATWALK_STAIRS_DR_NORTH, STEEL_CATWALK_STAIRS_DR_SOUTH, STEEL_CATWALK_STAIRS_DR_WEST, STEEL_CATWALK_STAIRS_DR_EAST)), new Item.Properties());
private static final VoxelShape STEEL_RAILING_NORTH = Block.box(0.25, 0.25, 0.25, 15.75, 16, 1.25);
private static final VoxelShape STEEL_RAILING_SOUTH = Block.box(0.25, 0.25, 14.75, 15.75, 16, 15.75);
private static final VoxelShape STEEL_RAILING_WEST = Block.box(14.75, 0.25, 0.25, 15.75, 16, 15.75);
private static final VoxelShape STEEL_RAILING_EAST = Block.box(0.25, 0.25, 0.25, 1.25, 16, 15.75);
public static final RegistryObject<Block> STEEL_RAILING = registerWithItem(BLOCKS.register("steel_railing", ()->new RotatableBlockCustomVoxels(gratingBlock, STEEL_RAILING_NORTH, STEEL_RAILING_SOUTH, STEEL_RAILING_WEST, STEEL_RAILING_EAST)), new Item.Properties());
}

View file

@ -0,0 +1,18 @@
package dev.zontreck.otemod.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.AbstractGlassBlock;
import net.minecraft.world.level.block.state.BlockState;
public class PartialTransparentBlock extends AbstractGlassBlock
{
protected PartialTransparentBlock(Properties p_48729_) {
super(p_48729_);
}
@Override
public boolean propagatesSkylightDown(BlockState p_48740_, BlockGetter p_48741_, BlockPos p_48742_) {
return true;
}
}

View file

@ -0,0 +1,19 @@
package dev.zontreck.otemod.blocks;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.AbstractGlassBlock;
import net.minecraft.world.level.block.SlabBlock;
import net.minecraft.world.level.block.state.BlockState;
public class PartialTransparentSlabBlock extends SlabBlock
{
protected PartialTransparentSlabBlock(Properties p_48729_) {
super(p_48729_);
}
@Override
public boolean propagatesSkylightDown(BlockState p_48740_, BlockGetter p_48741_, BlockPos p_48742_) {
return true;
}
}

View file

@ -0,0 +1,35 @@
package dev.zontreck.otemod.blocks;
import dev.zontreck.ariaslib.util.Maps;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.HashMap;
import java.util.Map;
public class RotatableBlockCustomVoxels extends RotatableBlock
{
private Map<Direction, VoxelShape> rotatedShapes = new HashMap<>();
protected RotatableBlockCustomVoxels(Properties properties, VoxelShape north, VoxelShape south, VoxelShape east, VoxelShape west) {
super(properties);
rotatedShapes = Maps.of(new Maps.Entry<>(Direction.NORTH, north), new Maps.Entry<>(Direction.SOUTH, south), new Maps.Entry<>(Direction.WEST, west), new Maps.Entry<>(Direction.EAST, east), new Maps.Entry<>(Direction.NORTH, north), new Maps.Entry<>(Direction.DOWN, north));
}
@Override
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
Direction facing = state.getValue(FACING);
return rotatedShapes.get(facing);
}
@Override
public boolean propagatesSkylightDown(BlockState p_49928_, BlockGetter p_49929_, BlockPos p_49930_) {
return true;
}
}

View file

@ -136,6 +136,13 @@ public class ModBlockStatesProvider extends BlockStateProvider {
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/glass/panzerglass_block_texture3")
};
ResourceLocation[] oldIndustrialWood = new ResourceLocation[]{
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/material/industrial_planks_texture0"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/material/industrial_planks_texture1"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/material/industrial_planks_texture2"),
new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/material/industrial_planks_texture3"),
};
variantCubeBlock(ModBlocks.CLINKER_BRICK_BLOCK, clinkerBlock);
customSlabBlock(ModBlocks.CLINKER_BRICK_SLAB, clinkerBlock);
customStairBlock(ModBlocks.CLINKER_BRICK_STAIRS, clinkerBlock);
@ -161,6 +168,43 @@ public class ModBlockStatesProvider extends BlockStateProvider {
variantTransparentCubeBlock(ModBlocks.PANZER_GLASS_BLOCK, new ResourceLocation(OTEMod.MOD_ID, "engineersdecor/glass/panzerglass_block_texture_inventory"), panzerglass);
customTransparentSlabBlock(ModBlocks.PANZER_GLASS_SLAB, panzerglass);
variantCubeBlock(ModBlocks.OLD_INDUSTRIAL_WOOD_PLANKS, oldIndustrialWood);
customSlabBlock(ModBlocks.OLD_INDUSTRIAL_WOOD_SLAB, oldIndustrialWood);
customStairBlock(ModBlocks.OLD_INDUSTRIAL_WOOD_STAIRS, oldIndustrialWood);
doorBlock(ModBlocks.OLD_INDUSTRIAL_WOOD_DOOR, new ResourceLocation(OTEMod.MOD_ID, "block/engineersdecor/door/old_industrial_door_texture_bottom"), new ResourceLocation(OTEMod.MOD_ID, "block/engineersdecor/door/old_industrial_door_texture_top"));
blockWithExistingModel(ModBlocks.STEEL_GRATING, "block/engineersdecor/furniture/steel_floor_grating", false);
blockWithExistingModel(ModBlocks.STEEL_GRATING_TOP, "block/engineersdecor/furniture/steel_floor_grating_top", false);
blockWithExistingModel(ModBlocks.STEEL_TABLE, "block/engineersdecor/furniture/steel_table", false);
blockWithExistingModel(ModBlocks.STEEL_CATWALK, "block/engineersdecor/furniture/steel_catwalk", false);
blockWithExistingModel(ModBlocks.STEEL_CATWALK_TOP, "block/engineersdecor/furniture/steel_catwalk_top", false);
blockWithExistingModel(ModBlocks.STEEL_RAILING, "block/engineersdecor/furniture/steel_railing", true);
blockWithExistingModel(ModBlocks.STEEL_CATWALK_STAIRS, "block/engineersdecor/furniture/steel_catwalk_stairs", true);
blockWithExistingModel(ModBlocks.STEEL_CATWALK_STAIRS_LR, "block/engineersdecor/furniture/steel_catwalk_stairs_lr", true);
blockWithExistingModel(ModBlocks.STEEL_CATWALK_STAIRS_RR, "block/engineersdecor/furniture/steel_catwalk_stairs_rr", true);
blockWithExistingModel(ModBlocks.STEEL_CATWALK_STAIRS_DR, "block/engineersdecor/furniture/steel_catwalk_stairs_dr", true);
}
private void blockWithExistingModel(RegistryObject<Block> blk, String model, boolean rotatable)
{
ResourceLocation modelLoc = new ResourceLocation(OTEMod.MOD_ID, model);
ModelFile mFile = models().withExistingParent(name(blk.get()), modelLoc);
if(!rotatable)
simpleBlock(blk.get(), mFile);
else horizontalBlock(blk.get(), mFile);
simpleBlockItem(blk.get(), mFile);
}
private void doorBlock(RegistryObject<Block> blk, ResourceLocation textureTop, ResourceLocation textureBottom)
{
doorBlockWithRenderType((DoorBlock) blk.get(), textureBottom, textureTop, new ResourceLocation("translucent"));
simpleBlockItem(blk.get(), models().doorBottomLeft(name(blk.get()), textureBottom, textureTop));
}
private void wallBlock(RegistryObject<Block> blk, ResourceLocation texture)

View file

@ -2,30 +2,21 @@ package dev.zontreck.otemod.data.loot;
import dev.zontreck.otemod.blocks.*;
import dev.zontreck.otemod.items.ModItems;
import net.minecraft.data.PackOutput;
import net.minecraft.data.loot.BlockLootSubProvider;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.entries.LootItem;
import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer;
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount;
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.RegistryObject;
import java.util.List;
import java.util.Set;
import static dev.zontreck.otemod.blocks.ModBlocks.BLOCKS;
public class ModBlockLootTablesProvider extends BlockLootSubProvider
{
public ModBlockLootTablesProvider()
@ -67,44 +58,44 @@ public class ModBlockLootTablesProvider extends BlockLootSubProvider
dropSelf(ModBlocks.CYAN_WALL_V2.get());
dropSelf(ModBlocks.POOL_TILE.get());
dropSelf(ModBlocks.POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.POOL_TILE_SLAB);
dropSelf(ModBlocks.POOL_LIGHT.get());
dropSelf(ModBlocks.DIRTY_POOL_TILE.get());
dropSelf(ModBlocks.DIRTY_POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.DIRTY_POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.DIRTY_POOL_TILE_SLAB);
dropSelf(ModBlocks.DIRTY_POOL_LIGHT.get());
dropSelf(ModBlocks.FILTHY_POOL_LIGHT.get());
dropSelf(ModBlocks.DARK_POOL_TILE.get());
dropSelf(ModBlocks.DARK_POOL_LIGHT.get());
dropSelf(ModBlocks.DARK_POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.DARK_POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.DARK_POOL_TILE_SLAB);
dropSelf(ModBlocks.BLUE_POOL_TILE.get());
dropSelf(ModBlocks.BLUE_POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.BLUE_POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.BLUE_POOL_TILE_SLAB);
dropSelf(ModBlocks.BLUE_POOL_LIGHT.get());
dropSelf(ModBlocks.DIRTY_BLUE_POOL_TILE.get());
dropSelf(ModBlocks.DIRTY_BLUE_POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.DIRTY_BLUE_POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.DIRTY_BLUE_POOL_TILE_SLAB);
dropSelf(ModBlocks.DIRTY_BLUE_POOL_LIGHT.get());
dropSelf(ModBlocks.FILTHY_BLUE_POOL_LIGHT.get());
dropSelf(ModBlocks.RED_POOL_TILE.get());
dropSelf(ModBlocks.RED_POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.RED_POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.RED_POOL_TILE_SLAB);
dropSelf(ModBlocks.RED_POOL_LIGHT.get());
dropSelf(ModBlocks.DIRTY_RED_POOL_TILE.get());
dropSelf(ModBlocks.DIRTY_RED_POOL_LIGHT.get());
dropSelf(ModBlocks.FILTHY_RED_POOL_LIGHT.get());
dropSelf(ModBlocks.DIRTY_RED_POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.DIRTY_RED_POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.DIRTY_RED_POOL_TILE_SLAB);
dropSelf(ModBlocks.DARK_RED_WOOL.get());
dropSelf(ModBlocks.DARK_RED_CARPET.get());
dropSelf(ModBlocks.GREEN_POOL_TILE.get());
dropSelf(ModBlocks.GREEN_POOL_LIGHT.get());
dropSelf(ModBlocks.GREEN_POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.GREEN_POOL_TILE_SLAB);
dropSelf(ModBlocks.GREEN_POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.DIRTY_GREEN_POOL_TILE.get());
dropSelf(ModBlocks.DIRTY_GREEN_POOL_LIGHT.get());
dropSelf(ModBlocks.DIRTY_GREEN_POOL_TILE_SLAB.get());
createSlabItemTable(ModBlocks.DIRTY_GREEN_POOL_TILE_SLAB);
dropSelf(ModBlocks.DIRTY_GREEN_POOL_TILE_STAIRS.get());
dropSelf(ModBlocks.FILTHY_GREEN_POOL_LIGHT.get());
dropSelf(ModBlocks.UNCRAFTER.get());
@ -115,35 +106,65 @@ public class ModBlockLootTablesProvider extends BlockLootSubProvider
dropSelf(ModBlocks.CLINKER_BRICK_BLOCK.get());
dropSelf(ModBlocks.CLINKER_BRICK_RECESSED.get());
dropSelf(ModBlocks.CLINKER_BRICK_VERTICALLY_SLIT.get());
dropSelf(ModBlocks.CLINKER_BRICK_SLAB.get());
createSlabItemTable(ModBlocks.CLINKER_BRICK_SLAB);
dropSelf(ModBlocks.CLINKER_BRICK_STAIRS.get());
dropSelf(ModBlocks.CLINKER_BRICK_STAINED_BLOCK.get());
dropSelf(ModBlocks.CLINKER_BRICK_STAINED_SLAB.get());
createSlabItemTable(ModBlocks.CLINKER_BRICK_STAINED_SLAB);
dropSelf(ModBlocks.CLINKER_BRICK_STAINED_STAIRS.get());
dropSelf(ModBlocks.CLINKER_BRICK_SASTOR_CORNER_BLOCK.get());
dropSelf(ModBlocks.CLINKER_BRICK_WALL.get());
dropSelf(ModBlocks.SLAG_BRICK_BLOCK.get());
dropSelf(ModBlocks.SLAG_BRICK_SLAB.get());
createSlabItemTable(ModBlocks.SLAG_BRICK_SLAB);
dropSelf(ModBlocks.SLAG_BRICK_WALL.get());
dropSelf(ModBlocks.SLAG_BRICK_STAIRS.get());
dropSelf(ModBlocks.REBAR_CONCRETE_BLOCK.get());
dropSelf(ModBlocks.REBAR_CONCRETE_SLAB.get());
createSlabItemTable(ModBlocks.REBAR_CONCRETE_SLAB);
dropSelf(ModBlocks.REBAR_CONCRETE_STAIRS.get());
dropSelf(ModBlocks.REBAR_CONCRETE_WALL.get());
dropSelf(ModBlocks.REBAR_CONCRETE_TILE_BLOCK.get());
dropSelf(ModBlocks.REBAR_CONCRETE_TILE_SLAB.get());
createSlabItemTable(ModBlocks.REBAR_CONCRETE_TILE_SLAB);
dropSelf(ModBlocks.REBAR_CONCRETE_TILE_STAIRS.get());
dropSelf(ModBlocks.PANZER_GLASS_BLOCK.get());
dropSelf(ModBlocks.PANZER_GLASS_SLAB.get());
createSlabItemTable(ModBlocks.PANZER_GLASS_SLAB);
dropSelf(ModBlocks.OLD_INDUSTRIAL_WOOD_PLANKS.get());
createSlabItemTable(ModBlocks.OLD_INDUSTRIAL_WOOD_SLAB);
dropSelf(ModBlocks.OLD_INDUSTRIAL_WOOD_STAIRS.get());
createDoorTable(ModBlocks.OLD_INDUSTRIAL_WOOD_DOOR);
dropSelf(ModBlocks.STEEL_TABLE.get());
dropSelf(ModBlocks.STEEL_CATWALK.get());
dropSelf(ModBlocks.STEEL_RAILING.get());
dropSelf(ModBlocks.STEEL_CATWALK_STAIRS.get());
dropSelf(ModBlocks.STEEL_CATWALK_STAIRS_LR.get());
dropSelf(ModBlocks.STEEL_CATWALK_STAIRS_RR.get());
dropSelf(ModBlocks.STEEL_CATWALK_STAIRS_DR.get());
dropSelf(ModBlocks.STEEL_GRATING.get());
dropSelf(ModBlocks.STEEL_GRATING_TOP.get());
dropSelf(ModBlocks.STEEL_CATWALK_TOP.get());
}
private void createDoorTable(RegistryObject<Block> blk)
{
var loot = createDoorTable(blk.get());
add(blk.get(), loot);
}
private void createSlabItemTable(RegistryObject<Block> slab)
{
var loot = createSlabItemTable(slab.get());
add(slab.get(), loot);
}
@Override
protected Iterable<Block> getKnownBlocks() {
return ModBlocks.BLOCKS.getEntries().stream().map(RegistryObject::get)::iterator;