Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/draylar/gofish/impl/GoFishLootTables.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class GoFishLootTables {

public static final Identifier OVERWORLD_FISHING = GoFish.id("gameplay/fishing/overworld/fishing");
public static final Identifier NETHER_FISHING = GoFish.id("gameplay/fishing/nether/fishing");
public static final Identifier END_FISHING = GoFish.id("gameplay/fishing/end/fishing");
}
12 changes: 11 additions & 1 deletion src/main/java/draylar/gofish/mixin/FishingBobberLootMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import draylar.gofish.api.FireproofEntity;
import draylar.gofish.impl.GoFishLootTables;
import net.fabricmc.fabric.api.entity.FakePlayer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ItemEntity;
Expand All @@ -13,6 +14,7 @@
import net.minecraft.loot.LootTables;
import net.minecraft.loot.context.LootContext;
import net.minecraft.loot.context.LootContextParameterSet;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
Expand Down Expand Up @@ -40,6 +42,14 @@ private FishingBobberLootMixin(EntityType<?> type, World world) {
private LootTable getTable(LootManager lootManager, Identifier id) {
assert getWorld().getServer() != null;

FishingBobberEntity bobber = (FishingBobberEntity) (Object) this;
Entity owner = bobber.getOwner();

if (!(owner instanceof ServerPlayerEntity) || (owner instanceof FakePlayer)) {
// If a fishing is being done by a fake player give regular loot
return this.getWorld().getServer().getLootManager().getLootTable(LootTables.FISHING_GAMEPLAY);
}

final DimensionType dimension = getWorld().getDimension();
if(dimension.ultrawarm()) {
return this.getWorld().getServer().getLootManager().getLootTable(GoFishLootTables.NETHER_FISHING);
Expand All @@ -48,7 +58,7 @@ private LootTable getTable(LootManager lootManager, Identifier id) {
}

// Default
return this.getWorld().getServer().getLootManager().getLootTable(LootTables.FISHING_GAMEPLAY);
return this.getWorld().getServer().getLootManager().getLootTable(GoFishLootTables.OVERWORLD_FISHING);
}

@Inject(
Expand Down