Jump to content

realicraft

Members
  • Posts

    3
  • Joined

  • Last visited

Converted

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

realicraft's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Hi, I'm trying to make a custom boat, however, I'm stuck on how to proceed. I know that the boat's custom class should extend .entity.vehicle.Boat, however, it seems that there's an Enum in that class that would be difficult to add another element to; overriding the enum doesn't seem to work, either, as several parts of it specifically require the Boat class. Here's the code of the related files: entity/custom/ModBoatEntity.java: package com.realicraft.charlogs.block.entity.custom; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.level.Level; public class ModBoatEntity extends Boat { public ModBoatEntity(EntityType<? extends Boat> p_38290_, Level p_38291_) { super(p_38290_, p_38291_); } } item/ModItems.java: package com.realicraft.charlogs.item; import com.realicraft.charlogs.block.ModBlocks; import com.realicraft.charlogs.charLogs; import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.item.BoatItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.SignItem; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class ModItems { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, charLogs.MODID); public static final RegistryObject<Item> CHAR_SIGN = ITEMS.register("char_sign", () -> new SignItem(new Item.Properties().tab(ModCreativeModeTab.CHARLOGS_TAB).stacksTo(16), ModBlocks.CHAR_SIGN.get(), ModBlocks.CHAR_WALL_SIGN.get())); public static final RegistryObject<Item> CHAR_BOAT = ITEMS.register("char_boat", () -> new BoatItem(false, Boat.Type.OAK, (new Item.Properties()).stacksTo(1).tab(ModCreativeModeTab.CHARLOGS_TAB))); public static void register(IEventBus eventBus) { ITEMS.register(eventBus); } }
  2. This seems to have fixed the x-ray issue. Thanks!
  3. Hi, I'm having trouble with making blocks that don't take up the full area of a block. I've tried copying code from carpet blocks, but that doesn't seem to be working. Here's an image showing the problem: On the left is a block that's meant to be a coconut. On the right is a block that's meant to be a cutting board. As the game mistakenly believes that they are full blocks, it does not render the grass blocks below them, resulting in an unintended x-ray effect. Here's the code of the related files: block/custom/CoconutBlock.java: package com.realicraft.rckitchen.block.custom; import net.minecraft.world.level.block.Block; public class CoconutBlock extends Block { public CoconutBlock(Properties properties) { super(properties); } } block/custom/CuttingBoardBlock.java: package com.realicraft.rckitchen.block.custom; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; public class CuttingBoardBlock extends Block { protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D); public CuttingBoardBlock(BlockBehaviour.Properties properties) { super(properties); } public VoxelShape getShape(BlockState p_152917_, BlockGetter p_152918_, BlockPos p_152919_, CollisionContext p_152920_) { return SHAPE; } } (Some of this code has been copied from the java file for carpet blocks.) block/ModBlocks.java: package com.realicraft.rckitchen.block; import com.realicraft.rckitchen.block.custom.CoconutBlock; import com.realicraft.rckitchen.block.custom.CuttingBoardBlock; import com.realicraft.rckitchen.item.ModCreativeModeTab; import com.realicraft.rckitchen.item.ModItems; import com.realicraft.rckitchen.rcKitchen; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.Material; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; import java.util.function.Supplier; public class ModBlocks { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, rcKitchen.MODID); public static final RegistryObject<Block> COCONUT_BLOCK = registerBlock("coconut_block", () -> new CoconutBlock(BlockBehaviour.Properties.of(Material.WEB)), ModCreativeModeTab.KITCHEN_TAB); public static final RegistryObject<Block> CUTTING_BOARD = registerBlock("cutting_board", () -> new CuttingBoardBlock(BlockBehaviour.Properties.of(Material.WOOD)), ModCreativeModeTab.KITCHEN_TAB); private static <T extends Block>RegistryObject<T> registerBlock(String name, Supplier<T> block, CreativeModeTab tab) { RegistryObject<T> toReturn = BLOCKS.register(name, block); registerBlockItem(name, toReturn, tab); return toReturn; }; private static <T extends Block>RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab) { return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties().tab(tab))); }; public static void register(IEventBus eventBus) { BLOCKS.register(eventBus); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.