Compare commits
No commits in common. "1ea3ac0c13b414b69a892fd0af3886b5e1422707" and "6beb4911acba4ed89fce3d225978ab9e133b3d92" have entirely different histories.
1ea3ac0c13
...
6beb4911ac
|
@ -1,19 +1,29 @@
|
||||||
package me.parsell.glowstonewire;
|
package me.parsell.glowstonewire;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import me.parsell.glowstonewire.core.glowBlocks;
|
import me.parsell.glowstonewire.core.glowBlocks;
|
||||||
import me.parsell.glowstonewire.core.glowItems;
|
import me.parsell.glowstonewire.core.glowItems;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.item.ItemGroup;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
|
|
||||||
public class GlowstoneWire implements ModInitializer {
|
public class GlowstoneWire implements ModInitializer {
|
||||||
public static final String MODID = "GlowstoneWire";
|
|
||||||
public static final ItemGroup GLOWSTONEWIRE_MOD = FabricItemGroupBuilder.create(new Identifier(MODID, "general")).build();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
|
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
||||||
|
// However, some things (like resources) may still be uninitialized.
|
||||||
|
// Proceed with mild caution.
|
||||||
|
|
||||||
|
System.out.println("Hello Fabric world!");
|
||||||
glowBlocks.init();
|
glowBlocks.init();
|
||||||
glowItems.init();
|
glowItems.init();
|
||||||
|
|
||||||
|
String[] states = {"none", "broke", "side", "up"};
|
||||||
|
//for(int i = 0; i < 4; i++)
|
||||||
|
// for (int j = 0; j < 4; j++)
|
||||||
|
// for (int k = 0; k < 4; k++)
|
||||||
|
// for (int l = 0; l < 4; l++)
|
||||||
|
// System.out.println("north: " + states[i] + " south: " + states[j] + " east: " + states[k] + " west: " + states[l]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ public class GlowstoneWireClient implements ClientModInitializer {
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient(){
|
public void onInitializeClient(){
|
||||||
BlockRenderLayerMap.INSTANCE.putBlock(glowBlocks.GLOWSTONEWIRE, RenderLayer.getCutout());
|
BlockRenderLayerMap.INSTANCE.putBlock(glowBlocks.GLOWSTONEWIRE, RenderLayer.getCutout());
|
||||||
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> {return 0xffbc5e;}, glowBlocks.GLOWSTONEWIRE);
|
ColorProviderRegistry.BLOCK.register((state, world, pos, tintIndex) -> {
|
||||||
|
return 0xFFFF00;
|
||||||
|
}, glowBlocks.GLOWSTONEWIRE);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -29,8 +29,4 @@ public enum GlowWireConnection implements StringIdentifiable{
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
return this != NONE && this != BROKE;
|
return this != NONE && this != BROKE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnectedUp(){
|
|
||||||
return this == UP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,20 +4,14 @@ import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.UnmodifiableIterator;
|
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.ShapeContext;
|
import net.minecraft.block.ShapeContext;
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
import net.minecraft.entity.EquipmentSlot;
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.state.property.EnumProperty;
|
import net.minecraft.state.property.EnumProperty;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
|
@ -46,20 +40,14 @@ public class GlowstoneWireBlock extends Block{
|
||||||
|
|
||||||
// Determines the hitbox for our block
|
// Determines the hitbox for our block
|
||||||
public static final VoxelShape DOT_VOXELSHAPE;
|
public static final VoxelShape DOT_VOXELSHAPE;
|
||||||
private static final Map<Direction, VoxelShape> DIRECTION_HITBOX, UP_HITBOX;
|
private static final Map<Direction, VoxelShape> field_24414;
|
||||||
private final Map<BlockState, VoxelShape> STATE_TO_VOXELSHAPE = Maps.newHashMap();
|
private static final Map<Direction, VoxelShape> field_24415;
|
||||||
|
|
||||||
|
|
||||||
public GlowstoneWireBlock(Settings settings) {
|
public GlowstoneWireBlock(Settings settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
// Set these properties to be none as start, so we start with a dot
|
// Set these properties to be none as start, so we start with a dot
|
||||||
this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(WIRE_CONNECTION_NORTH, GlowWireConnection.NONE)).with(WIRE_CONNECTION_EAST, GlowWireConnection.NONE)).with(WIRE_CONNECTION_SOUTH, GlowWireConnection.NONE)).with(WIRE_CONNECTION_WEST, GlowWireConnection.NONE)));
|
this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(WIRE_CONNECTION_NORTH, GlowWireConnection.NONE)).with(WIRE_CONNECTION_EAST, GlowWireConnection.NONE)).with(WIRE_CONNECTION_SOUTH, GlowWireConnection.NONE)).with(WIRE_CONNECTION_WEST, GlowWireConnection.NONE)));
|
||||||
|
|
||||||
UnmodifiableIterator stateItr = this.getStateManager().getStates().iterator();
|
|
||||||
while(stateItr.hasNext()) {
|
|
||||||
BlockState state = (BlockState)stateItr.next();
|
|
||||||
this.STATE_TO_VOXELSHAPE.put(state, determineVoxelShape(state));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure out block has the properties for us to manage
|
// Make sure out block has the properties for us to manage
|
||||||
|
@ -68,6 +56,20 @@ public class GlowstoneWireBlock extends Block{
|
||||||
builder.add(WIRE_CONNECTION_NORTH, WIRE_CONNECTION_EAST, WIRE_CONNECTION_SOUTH, WIRE_CONNECTION_WEST);
|
builder.add(WIRE_CONNECTION_NORTH, WIRE_CONNECTION_EAST, WIRE_CONNECTION_SOUTH, WIRE_CONNECTION_WEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isFullyConnected(BlockState state) {
|
||||||
|
return ((GlowWireConnection)state.get(WIRE_CONNECTION_NORTH)).isConnected() &&
|
||||||
|
((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() &&
|
||||||
|
((GlowWireConnection)state.get(WIRE_CONNECTION_EAST)).isConnected() &&
|
||||||
|
((GlowWireConnection)state.get(WIRE_CONNECTION_WEST)).isConnected();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isNotConnected(BlockState state) {
|
||||||
|
return !((GlowWireConnection)state.get(WIRE_CONNECTION_NORTH)).isConnected() &&
|
||||||
|
!((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() &&
|
||||||
|
!((GlowWireConnection)state.get(WIRE_CONNECTION_EAST)).isConnected() &&
|
||||||
|
!((GlowWireConnection)state.get(WIRE_CONNECTION_WEST)).isConnected();
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean hasConnection(BlockState state) {
|
private static boolean hasConnection(BlockState state) {
|
||||||
return ((GlowWireConnection)state.get(WIRE_CONNECTION_NORTH)).isConnected() ||
|
return ((GlowWireConnection)state.get(WIRE_CONNECTION_NORTH)).isConnected() ||
|
||||||
((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() ||
|
((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() ||
|
||||||
|
@ -79,49 +81,37 @@ public class GlowstoneWireBlock extends Block{
|
||||||
Iterator<Direction> dirItr = Direction.Type.HORIZONTAL.iterator();
|
Iterator<Direction> dirItr = Direction.Type.HORIZONTAL.iterator();
|
||||||
while(dirItr.hasNext()){
|
while(dirItr.hasNext()){
|
||||||
Direction dir = dirItr.next();
|
Direction dir = dirItr.next();
|
||||||
|
if(world.getBlockState(pos.offset(dir)).isOf(this) && !state.get(DIRECTION_TO_WIRE_CONNECTION.get(dir)).isBroken())
|
||||||
state = state.with(DIRECTION_TO_WIRE_CONNECTION.get(dir), determineConnection(world, pos, dir));
|
state = state.with(DIRECTION_TO_WIRE_CONNECTION.get(dir), determineConnection(world, pos, dir));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
private GlowWireConnection determineConnection(WorldAccess world, BlockPos pos, Direction direction){
|
private GlowWireConnection determineConnection(WorldAccess world, BlockPos pos, Direction direction){
|
||||||
if((world.getBlockState(pos.offset(direction).up()).isOf(this) && world.isAir(pos.up()))) // If offset+up is me && if up is air
|
if(world.getBlockState(pos.offset(direction).up()).isOf(this))
|
||||||
if(!world.getBlockState(pos.offset(direction).up()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+up is not broken
|
if(!world.getBlockState(pos.offset(direction).up()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken())
|
||||||
if(world.getBlockState(pos.offset(direction)).hasSidedTransparency())
|
|
||||||
return GlowWireConnection.SIDE;
|
|
||||||
else
|
|
||||||
return GlowWireConnection.UP;
|
return GlowWireConnection.UP;
|
||||||
if(world.getBlockState(pos.offset(direction).down()).isOf(this) && world.isAir(pos.offset(direction))) // if offset+down is me && if offset is air
|
if(world.getBlockState(pos.offset(direction).down()).isOf(this))
|
||||||
if(!world.getBlockState(pos.offset(direction).down()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+down is not broken
|
if(!world.getBlockState(pos.offset(direction).down()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken())
|
||||||
return GlowWireConnection.SIDE;
|
return GlowWireConnection.SIDE;
|
||||||
if(world.getBlockState(pos.offset(direction)).isOf(this)) // if offset is me
|
if(world.getBlockState(pos.offset(direction)).isOf(this))
|
||||||
if(!world.getBlockState(pos.offset(direction)).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) // if offset is not broken
|
if(!world.getBlockState(pos.offset(direction)).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) {
|
||||||
return GlowWireConnection.SIDE;
|
return GlowWireConnection.SIDE;
|
||||||
|
}
|
||||||
return GlowWireConnection.NONE;
|
return GlowWireConnection.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||||
return STATE_TO_VOXELSHAPE.get(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
public VoxelShape determineVoxelShape(BlockState state){
|
|
||||||
VoxelShape voxelShape = DOT_VOXELSHAPE;
|
VoxelShape voxelShape = DOT_VOXELSHAPE;
|
||||||
|
Iterator var3 = Direction.Type.HORIZONTAL.iterator();
|
||||||
|
|
||||||
Iterator dirItr1 = Direction.Type.HORIZONTAL.iterator();
|
while(var3.hasNext()) {
|
||||||
while(dirItr1.hasNext()) {
|
Direction direction = (Direction)var3.next();
|
||||||
Direction direction = (Direction)dirItr1.next();
|
|
||||||
GlowWireConnection wireConnection = state.get(DIRECTION_TO_WIRE_CONNECTION.get(direction));
|
GlowWireConnection wireConnection = state.get(DIRECTION_TO_WIRE_CONNECTION.get(direction));
|
||||||
if(state.equals(this.getDefaultState().with(DIRECTION_TO_WIRE_CONNECTION.get(direction), GlowWireConnection.SIDE))) {
|
if (wireConnection == GlowWireConnection.SIDE) {
|
||||||
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)DIRECTION_HITBOX.get(direction));
|
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)field_24414.get(direction));
|
||||||
return VoxelShapes.union(voxelShape, DIRECTION_HITBOX.get(direction.getOpposite()));
|
|
||||||
} else if (state.equals(this.getDefaultState().with(DIRECTION_TO_WIRE_CONNECTION.get(direction), GlowWireConnection.UP))) {
|
|
||||||
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)UP_HITBOX.get(direction));
|
|
||||||
return VoxelShapes.union(voxelShape, DIRECTION_HITBOX.get(direction.getOpposite()));
|
|
||||||
} else if (wireConnection == GlowWireConnection.SIDE) {
|
|
||||||
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)DIRECTION_HITBOX.get(direction));
|
|
||||||
} else if (wireConnection == GlowWireConnection.UP) {
|
} else if (wireConnection == GlowWireConnection.UP) {
|
||||||
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)UP_HITBOX.get(direction));
|
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)field_24415.get(direction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,8 +154,7 @@ public class GlowstoneWireBlock extends Block{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place block check disconnect (if block block connection)
|
@Override
|
||||||
@Override // For each link, set to break and update the blocks around me (above and below)
|
|
||||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
|
||||||
if(player.abilities.allowModifyWorld)
|
if(player.abilities.allowModifyWorld)
|
||||||
if(hasConnection(state) && !player.hasStackEquipped(EquipmentSlot.MAINHAND)) {
|
if(hasConnection(state) && !player.hasStackEquipped(EquipmentSlot.MAINHAND)) {
|
||||||
|
@ -176,48 +165,29 @@ public class GlowstoneWireBlock extends Block{
|
||||||
state = state.with(DIRECTION_TO_WIRE_CONNECTION.get(dir), GlowWireConnection.BROKE);
|
state = state.with(DIRECTION_TO_WIRE_CONNECTION.get(dir), GlowWireConnection.BROKE);
|
||||||
}
|
}
|
||||||
world.setBlockState(pos, state);
|
world.setBlockState(pos, state);
|
||||||
// These call neighborUpdate not getStateForNeighborUpdate!!
|
world.updateNeighborsAlways(pos, this);
|
||||||
//world.updateNeighborsAlways(pos, this); // Update those around me
|
|
||||||
world.updateNeighbors(pos.down(), this); // Update those below me
|
|
||||||
world.updateNeighbors(pos.up(), this); // Update those above me
|
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // Get the state I should place in, and update those around me (above/below) as needed
|
@Override
|
||||||
|
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||||
|
if (direction != Direction.DOWN && direction != Direction.UP && !state.get(DIRECTION_TO_WIRE_CONNECTION.get(direction)).isBroken())
|
||||||
|
state = state.with(DIRECTION_TO_WIRE_CONNECTION.get(direction), determineConnection(world, pos, direction));
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BlockState getPlacementState(ItemPlacementContext ctx){
|
public BlockState getPlacementState(ItemPlacementContext ctx){
|
||||||
return determineState(ctx.getWorld(), this.getDefaultState(), ctx.getBlockPos());
|
return determineState(ctx.getWorld(), this.getDefaultState(), ctx.getBlockPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) {
|
|
||||||
world.updateNeighbors(pos.offset(Direction.UP), state.getBlock());
|
|
||||||
world.updateNeighbors(pos.offset(Direction.DOWN), state.getBlock());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // This causes w/e issue that tracks deal with.
|
|
||||||
public void onBroken(WorldAccess world, BlockPos pos, BlockState state) {
|
|
||||||
world.updateNeighbors(pos.offset(Direction.UP), state.getBlock());
|
|
||||||
world.updateNeighbors(pos.offset(Direction.DOWN), state.getBlock());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // Called when I get told to update, so I should see what/why I need to update. I also use this to determine if I need to be drop or not.
|
|
||||||
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
|
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
|
||||||
if (!world.isClient) {
|
if (!world.isClient && !state.canPlaceAt(world, pos)) {
|
||||||
if(!state.canPlaceAt(world, pos)) {
|
|
||||||
dropStacks(state, world, pos);
|
dropStacks(state, world, pos);
|
||||||
world.removeBlock(pos, false);
|
world.removeBlock(pos, false);
|
||||||
this.onBroken(world, pos, state);
|
|
||||||
} else {
|
|
||||||
Iterator<Direction> dirItr = Direction.Type.HORIZONTAL.iterator();
|
|
||||||
while(dirItr.hasNext()){
|
|
||||||
Direction dir = dirItr.next();
|
|
||||||
if(!state.get(DIRECTION_TO_WIRE_CONNECTION.get(dir)).isBroken())
|
|
||||||
state = state.with(DIRECTION_TO_WIRE_CONNECTION.get(dir), determineConnection(world, pos, dir));
|
|
||||||
}
|
|
||||||
world.setBlockState(pos, state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,27 +197,11 @@ public class GlowstoneWireBlock extends Block{
|
||||||
WIRE_CONNECTION_SOUTH = EnumProperty.of("south", GlowWireConnection.class);
|
WIRE_CONNECTION_SOUTH = EnumProperty.of("south", GlowWireConnection.class);
|
||||||
WIRE_CONNECTION_WEST = EnumProperty.of("west", GlowWireConnection.class);
|
WIRE_CONNECTION_WEST = EnumProperty.of("west", GlowWireConnection.class);
|
||||||
|
|
||||||
DIRECTION_TO_WIRE_CONNECTION = Maps.newEnumMap((Map)ImmutableMap.of(
|
DIRECTION_TO_WIRE_CONNECTION = Maps.newEnumMap((Map)ImmutableMap.of(Direction.NORTH, WIRE_CONNECTION_NORTH, Direction.EAST, WIRE_CONNECTION_EAST, Direction.SOUTH, WIRE_CONNECTION_SOUTH, Direction.WEST, WIRE_CONNECTION_WEST));
|
||||||
Direction.NORTH, WIRE_CONNECTION_NORTH,
|
|
||||||
Direction.EAST, WIRE_CONNECTION_EAST,
|
|
||||||
Direction.SOUTH, WIRE_CONNECTION_SOUTH,
|
|
||||||
Direction.WEST, WIRE_CONNECTION_WEST)
|
|
||||||
);
|
|
||||||
|
|
||||||
DOT_VOXELSHAPE = Block.createCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D);
|
DOT_VOXELSHAPE = Block.createCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D);
|
||||||
|
field_24414 = Maps.newEnumMap((Map)ImmutableMap.of(Direction.NORTH, Block.createCuboidShape(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D), Direction.SOUTH, Block.createCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D), Direction.EAST, Block.createCuboidShape(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D), Direction.WEST, Block.createCuboidShape(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D)));
|
||||||
|
field_24415 = Maps.newEnumMap((Map)ImmutableMap.of(Direction.NORTH, VoxelShapes.union((VoxelShape)field_24414.get(Direction.NORTH), Block.createCuboidShape(3.0D, 0.0D, 0.0D, 13.0D, 16.0D, 1.0D)), Direction.SOUTH, VoxelShapes.union((VoxelShape)field_24414.get(Direction.SOUTH), Block.createCuboidShape(3.0D, 0.0D, 15.0D, 13.0D, 16.0D, 16.0D)), Direction.EAST, VoxelShapes.union((VoxelShape)field_24414.get(Direction.EAST), Block.createCuboidShape(15.0D, 0.0D, 3.0D, 16.0D, 16.0D, 13.0D)), Direction.WEST, VoxelShapes.union((VoxelShape)field_24414.get(Direction.WEST), Block.createCuboidShape(0.0D, 0.0D, 3.0D, 1.0D, 16.0D, 13.0D))));
|
||||||
|
|
||||||
DIRECTION_HITBOX = Maps.newEnumMap((Map)ImmutableMap.of(
|
|
||||||
Direction.NORTH, Block.createCuboidShape(3.0D, 0.0D, 0.0D, 13.0D, 1.0D, 13.0D),
|
|
||||||
Direction.SOUTH, Block.createCuboidShape(3.0D, 0.0D, 3.0D, 13.0D, 1.0D, 16.0D),
|
|
||||||
Direction.EAST, Block.createCuboidShape(3.0D, 0.0D, 3.0D, 16.0D, 1.0D, 13.0D),
|
|
||||||
Direction.WEST, Block.createCuboidShape(0.0D, 0.0D, 3.0D, 13.0D, 1.0D, 13.0D))
|
|
||||||
);
|
|
||||||
|
|
||||||
UP_HITBOX = Maps.newEnumMap((Map)ImmutableMap.of(
|
|
||||||
Direction.NORTH, VoxelShapes.union((VoxelShape)DIRECTION_HITBOX.get(Direction.NORTH), Block.createCuboidShape(3.0D, 0.0D, 0.0D, 13.0D, 16.0D, 1.0D)),
|
|
||||||
Direction.SOUTH, VoxelShapes.union((VoxelShape)DIRECTION_HITBOX.get(Direction.SOUTH), Block.createCuboidShape(3.0D, 0.0D, 15.0D, 13.0D, 16.0D, 16.0D)),
|
|
||||||
Direction.EAST, VoxelShapes.union((VoxelShape)DIRECTION_HITBOX.get(Direction.EAST), Block.createCuboidShape(15.0D, 0.0D, 3.0D, 16.0D, 16.0D, 13.0D)),
|
|
||||||
Direction.WEST, VoxelShapes.union((VoxelShape)DIRECTION_HITBOX.get(Direction.WEST), Block.createCuboidShape(0.0D, 0.0D, 3.0D, 1.0D, 16.0D, 13.0D)))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package me.parsell.glowstonewire.core;
|
package me.parsell.glowstonewire.core;
|
||||||
|
|
||||||
import me.parsell.glowstonewire.GlowstoneWire;
|
|
||||||
import me.parsell.glowstonewire.common.GlowstoneWireBlock;
|
import me.parsell.glowstonewire.common.GlowstoneWireBlock;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
@ -12,6 +11,7 @@ public class glowBlocks {
|
||||||
public static final Block GLOWSTONEWIRE = new GlowstoneWireBlock(FabricBlockSettings.of(Material.SUPPORTED).breakInstantly().noCollision().luminance(8));
|
public static final Block GLOWSTONEWIRE = new GlowstoneWireBlock(FabricBlockSettings.of(Material.SUPPORTED).breakInstantly().noCollision().luminance(8));
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
Registry.register(Registry.BLOCK, new Identifier(GlowstoneWire.MODID, "glowstone_wire"), GLOWSTONEWIRE);
|
Registry.register(Registry.BLOCK, new Identifier("glowstonewire", "glowstone_wire"), GLOWSTONEWIRE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
package me.parsell.glowstonewire.core;
|
package me.parsell.glowstonewire.core;
|
||||||
|
|
||||||
import me.parsell.glowstonewire.GlowstoneWire;
|
|
||||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
public class glowItems {
|
public class glowItems {
|
||||||
public static final Item Glowstone = new BlockItem(glowBlocks.GLOWSTONEWIRE, new FabricItemSettings().group(GlowstoneWire.GLOWSTONEWIRE_MOD));
|
|
||||||
|
|
||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
Registry.register(Registry.ITEM, new Identifier(GlowstoneWire.MODID, "glowstone"), Glowstone);
|
Registry.register(Registry.ITEM, new Identifier("glowstonewire", "glowstone_wire"), new BlockItem(glowBlocks.GLOWSTONEWIRE, new FabricItemSettings().group(ItemGroup.MISC)));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
"when": {
|
"when": {
|
||||||
"OR": [
|
"OR": [
|
||||||
{
|
{
|
||||||
"south": "none|broke",
|
"south": "none",
|
||||||
"north": "none|broke",
|
"north": "none",
|
||||||
"west": "none|broke",
|
"west": "none",
|
||||||
"east": "none|broke"
|
"east": "none"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"north": "side|up",
|
"north": "side|up",
|
||||||
|
@ -39,9 +39,9 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"south": "side|up",
|
"south": "side|up",
|
||||||
"north": "none|broke",
|
"north": "none",
|
||||||
"west": "none|broke",
|
"west": "none",
|
||||||
"east": "none|broke"
|
"east": "none"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -56,16 +56,10 @@
|
||||||
"south": "side|up"
|
"south": "side|up"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"south": "none|broke",
|
"south": "none",
|
||||||
"north": "side|up",
|
"north": "side|up",
|
||||||
"west": "none|broke",
|
"west": "none",
|
||||||
"east": "none|broke"
|
"east": "none"
|
||||||
},
|
|
||||||
{
|
|
||||||
"south": "broke",
|
|
||||||
"north": "side|up",
|
|
||||||
"west": "broke",
|
|
||||||
"east": "broke"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -80,16 +74,10 @@
|
||||||
"east": "side|up"
|
"east": "side|up"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"south": "none|broke",
|
"south": "none",
|
||||||
"north": "none|broke",
|
"north": "none",
|
||||||
"west": "side|up",
|
"west": "side|up",
|
||||||
"east": "none|broke"
|
"east": "none"
|
||||||
},
|
|
||||||
{
|
|
||||||
"south": "broke",
|
|
||||||
"north": "broke",
|
|
||||||
"west": "side|up",
|
|
||||||
"east": "broke"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -105,15 +93,9 @@
|
||||||
"west": "side|up"
|
"west": "side|up"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"south": "none|broke",
|
"south": "none",
|
||||||
"north": "none|broke",
|
"north": "none",
|
||||||
"west": "none|broke",
|
"west": "none",
|
||||||
"east": "side|up"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"south": "broke",
|
|
||||||
"north": "broke",
|
|
||||||
"west": "broke",
|
|
||||||
"east": "side|up"
|
"east": "side|up"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue