Hello, Newbie here. I having an issue trying to make a fenceBlock and for some reason the North, South, East and West properties don't set correctly when i'm placing the item, therefore, the correct variant is not being used.
Here is a pick to illustrate what's happening. the 2 in the foreground should connect to each other like the one in the background, but NSEW are all false on the ones in the foreground.
Here is a link to the files, and keep in mind, I'm fairly new to Java and Minecraft modding , it's the MediumYellowConduitDown
https://github.com/oneilljp-keyin/TrekFiles/blob/0ae07709966d916227f7b152b28db24e7037ad7b/src/main/java/tech/johnoneill/trekfiles/init/BlockInit.java
package tech.johnoneill.trekfiles.init;
import java.util.function.Function;
import com.google.common.base.Supplier;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FenceBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import tech.johnoneill.trekfiles.TrekFiles;
import tech.johnoneill.trekfiles.block.*;
public class BlockInit {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS,
TrekFiles.MOD_ID);
public static final DeferredRegister<Item> ITEMS = ItemInit.ITEMS;
public static final RegistryObject<Block> LARGE_YELLOW_CONDUIT_UP = register("large_yellow_conduit_up",
() -> new LargeYellowConduitUp(BlockBehaviour.Properties.of(Material.HEAVY_METAL).sound(SoundType.METAL)),
object -> () -> new BlockItem(object.get(), new Item.Properties().tab(TrekFiles.TREKFILES_TAB)));
public static final RegistryObject<Block> LARGE_YELLOW_CONDUIT_DOWN = register("large_yellow_conduit_down",
() -> new LargeYellowConduitDown(BlockBehaviour.Properties.of(Material.HEAVY_METAL).sound(SoundType.METAL)),
object -> () -> new BlockItem(object.get(), new Item.Properties().tab(TrekFiles.TREKFILES_TAB)));
public static final RegistryObject<FenceBlock> MEDIUM_YELLOW_CONDUIT_UP = register("medium_yellow_conduit_up",
() -> new FenceBlock(BlockBehaviour.Properties.of(Material.HEAVY_METAL).sound(SoundType.METAL)),
object -> () -> new BlockItem(object.get(), new Item.Properties().tab(TrekFiles.TREKFILES_TAB)));
public static final RegistryObject<Block> MEDIUM_YELLOW_CONDUIT_DOWN = register("medium_yellow_conduit_down",
() -> new MediumYellowConduitDown(BlockBehaviour.Properties.of(Material.METAL).sound(SoundType.METAL)),
object -> () -> new BlockItem(object.get(), new Item.Properties().tab(TrekFiles.TREKFILES_TAB)));
public static final RegistryObject<Block> LARGE_BLUE_CONDUIT_UP = register("large_blue_conduit_up",
() -> new LargeBlueConduitUp(BlockBehaviour.Properties.copy(Blocks.BONE_BLOCK).sound(SoundType.METAL)),
object -> () -> new BlockItem(object.get(), new Item.Properties().tab(TrekFiles.TREKFILES_TAB)));
public static final RegistryObject<Block> LARGE_BLUE_CONDUIT_DOWN = register("large_blue_conduit_down",
() -> new LargeBlueConduitDown(BlockBehaviour.Properties.copy(Blocks.BONE_BLOCK).sound(SoundType.METAL)),
object -> () -> new BlockItem(object.get(), new Item.Properties().tab(TrekFiles.TREKFILES_TAB)));
public static final RegistryObject<Block> LARGE_RED_CONDUIT_UP = register("large_red_conduit_up",
() -> new LargeRedConduitUp(BlockBehaviour.Properties.copy(Blocks.BONE_BLOCK).sound(SoundType.METAL)),
object -> () -> new BlockItem(object.get(), new Item.Properties().tab(TrekFiles.TREKFILES_TAB)));
public static final RegistryObject<Block> LARGE_RED_CONDUIT_DOWN = register("large_red_conduit_down",
() -> new LargeRedConduitDown(BlockBehaviour.Properties.copy(Blocks.BONE_BLOCK).sound(SoundType.METAL)),
object -> () -> new BlockItem(object.get(), new Item.Properties().tab(TrekFiles.TREKFILES_TAB)));
private static <T extends Block> RegistryObject<T> registerBlock(final String name,
final Supplier<? extends T> block) {
return BLOCKS.register(name, block);
}
private static <T extends Block> RegistryObject<T> register(final String name, final Supplier<? extends T> block,
Function<RegistryObject<T>, Supplier<? extends Item>> item) {
RegistryObject<T> obj = registerBlock(name, block);
ITEMS.register(name, item.apply(obj));
return obj;
}
}
https://github.com/oneilljp-keyin/TrekFiles/blob/0ae07709966d916227f7b152b28db24e7037ad7b/src/main/java/tech/johnoneill/trekfiles/block/MediumYellowConduitDown.java
package tech.johnoneill.trekfiles.block;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.FenceBlock;
import net.minecraft.world.level.block.PipeBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class MediumYellowConduitDown extends FenceBlock {
private static final VoxelShape SHAPE = makeShape();
public MediumYellowConduitDown(Properties properties) {
super(properties);
}
@Override
public @NotNull VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter level, @NotNull BlockPos pos, @NotNull CollisionContext ctx) {
return SHAPE;
}
public static VoxelShape makeShape() {
VoxelShape shape = Shapes.empty();
shape = Shapes.join(shape, Shapes.box(0.1875, 0, 0.1875, 0.8125, 1, 0.8125), BooleanOp.OR);
shape = Shapes.join(shape, Shapes.box(0.25, 0, 0.125, 0.75, 1, 0.875), BooleanOp.OR);
shape = Shapes.join(shape, Shapes.box(0.125, 0, 0.25, 0.875, 1, 0.75), BooleanOp.OR);
return shape;
}
}
Any help would be really appreciated, my google searches have not been helpful.