Skip to content

Commit

Permalink
add temporary loot table manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-kirby committed Sep 25, 2020
1 parent bcc7710 commit ce68fd9
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ dependencies {
compile fg.deobf('curse.maven:jaff-1.7:2448283')
compile fg.deobf('slimeknights:TConstruct:1.12.2-2.13.0.184')
compile 'curse.maven:realisticitemdrops_deobf_1.2.14:2630385'
compile fg.deobf('curse.maven:primalcore_1.12.2-0.6.105:2734701')

// TODO: remove
compile fg.deobf('curse.maven:twilightforest-3.8.689:2618264')
}

mixin {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version_base = 1.5
version_base = 1.6

# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
28 changes: 28 additions & 0 deletions src/main/java/tv/darkosto/sevpatches/SevPatches.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootEntry;
import net.minecraft.world.storage.loot.LootEntryItem;
import net.minecraft.world.storage.loot.LootPool;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraft.world.storage.loot.RandomValueRange;
import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraft.world.storage.loot.functions.LootFunction;
import net.minecraft.world.storage.loot.functions.SetCount;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
Expand All @@ -17,6 +27,7 @@
import org.apache.logging.log4j.Logger;
import realdrops.entities.EntityItemLoot;
import slimeknights.tconstruct.tools.ranged.RangedEvents;
import twilightforest.item.TFItems;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -71,6 +82,23 @@ public void onServerTick(TickEvent.ServerTickEvent event) {
}
}

// Temporary loot adder
// TODO: remove
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event) {
ResourceLocation tableName = event.getName();
if (tableName.getNamespace().equals("twilightforest") && tableName.getPath().split("/")[0].equals("structures") && !tableName.getPath().matches(".*(common|uncommon|useless|rare|ultrarare)$")) {
LootTable table = event.getTable();
LootEntry liveRoot = new LootEntryItem(TFItems.liveroot, 1, 1, new LootFunction[]{new SetCount(new LootCondition[]{}, new RandomValueRange(1, 5))}, new LootCondition[]{}, "twilightforest:liveroot");

LootPool pool = new LootPool(new LootEntry[]{liveRoot}, new LootCondition[]{}, new RandomValueRange(1), new RandomValueRange(0), "liveroot");
table.addPool(pool);

Logger logger = LogManager.getLogger();
logger.debug("Adding liveroot pool to {}", tableName);
}
}

@Mod.EventHandler
public void onServerStopping(FMLServerStoppingEvent event) {
itemList.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "sevpatches",
"name": "SevPatches",
"description": "Consolidated patches for mods that are EOL used in SevTech: Ages",
"version": "1.4",
"version": "1.6",
"mcversion": "1.12.2",
"url": "https://www.curseforge.com/minecraft/mc-mods/sevpatches",
"updateUrl": "",
Expand Down

0 comments on commit ce68fd9

Please sign in to comment.