Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit bd89e33

Browse files
committed
Dispatch from the god classes for the events added in this PR
1 parent a7071e4 commit bd89e33

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

patchwork-events-lifecycle/src/main/java/net/minecraftforge/fml/server/ServerLifecycleHooks.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,8 @@ public static boolean handleServerStarting(final MinecraftServer server) {
5151
public static void handleServerStarted(final MinecraftServer server) {
5252
LifecycleEvents.handleServerStarted(server);
5353
}
54+
55+
public static void handleServerStopped(final MinecraftServer server) {
56+
LifecycleEvents.handleServerStopped(server);
57+
}
5458
}

patchwork-god-classes/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ dependencies {
77
compile project(path: ':patchwork-events-entity', configuration: 'dev')
88
compile project(path: ':patchwork-events-lifecycle', configuration: 'dev')
99
compile project(path: ':patchwork-events-rendering', configuration: 'dev')
10+
compile project(path: ':patchwork-loot', configuration: 'dev')
1011
}

patchwork-god-classes/src/main/java/net/minecraftforge/common/ForgeHooks.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
import javax.annotation.Nullable;
2525

26+
import com.google.gson.Gson;
27+
import com.google.gson.JsonObject;
2628
import net.minecraftforge.event.ForgeEventFactory;
2729
import net.minecraftforge.eventbus.api.Event;
2830

@@ -33,12 +35,16 @@
3335
import net.minecraft.entity.damage.DamageSource;
3436
import net.minecraft.entity.mob.MobEntity;
3537
import net.minecraft.entity.player.PlayerEntity;
38+
import net.minecraft.loot.LootManager;
39+
import net.minecraft.loot.LootTable;
3640
import net.minecraft.util.ActionResult;
3741
import net.minecraft.util.Hand;
42+
import net.minecraft.util.Identifier;
3843
import net.minecraft.world.IWorld;
3944
import net.minecraft.world.MobSpawnerLogic;
4045

4146
import net.patchworkmc.impl.event.entity.EntityEvents;
47+
import net.patchworkmc.impl.loot.LootHooks;
4248

4349
/*
4450
* Note: this class is intended for mod use only, to dispatch to the implementations kept in their own modules.
@@ -98,4 +104,13 @@ public static boolean onLivingDrops(LivingEntity entity, DamageSource source, Co
98104
public static boolean onPlayerAttackTarget(PlayerEntity player, Entity target) {
99105
return EntityEvents.attackEntity(player, target);
100106
}
107+
108+
@Nullable
109+
public static LootTable loadLootTable(Gson gson, Identifier name, JsonObject data, boolean custom, LootManager lootTableManager) {
110+
return LootHooks.loadLootTable(gson, name, data, custom, lootTableManager);
111+
}
112+
113+
public static String readPoolName(JsonObject json) {
114+
return LootHooks.readPoolName(json);
115+
}
101116
}

patchwork-god-classes/src/main/java/net/minecraftforge/event/ForgeEventFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@
2828
import net.minecraft.entity.SpawnType;
2929
import net.minecraft.entity.mob.MobEntity;
3030
import net.minecraft.entity.player.PlayerEntity;
31+
import net.minecraft.loot.LootManager;
32+
import net.minecraft.loot.LootTable;
33+
import net.minecraft.util.Identifier;
3134
import net.minecraft.world.IWorld;
3235
import net.minecraft.world.MobSpawnerLogic;
3336
import net.minecraft.world.World;
3437

3538
import net.patchworkmc.impl.capability.CapabilityEvents;
3639
import net.patchworkmc.impl.event.entity.EntityEvents;
40+
import net.patchworkmc.impl.event.loot.LootEvents;
3741

3842
/*
3943
* Note: this class is intended for mod use only, to dispatch to the implementations kept in their own modules.
@@ -65,4 +69,8 @@ public static void onPlayerFall(PlayerEntity player, float distance, float multi
6569
public static boolean doSpecialSpawn(MobEntity entity, World world, float x, float y, float z, MobSpawnerLogic spawner, SpawnType spawnReason) {
6670
return EntityEvents.doSpecialSpawn(entity, world, x, y, z, spawner, spawnReason);
6771
}
72+
73+
public static LootTable loadLootTable(Identifier name, LootTable table, LootManager lootTableManager) {
74+
return LootEvents.loadLootTable(name, table, lootTableManager);
75+
}
6876
}

patchwork-god-classes/src/main/resources/fabric.mod.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"patchwork-fml": "*",
2020
"patchwork-capabilities": "*",
2121
"patchwork-events-lifecycle": "*",
22-
"patchwork-events-rendering": "*"
22+
"patchwork-events-rendering": "*",
23+
"patchwork-loot": "*"
2324
},
2425
"custom": {
2526
"modmenu:api": true,

0 commit comments

Comments
 (0)