I WARNED YOU ABOUT STAIRS BRO

This commit is contained in:
quat1024 2023-07-09 01:18:52 -04:00
parent 3d77770a8b
commit 3b02b92f9a
8 changed files with 342 additions and 1 deletions

View File

@ -13,6 +13,7 @@ import io.github.cottonmc.templates.block.TemplatePressurePlateBlock;
import io.github.cottonmc.templates.block.TemplateSlabBlock;
import io.github.cottonmc.templates.block.TemplateSlopeBlock;
import io.github.cottonmc.templates.block.TemplateEntity;
import io.github.cottonmc.templates.block.TemplateStairsBlock;
import io.github.cottonmc.templates.block.TemplateWallBlock;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
@ -63,7 +64,7 @@ public class Templates implements ModInitializer {
public static final Block POST = reg("post", new TemplatePostBlock(cp(Blocks.OAK_FENCE)));
public static final Block PRESSURE_PLATE = reg("pressure_plate", new TemplatePressurePlateBlock(cp(Blocks.OAK_PRESSURE_PLATE)));
public static final Block SLAB = reg("slab", new TemplateSlabBlock(cp(Blocks.OAK_SLAB)));
//stair
public static final Block STAIRS = reg("stairs", new TemplateStairsBlock(cp(Blocks.OAK_STAIRS)));
//trapdoor
public static final Block WALL = reg("wall", new TemplateWallBlock(cp(Blocks.COBBLESTONE_WALL)));

View File

@ -77,6 +77,9 @@ public class TemplatesClient implements ClientModInitializer {
provider.addTemplateModel(Templates.id("pressure_plate_down_special"), new UnbakedAutoRetexturedModel(new Identifier("block/pressure_plate_down")));
provider.addTemplateModel(Templates.id("slab_bottom_special"), new UnbakedAutoRetexturedModel(new Identifier("block/slab")));
provider.addTemplateModel(Templates.id("slab_top_special"), new UnbakedAutoRetexturedModel(new Identifier("block/slab_top")));
provider.addTemplateModel(Templates.id("stairs_special"), new UnbakedAutoRetexturedModel(new Identifier("block/stairs")));
provider.addTemplateModel(Templates.id("inner_stairs_special"), new UnbakedAutoRetexturedModel(new Identifier("block/inner_stairs")));
provider.addTemplateModel(Templates.id("outer_stairs_special"), new UnbakedAutoRetexturedModel(new Identifier("block/outer_stairs")));
provider.addTemplateModel(Templates.id("wall_post_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_wall_post")));
provider.addTemplateModel(Templates.id("wall_side_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_wall_side")));
provider.addTemplateModel(Templates.id("wall_side_tall_special"), new UnbakedAutoRetexturedModel(new Identifier("block/template_wall_side_tall")));
@ -106,6 +109,7 @@ public class TemplatesClient implements ClientModInitializer {
provider.assignItemModel(Templates.id("pressure_plate_up_special"), Templates.PRESSURE_PLATE);
provider.assignItemModel(Templates.id("slope_special"), Templates.SLOPE);
provider.assignItemModel(Templates.id("slab_bottom_special"), Templates.SLAB);
provider.assignItemModel(Templates.id("stairs_special"), Templates.STAIRS);
provider.assignItemModel(Templates.id("wall_inventory_special"), Templates.WALL);
}
}

View File

@ -0,0 +1,85 @@
package io.github.cottonmc.templates.block;
import com.google.common.base.MoreObjects;
import io.github.cottonmc.templates.Templates;
import io.github.cottonmc.templates.api.TemplateInteractionUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.ShapeContext;
import net.minecraft.block.StairsBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateManager;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
public class TemplateStairsBlock extends StairsBlock implements BlockEntityProvider {
public TemplateStairsBlock(BlockState blockState, Settings settings) {
super(blockState, settings);
}
public TemplateStairsBlock(Settings settings) {
this(Blocks.OAK_PLANKS.getDefaultState(), settings);
}
@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return Templates.TEMPLATE_BLOCK_ENTITY.instantiate(pos, state);
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(TemplateInteractionUtil.appendProperties(builder));
}
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit);
if(!r.isAccepted()) r = super.onUse(state, world, pos, player, hand, hit);
return r;
}
@Override
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
TemplateInteractionUtil.onStateReplaced(state, world, pos, newState, moved);
super.onStateReplaced(state, world, pos, newState, moved);
}
@Override
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
TemplateInteractionUtil.onPlaced(world, pos, state, placer, stack);
super.onPlaced(world, pos, state, placer, stack);
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
return MoreObjects.firstNonNull(TemplateInteractionUtil.getCollisionShape(state, view, pos, ctx), super.getCollisionShape(state, view, pos, ctx));
}
@Override
public boolean emitsRedstonePower(BlockState state) {
return TemplateInteractionUtil.emitsRedstonePower(state);
}
@Override
public int getWeakRedstonePower(BlockState state, BlockView view, BlockPos pos, Direction dir) {
return TemplateInteractionUtil.getWeakRedstonePower(state, view, pos, dir);
}
@Override
public int getStrongRedstonePower(BlockState state, BlockView view, BlockPos pos, Direction dir) {
return TemplateInteractionUtil.getStrongRedstonePower(state, view, pos, dir);
}
}

