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

Triphion

Members
  • Content Count

    116
  • Joined

  • Last visited

Everything posted by Triphion

  1. Thank you so much! With all my researching I didn't come across LinkedHash anywhere. I feel like Java is harder to find solutions and documentations on. C# has complete docs with references, examples and very detailed explanations and scenarios. Sidenote: Do you know if there are any good docs where I can read up a bit more on Java in general?
  2. Alright, I've researched this since yesterday and I simply cannot figure this out. What do you mean by "mutate" it? What I was thinking was to create a copy of the old multimap, change a few values in there, and then replace the old one. But this doesn't work since i'm getting an unsupportedOperationException: null. Which is confusing since if I cannot remove and add values from the copy I made and replace the old ones, how am I supposed to change the values?
  3. Oh, okay! But i'm still having a hard time understanding how i'm gonna modify the values. I had an old way of doing this, but this doesn't work anymore due to it being an immutable list now. @Override public Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack) { final Multimap<Attribute, AttributeModifier> modifiers = super.getAttributeModifiers(slot, stack); if (slot == EquipmentSlotType.MAINHAND && getBurning(stack) == true) { replaceModifier(modifiers, Attributes.ATTACK_DAMAGE, BASE_ATTACK_DAMAGE_UUID, 1.
  4. Alright, thanks! I moved it into my general EventHandler and it seems to work fine now. As a sidenote, I seem to have a hard time understanding the new way of changing attributes. I had a way of changing attributes based on different modes on items. I have an event that fires every time a player presses a certain keybinding, and that works fine. But to add the attributes through the event after the maps got changed to immutable has been quite hard. @SubscribeEvent public static void updateItemAttributes(ItemAttributeModifierEvent event) { Utils.getLogger().info("ItemStackModifierEvent
  5. I was trying to add the ItemAttributeModifierEvent so that I could change values depending on different circumstances. But I ran into a weird error which i've never seen before and I can't really make out what it means. Any help would be appreciated. This is my event handler and main class for reference. public MainClass() { instance = this; final IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); modBus.addListener(this::commonSetup); modBus.addListener(this::clientSetup); modBus.addListener(this::onLoadComplete); EtauricBlocks.BLOCKS.register(mod
  6. Simple question, I started to update my 1.12 mod to 1.16.5 and a whole lot of functions and methods are renamed and reworked. One such function is the addPropertyOverride function. I looked through vanilla code for Bow and Elytra and the call function is not even there. What is the new way of doing propertyOverrides? this.addPropertyOverride(new ResourceLocation(Reference.MODID + ":stalking"), new IItemPropertyGetter() { @Override public float call(ItemStack p_call_1_, World p_call_2_, LivingEntity p_call_3_) { return stalking ? 1.0F : 0.0F; } }); This was h
  7. I've managed to add entities to the mod, but not with spawn eggs and natural spawns. To start off with, I don't know when to add the entity spawns. Secondly, I don't know if my current spawn code actually works since I haven't tried it, but if you see some problem with it, please point that out. And lastly, the spawn eggs. I know how to add a spawn egg, unfortunately, since i'm using deferred registries for the entities etc. the normal "Entitytype.MYENTITY" does not work, and neither does "Entitytype.MYENTITY.get()" nor "RegistryObject.of(Entitytype.MYENTITY.getId(), ForgeRegistries.ENTITIES)"
  8. Thank you! I changed it to a Supplier instead. I'm gonna have to learn how to use these systems so that I can use them more efficiently in the future. Case solved!
  9. Oh? Then how would I pass in a vanilla creature? Since the vanilla creatures are EntityTypes, I don't know how to do that.
  10. I'm sorry, I don't think I follow. If I were to store it like so: public BossItem.BossProperties setBoss(RegistryObject<? extends EntityType<? extends LivingEntity>> boss) { this.boss = boss; return this; } I have to remove this: private EntityType<? extends LivingEntity> boss; public BossItem.BossProperties setBoss(EntityType<? extends LivingEntity> boss) { this.boss = boss; return this; } And change this: private EntityType<? extends LivingEntity> boss; To this: private RegistryObject<? ext
  11. Oh. Well, how would i do that? The registry objects and the suppliers are really new to me so I haven't really figured out how to use them. public static final RegistryObject<Item> TERROR_FEEDER = ITEMS.register("terror_feeder", () -> new BossItem(new BossItem.BossProperties().setBoss(EtauricEntities.CHUPNUT).setTooltip("A food source for a special water beast..."))); RegistryObject<EntityType<EtauricEntities.CHUPNUT>> This is obviously wrong as i've experienced...
  12. Wow. Thanks for telling me, that would have been a great pain for me to figure out by my own. Still, the registry_object is not present remains. This is my current code: public static final RegistryObject<Item> TERROR_FEEDER = ITEMS.register("terror_feeder", () -> new BossItem(new BossItem.BossProperties().setBoss(EtauricEntities.CHUPNUT).setTooltip("A food source for a special water beast..."))); Item register. public class BossItem extends Item { private final String tooltip; private final EntityType<? extends LivingEntity> boss; public BossItem(BossItem.Boss
  13. On the setBoss method. And then it gives me 3 "quick fixes" that all involves I change either the chupnut to livingentity or that the method parameter be changed to chupnutentity.
  14. I'll rephrase; it doesn't give me errors if I specifically say that the <?> is a Chupnut.
  15. Why doesn't this work? public static final RegistryObject<Item> TERROR_FEEDER = ITEMS.register("terror_feeder", () -> new BossItem(new BossItem.BossProperties().setBoss(EtauricEntities.CHUPNUT).setTooltip("A food source for a special water beast..."))); It won't work unless i specifically say that the <?> entity is an entity chupnut... public BossItem.BossProperties setBoss(RegistryObject<EntityType<? extends LivingEntity>> boss) { this.boss = boss.get(); return this; } I assume that this is what you meant by that?
  16. I have registered my entities using Deferred registries and it has been working fine until I tried to create a boss-summoning item. I have tried to use vanilla entities instead of my own entities and they work. But apparently, my own entities are being registered AFTER I register my items and blocks, but this should not be the case since I register my entities BEFORE my items and blocks. The error message states: Which to me states that it cannot grab the entity since it hasn't been registered yet. instance = this; final IEventBus modBus = FMLJavaModLoadingContext.get
  17. I just fixed it. For some reason my entity constructor had "protected" instead of "public"... Thanks for the pointers!
  18. So... what is the problem then? My IDE needs upgrading or my version of the mod needs to be upgraded to a newer 1.15.2?
  19. These also don't disappear even if I were to extend another vanilla class. These.
  20. I recently started to use deferred registries instead of the old way of registering stuff such as items and blocks. And i've gotten all other stuff i've tried to work splendidly, all but entities. It just gives me error messages for every single solution I try; and it's driving me nuts. Help please. What is it that's so wrong with this code? public static final DeferredRegister<EntityType<?>> ENTITIES = new DeferredRegister<>(ForgeRegistries.ENTITIES, Reference.MODID); public static final RegistryObject<EntityType<ChupnutEntity>> CHUPNUT = EN
  21. Did this and it works! Thank you! Only issue i have now is that the Crafting Book is behaving oddly, the recipes themselves aren't showing up when i click on them and my custom recipe for sword is showing up as a 90 degrees rotated sword recipe. The Crafting Book issue regarding the recipes that aren't showing up inside the crafting window however has something to do with the container, don't know where this gets called since i have checked withing the vanilla Crafting Table and my code looks pretty identical.
  22. I want my special recipes to work ONLY on my new crafting table. I have everything set-up: Custom Crafting Table, Custom IRecipe implementation and a _factories.json. My Crafting Table is just like a normal Crafting Table so my custom IRecipe is essentially the same as a "shaped" recipe. This is what my custom IRecipe implementation looks like: Custom IRecipe implementation - https://gist.github.com/triphion/ac318db6a9a38789e219bbc71adea2b8 My guess is that i can somehow change this inside the matches function.
  23. After looking into it for a day, i found out that you can never have two of the same item in the same pool, even if the other one is enchanted. So i made some alternative pools to overcome this and now everything works.
  24. To be clear, i have added loot_tables before, and i have also added loot_tables in this mod i'm making right now. However, some loot_table jsons aren't working and i can't get my head around why they don't. So here is one of them that i think should work but doesn't. There aren't any problems with the registering of the loot_table either, i have tried with the same name with different loot inside and it works, but this loot does not.
×
×
  • Create New...

Important Information

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