Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Modder Support

This is the support section for those modding with Forge. Help with modding goes in here, however, please keep in mind that this is not a Java school. You are expected to have basic knowledge of Java before posting here.


Subforums

  1. ForgeGradle

    Help and support for the new ForgeGradle system of building mods.

    4.9k
    posts

41271 topics in this forum

    • 3 replies
    • 64.4k views
    • 0 replies
    • 0 views
    • 8 replies
    • 159 views
    • 6 replies
    • 220 views
    • 7 replies
    • 679 views
    • 1 reply
    • 37 views
    • 5 replies
    • 112 views
    • 1 reply
    • 82 views
    • 12 replies
    • 214 views
    • 23 replies
    • 432 views
    • 4 replies
    • 148 views
    • 0 replies
    • 59 views
    • 7 replies
    • 125 views
    • 4 replies
    • 97 views
    • 3 replies
    • 251 views
    • 5 replies
    • 198 views
    • 3 replies
    • 131 views
    • 3 replies
    • 101 views
    • 1 reply
    • 48 views
    • 1 reply
    • 103 views
    • 1 reply
    • 88 views
    • 7 replies
    • 117 views
    • 2 replies
    • 75 views
    • 8 replies
    • 230 views
    • 2 replies
    • 89 views


  • Posts

    • I decided to make a minecraft mod and I made a block with a custom model that is one block wide and two blocks tall. After adding in what I needed to, IntelliJ had no errors so I thought that everything would work. However, when I loaded into my game everything worked fine, except that my custom block didn't exist at all. My custom tab was blank, it wasn't in any of the vanilla tabs (or my other custom tab), and it said that the block was invalid and didn't exist when I tried to use the /give command to give me the block manually. IntelliJ still gave no errors. How do I fix this? Here is my Registry Handler class. package com.gt546.gfasm.util; import com.gt546.gfasm.GFASM; import com.gt546.gfasm.blocks.OakChair; import net.minecraft.block.Block; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class RegistryHandler { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, GFASM.MOD_ID); public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, GFASM.MOD_ID); public static void init() { ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); } //Furniture Blocks public static final RegistryObject<Block> OAK_CHAIR = BLOCKS.register("oak_chair", OakChair::new); //Furniture Block Items public static final RegistryObject<Item> OAK_CHAIR_ITEM = ITEMS.register("oak_chair", () -> new BlockItem(OAK_CHAIR.get(), new Item.Properties().group(GFASM.FTAB))); //Statue Blocks //Statue Block Items } And here is my main block class. package com.gt546.gfasm.blocks; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraftforge.common.ToolType; import javax.annotation.Nullable; public class OakChair extends Block { private static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; public OakChair() { super(AbstractBlock.Properties.create(Material.WOOD) .hardnessAndResistance(3.5f, 4.0f) .sound(SoundType.WOOD) .harvestLevel(0) .harvestTool(ToolType.AXE) .setRequiresTool()); } @Nullable @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite()); } @Override public BlockState rotate(BlockState state, Rotation rot) { return state.with(FACING, rot.rotate(state.get(FACING))); } @Override public BlockState mirror(BlockState state, Mirror mirrorIn) { return state.rotate(mirrorIn.toRotation(state.get(FACING))); } @Override protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(FACING); } }  
    • Diesieben07, how to close the topic lmao?
    • ANYWAYS! I finaly found the way to install java. Well. I guess we can close this topic now.
    • Thank you for that. I it also got me to re-examine a bit of 'my code' again, and I was able to cleanly insert it properly this time and actually UNDERSTAND what was doing what. Unsure if I should list the updated code I got from it, but in short effect I got the BLOCK & ITEM override sitting next to my  actual ones, and it being called as intended. -- genuinely wish there was a better way to inject behavior into a block that was able to interact with tick void w/o having to recreate/override the block.   while I did what I could to minimize any conflicts possible... I feel this can cause unexpected behavior if another mod recreates the same block(s) -my case, sand, red_sand, gravel ... for the gravity behavior.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.