• Recently Browsing

    No registered users viewing this page.

  • Posts

    • ohhh, allright now I understatnd   thats Registry: package me.gleep.oreexpansion.util; import me.gleep.oreexpansion.OreExpansion; import me.gleep.oreexpansion.armors.STAMaterial; import me.gleep.oreexpansion.armors.ArmorBase; import me.gleep.oreexpansion.blocks.*; import me.gleep.oreexpansion.blocks.tileentities.SilverBlockTileEntity; import me.gleep.oreexpansion.items.ItemBase; import me.gleep.oreexpansion.tools.STSMaterial; import me.gleep.oreexpansion.tools.STSBase; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.*; import net.minecraft.tileentity.TileEntityType; import net.minecraft.world.gen.blockstateprovider.BlockStateProviderType; import net.minecraftforge.client.model.generators.BlockStateProvider; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class RegistryHandler { //Vanilla private static final DeferredRegister<Block> VANILLA_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "minecraft"); //Mod private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, OreExpansion.MOD_ID); private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, OreExpansion.MOD_ID); //private static final DeferredRegister<Fluid> FLUDIS = DeferredRegister.create(ForgeRegistries.FLUIDS, OreExpansion.MOD_ID); private static final DeferredRegister<TileEntityType<?>> TILE_ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.TILE_ENTITIES, OreExpansion.MOD_ID); //private static final DeferredRegister<IRecipeSerializer<?>> RECIPES = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, OreExpansion.MOD_ID); public static void init() { ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); //FLUDIS.register(FMLJavaModLoadingContext.get().getModEventBus()); TILE_ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); VANILLA_BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); } //Items public static final RegistryObject<Item> SILVER_INGOT = ITEMS.register("silver_ingot", ItemBase::new); public static final RegistryObject<Item> LEAD_INGOT = ITEMS.register("lead_ingot", ItemBase::new); public static final RegistryObject<Item> SILVER_NUGGET = ITEMS.register("silver_nugget", ItemBase::new); public static final RegistryObject<Item> LEAD_NUGGET = ITEMS.register("lead_nugget", ItemBase::new); public static final RegistryObject<Item> NETHERITE_NUGGET = ITEMS.register("netherite_nugget", () -> new ItemBase(true)); //public static final RegistryObject<Item> LEAD_BUCKET = ITEMS.register("lead_bucket", LeadBucket::new); //Blocks public static final RegistryObject<Block> SILVER_BLOCK = BLOCKS.register("silver_block", SilverBlock::new); public static final RegistryObject<Block> LEAD_BLOCK = BLOCKS.register("lead_block", LeadBlock::new); public static final RegistryObject<Block> SILVER_ORE = BLOCKS.register("silver_ore", SilverOre::new); public static final RegistryObject<Block> LEAD_ORE = BLOCKS.register("lead_ore", LeadOre::new); public static final RegistryObject<Block> CAULDRON = VANILLA_BLOCKS.register("cauldron", Cauldron::new); //Block Item public static final RegistryObject<Item> SILVER_BLOCK_ITEM = ITEMS.register("silver_block", () -> new BlockItemBase(SILVER_BLOCK.get())); public static final RegistryObject<Item> LEAD_BLOCK_ITEM = ITEMS.register("lead_block", () -> new BlockItemBase(LEAD_BLOCK.get())); public static final RegistryObject<Item> SILVER_ORE_ITEM = ITEMS.register("silver_ore", () -> new BlockItemBase(SILVER_ORE.get())); public static final RegistryObject<Item> LEAD_ORE_ITEM = ITEMS.register("lead_ore", () -> new BlockItemBase(LEAD_ORE.get())); //Fluids //public static final RegistryObject<FlowingFluidBlock> LEAD_FLUID = FLUDIS.register("lead_fluid", (); //Tile Entities public static final RegistryObject<TileEntityType<SilverBlockTileEntity>> SILVER_BLOCK_TE = TILE_ENTITY_TYPES.register("silver_block", () -> TileEntityType.Builder.create( SilverBlockTileEntity::new, SILVER_BLOCK.get()).build(null)); //Tools public static final RegistryObject<SwordItem> SILVER_TINTED_GOLDEN_SWORD = ITEMS.register("silver_tinted_golden_sword", () -> new STSBase(STSMaterial.STGS, 3, -2.4F)); public static final RegistryObject<SwordItem> SILVER_TINTED_DIAMOND_SWORD = ITEMS.register("silver_tinted_diamond_sword", () -> new STSBase(STSMaterial.STDS, 3, -2.4F)); public static final RegistryObject<SwordItem> SILVER_TINTED_NETHERITE_SWORD = ITEMS.register("silver_tinted_netherite_sword", () -> new STSBase(STSMaterial.STNS, 3, -2.4F, true)); //Armors public static final RegistryObject<ArmorItem> SILVER_TITNTED_GOLDEN_HELMET = ITEMS.register("silver_tinted_golden_helmet", () -> new ArmorBase(STAMaterial.STGA, EquipmentSlotType.HEAD)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_GOLDEN_CHESTPLATE = ITEMS.register("silver_tinted_golden_chestplate", () -> new ArmorBase(STAMaterial.STGA, EquipmentSlotType.CHEST)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_GOLDEN_LEGGINGS = ITEMS.register("silver_tinted_golden_leggings", () -> new ArmorBase(STAMaterial.STGA, EquipmentSlotType.LEGS)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_GOLDEN_BOOTS = ITEMS.register("silver_tinted_golden_boots", () -> new ArmorBase(STAMaterial.STGA, EquipmentSlotType.FEET)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_DIAMOND_HELMET = ITEMS.register("silver_tinted_diamond_helmet", () -> new ArmorBase(STAMaterial.STDA, EquipmentSlotType.HEAD)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_DIAMOND_CHESTPLATE = ITEMS.register("silver_tinted_diamond_chestplate", () -> new ArmorBase(STAMaterial.STDA, EquipmentSlotType.CHEST)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_DIAMOND_LEGGINGS = ITEMS.register("silver_tinted_diamond_leggings", () -> new ArmorBase(STAMaterial.STDA, EquipmentSlotType.LEGS)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_DIAMOND_BOOTS = ITEMS.register("silver_tinted_diamond_boots", () -> new ArmorBase(STAMaterial.STDA, EquipmentSlotType.FEET)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_NETHERITE_HELMET = ITEMS.register("silver_tinted_netherite_helmet", () -> new ArmorBase(STAMaterial.STNA, EquipmentSlotType.HEAD, true)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_NETHERITE_CHESTPLATE = ITEMS.register("silver_tinted_netherite_chestplate", () -> new ArmorBase(STAMaterial.STNA, EquipmentSlotType.CHEST, true)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_NETHERITE_LEGGINGS = ITEMS.register("silver_tinted_netherite_leggings", () -> new ArmorBase(STAMaterial.STNA, EquipmentSlotType.LEGS, true)); public static final RegistryObject<ArmorItem> SILVER_TITNTED_NETHERITE_BOOTS = ITEMS.register("silver_tinted_netherite_boots", () -> new ArmorBase(STAMaterial.STNA, EquipmentSlotType.FEET, true)); } like I haven't made change since I'm editing the cauldron and the main:   package me.gleep.oreexpansion; import me.gleep.oreexpansion.util.RegistryHandler; import me.gleep.oreexpansion.world.gen.CustomOreGen; import net.minecraft.block.Blocks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod("oreexpansion") public class OreExpansion { private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "oreexpansion"; public OreExpansion() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); RegistryHandler.init(); } private void setup(final FMLCommonSetupEvent event) { CustomOreGen.registerOres(); MinecraftForge.EVENT_BUS.register(this); LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } }
    • Can you share your Registry code and your Mod main class?   I'm talking about this snippet: @Nullable @Override public BlockState getStateForPlacement(BlockItemUseContext context) { return this.getDefaultState().with(CONTENT, 0).getBlockState(); } this function return the state for placement based on the context of the placement, it's useful so you can orient a directional block for example, but in this case it always return the same block state independent of the state, so it's redundant this clearly isn't the problem that's causing the crash tho   The crash log doesn't say anything about the State Container crashing, it says the error ocurred when registering, did you alter something in the registration before it started crashing?  
    • Okay so, I tried this in the constructor (the second line is what I tried first): this.setDefaultState(this.getDefaultState().with(LEVEL, Integer.valueOf(0)).with(CONTENT, Integer.valueOf(0))); this.setDefaultState(this.stateContainer.getBaseState().with(CONTENT, Integer.valueOf(0)).with(LEVEL, Integer.valueOf(0))); And I still got the same error: I tried it without that 2 methods with one of them and still don't working. I don't know if I mention that but I'm registring it as vanilla block. It was working before I start to deal with block states. And also Im creating new cauldron.json in texturepacks but thats not the main problem I think because it runs without textures.   I know I just forgot to remove it before posting.   It is not always 0 it stores the material in the cauldron
    • They are located inside TickEvent. https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
    • So I have a class attached to the chunks through capabilities, and I want to update the values in world tick. I have an event subscriber for the TickEvent.WorldTickEvent event, but I don't know how to get the loaded chunks. I would also need access to multiple chunks at once, as the value for a chunks next state would depend on it's neighbours
  • Topics

  • Who's Online (See full list)