removed slopes

This commit is contained in:
Adrien1106 2024-02-09 18:58:14 +01:00
parent 4f3808c376
commit 953e79f388
9 changed files with 4 additions and 171 deletions

View File

@ -33,7 +33,7 @@ public class Templates implements ModInitializer {
//addon devs: *Don't* add your blocks to this collection, it's just for my registration convenience since Templates adds a lot of blocks... //addon devs: *Don't* add your blocks to this collection, it's just for my registration convenience since Templates adds a lot of blocks...
@ApiStatus.Internal static final ArrayList<Block> INTERNAL_TEMPLATES = new ArrayList<>(); @ApiStatus.Internal static final ArrayList<Block> INTERNAL_TEMPLATES = new ArrayList<>();
@ApiStatus.Internal static Block CUBE, STAIRS, SLAB, VERTICAL_SLAB, POST, FENCE, FENCE_GATE, DOOR, TRAPDOOR, IRON_DOOR, IRON_TRAPDOOR, PRESSURE_PLATE, BUTTON, LEVER, WALL, CARPET, PANE, CANDLE, SLOPE, TINY_SLOPE; @ApiStatus.Internal static Block CUBE, STAIRS, SLAB, VERTICAL_SLAB, POST, FENCE, FENCE_GATE, DOOR, TRAPDOOR, IRON_DOOR, IRON_TRAPDOOR, PRESSURE_PLATE, BUTTON, LEVER, WALL, CARPET, PANE, CANDLE;
//For addon devs: Please don't stuff more blocks into this BlockEntityType, and register your own. //For addon devs: Please don't stuff more blocks into this BlockEntityType, and register your own.
//You can even re-register the same TemplateEntity class under your own ID if you like. (It's an extensible block entity.) //You can even re-register the same TemplateEntity class under your own ID if you like. (It's an extensible block entity.)
@ -67,8 +67,6 @@ public class Templates implements ModInitializer {
CARPET = registerTemplate("carpet" , new TemplateCarpetBlock(cp(Blocks.WHITE_CARPET))); CARPET = registerTemplate("carpet" , new TemplateCarpetBlock(cp(Blocks.WHITE_CARPET)));
PANE = registerTemplate("pane" , new TemplatePaneBlock(cp(Blocks.GLASS_PANE))); PANE = registerTemplate("pane" , new TemplatePaneBlock(cp(Blocks.GLASS_PANE)));
CANDLE = registerTemplate("candle" , new TemplateCandleBlock(TemplateCandleBlock.configureSettings(cp(Blocks.CANDLE)))); CANDLE = registerTemplate("candle" , new TemplateCandleBlock(TemplateCandleBlock.configureSettings(cp(Blocks.CANDLE))));
SLOPE = registerTemplate("slope" , new TemplateSlopeBlock(TemplateInteractionUtil.makeSettings()));
TINY_SLOPE = registerTemplate("tiny_slope" , new TemplateSlopeBlock.Tiny(TemplateInteractionUtil.makeSettings()));
//The block entity is still called templates:slope; this is a bit of a legacy mistake. //The block entity is still called templates:slope; this is a bit of a legacy mistake.
TEMPLATE_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, id("slope"), TEMPLATE_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE, id("slope"),
@ -77,7 +75,7 @@ public class Templates implements ModInitializer {
Registry.register(Registries.ITEM_GROUP, id("tab"), FabricItemGroup.builder() Registry.register(Registries.ITEM_GROUP, id("tab"), FabricItemGroup.builder()
.displayName(Text.translatable("itemGroup.reframedtemplates.tab")) .displayName(Text.translatable("itemGroup.reframedtemplates.tab"))
.icon(() -> new ItemStack(SLOPE)) .icon(() -> new ItemStack(SLAB))
.entries((ctx, e) -> { .entries((ctx, e) -> {
e.addAll(INTERNAL_TEMPLATES.stream().map(ItemStack::new).collect(Collectors.toList())); e.addAll(INTERNAL_TEMPLATES.stream().map(ItemStack::new).collect(Collectors.toList()));
}).build() }).build()

View File

@ -80,12 +80,6 @@ public class TemplatesClient implements ClientModInitializer {
api.addTemplateModel(Templates.id("wall_side_special") , api.json(Templates.id("block/wall_side"))); api.addTemplateModel(Templates.id("wall_side_special") , api.json(Templates.id("block/wall_side")));
api.addTemplateModel(Templates.id("wall_side_tall_special") , api.json(Templates.id("block/wall_side_tall"))); api.addTemplateModel(Templates.id("wall_side_tall_special") , api.json(Templates.id("block/wall_side_tall")));
//mesh models
api.addTemplateModel(Templates.id("slope_special") , api.mesh(Templates.id("block/slope_base"), SlopeBaseMesh::makeUpright).disableAo());
api.addTemplateModel(Templates.id("slope_side_special") , api.mesh(Templates.id("block/slope_base"), SlopeBaseMesh::makeSide).disableAo());
api.addTemplateModel(Templates.id("tiny_slope_special") , api.mesh(Templates.id("block/tiny_slope_base"), SlopeBaseMesh::makeTinyUpright).disableAo());
api.addTemplateModel(Templates.id("tiny_slope_side_special") , api.mesh(Templates.id("block/tiny_slope_base"), SlopeBaseMesh::makeTinySide).disableAo());
//item only models //item only models
api.addTemplateModel(Templates.id("button_inventory_special") , api.auto(new Identifier("block/button_inventory"))); api.addTemplateModel(Templates.id("button_inventory_special") , api.auto(new Identifier("block/button_inventory")));
api.addTemplateModel(Templates.id("fence_inventory_special") , api.auto(new Identifier("block/fence_inventory"))); api.addTemplateModel(Templates.id("fence_inventory_special") , api.auto(new Identifier("block/fence_inventory")));
@ -106,8 +100,6 @@ public class TemplatesClient implements ClientModInitializer {
api.assignItemModel(Templates.id("trapdoor_bottom_special") , Templates.TRAPDOOR); api.assignItemModel(Templates.id("trapdoor_bottom_special") , Templates.TRAPDOOR);
api.assignItemModel(Templates.id("vertical_slab_special") , Templates.VERTICAL_SLAB); api.assignItemModel(Templates.id("vertical_slab_special") , Templates.VERTICAL_SLAB);
api.assignItemModel(Templates.id("wall_inventory_special") , Templates.WALL); api.assignItemModel(Templates.id("wall_inventory_special") , Templates.WALL);
api.assignItemModel(Templates.id("slope_special") , Templates.SLOPE);
api.assignItemModel(Templates.id("tiny_slope_special") , Templates.TINY_SLOPE);
} }
private void privateInit() { private void privateInit() {

View File

@ -1,74 +0,0 @@
package fr.adrien1106.reframedtemplates.block;
import com.google.common.base.MoreObjects;
import fr.adrien1106.reframedtemplates.api.TemplateInteractionUtil;
import fr.adrien1106.reframedtemplates.util.Edge;
import fr.adrien1106.reframedtemplates.util.StairShapeMaker;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import org.jetbrains.annotations.Nullable;
public class TemplateSlopeBlock extends WaterloggableTemplateBlock {
public static final EnumProperty<Edge> EDGE = EnumProperty.of("edge", Edge.class);
protected final VoxelShape[] shapes = new VoxelShape[Edge.values().length];
public TemplateSlopeBlock(Settings settings) {
super(settings);
setDefaultState(getDefaultState().with(EDGE, Edge.DOWN_NORTH));
for(Edge edge : Edge.values()) {
shapes[edge.ordinal()] = getShape(edge);
}
}
protected VoxelShape getShape(Edge edge) {
return StairShapeMaker.makeStair(edge, 1, 0.125d, 0.125d, 0.125d, 8);
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
super.appendProperties(builder.add(EDGE));
}
@Nullable
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
//not calling TemplateInteractionUtil.modifyPlacementState because we extend TemplateBlock which already does
BlockState sup = super.getPlacementState(ctx);
if(sup != null) sup = sup.with(EDGE, Edge.stairslikePlacement(ctx));
return sup;
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
return MoreObjects.firstNonNull(
TemplateInteractionUtil.getCollisionShape(state, view, pos, ctx),
shapes[state.get(EDGE).ordinal()]
);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) {
return shapes[state.get(EDGE).ordinal()];
}
public static class Tiny extends TemplateSlopeBlock {
public Tiny(Settings settings) {
super(settings);
}
@Override
protected VoxelShape getShape(Edge edge) {
return StairShapeMaker.makeStair(edge, 0.5, 0.125d, 0.125d, 0.125d, 4);
}
}
}

View File

@ -16,8 +16,6 @@
"reframedtemplates:stairs", "reframedtemplates:stairs",
"reframedtemplates:trapdoor", "reframedtemplates:trapdoor",
"reframedtemplates:vertical_slab", "reframedtemplates:vertical_slab",
"reframedtemplates:wall", "reframedtemplates:wall"
"reframedtemplates:slope",
"reframedtemplates:tiny_slope"
] ]
} }

View File

@ -19,9 +19,7 @@
"reframedtemplates:stairs", "reframedtemplates:stairs",
"reframedtemplates:trapdoor", "reframedtemplates:trapdoor",
"reframedtemplates:vertical_slab", "reframedtemplates:vertical_slab",
"reframedtemplates:wall", "reframedtemplates:wall"
"reframedtemplates:slope",
"reframedtemplates:tiny_slope"
] ]
}, },
"criteria": { "criteria": {

View File

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

View File

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

View File

@ -1,21 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"I ",
"I~ ",
"III"
],
"key": {
"I": {
"item": "minecraft:bamboo"
},
"~": {
"item": "minecraft:string"
}
},
"result": {
"item": "reframedtemplates:slope",
"count": 4
},
"group": "reframedtemplates"
}

View File

@ -1,20 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"I~",
"II"
],
"key": {
"I": {
"item": "minecraft:bamboo"
},
"~": {
"item": "minecraft:string"
}
},
"result": {
"item": "reframedtemplates:tiny_slope",
"count": 8
},
"group": "reframedtemplates"
}