|
@@ -6,16 +6,21 @@ import java.util.function.Consumer;
|
|
|
import javax.annotation.Nullable;
|
|
|
import net.minecraft.block.BlockState;
|
|
|
import net.minecraft.entity.Entity;
|
|
|
+import net.minecraft.entity.player.PlayerEntity;
|
|
|
+import net.minecraft.inventory.CraftResultInventory;
|
|
|
+import net.minecraft.inventory.CraftingInventory;
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
import net.minecraft.server.dedicated.DedicatedPlayerList;
|
|
|
import net.minecraft.server.dedicated.DedicatedServer;
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
+import net.minecraft.world.World;
|
|
|
import net.minecraft.world.server.ServerWorld;
|
|
|
|
|
|
public class Hooks {
|
|
|
private static Consumer<DedicatedServer> playerListFunction = null;
|
|
|
private static BlockHarvest blockHarvest = (state, w, pos, tileEnt, ent, stack) -> Collections.EMPTY_LIST;
|
|
|
+ private static Craft craft = (id, w, p, cInv, slot) -> {};
|
|
|
|
|
|
public static void setPlayerListFunction(Consumer<DedicatedServer> c) {
|
|
|
playerListFunction = c;
|
|
@@ -37,6 +42,10 @@ public class Hooks {
|
|
|
public static void setBlockHarvest(BlockHarvest c) {
|
|
|
blockHarvest = c;
|
|
|
}
|
|
|
+
|
|
|
+ public static void setCraft(Craft c) {
|
|
|
+ craft = c;
|
|
|
+ }
|
|
|
|
|
|
public static List<ItemStack> getDropsA(BlockState state, ServerWorld w, BlockPos pos, @Nullable TileEntity tileEnt) {
|
|
|
return blockHarvest.onBlockHarvest(state, w, pos, tileEnt, null, null);
|
|
@@ -45,4 +54,8 @@ public class Hooks {
|
|
|
public static List<ItemStack> getDropsB(BlockState state, ServerWorld w, BlockPos pos, @Nullable TileEntity tileEnt, @Nullable Entity ent, ItemStack stack) {
|
|
|
return blockHarvest.onBlockHarvest(state, w, pos, tileEnt, ent, stack);
|
|
|
}
|
|
|
+
|
|
|
+ public static void onCraft(int id, World w, PlayerEntity p, CraftingInventory cInv, CraftResultInventory slot) {
|
|
|
+ craft.onCraft(id, w, p, cInv, slot);
|
|
|
+ }
|
|
|
}
|