View File

@ -0,0 +1,209 @@
{
"variants": {
"facing=east,half=bottom,shape=inner_left": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"y": 270
},
"facing=east,half=bottom,shape=inner_right": {
"model": "templates:inner_stairs_special"
},
"facing=east,half=bottom,shape=outer_left": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"y": 270
},
"facing=east,half=bottom,shape=outer_right": {
"model": "templates:outer_stairs_special"
},
"facing=east,half=bottom,shape=straight": {
"model": "templates:stairs_special"
},
"facing=east,half=top,shape=inner_left": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"x": 180
},
"facing=east,half=top,shape=inner_right": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"x": 180,
"y": 90
},
"facing=east,half=top,shape=outer_left": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"x": 180
},
"facing=east,half=top,shape=outer_right": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"x": 180,
"y": 90
},
"facing=east,half=top,shape=straight": {
"model": "templates:stairs_special",
"uvlock": true,
"x": 180
},
"facing=north,half=bottom,shape=inner_left": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"y": 180
},
"facing=north,half=bottom,shape=inner_right": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"y": 270
},
"facing=north,half=bottom,shape=outer_left": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"y": 180
},
"facing=north,half=bottom,shape=outer_right": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"y": 270
},
"facing=north,half=bottom,shape=straight": {
"model": "templates:stairs_special",
"uvlock": true,
"y": 270
},
"facing=north,half=top,shape=inner_left": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"x": 180,
"y": 270
},
"facing=north,half=top,shape=inner_right": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"x": 180
},
"facing=north,half=top,shape=outer_left": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"x": 180,
"y": 270
},
"facing=north,half=top,shape=outer_right": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"x": 180
},
"facing=north,half=top,shape=straight": {
"model": "templates:stairs_special",
"uvlock": true,
"x": 180,
"y": 270
},
"facing=south,half=bottom,shape=inner_left": {
"model": "templates:inner_stairs_special"
},
"facing=south,half=bottom,shape=inner_right": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"y": 90
},
"facing=south,half=bottom,shape=outer_left": {
"model": "templates:outer_stairs_special"
},
"facing=south,half=bottom,shape=outer_right": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"y": 90
},
"facing=south,half=bottom,shape=straight": {
"model": "templates:stairs_special",
"uvlock": true,
"y": 90
},
"facing=south,half=top,shape=inner_left": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"x": 180,
"y": 90
},
"facing=south,half=top,shape=inner_right": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"x": 180,
"y": 180
},
"facing=south,half=top,shape=outer_left": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"x": 180,
"y": 90
},
"facing=south,half=top,shape=outer_right": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"x": 180,
"y": 180
},
"facing=south,half=top,shape=straight": {
"model": "templates:stairs_special",
"uvlock": true,
"x": 180,
"y": 90
},
"facing=west,half=bottom,shape=inner_left": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"y": 90
},
"facing=west,half=bottom,shape=inner_right": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"y": 180
},
"facing=west,half=bottom,shape=outer_left": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"y": 90
},
"facing=west,half=bottom,shape=outer_right": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"y": 180
},
"facing=west,half=bottom,shape=straight": {
"model": "templates:stairs_special",
"uvlock": true,
"y": 180
},
"facing=west,half=top,shape=inner_left": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"x": 180,
"y": 180
},
"facing=west,half=top,shape=inner_right": {
"model": "templates:inner_stairs_special",
"uvlock": true,
"x": 180,
"y": 270
},
"facing=west,half=top,shape=outer_left": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"x": 180,
"y": 180
},
"facing=west,half=top,shape=outer_right": {
"model": "templates:outer_stairs_special",
"uvlock": true,
"x": 180,
"y": 270
},
"facing=west,half=top,shape=straight": {
"model": "templates:stairs_special",
"uvlock": true,
"x": 180,
"y": 180
}
}
}

View File

@ -12,5 +12,6 @@
"block.templates.pressure_plate": "Pressure Plate Template",
"block.templates.slope": "Slope Template",
"block.templates.slab": "Slab Template",
"block.templates.stairs": "Stairs Template",
"block.templates.wall": "Wall Template"
}

View File

@ -11,6 +11,7 @@
"templates:post",
"templates:slab",
"templates:slope",
"templates:stairs",
"templates:wall"
]
},

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "templates:stairs"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"I~ ",
"II~",
"III"
],
"key": {
"I": {
"item": "minecraft:bamboo"
},
"~": {
"item": "minecraft:string"
}
},
"result": {
"item": "templates:stairs",
"count": 10
},
"group": "templates"
}