Jump to content

Daedalus4096

Members
  • Posts

    7
  • Joined

  • Last visited

Recent Profile Visitors

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

Daedalus4096's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I had this problem and was able to resolve it by fully updating my gradle files from the most recent MDK. Hope that helps you too!
  2. Thank you for the advice, both of you. I'll make the necessary fixes!
  3. I'm trying out using global loot modifiers to modify the loot tables of some vanilla entities for my mod. At first I thought I had it working fine: my custom item dropped for entities in the specified tag and didn't drop for entities outside of it. Great. The next day, though, while doing some testing in survival mode, I broke an oak log... and my custom item dropped for that too. And then again for stone, granite, and coal ore. Not great. Can anyone tell me what I'm doing wrong? Why my loot modifier, with conditions that seem to imply that it should only drop for certain entity types, is also triggering for every block under the sun? I haven't found anything that derives from ILootCondition with a name that suggests it differentiates between blocks and entities, so I'm feeling stuck. Here's the code for the loot modifier object: package com.verdantartifice.primalmagic.common.loot.modifiers; import java.util.ArrayList; import java.util.List; import com.google.gson.JsonObject; import com.verdantartifice.primalmagic.common.items.ItemsPM; import com.verdantartifice.primalmagic.common.util.ItemUtils; import net.minecraft.item.ItemStack; import net.minecraft.loot.ConstantRange; import net.minecraft.loot.ItemLootEntry; import net.minecraft.loot.LootContext; import net.minecraft.loot.LootPool; import net.minecraft.loot.LootTable; import net.minecraft.loot.RandomValueRange; import net.minecraft.loot.conditions.ILootCondition; import net.minecraft.loot.functions.LootingEnchantBonus; import net.minecraft.loot.functions.SetCount; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.common.loot.LootModifier; /** * Global loot modifier that allows mobs in the conditioned tag to drop Bloody Flesh when killed. * * @author Daedalus4096 */ public class BloodyFleshModifier extends LootModifier { public BloodyFleshModifier(ILootCondition[] conditionsIn) { super(conditionsIn); } @SuppressWarnings("deprecation") @Override protected List<ItemStack> doApply(List<ItemStack> generatedLoot, LootContext context) { LootTable table = LootTable.builder().addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(ItemLootEntry.builder(ItemsPM.BLOODY_FLESH.get()).acceptFunction(SetCount.builder(RandomValueRange.of(0.0F, 1.0F))).acceptFunction(LootingEnchantBonus.builder(RandomValueRange.of(0.0F, 1.0F))))).build(); List<ItemStack> lootList = new ArrayList<>(); table.generate(context, lootList::add); // Use deprecated version to avoid calling modifyLoot and prevent infinite recursion return ItemUtils.mergeItemStackLists(generatedLoot, lootList); } public static class Serializer extends GlobalLootModifierSerializer<BloodyFleshModifier> { @Override public BloodyFleshModifier read(ResourceLocation location, JsonObject object, ILootCondition[] ailootcondition) { return new BloodyFleshModifier(ailootcondition); } @Override public JsonObject write(BloodyFleshModifier instance) { return this.makeConditions(instance.conditions); } } } And here's the JSON file for the modifier: { "conditions": [ { "condition": "minecraft:entity_properties", "predicate": { "type": "#primalmagic:drops_bloody_flesh" }, "entity": "this" } ], "type": "primalmagic:bloody_flesh" } The GitHub repository can be found here if you need to look at anything else. Thank you for your time.
  4. I think I've found the cause of the problem. A recently updated Java installation installed just the JRE instead of the JDK, and was causing gradle to be unable to find tools.jar. Installing the updated version of the JDK seems to have fixed the problem. Thank you, and I apologize for wasting your time.
  5. I just today tried to rebuild my project on a laptop that I haven't used in a couple of years. After downloading HEAD, along with the up-to-date MDK, and trying to run gradlew eclipse, the gradle process failed citing "Could not resolve: net.minecraftforge:forge:1.16.5-36.1.0_mapped_snapshot_20210309-1.16.5_at_bafb3e1b42c31582fafe93878f76a7fc577e66fb" and an exception with a stacktrace longer than my terminal buffer. I've tried deleting the source folder and re-cloning, as well as deleting my entire %APPDATA%\.gradle folder, but to no avail. Google searching hasn't yielded much, at least for current versions of Forge. Does anyone have any suggestions as to what I could be missing? Thank you.
  6. After doing some digging in the Minecraft initialization code, I found the solution to my problem: I was registering my particle factory in response to the wrong event. Rather than doing it during client setup, it turns out there's an event specifically for when you're supposed to register your particle factories: the aptly-named ParticleFactoryRegisterEvent. After moving my factory registration code there, everything seems to load just fine. Thanks anyway!
  7. I'm trying to implement a custom particle type for my new 1.14 mod, but during the loading screen I get a crash citing "Redundant texture list for particle". The full log file can be found here: https://pastebin.com/vuP4QESv From what I can tell, the problem appears to be a race condition in the ParticleManager initialization process. I believe so because if I park a breakpoint at the start of ParticleManager#loadTextureLists and wait for even a second or two, then the game loads successfully and my particles appear properly in game. I'm registering the particle type in response to the appropriate registry event, and registering the particle factory in response to the FMLClientSetupEvent, which I think is as it should be. The code for my mod can be found here, specifically the point where I register the particle factory: https://github.com/daedalus4096/PrimalMagic/blob/0e56bff9bcc0bc4ff691d8d5cf23322a017f108f/src/main/java/com/verdantartifice/primalmagic/proxy/ClientProxy.java#L38 Any advice you can offer on how to deal with this race condition would be greatly appreciated. Thanks in advance!
×
×
  • Create New...

Important Information

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