Repository navigation
Releases: TamKungZ/droprateapi
Release list
1.0.1-patch1
Update build.gradle
1.0.1+patch1
1.0.1
Changelog - DropRateAPI Mod
Version 1.0.1 - [DATE]
🔄 New Features & Improvements
-
Added Config Reloading Command
1. Implemented/droprate_reloadcommand to reloaddroprate.config.jsonwithout restarting the game.
2. Now developers can test drop changes in real-time! -
Added Drop Removal API
- New method
DropRateAPI.removeDrop(EntityType<?>, Item)allows developers to remove specific drops from mobs. - This feature is useful for modifying existing drop tables dynamically.
- Ensures greater flexibility in drop management without overriding entire loot tables.
- Example:
- New method
```DropRateAPI.removeDrop(EntityType.ZOMBIE, Items.ROTTEN_FLESH);```
- Improved Debugging & Error Handling
- Added error messages when invalid item IDs are detected in
droprate.config.json. - Now, if an incorrect item ID is provided, a warning is logged to help troubleshoot issues.
- Example log message:
- Added error messages when invalid item IDs are detected in
[DropRate] WARNING: Item "minecraft:golden_potato" does not exist!
🛠️ Bug Fixes & Code Refactor
- Fixed Package Name Issues
- Updated all references from
th.tamkungz.droprate.api.DropRateAPItoth.tamkungz.droprateapi.api.DropRateAPIfor consistency.
- Updated all references from
📌 Previous Changes
- Refactored DropRateAPI to store multiple drop entries per entity.
- Added JSON-based configuration for defining custom mob drops.
- Improved cross-mod compatibility.
🚀 Keep customizing your mob drops with DropRate!
1.0.0
change class from th.tamkungz.droprate.api.DropRateAPI to th.tamkungz.droprateapi.api.DropRateAPI
import th.tamkungz.droprateapi.api.DropRateAPI
Registering Custom Drops
// old import th.tamkungz.droprate.api.DropRateAPI;
import th.tamkungz.droprateapi.api.DropRateAPI;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Items;
import java.util.Arrays;
// Example: 50% chance for zombies to drop 1-3 diamonds/gold ingots
EntityType<?> zombie = ForgeRegistries.ENTITIES.getValue(new ResourceLocation("minecraft:zombie"));
DropRateAPI.registerDrop(zombie, 50, Arrays.asList(Items.DIAMOND, Items.GOLD_INGOT), 1, 3);
.ftl
package ${package}
<#-- Import necessary classes -->
import th.tamkungz.droprateapi.api.DropRateAPI;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraft.util.ResourceLocation;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
<#-- Define entity type using MCreator variables -->
EntityType<?> mob = ForgeRegistries.ENTITIES.getValue(new ResourceLocation("${entity}"));
<#-- Define drop settings -->
public static final int max = ${max_amount};
public static final int min = ${min_amount};
public static final int rate = ${drop_rate};
<#-- Define item drop list -->
List item = new ArrayList<>();
item.add(${drop_item});
<#-- Register the drop -->
DropRateAPI.registerDrop(mob, rate, item, min, max);