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

Slit_bodmod

Members
  • Posts

    61
  • Joined

  • Last visited

Recent Profile Visitors

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

Slit_bodmod's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. oh sry maybe I forgot to commit that fix, but you're not also getting the attribute exeption earlier?
  2. hmm, I'm still getting a crash that looks like this: I can't figure out why the getAttributes would return null as it just returns the attributes field which is final and should always be set upon construction.
  3. Yeah that makes sense, I know it sounds dumb but I fully didn't realise that there were 2
  4. Ah thankyou, yeah sometimes when it's not clear on the stacktrace where the problem started because of nullptrs or lambdas or something I find it quite difficult to work out where to look. Is this what caused the crash and can I simply fix it by adding something like: modEventBus.addListener(EntityAISetupManager::addEntityAttributes); to my LotbMod constructor
  5. That's what I'm trying to figure out, I can't work out where the error starts
  6. Hi, I was in the middle of porting my mod to 1.17.1 and when adding the attributes to the entities my game would freeze and produce this crash report: I found it very difficult to actually begin working out where the source of the problem is and was wondering if anyone could help me track it down, the github for the latest sourcecode is currently https://github.com/slit-bodmod/LordOfTheBlocks if you want to have a look, or if you could just point me in the right direction, idk
  7. Yeah my system is built on top of deferred register. It's kinda a bit of an experiment to see how much milage I can get out of getting the registry system to do most of my mods heavy lifting.
  8. oh yeah that makes so much sense now. I feel like that's the kinda thing that's so simple I would have never have figured it out lol. Hmm so now I have to find a way to access the properties of an object that hasn't been constructed yet, in the supplier I'm handing to that object. That or back to the drawing board.
  9. Actually I thought I could be nice and tidy up the BlockItemRegister class a bit: public class BlockItemRegister<B extends Block> implements Supplier<B> { public final Supplier<B> block; public final Supplier<Item> item; public BlockItemRegister(Supplier<B> _block, Supplier<Item> _item) { block = _block; item = _item; } public B get() { return block.get(); } //------------------ GEN FUNCS ------------------ public static <B extends Block> BlockItemRegister<B> gen(String id, Supplier<B> _block) { return gen(id, _block, ModItems.withTab(ItemGroup.TAB_BUILDING_BLOCKS)); } public static <B extends Block> BlockItemRegister<B> gen(String id, Supplier<B> _block, Item.Properties prop) { return gen(id, _block, () -> new BlockItem(_block.get(), prop) ); } public static <B extends Block> BlockItemRegister<B> gen(String id, Supplier<B> _block, Supplier<Item> _item) { return new BlockItemRegister<>( ModBlocks.registerBlock(id, _block ), ModItems.register(id, _item) ); } } And the plot thickens. this organisation of the BlockItemRegister breaks the working code I had, somehow, in the same way where the blockItemRegister itself holds the item but doesn't tie it to the block for block.asitem()
  10. So I've been working on an experimental mod recently, trying to structure the registry side of my mod in a different way (hence 2 forum questions in basically as many days). So I have this class here that is supposed to ease with the registering of blocks and block items that looks like this: public class BlockItemRegister<B extends Block> implements Supplier<B> { public final Supplier<B> block; public final Supplier<Item> item; public BlockItemRegister(Supplier<B> _block, Supplier<Item> _item) { block = _block; item = _item; } public BlockItemRegister(String id, Supplier<B> _block, Item.Properties prop) { this(_block, ModItems.register(id, () -> new BlockItem(_block.get(), prop)) ); } public BlockItemRegister(String id, Supplier<B> _block) { this(id, _block, new Item.Properties().tab(ItemGroup.TAB_BUILDING_BLOCKS)); } public B get() { return block.get(); } //--------- method created to scare away some generic weirdness public static <B extends Block> BlockItemRegister<B> gen(String id, Supplier<B> _block) { return new BlockItemRegister<>( id, ModBlocks.registerBlock(id, _block ) ); } public static <B extends Block> BlockItemRegister<B> gen(String id, Supplier<B> _block, Item.Properties prop) { return new BlockItemRegister<>( id, ModBlocks.registerBlock(id, _block ), prop ); } public static <B extends Block> BlockItemRegister<B> gen(String id, Supplier<B> _block, Supplier<Item> _item) { return new BlockItemRegister<>( ModBlocks.registerBlock(id, _block ), _item ); } } This references this function in the ModBlocks class: public static <B extends Block> RegistryObject<B> registerBlock(String name, Supplier<B> block) { return BLOCKS.register(name , block); } and this one in ModItems: public static <I extends Item> RegistryObject<I> register(String name, Supplier<I> item) { return ITEMS.register(name , item); } which is fairly straightforward. I can then register a block item like this and it works fine: BlockItemRegister<RotatedPillarBlock> log = BlockItemRegister.gen( id, () -> new RotatedPillarBlock(ModBlockProperties.LOG), ModItems.withTab(ItemGroup.TAB_BUILDING_BLOCKS)); however if I do this: Supplier<DoorBlock> door_block = () -> new DoorBlock(ModBlockProperties.PLANKS); BlockItemRegister<DoorBlock> doorBlock = BlockItemRegister.gen( id, door_block, ModItems.register( id, () -> new TallBlockItem(door_block.get(), ModItems.withTab(ItemGroup.TAB_REDSTONE) ))); the block item register holds the door item however when I call .asItem() on the block it returns air which is causing me crashes. I'm struggling to understand why this might be as theoretically these are basically calling the same functions just with and without default functions
  11. No sry I don't have a git repo as this is a bit of an experiment mod, I can try creating a one if it's really necessary but for the moment this is the class that handles the loot tables: public class GaiaBlockLootTables extends BlockLootTables { public static final List<Consumer<GaiaBlockLootTables>> TABLES = new ArrayList<>(); @Override protected void addTables() { TABLES.forEach( (gen) -> gen.accept(this) ); } @Override protected @Nonnull Iterable<Block> getKnownBlocks() { return ModBlocks.BLOCKS.getEntries().stream().map(RegistryObject::get).collect(Collectors.toList()); } //=========================================== METHODS ======================================================================= public void add(Block _block, LootTable.Builder _builder) { super.add(_block,_builder); } public void accept(BiConsumer<ResourceLocation, LootTable.Builder> p_accept_1_) { super.accept(p_accept_1_); } public void dropSlab(Block block) { this.add(block, createSlabItemTable(block)); } } this is then registered through this class: public class GaiaLootTableGenerator extends LootTableProvider { public GaiaLootTableGenerator(DataGenerator dataGeneratorIn) { super(dataGeneratorIn); } @Override protected @Nonnull List<Pair<Supplier<Consumer<BiConsumer<ResourceLocation, LootTable.Builder>>>, LootParameterSet>> getTables() { return ImmutableList.of( Pair.of(GaiaBlockLootTables::new, LootParameterSets.BLOCK) ); } } which is registered through this class: @Mod.EventBusSubscriber(modid = GaiaTerrainMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD) public class GaiaDataManager { @SubscribeEvent public static void gatherData(final GatherDataEvent event) { GaiaTerrainMod.LOGGER.info("gathering data!"); DataGenerator generate = event.getGenerator(); ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); generate.addProvider(new GaiaBlockStateGenerator(generate,existingFileHelper)); generate.addProvider(new GaiaItemModelGenerator(generate, existingFileHelper)); GaiaBlockTagGenerator blockTags = new GaiaBlockTagGenerator(generate, existingFileHelper); generate.addProvider(blockTags); generate.addProvider(new GaiaItemTagGenerator(generate, blockTags, existingFileHelper)); generate.addProvider(new GaiaLootTableGenerator(generate)); generate.addProvider(new GaiaRecipeGenerator(generate)); GaiaTerrainMod.LOGGER.info("gathered data!"); } } and then there are these snippets throughout my code base that do something like this: GaiaBlockLootTables.TABLES.add( (instance) -> instance.dropSelf(button.get()) ); this allow my loot tables to be generated somewhat automatically from a number of different places (my registry system is kinda unconventional)
  12. Right yeah I wanted to but obviously I can't show you the whole thing, where should I show first that might be causing the issue as tbh my main problem is I don't know where to start looking, do you know what would cause this error
  13. So I've been messing around with data generators and I've gotten pretty far but then just before everything seemed like it was working I got this crash So I looked at the logs and it seemed to indicate that the problem was with vanilla loot tables? I kinda reached the end of my train here and was just looking for any pointers as to where to start fixing this kinda issue cause it seems a little odd to me
  14. oh the crash seems to be caused by the fact I'm missing a texture, is that not allowed
×
×
  • Create New...

Important Information

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