Compare commits
No commits in common. "3afee9e501c1891a5968410dbd831ae7743c4477" and "3048f538782bc9cbf0246464350768a6480f9832" have entirely different histories.
3afee9e501
...
3048f53878
@ -210,7 +210,6 @@ modrinth {
|
|||||||
required.project "fabric-api"
|
required.project "fabric-api"
|
||||||
optional.version "b1ZV3DIJ", "${project.athena_version}"
|
optional.version "b1ZV3DIJ", "${project.athena_version}"
|
||||||
optional.version "Orvt0mRa", "${project.indium_version}+mc${project.minecraft_version}"
|
optional.version "Orvt0mRa", "${project.indium_version}+mc${project.minecraft_version}"
|
||||||
optional.version "1IjD5062", "${project.continuity_version}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import java.util.stream.Stream;
|
|||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* TODO make block pairable by right click -> for v1.6
|
||||||
* TODO Dynamic Ambient Occlusion -> for v1.6
|
* TODO Dynamic Ambient Occlusion -> for v1.6
|
||||||
* TODO add minecraft models like wall fence etc -> for v1.6
|
* TODO add minecraft models like wall fence etc -> for v1.6
|
||||||
* TODO better connected textures -> maybe v1.6 ?
|
* TODO better connected textures -> maybe v1.6 ?
|
||||||
|
@ -15,9 +15,7 @@ import net.minecraft.item.ItemPlacementContext;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.NbtHelper;
|
|
||||||
import net.minecraft.recipe.book.RecipeCategory;
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
import net.minecraft.registry.Registries;
|
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
@ -33,12 +31,8 @@ import net.minecraft.world.GameRules;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.IntStream;
|
|
||||||
|
|
||||||
import static fr.adrien1106.reframed.block.ReFramedEntity.BLOCKSTATE_KEY;
|
|
||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.LIGHT;
|
||||||
|
|
||||||
public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeSetter {
|
public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeSetter {
|
||||||
@ -103,7 +97,7 @@ public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeS
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
|
public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
|
||||||
if(!(newState.getBlock() instanceof ReFramedBlock) &&
|
if(!state.isOf(newState.getBlock()) &&
|
||||||
world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity &&
|
world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity &&
|
||||||
world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)
|
world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)
|
||||||
) {
|
) {
|
||||||
@ -129,51 +123,13 @@ public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeS
|
|||||||
super.onStateReplaced(state, world, pos, newState, moved);
|
super.onStateReplaced(state, world, pos, newState, moved);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack, BlockState old_state, BlockEntity old_entity) {
|
@Override
|
||||||
if (!(world.getBlockEntity(pos) instanceof ReFramedEntity frame_entity)) {
|
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
|
||||||
onPlaced(world, pos, state, placer, stack);
|
if(world.isClient && world.getBlockEntity(pos) instanceof ReFramedEntity be) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// apply state change keeping the old information
|
|
||||||
if (old_state.getBlock() instanceof ReFramedBlock old_frame_block
|
|
||||||
&& old_entity instanceof ReFramedEntity old_frame_entity) {
|
|
||||||
Map<Integer, Integer> theme_map = old_frame_block.getThemeMap(old_state, state);
|
|
||||||
theme_map.forEach((self, other) ->
|
|
||||||
frame_entity.setTheme(old_frame_entity.getTheme(self), other)
|
|
||||||
);
|
|
||||||
|
|
||||||
// apply any changes needed to keep previous properties
|
|
||||||
if (old_frame_entity.emitsLight() && !frame_entity.emitsLight()) {
|
|
||||||
frame_entity.toggleLight();
|
|
||||||
world.setBlockState(pos, state.with(LIGHT, true));
|
|
||||||
}
|
|
||||||
if (old_frame_entity.emitsRedstone() && !frame_entity.emitsRedstone()) {
|
|
||||||
frame_entity.toggleRedstone();
|
|
||||||
world.updateNeighbors(pos, this);
|
|
||||||
}
|
|
||||||
if (old_frame_entity.isSolid() && !frame_entity.isSolid()) frame_entity.toggleSolidity();
|
|
||||||
|
|
||||||
// apply themes from item
|
|
||||||
NbtCompound tag = BlockItem.getBlockEntityNbt(stack);
|
NbtCompound tag = BlockItem.getBlockEntityNbt(stack);
|
||||||
if(tag != null) {
|
if(tag != null) be.readNbt(tag);
|
||||||
// determine a list of themes than can be used
|
|
||||||
Iterator<Integer> free_themes = IntStream
|
|
||||||
.rangeClosed(1, frame_entity.getThemes().size())
|
|
||||||
.filter(value -> !theme_map.containsValue(value))
|
|
||||||
.iterator();
|
|
||||||
// apply all the themes possible from item
|
|
||||||
for (int i = 1; tag.contains(BLOCKSTATE_KEY + i) && free_themes.hasNext(); i++) {
|
|
||||||
BlockState theme = NbtHelper.toBlockState(Registries.BLOCK.getReadOnlyWrapper(), tag.getCompound(BLOCKSTATE_KEY + i));
|
|
||||||
if (theme == null || theme.getBlock() == Blocks.AIR) continue;
|
|
||||||
frame_entity.setTheme(theme, free_themes.next());
|
|
||||||
}
|
}
|
||||||
}
|
super.onPlaced(world, pos, state, placer, stack);
|
||||||
} else if(world.isClient) { // prevents flashing with default texture before server sends the update
|
|
||||||
NbtCompound tag = BlockItem.getBlockEntityNbt(stack);
|
|
||||||
if(tag != null) frame_entity.readNbt(tag);
|
|
||||||
}
|
|
||||||
onPlaced(world, pos, state, placer, stack);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -209,23 +165,10 @@ public class ReFramedBlock extends Block implements BlockEntityProvider, RecipeS
|
|||||||
return getWeakRedstonePower(state, view, pos, dir);
|
return getWeakRedstonePower(state, view, pos, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param state - the block state to get the top theme index from
|
|
||||||
* @return the index of the top theme to use for the block
|
|
||||||
*/
|
|
||||||
public int getTopThemeIndex(BlockState state) {
|
public int getTopThemeIndex(BlockState state) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param state - the block state of the block that is being replaced
|
|
||||||
* @param new_state - the block state of the block that is replacing the block
|
|
||||||
* @return a map of the theme indexes to map when changing state so that the themes are preserved
|
|
||||||
*/
|
|
||||||
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
|
|
||||||
return Map.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecipe(RecipeExporter exporter) {
|
public void setRecipe(RecipeExporter exporter) {
|
||||||
ShapedRecipeJsonBuilder
|
ShapedRecipeJsonBuilder
|
||||||
|
@ -7,7 +7,6 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.block.ShapeContext;
|
import net.minecraft.block.ShapeContext;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.state.property.Property;
|
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
@ -50,29 +49,6 @@ public abstract class ReFramedDoubleBlock extends ReFramedBlock {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
|
||||||
public final <T extends Comparable<T>> boolean matchesAnyOutline(Vec3d hit, BlockPos pos, Property<T> property, T... values) {
|
|
||||||
for (T value : values)
|
|
||||||
if (matchesOutline(hit, pos, property, value)) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends Comparable<T>> boolean matchesOutline(Vec3d hit, BlockPos pos, Property<T> property, T value) {
|
|
||||||
Vec3d rel = BlockHelper.getRelativePos(hit, pos);
|
|
||||||
return BlockHelper.cursorMatchesFace(
|
|
||||||
getOutlineShape(getDefaultState().with(property, value), null, null, null),
|
|
||||||
rel
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends Comparable<T>> boolean matchesShape(Vec3d hit, BlockPos pos, BlockState state, int i) {
|
|
||||||
Vec3d rel = BlockHelper.getRelativePos(hit, pos);
|
|
||||||
return BlockHelper.cursorMatchesFace(
|
|
||||||
getShape(state, i),
|
|
||||||
rel
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {
|
public boolean isTransparent(BlockState state, BlockView world, BlockPos pos) {
|
||||||
return world.getBlockEntity(pos) instanceof ThemeableBlockEntity framed_entity
|
return world.getBlockEntity(pos) instanceof ThemeableBlockEntity framed_entity
|
||||||
|
@ -15,23 +15,20 @@ import net.minecraft.data.client.MultipartBlockStateSupplier;
|
|||||||
import net.minecraft.data.server.recipe.RecipeExporter;
|
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||||
import net.minecraft.data.server.recipe.RecipeProvider;
|
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.recipe.book.RecipeCategory;
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.function.BooleanBiFunction;
|
import net.minecraft.util.function.BooleanBiFunction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.*;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER;
|
||||||
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER_FACE;
|
||||||
import static fr.adrien1106.reframed.util.blocks.Corner.*;
|
import static fr.adrien1106.reframed.util.blocks.Corner.*;
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||||
|
|
||||||
@ -61,32 +58,8 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement
|
|||||||
super.appendProperties(builder.add(CORNER,CORNER_FACE));
|
super.appendProperties(builder.add(CORNER,CORNER_FACE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
|
||||||
return !(
|
|
||||||
context.getPlayer().isSneaking()
|
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|
||||||
|| (
|
|
||||||
block_item.getBlock() != this
|
|
||||||
&& block_item.getBlock() != ReFramed.SMALL_CUBE
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
|
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||||
BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos());
|
|
||||||
if (current_state.isOf(ReFramed.SMALL_CUBE)) {
|
|
||||||
Corner corner = current_state.get(CORNER).getOpposite(ctx.getSide().getOpposite());
|
|
||||||
return ReFramed.HALF_STAIRS_SLAB.getDefaultState()
|
|
||||||
.with(CORNER, corner)
|
|
||||||
.with(CORNER_FACE, corner.getDirectionIndex(ctx.getSide().getOpposite()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current_state.isOf(this))
|
|
||||||
return ReFramed.HALF_STAIRS_STAIR.getDefaultState()
|
|
||||||
.with(EDGE, current_state.get(CORNER).getEdge(current_state.get(CORNER).getDirection(current_state.get(CORNER_FACE))));
|
|
||||||
|
|
||||||
Corner corner = BlockHelper.getPlacementCorner(ctx);
|
Corner corner = BlockHelper.getPlacementCorner(ctx);
|
||||||
return super.getPlacementState(ctx)
|
return super.getPlacementState(ctx)
|
||||||
.with(CORNER, corner)
|
.with(CORNER, corner)
|
||||||
@ -98,19 +71,6 @@ public class ReFramedHalfStairBlock extends WaterloggableReFramedBlock implement
|
|||||||
return HALF_STAIR_VOXELS[state.get(CORNER_FACE) + state.get(CORNER).getID() * 3];
|
return HALF_STAIR_VOXELS[state.get(CORNER_FACE) + state.get(CORNER).getID() * 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
|
|
||||||
if (new_state.isOf(ReFramed.HALF_STAIRS_SLAB)) return Map.of(1, 1);
|
|
||||||
if (new_state.isOf(ReFramed.HALF_STAIRS_STAIR))
|
|
||||||
return Map.of(
|
|
||||||
1,
|
|
||||||
state.get(CORNER)
|
|
||||||
.getDirection(state.get(CORNER_FACE))
|
|
||||||
.getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1
|
|
||||||
);
|
|
||||||
return super.getThemeMap(state, new_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockStateSupplier getMultipart() {
|
public BlockStateSupplier getMultipart() {
|
||||||
return getHalfStairMultipart(
|
return getHalfStairMultipart(
|
||||||
|
@ -116,13 +116,13 @@ public class ReFramedHalfStairsStairBlock extends WaterloggableReFramedDoubleBlo
|
|||||||
GBlockstate.variant(model_id, true, R0, R270))
|
GBlockstate.variant(model_id, true, R0, R270))
|
||||||
/* Z AXIS */
|
/* Z AXIS */
|
||||||
.with(GBlockstate.when(EDGE, DOWN_EAST),
|
.with(GBlockstate.when(EDGE, DOWN_EAST),
|
||||||
GBlockstate.variant(reverse_model_id, true, R0, R90))
|
GBlockstate.variant(side_model_id, true, R0, R90))
|
||||||
.with(GBlockstate.when(EDGE, EAST_UP),
|
.with(GBlockstate.when(EDGE, EAST_UP),
|
||||||
GBlockstate.variant(side_model_id, true, R180, R270))
|
GBlockstate.variant(reverse_model_id, true, R180, R270))
|
||||||
.with(GBlockstate.when(EDGE, UP_WEST),
|
.with(GBlockstate.when(EDGE, UP_WEST),
|
||||||
GBlockstate.variant(reverse_model_id, true, R180, R90))
|
GBlockstate.variant(side_model_id, true, R180, R90))
|
||||||
.with(GBlockstate.when(EDGE, WEST_DOWN),
|
.with(GBlockstate.when(EDGE, WEST_DOWN),
|
||||||
GBlockstate.variant(side_model_id, true, R0, R270));
|
GBlockstate.variant(reverse_model_id, true, R0, R270));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,7 +11,6 @@ import net.minecraft.data.client.MultipartBlockStateSupplier;
|
|||||||
import net.minecraft.data.server.recipe.RecipeExporter;
|
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||||
import net.minecraft.data.server.recipe.RecipeProvider;
|
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.recipe.book.RecipeCategory;
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
@ -23,10 +22,7 @@ import net.minecraft.util.shape.VoxelShapes;
|
|||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||||
import static net.minecraft.state.property.Properties.AXIS;
|
|
||||||
import static net.minecraft.state.property.Properties.FACING;
|
import static net.minecraft.state.property.Properties.FACING;
|
||||||
|
|
||||||
public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
||||||
@ -58,23 +54,9 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements Blo
|
|||||||
super.appendProperties(builder.add(FACING));
|
super.appendProperties(builder.add(FACING));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
|
||||||
return !(
|
|
||||||
context.getPlayer().isSneaking()
|
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|
||||||
|| block_item.getBlock() != this
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||||
BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos());
|
|
||||||
if (current_state.isOf(this))
|
|
||||||
return ReFramed.SLABS_CUBE.getDefaultState()
|
|
||||||
.with(AXIS, current_state.get(FACING).getAxis());
|
|
||||||
|
|
||||||
return super.getPlacementState(ctx).with(FACING, ctx.getSide().getOpposite());
|
return super.getPlacementState(ctx).with(FACING, ctx.getSide().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,12 +76,6 @@ public class ReFramedSlabBlock extends WaterloggableReFramedBlock implements Blo
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
|
|
||||||
if (new_state.isOf(ReFramed.SLABS_CUBE)) return Map.of(1, state.get(FACING).getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1);
|
|
||||||
return super.getThemeMap(state, new_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MultipartBlockStateSupplier getMultipart() {
|
public MultipartBlockStateSupplier getMultipart() {
|
||||||
Identifier model_id = ReFramed.id("slab_special");
|
Identifier model_id = ReFramed.id("slab_special");
|
||||||
|
@ -19,7 +19,8 @@ import net.minecraft.util.shape.VoxelShape;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import static fr.adrien1106.reframed.block.ReFramedSlabBlock.*;
|
import static fr.adrien1106.reframed.block.ReFramedSlabBlock.*;
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
import static net.minecraft.data.client.VariantSettings.Rotation.R0;
|
||||||
|
import static net.minecraft.data.client.VariantSettings.Rotation.R90;
|
||||||
import static net.minecraft.state.property.Properties.AXIS;
|
import static net.minecraft.state.property.Properties.AXIS;
|
||||||
|
|
||||||
public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements BlockStateProvider {
|
public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements BlockStateProvider {
|
||||||
@ -54,14 +55,15 @@ public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements Block
|
|||||||
public VoxelShape getShape(BlockState state, int i) {
|
public VoxelShape getShape(BlockState state, int i) {
|
||||||
return switch (state.get(AXIS)) {
|
return switch (state.get(AXIS)) {
|
||||||
case Y -> i == 2 ? UP : DOWN;
|
case Y -> i == 2 ? UP : DOWN;
|
||||||
case Z -> i == 2 ? SOUTH : NORTH;
|
case Z -> i == 2 ? NORTH : SOUTH;
|
||||||
case X -> i == 2 ? EAST : WEST;
|
case X -> i == 2 ? EAST : WEST;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTopThemeIndex(BlockState state) {
|
public int getTopThemeIndex(BlockState state) {
|
||||||
return 2;
|
// when the side is shared just return one
|
||||||
|
return state.get(AXIS) == Direction.Axis.Y ? 2: super.getTopThemeIndex(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -71,7 +73,7 @@ public class ReFramedSlabsCubeBlock extends ReFramedDoubleBlock implements Block
|
|||||||
.with(GBlockstate.when(AXIS, Direction.Axis.Y),
|
.with(GBlockstate.when(AXIS, Direction.Axis.Y),
|
||||||
GBlockstate.variant(model_id, true, R0, R0))
|
GBlockstate.variant(model_id, true, R0, R0))
|
||||||
.with(GBlockstate.when(AXIS, Direction.Axis.Z),
|
.with(GBlockstate.when(AXIS, Direction.Axis.Z),
|
||||||
GBlockstate.variant(model_id, true, R270, R0))
|
GBlockstate.variant(model_id, true, R90, R0))
|
||||||
.with(GBlockstate.when(AXIS, Direction.Axis.X),
|
.with(GBlockstate.when(AXIS, Direction.Axis.X),
|
||||||
GBlockstate.variant(model_id, true, R90, R90));
|
GBlockstate.variant(model_id, true, R90, R90));
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import fr.adrien1106.reframed.generator.BlockStateProvider;
|
|||||||
import fr.adrien1106.reframed.generator.GBlockstate;
|
import fr.adrien1106.reframed.generator.GBlockstate;
|
||||||
import fr.adrien1106.reframed.util.VoxelHelper;
|
import fr.adrien1106.reframed.util.VoxelHelper;
|
||||||
import fr.adrien1106.reframed.util.blocks.BlockHelper;
|
import fr.adrien1106.reframed.util.blocks.BlockHelper;
|
||||||
import fr.adrien1106.reframed.util.blocks.Corner;
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
@ -15,23 +14,18 @@ import net.minecraft.data.client.MultipartBlockStateSupplier;
|
|||||||
import net.minecraft.data.server.recipe.RecipeExporter;
|
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||||
import net.minecraft.data.server.recipe.RecipeProvider;
|
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||||
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
|
import net.minecraft.data.server.recipe.ShapelessRecipeJsonBuilder;
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.recipe.book.RecipeCategory;
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.*;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.CORNER;
|
||||||
import static fr.adrien1106.reframed.util.blocks.Corner.*;
|
import static fr.adrien1106.reframed.util.blocks.Corner.*;
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||||
|
|
||||||
@ -59,73 +53,8 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement
|
|||||||
super.appendProperties(builder.add(CORNER));
|
super.appendProperties(builder.add(CORNER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
|
||||||
Corner corner = state.get(CORNER);
|
|
||||||
return !(
|
|
||||||
context.getPlayer().isSneaking()
|
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|
||||||
|| (
|
|
||||||
!(
|
|
||||||
block_item.getBlock() == ReFramed.HALF_STAIR
|
|
||||||
&& !(corner.hasDirection(context.getSide())
|
|
||||||
|| (corner.hasDirection(context.getSide().getOpposite())
|
|
||||||
&& BlockHelper.cursorMatchesFace(
|
|
||||||
getOutlineShape(state, context.getWorld(), context.getBlockPos(), null),
|
|
||||||
BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos())
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
&& !(
|
|
||||||
block_item.getBlock() == this
|
|
||||||
&& !(
|
|
||||||
corner.hasDirection(context.getSide())
|
|
||||||
&& BlockHelper.cursorMatchesFace(
|
|
||||||
getOutlineShape(state, context.getWorld(), context.getBlockPos(), null),
|
|
||||||
BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos())
|
|
||||||
)
|
|
||||||
)
|
|
||||||
&& ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP)
|
|
||||||
.matchesAnyOutline(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
EDGE,
|
|
||||||
corner.getEdge(corner.getFirstDirection()),
|
|
||||||
corner.getEdge(corner.getSecondDirection()),
|
|
||||||
corner.getEdge(corner.getThirdDirection())
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
|
public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||||
BlockPos pos = ctx.getBlockPos();
|
|
||||||
BlockState current_state = ctx.getWorld().getBlockState(pos);
|
|
||||||
if (current_state.isOf(ReFramed.HALF_STAIR))
|
|
||||||
return ReFramed.HALF_STAIRS_SLAB.getDefaultState()
|
|
||||||
.with(CORNER, current_state.get(CORNER))
|
|
||||||
.with(CORNER_FACE, current_state.get(CORNER_FACE));
|
|
||||||
|
|
||||||
|
|
||||||
if (current_state.isOf(this)) {
|
|
||||||
Vec3d hit = ctx.getHitPos();
|
|
||||||
Corner corner = current_state.get(CORNER);
|
|
||||||
ReFramedSmallCubesStepBlock block = ((ReFramedSmallCubesStepBlock) ReFramed.SMALL_CUBES_STEP);
|
|
||||||
BlockState state = block.getDefaultState().with(EDGE, corner.getEdge(corner.getFirstDirection()));
|
|
||||||
if (!block.matchesShape(
|
|
||||||
hit, pos, state,
|
|
||||||
corner.getFirstDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)) state = state.with(EDGE, corner.getEdge(corner.getSecondDirection()));
|
|
||||||
if (!block.matchesShape(
|
|
||||||
hit, pos, state,
|
|
||||||
corner.getSecondDirection().getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)) state = state.with(EDGE, corner.getEdge(corner.getThirdDirection()));
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.getPlacementState(ctx).with(CORNER, BlockHelper.getPlacementCorner(ctx));
|
return super.getPlacementState(ctx).with(CORNER, BlockHelper.getPlacementCorner(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,19 +63,6 @@ public class ReFramedSmallCubeBlock extends WaterloggableReFramedBlock implement
|
|||||||
return SMALL_CUBE_VOXELS[state.get(CORNER).getID()];
|
return SMALL_CUBE_VOXELS[state.get(CORNER).getID()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
|
|
||||||
if (new_state.isOf(ReFramed.HALF_STAIRS_SLAB)) return Map.of(1, 2);
|
|
||||||
if (new_state.isOf(ReFramed.SMALL_CUBES_STEP))
|
|
||||||
return Map.of(
|
|
||||||
1,
|
|
||||||
state.get(CORNER)
|
|
||||||
.getOtherDirection(new_state.get(EDGE))
|
|
||||||
.getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1
|
|
||||||
);
|
|
||||||
return super.getThemeMap(state, new_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockStateSupplier getMultipart() {
|
public BlockStateSupplier getMultipart() {
|
||||||
Identifier small_cube_id = ReFramed.id("small_cube_special");
|
Identifier small_cube_id = ReFramed.id("small_cube_special");
|
||||||
|
@ -93,13 +93,13 @@ public class ReFramedSmallCubesStepBlock extends WaterloggableReFramedDoubleBloc
|
|||||||
return MultipartBlockStateSupplier.create(this)
|
return MultipartBlockStateSupplier.create(this)
|
||||||
/* X AXIS */
|
/* X AXIS */
|
||||||
.with(GBlockstate.when(EDGE, DOWN_EAST),
|
.with(GBlockstate.when(EDGE, DOWN_EAST),
|
||||||
GBlockstate.variant(model_id, true, R0, R0))
|
GBlockstate.variant(reverse_model_id, true, R0, R0))
|
||||||
.with(GBlockstate.when(EDGE, EAST_UP),
|
.with(GBlockstate.when(EDGE, EAST_UP),
|
||||||
GBlockstate.variant(reverse_model_id, true, R180, R0))
|
GBlockstate.variant(model_id, true, R180, R0))
|
||||||
.with(GBlockstate.when(EDGE, UP_WEST),
|
.with(GBlockstate.when(EDGE, UP_WEST),
|
||||||
GBlockstate.variant(model_id, true, R180, R180))
|
GBlockstate.variant(reverse_model_id, true, R180, R180))
|
||||||
.with(GBlockstate.when(EDGE, WEST_DOWN),
|
.with(GBlockstate.when(EDGE, WEST_DOWN),
|
||||||
GBlockstate.variant(reverse_model_id, true, R0, R180))
|
GBlockstate.variant(model_id, true, R0, R180))
|
||||||
/* Y AXIS */
|
/* Y AXIS */
|
||||||
.with(GBlockstate.when(EDGE, EAST_SOUTH),
|
.with(GBlockstate.when(EDGE, EAST_SOUTH),
|
||||||
GBlockstate.variant(model_id, true, R90, R0))
|
GBlockstate.variant(model_id, true, R90, R0))
|
||||||
|
@ -16,7 +16,6 @@ import net.minecraft.data.client.When;
|
|||||||
import net.minecraft.data.server.recipe.RecipeExporter;
|
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||||
import net.minecraft.data.server.recipe.RecipeProvider;
|
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.recipe.book.RecipeCategory;
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
@ -31,7 +30,6 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
||||||
@ -65,15 +63,6 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl
|
|||||||
super.appendProperties(builder.add(EDGE, STAIR_SHAPE));
|
super.appendProperties(builder.add(EDGE, STAIR_SHAPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
|
||||||
return !(
|
|
||||||
context.getPlayer().isSneaking()
|
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|
||||||
|| block_item.getBlock() != ReFramed.STEP
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighbor_state, WorldAccess world, BlockPos pos, BlockPos moved) {
|
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighbor_state, WorldAccess world, BlockPos pos, BlockPos moved) {
|
||||||
return super.getStateForNeighborUpdate(state, direction, neighbor_state, world, pos, moved)
|
return super.getStateForNeighborUpdate(state, direction, neighbor_state, world, pos, moved)
|
||||||
@ -81,20 +70,11 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override // Pretty happy of how clean it is (also got it on first try :) )
|
||||||
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||||
BlockState current_state = ctx.getWorld().getBlockState(ctx.getBlockPos());
|
Edge face = BlockHelper.getPlacementEdge(ctx);
|
||||||
if (current_state.isOf(ReFramed.STEP)) {
|
StairShape shape = BlockHelper.getStairsShape(face, ctx.getWorld(), ctx.getBlockPos());
|
||||||
Edge edge = current_state.get(EDGE).opposite();
|
return super.getPlacementState(ctx).with(EDGE, face).with(STAIR_SHAPE, shape);
|
||||||
StairShape shape = BlockHelper.getStairsShape(edge, ctx.getWorld(), ctx.getBlockPos());
|
|
||||||
return ReFramed.STAIRS_CUBE.getDefaultState()
|
|
||||||
.with(EDGE, edge)
|
|
||||||
.with(STAIR_SHAPE, shape);
|
|
||||||
}
|
|
||||||
|
|
||||||
Edge edge = BlockHelper.getPlacementEdge(ctx);
|
|
||||||
StairShape shape = BlockHelper.getStairsShape(edge, ctx.getWorld(), ctx.getBlockPos());
|
|
||||||
return super.getPlacementState(ctx).with(EDGE, edge).with(STAIR_SHAPE, shape);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -113,12 +93,6 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl
|
|||||||
return STAIR_VOXELS[edge.getID() * 9 + shape.getID()];
|
return STAIR_VOXELS[edge.getID() * 9 + shape.getID()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
|
|
||||||
if (new_state.isOf(ReFramed.STAIRS_CUBE)) return Map.of(1, 1);
|
|
||||||
return super.getThemeMap(state, new_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MultipartBlockStateSupplier getMultipart() {
|
public MultipartBlockStateSupplier getMultipart() {
|
||||||
return getStairMultipart(this, false);
|
return getStairMultipart(this, false);
|
||||||
@ -163,94 +137,94 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl
|
|||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_RIGHT)),
|
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_LEFT)),
|
||||||
GBlockstate.variant(inner_id, true, R0, R180))
|
GBlockstate.variant(inner_id, true, R0, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_LEFT),
|
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, INNER_LEFT),
|
||||||
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_RIGHT)),
|
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_LEFT)),
|
||||||
GBlockstate.variant(inner_id, true, R0, R270))
|
GBlockstate.variant(inner_id, true, R0, R270))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_LEFT),
|
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_LEFT),
|
||||||
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_LEFT)),
|
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, INNER_RIGHT)),
|
||||||
GBlockstate.variant(inner_id, true, R0, R0))
|
GBlockstate.variant(inner_id, true, R0, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_LEFT)),
|
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, INNER_RIGHT)),
|
||||||
GBlockstate.variant(inner_id, true, R0, R90))
|
GBlockstate.variant(inner_id, true, R0, R90))
|
||||||
/* INNER TOP */
|
/* INNER TOP */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_LEFT),
|
||||||
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_LEFT),
|
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, INNER_LEFT),
|
||||||
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_LEFT)),
|
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_LEFT)),
|
||||||
GBlockstate.variant(inner_id, true, R180, R0))
|
GBlockstate.variant(inner_id, true, R180, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_LEFT),
|
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_LEFT),
|
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, INNER_LEFT),
|
||||||
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_LEFT)),
|
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_LEFT)),
|
||||||
GBlockstate.variant(inner_id, true, R180, R90))
|
GBlockstate.variant(inner_id, true, R180, R90))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_LEFT),
|
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, INNER_LEFT),
|
||||||
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_LEFT)),
|
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_RIGHT)),
|
||||||
GBlockstate.variant(inner_id, true, R180, R180))
|
GBlockstate.variant(inner_id, true, R180, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_RIGHT),
|
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, INNER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_LEFT),
|
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, INNER_LEFT),
|
||||||
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_RIGHT)),
|
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, INNER_LEFT)),
|
||||||
GBlockstate.variant(inner_id, true, R180, R270))
|
GBlockstate.variant(inner_id, true, R180, R270))
|
||||||
/* OUTER BOTTOM */
|
/* OUTER BOTTOM */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT),
|
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_LEFT)),
|
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_RIGHT)),
|
||||||
GBlockstate.variant(outer_id, true, R0, R0))
|
GBlockstate.variant(outer_id, true, R0, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT),
|
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT)),
|
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT)),
|
||||||
GBlockstate.variant(outer_id, true, R0, R90))
|
GBlockstate.variant(outer_id, true, R0, R90))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT),
|
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_RIGHT)),
|
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT)),
|
||||||
GBlockstate.variant(outer_id, true, R0, R180))
|
GBlockstate.variant(outer_id, true, R0, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT),
|
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, FIRST_OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_RIGHT)),
|
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, SECOND_OUTER_LEFT)),
|
||||||
GBlockstate.variant(outer_id, true, R0, R270))
|
GBlockstate.variant(outer_id, true, R0, R270))
|
||||||
/* OUTER TOP */
|
/* OUTER TOP */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT),
|
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT)),
|
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_LEFT)),
|
||||||
GBlockstate.variant(outer_id, true, R180, R0))
|
GBlockstate.variant(outer_id, true, R180, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_LEFT),
|
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_LEFT)),
|
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT)),
|
||||||
GBlockstate.variant(outer_id, true, R180, R90))
|
GBlockstate.variant(outer_id, true, R180, R90))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT),
|
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, FIRST_OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_LEFT)),
|
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_RIGHT)),
|
||||||
GBlockstate.variant(outer_id, true, R180, R180))
|
GBlockstate.variant(outer_id, true, R180, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT),
|
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_RIGHT)),
|
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, SECOND_OUTER_LEFT)),
|
||||||
GBlockstate.variant(outer_id, true, R180, R270))
|
GBlockstate.variant(outer_id, true, R180, R270))
|
||||||
/* OUTER EAST */
|
/* OUTER EAST */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT),
|
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT)),
|
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT)),
|
||||||
GBlockstate.variant(outer_side_id, true, R0, R0))
|
GBlockstate.variant(outer_side_id, true, R0, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT),
|
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, SECOND_OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_LEFT)),
|
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_RIGHT)),
|
||||||
GBlockstate.variant(outer_side_id, true, R90, R0))
|
GBlockstate.variant(outer_side_id, true, R90, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT),
|
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_RIGHT)),
|
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, SECOND_OUTER_LEFT)),
|
||||||
GBlockstate.variant(outer_side_id, true, R180, R0))
|
GBlockstate.variant(outer_side_id, true, R180, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT),
|
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_RIGHT)),
|
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, FIRST_OUTER_LEFT)),
|
||||||
GBlockstate.variant(outer_side_id, true, R270, R0))
|
GBlockstate.variant(outer_side_id, true, R270, R0))
|
||||||
/* OUTER SOUTH */
|
/* OUTER SOUTH */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
@ -272,19 +246,19 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl
|
|||||||
/* OUTER WEST */
|
/* OUTER WEST */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT),
|
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_RIGHT)),
|
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_LEFT)),
|
||||||
GBlockstate.variant(outer_side_id, true, R0, R180))
|
GBlockstate.variant(outer_side_id, true, R0, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT),
|
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, SECOND_OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT)),
|
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT)),
|
||||||
GBlockstate.variant(outer_side_id, true, R90, R180))
|
GBlockstate.variant(outer_side_id, true, R90, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT),
|
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_LEFT)),
|
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT)),
|
||||||
GBlockstate.variant(outer_side_id, true, R180, R180))
|
GBlockstate.variant(outer_side_id, true, R180, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT),
|
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, FIRST_OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_LEFT)),
|
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, SECOND_OUTER_RIGHT)),
|
||||||
GBlockstate.variant(outer_side_id, true, R270, R180))
|
GBlockstate.variant(outer_side_id, true, R270, R180))
|
||||||
/* OUTER NORTH */
|
/* OUTER NORTH */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
@ -306,43 +280,43 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl
|
|||||||
/* OUTER BOTTOM */
|
/* OUTER BOTTOM */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_LEFT),
|
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_LEFT),
|
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_RIGHT)),
|
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_RIGHT)),
|
||||||
GBlockstate.variant(double_outer_id, true, R0, R0))
|
GBlockstate.variant(double_outer_id, true, R0, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_RIGHT),
|
GBlockstate.when(EDGE, DOWN_SOUTH, STAIR_SHAPE, OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_LEFT),
|
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_RIGHT)),
|
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_RIGHT)),
|
||||||
GBlockstate.variant(double_outer_id, true, R0, R90))
|
GBlockstate.variant(double_outer_id, true, R0, R90))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_RIGHT),
|
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_RIGHT),
|
GBlockstate.when(EDGE, WEST_DOWN, STAIR_SHAPE, OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_RIGHT)),
|
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_RIGHT)),
|
||||||
GBlockstate.variant(double_outer_id, true, R0, R180))
|
GBlockstate.variant(double_outer_id, true, R0, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_LEFT),
|
GBlockstate.when(EDGE, NORTH_DOWN, STAIR_SHAPE, OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_RIGHT),
|
GBlockstate.when(EDGE, DOWN_EAST, STAIR_SHAPE, OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_RIGHT)),
|
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_RIGHT)),
|
||||||
GBlockstate.variant(double_outer_id, true, R0, R270))
|
GBlockstate.variant(double_outer_id, true, R0, R270))
|
||||||
/* OUTER TOP */
|
/* OUTER TOP */
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_LEFT),
|
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_RIGHT),
|
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_LEFT)),
|
GBlockstate.when(EDGE, NORTH_EAST, STAIR_SHAPE, OUTER_LEFT)),
|
||||||
GBlockstate.variant(double_outer_id, true, R180, R0))
|
GBlockstate.variant(double_outer_id, true, R180, R0))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_LEFT),
|
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_LEFT),
|
GBlockstate.when(EDGE, EAST_UP, STAIR_SHAPE, OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_LEFT)),
|
GBlockstate.when(EDGE, EAST_SOUTH, STAIR_SHAPE, OUTER_LEFT)),
|
||||||
GBlockstate.variant(double_outer_id, true, R180, R90))
|
GBlockstate.variant(double_outer_id, true, R180, R90))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_RIGHT),
|
GBlockstate.when(EDGE, SOUTH_UP, STAIR_SHAPE, OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_LEFT),
|
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_LEFT)),
|
GBlockstate.when(EDGE, SOUTH_WEST, STAIR_SHAPE, OUTER_LEFT)),
|
||||||
GBlockstate.variant(double_outer_id, true, R180, R180))
|
GBlockstate.variant(double_outer_id, true, R180, R180))
|
||||||
.with(When.anyOf(
|
.with(When.anyOf(
|
||||||
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_RIGHT),
|
GBlockstate.when(EDGE, UP_NORTH, STAIR_SHAPE, OUTER_RIGHT),
|
||||||
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_RIGHT),
|
GBlockstate.when(EDGE, UP_WEST, STAIR_SHAPE, OUTER_LEFT),
|
||||||
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_LEFT)),
|
GBlockstate.when(EDGE, WEST_NORTH, STAIR_SHAPE, OUTER_LEFT)),
|
||||||
GBlockstate.variant(double_outer_id, true, R180, R270));
|
GBlockstate.variant(double_outer_id, true, R180, R270));
|
||||||
}
|
}
|
||||||
@ -408,51 +382,51 @@ public class ReFramedStairBlock extends WaterloggableReFramedBlock implements Bl
|
|||||||
.add(25, VoxelHelper::rotateCX).add(26, VoxelHelper::rotateCX)
|
.add(25, VoxelHelper::rotateCX).add(26, VoxelHelper::rotateCX)
|
||||||
// WEST_DOWN
|
// WEST_DOWN
|
||||||
.add(0, VoxelHelper::rotateCY)
|
.add(0, VoxelHelper::rotateCY)
|
||||||
.add(1).add(10)
|
.add(10).add(1)
|
||||||
.add(3).add(12)
|
.add(12).add(3)
|
||||||
.add(5).add(16)
|
.add(16).add(5)
|
||||||
.add(8, VoxelHelper::rotateCY).add(7, VoxelHelper::rotateCY)
|
.add(7, VoxelHelper::rotateCY).add(8, VoxelHelper::rotateCY)
|
||||||
// DOWN_EAST
|
// DOWN_EAST
|
||||||
.add(36, VoxelHelper::rotateZ)
|
.add(36, VoxelHelper::rotateZ)
|
||||||
.add(2).add(11)
|
.add(11).add(2)
|
||||||
.add(4).add(13)
|
.add(13).add(4)
|
||||||
.add(41, VoxelHelper::rotateZ).add(42, VoxelHelper::rotateZ)
|
.add(41, VoxelHelper::rotateZ).add(42, VoxelHelper::rotateZ)
|
||||||
.add(6).add(17)
|
.add(17).add(6)
|
||||||
// EAST_UP
|
// EAST_UP
|
||||||
.add(45, VoxelHelper::rotateZ)
|
.add(45, VoxelHelper::rotateZ)
|
||||||
.add(29).add(20)
|
.add(20).add(29)
|
||||||
.add(31).add(22)
|
.add(22).add(31)
|
||||||
.add(35).add(24)
|
.add(24).add(35)
|
||||||
.add(52, VoxelHelper::rotateZ).add(53, VoxelHelper::rotateZ)
|
.add(52, VoxelHelper::rotateZ).add(53, VoxelHelper::rotateZ)
|
||||||
// UP_WEST
|
// UP_WEST
|
||||||
.add(54, VoxelHelper::rotateZ)
|
.add(54, VoxelHelper::rotateZ)
|
||||||
.add(28).add(19)
|
.add(19).add(28)
|
||||||
.add(30).add(21)
|
.add(21).add(30)
|
||||||
.add(59, VoxelHelper::rotateZ).add(60, VoxelHelper::rotateZ)
|
.add(59, VoxelHelper::rotateZ).add(60, VoxelHelper::rotateZ)
|
||||||
.add(34).add(23)
|
.add(23).add(34)
|
||||||
// WEST_NORTH
|
// WEST_NORTH
|
||||||
.add(0, VoxelHelper::rotateCZ)
|
.add(0, VoxelHelper::rotateCZ)
|
||||||
.add(1).add(28)
|
.add(1).add(28)
|
||||||
.add(3).add(30)
|
.add(3).add(30)
|
||||||
.add(7).add(32)
|
.add(7).add(32)
|
||||||
.add(43).add(68)
|
.add(44).add(69)
|
||||||
// NORTH_EAST
|
// NORTH_EAST
|
||||||
.add(72, VoxelHelper::rotateY)
|
.add(72, VoxelHelper::rotateY)
|
||||||
.add(2).add(29)
|
.add(2).add(29)
|
||||||
.add(4).add(31)
|
.add(4).add(31)
|
||||||
.add(50).add(61)
|
.add(51).add(62)
|
||||||
.add(8).add(33)
|
.add(8).add(33)
|
||||||
// EAST_SOUTH
|
// EAST_SOUTH
|
||||||
.add(81, VoxelHelper::rotateY)
|
.add(81, VoxelHelper::rotateY)
|
||||||
.add(11).add(20)
|
.add(11).add(20)
|
||||||
.add(13).add(22)
|
.add(13).add(22)
|
||||||
.add(15).add(26)
|
.add(15).add(26)
|
||||||
.add(51).add(62)
|
.add(50).add(61)
|
||||||
// SOUTH_WEST
|
// SOUTH_WEST
|
||||||
.add(90, VoxelHelper::rotateY)
|
.add(90, VoxelHelper::rotateY)
|
||||||
.add(10).add(19)
|
.add(10).add(19)
|
||||||
.add(12).add(21)
|
.add(12).add(21)
|
||||||
.add(44).add(69)
|
.add(43).add(68)
|
||||||
.add(14).add(25)
|
.add(14).add(25)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -15,27 +15,19 @@ import net.minecraft.data.client.MultipartBlockStateSupplier;
|
|||||||
import net.minecraft.data.server.recipe.RecipeExporter;
|
import net.minecraft.data.server.recipe.RecipeExporter;
|
||||||
import net.minecraft.data.server.recipe.RecipeProvider;
|
import net.minecraft.data.server.recipe.RecipeProvider;
|
||||||
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.recipe.book.RecipeCategory;
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
import static fr.adrien1106.reframed.util.VoxelHelper.VoxelListBuilder;
|
||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
|
import static fr.adrien1106.reframed.util.blocks.BlockProperties.EDGE;
|
||||||
import static fr.adrien1106.reframed.util.blocks.BlockProperties.STAIR_SHAPE;
|
|
||||||
import static fr.adrien1106.reframed.util.blocks.Edge.*;
|
import static fr.adrien1106.reframed.util.blocks.Edge.*;
|
||||||
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
import static net.minecraft.data.client.VariantSettings.Rotation.*;
|
||||||
import static net.minecraft.state.property.Properties.AXIS;
|
|
||||||
import static net.minecraft.state.property.Properties.FACING;
|
|
||||||
|
|
||||||
public class ReFramedStepBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
public class ReFramedStepBlock extends WaterloggableReFramedBlock implements BlockStateProvider {
|
||||||
|
|
||||||
@ -61,68 +53,9 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo
|
|||||||
super.appendProperties(builder.add(EDGE));
|
super.appendProperties(builder.add(EDGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canReplace(BlockState state, ItemPlacementContext context) {
|
|
||||||
Edge edge = state.get(EDGE);
|
|
||||||
return !(
|
|
||||||
context.getPlayer().isSneaking()
|
|
||||||
|| !(context.getStack().getItem() instanceof BlockItem block_item)
|
|
||||||
|| (
|
|
||||||
block_item.getBlock() != ReFramed.STAIR
|
|
||||||
&& !(
|
|
||||||
block_item.getBlock() == this
|
|
||||||
&& !(
|
|
||||||
(edge.isSide(context.getSide()) || edge.hasDirection(context.getSide()))
|
|
||||||
&& BlockHelper.cursorMatchesFace(
|
|
||||||
getOutlineShape(state, context.getWorld(), context.getBlockPos(), null),
|
|
||||||
BlockHelper.getRelativePos(context.getHitPos(), context.getBlockPos())
|
|
||||||
)
|
|
||||||
)
|
|
||||||
&& ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB)
|
|
||||||
.matchesAnyOutline(
|
|
||||||
context.getHitPos(),
|
|
||||||
context.getBlockPos(),
|
|
||||||
FACING,
|
|
||||||
edge.getFirstDirection(),
|
|
||||||
edge.getSecondDirection()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||||
BlockPos pos = ctx.getBlockPos();
|
|
||||||
BlockState current_state = ctx.getWorld().getBlockState(pos);
|
|
||||||
if (current_state.isOf(ReFramed.STAIR))
|
|
||||||
return ReFramed.STAIRS_CUBE.getDefaultState()
|
|
||||||
.with(EDGE, current_state.get(EDGE))
|
|
||||||
.with(STAIR_SHAPE, current_state.get(STAIR_SHAPE));
|
|
||||||
|
|
||||||
|
|
||||||
if (current_state.isOf(this)) {
|
|
||||||
Vec3d hit = ctx.getHitPos();
|
|
||||||
Edge edge = current_state.get(EDGE);
|
|
||||||
Direction dir = edge.getFirstDirection();
|
|
||||||
ReFramedStepsSlabBlock block = ((ReFramedStepsSlabBlock) ReFramed.STEPS_SLAB);
|
|
||||||
BlockState state = block.getDefaultState()
|
|
||||||
.with(FACING, dir)
|
|
||||||
.with(AXIS, edge.getOtherDirection(dir).getAxis());
|
|
||||||
if (!block.matchesShape(
|
|
||||||
hit, pos,
|
|
||||||
state,
|
|
||||||
edge.getOtherDirection(dir).getDirection() == Direction.AxisDirection.POSITIVE ? 1 : 2
|
|
||||||
)) {
|
|
||||||
dir = edge.getSecondDirection();
|
|
||||||
state = state
|
|
||||||
.with(FACING, dir)
|
|
||||||
.with(AXIS, edge.getOtherDirection(dir).getAxis());
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.getPlacementState(ctx).with(EDGE, BlockHelper.getPlacementEdge(ctx));
|
return super.getPlacementState(ctx).with(EDGE, BlockHelper.getPlacementEdge(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,19 +68,6 @@ public class ReFramedStepBlock extends WaterloggableReFramedBlock implements Blo
|
|||||||
return STEP_VOXELS[edge.getID()];
|
return STEP_VOXELS[edge.getID()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Integer, Integer> getThemeMap(BlockState state, BlockState new_state) {
|
|
||||||
if (new_state.isOf(ReFramed.STAIRS_CUBE)) return Map.of(1, 2);
|
|
||||||
if (new_state.isOf(ReFramed.STEPS_SLAB))
|
|
||||||
return Map.of(
|
|
||||||
1,
|
|
||||||
state.get(EDGE)
|
|
||||||
.getOtherDirection(new_state.get(FACING))
|
|
||||||
.getDirection() == Direction.AxisDirection.POSITIVE ? 2 : 1
|
|
||||||
);
|
|
||||||
return super.getThemeMap(state, new_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockStateSupplier getMultipart() {
|
public BlockStateSupplier getMultipart() {
|
||||||
Identifier model_id = ReFramed.id("step_special");
|
Identifier model_id = ReFramed.id("step_special");
|
||||||
|
@ -81,7 +81,7 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock imp
|
|||||||
switch (axis) {
|
switch (axis) {
|
||||||
case X -> i == 1 ? Direction.WEST : Direction.EAST;
|
case X -> i == 1 ? Direction.WEST : Direction.EAST;
|
||||||
case Y -> i == 1 ? Direction.DOWN : Direction.UP;
|
case Y -> i == 1 ? Direction.DOWN : Direction.UP;
|
||||||
case Z -> i == 1 ? Direction.NORTH : Direction.SOUTH;
|
case Z -> i == 1 ? Direction.SOUTH : Direction.NORTH;
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -99,14 +99,14 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock imp
|
|||||||
.with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Axis.X),
|
.with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Axis.X),
|
||||||
GBlockstate.variant(step_id, true, R0, R180))
|
GBlockstate.variant(step_id, true, R0, R180))
|
||||||
.with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Axis.Z),
|
.with(GBlockstate.when(FACING, Direction.DOWN, AXIS, Axis.Z),
|
||||||
GBlockstate.variant(step_id, true, R0, R270))
|
GBlockstate.variant(step_id, true, R0, R90))
|
||||||
.with(GBlockstate.when(FACING, Direction.UP, AXIS, Axis.X),
|
.with(GBlockstate.when(FACING, Direction.UP, AXIS, Axis.X),
|
||||||
GBlockstate.variant(step_id, true, R180, R180))
|
GBlockstate.variant(step_id, true, R180, R180))
|
||||||
.with(GBlockstate.when(FACING, Direction.UP, AXIS, Axis.Z),
|
.with(GBlockstate.when(FACING, Direction.UP, AXIS, Axis.Z),
|
||||||
GBlockstate.variant(step_id, true, R180, R270))
|
GBlockstate.variant(step_id, true, R180, R90))
|
||||||
|
|
||||||
.with(GBlockstate.when(FACING, Direction.EAST, AXIS, Axis.Z),
|
.with(GBlockstate.when(FACING, Direction.EAST, AXIS, Axis.Z),
|
||||||
GBlockstate.variant(step_side_id, true, R0, R0))
|
GBlockstate.variant(step_side_id, true, R180, R0))
|
||||||
.with(GBlockstate.when(FACING, Direction.EAST, AXIS, Axis.Y),
|
.with(GBlockstate.when(FACING, Direction.EAST, AXIS, Axis.Y),
|
||||||
GBlockstate.variant(step_side_id, true, R90, R0))
|
GBlockstate.variant(step_side_id, true, R90, R0))
|
||||||
.with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Axis.X),
|
.with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Axis.X),
|
||||||
@ -114,7 +114,7 @@ public class ReFramedStepsSlabBlock extends WaterloggableReFramedDoubleBlock imp
|
|||||||
.with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Axis.Y),
|
.with(GBlockstate.when(FACING, Direction.SOUTH, AXIS, Axis.Y),
|
||||||
GBlockstate.variant(step_side_id, true, R90, R90))
|
GBlockstate.variant(step_side_id, true, R90, R90))
|
||||||
.with(GBlockstate.when(FACING, Direction.WEST, AXIS, Axis.Z),
|
.with(GBlockstate.when(FACING, Direction.WEST, AXIS, Axis.Z),
|
||||||
GBlockstate.variant(step_side_id, true, R180, R180))
|
GBlockstate.variant(step_side_id, true, R0, R180))
|
||||||
.with(GBlockstate.when(FACING, Direction.WEST, AXIS, Axis.Y),
|
.with(GBlockstate.when(FACING, Direction.WEST, AXIS, Axis.Y),
|
||||||
GBlockstate.variant(step_side_id, true, R90, R180))
|
GBlockstate.variant(step_side_id, true, R90, R180))
|
||||||
.with(GBlockstate.when(FACING, Direction.NORTH, AXIS, Axis.X),
|
.with(GBlockstate.when(FACING, Direction.NORTH, AXIS, Axis.X),
|
||||||
|
@ -16,7 +16,6 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
public class WaterloggableReFramedDoubleBlock extends ReFramedDoubleBlock implements Waterloggable {
|
public class WaterloggableReFramedDoubleBlock extends ReFramedDoubleBlock implements Waterloggable {
|
||||||
public WaterloggableReFramedDoubleBlock(Settings settings) {
|
public WaterloggableReFramedDoubleBlock(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
setDefaultState(getDefaultState().with(Properties.WATERLOGGED, false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
package fr.adrien1106.reframed.mixin.logic;
|
|
||||||
|
|
||||||
import fr.adrien1106.reframed.block.ReFramedBlock;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.item.BlockItem;
|
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ActionResult;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
@Mixin(BlockItem.class)
|
|
||||||
public class BlockItemMixin {
|
|
||||||
|
|
||||||
@Unique private final ThreadLocal<BlockState> old_state = new ThreadLocal<>();
|
|
||||||
@Unique private final ThreadLocal<BlockEntity> old_entity = new ThreadLocal<>();
|
|
||||||
|
|
||||||
@Redirect(
|
|
||||||
method = "place(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/util/ActionResult;",
|
|
||||||
at = @At(
|
|
||||||
value = "INVOKE",
|
|
||||||
target = "Lnet/minecraft/block/Block;onPlaced(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;)V"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
private void placeMoreInfo(Block block, World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
|
|
||||||
if (!(block instanceof ReFramedBlock frame_block)) {
|
|
||||||
block.onPlaced(world, pos, state, placer, itemStack);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
frame_block.onPlaced(world, pos, state, placer, itemStack, old_state.get(), old_entity.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(
|
|
||||||
method = "place(Lnet/minecraft/item/ItemPlacementContext;)Lnet/minecraft/util/ActionResult;",
|
|
||||||
at = @At(
|
|
||||||
value = "INVOKE",
|
|
||||||
target = "Lnet/minecraft/item/BlockItem;place(Lnet/minecraft/item/ItemPlacementContext;Lnet/minecraft/block/BlockState;)Z",
|
|
||||||
shift = At.Shift.BEFORE
|
|
||||||
)
|
|
||||||
)
|
|
||||||
private void savePreviousInfo(ItemPlacementContext context, CallbackInfoReturnable<ActionResult> cir) {
|
|
||||||
World world = context.getWorld();
|
|
||||||
BlockPos pos = context.getBlockPos();
|
|
||||||
old_state.set(world.getBlockState(pos));
|
|
||||||
old_entity.set(world.getBlockEntity(pos));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -130,14 +130,14 @@ public class BlockHelper {
|
|||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNeighborPos(Edge edge, Direction direction, Boolean reverse, Direction reference, BlockView world, BlockPos pos) {
|
public static String getNeighborPos(Edge face, Direction direction, Boolean reverse, Direction reference, BlockView world, BlockPos pos) {
|
||||||
BlockState block_state = world.getBlockState(
|
BlockState block_state = world.getBlockState(
|
||||||
pos.offset(reverse ? direction.getOpposite() : direction)
|
pos.offset(reverse ? direction.getOpposite() : direction)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isStair(block_state) && block_state.get(EDGE).hasDirection(reference)) {
|
if (isStair(block_state) && block_state.get(EDGE).hasDirection(reference)) {
|
||||||
if (block_state.get(EDGE).hasDirection(edge.getLeftDirection())) return "left";
|
if (block_state.get(EDGE).hasDirection(face.getLeftDirection())) return "left";
|
||||||
else if (block_state.get(EDGE).hasDirection(edge.getRightDirection())) return "right";
|
else if (block_state.get(EDGE).hasDirection(face.getRightDirection())) return "right";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -37,18 +37,6 @@ public enum Corner implements StringIdentifiable {
|
|||||||
return asString();
|
return asString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Direction getFirstDirection() {
|
|
||||||
return first_direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Direction getSecondDirection() {
|
|
||||||
return second_direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Direction getThirdDirection() {
|
|
||||||
return third_direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasDirection(Direction direction) {
|
public boolean hasDirection(Direction direction) {
|
||||||
return this.first_direction.equals(direction)
|
return this.first_direction.equals(direction)
|
||||||
|| this.second_direction.equals(direction)
|
|| this.second_direction.equals(direction)
|
||||||
@ -106,17 +94,4 @@ public enum Corner implements StringIdentifiable {
|
|||||||
Direction other_2 = second_direction == direction || first_direction == direction ? third_direction : second_direction;
|
Direction other_2 = second_direction == direction || first_direction == direction ? third_direction : second_direction;
|
||||||
return getByDirections(direction, other_1.getOpposite(), other_2.getOpposite());
|
return getByDirections(direction, other_1.getOpposite(), other_2.getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Edge getEdge(Direction direction) {
|
|
||||||
return Edge.getByDirections(
|
|
||||||
first_direction == direction ? second_direction : first_direction,
|
|
||||||
second_direction == direction || first_direction == direction ? third_direction : second_direction
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Direction getOtherDirection(Edge edge) {
|
|
||||||
if (edge.getFirstDirection() != second_direction && edge.getSecondDirection() != second_direction) return second_direction;
|
|
||||||
if (edge.getFirstDirection() != third_direction && edge.getSecondDirection() != third_direction) return third_direction;
|
|
||||||
return first_direction;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,18 @@ public enum Edge implements StringIdentifiable {
|
|||||||
return second_direction;
|
return second_direction;
|
||||||
}
|
}
|
||||||
public Direction getRightDirection() {
|
public Direction getRightDirection() {
|
||||||
return Direction.from(axis, Direction.AxisDirection.NEGATIVE);
|
return switch (axis) {
|
||||||
|
case X -> Direction.WEST;
|
||||||
|
case Y -> Direction.DOWN;
|
||||||
|
case Z -> Direction.SOUTH;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
public Direction getLeftDirection() {
|
public Direction getLeftDirection() {
|
||||||
return Direction.from(axis, Direction.AxisDirection.POSITIVE);
|
return switch (axis) {
|
||||||
|
case X -> Direction.EAST;
|
||||||
|
case Y -> Direction.UP;
|
||||||
|
case Z -> Direction.NORTH;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasDirection(Direction direction) {
|
public boolean hasDirection(Direction direction) {
|
||||||
@ -60,32 +68,16 @@ public enum Edge implements StringIdentifiable {
|
|||||||
|| this.second_direction.equals(direction);
|
|| this.second_direction.equals(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Direction.Axis getAxis() {
|
|
||||||
return this.axis;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getID() {
|
public int getID() {
|
||||||
return this.ID;
|
return this.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Edge opposite() {
|
|
||||||
return getByDirections(first_direction.getOpposite(), second_direction.getOpposite());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Edge getByDirections(Direction direction_1, Direction direction_2) {
|
public static Edge getByDirections(Direction direction_1, Direction direction_2) {
|
||||||
return Arrays.stream(Edge.values())
|
return Arrays.stream(Edge.values())
|
||||||
.filter(value -> value.hasDirection(direction_1) && value.hasDirection(direction_2))
|
.filter(value -> value.hasDirection(direction_1) && value.hasDirection(direction_2))
|
||||||
.findFirst().orElse(Edge.NORTH_DOWN);
|
.findFirst().orElse(Edge.NORTH_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSide(Direction side) {
|
|
||||||
return getRightDirection() == side || getLeftDirection() == side;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Direction getOtherDirection(Direction direction) {
|
|
||||||
return first_direction == direction ? second_direction : first_direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Edge fromId(int id) {
|
public static Edge fromId(int id) {
|
||||||
return Arrays.stream(Edge.values())
|
return Arrays.stream(Edge.values())
|
||||||
.filter(value -> value.getID() == id)
|
.filter(value -> value.getID() == id)
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
"mixins": [
|
"mixins": [
|
||||||
"BlockItemMixin",
|
"BlockItemMixin",
|
||||||
"WallBlockAccessor",
|
"WallBlockAccessor",
|
||||||
"logic.BlockItemMixin",
|
|
||||||
"particles.MixinEntity",
|
"particles.MixinEntity",
|
||||||
"particles.MixinLivingEntity"
|
"particles.MixinLivingEntity"
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user