Skip to content

Commit

Permalink
Fixed how loot tables is being determined. Closes #99
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Mar 21, 2020
1 parent 00f2292 commit 0b87e2b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ protected void registerGoals() {
super.registerGoals();

this.goalSelector.goals.forEach(prioritizedGoal -> { //Removes vanilla schooling goal
if (prioritizedGoal.getGoal().getClass() == FollowSchoolLeaderGoal.class)
if (prioritizedGoal.getGoal().getClass() == FollowSchoolLeaderGoal.class) {
this.goalSelector.removeGoal(prioritizedGoal.getGoal());
}
});
this.goalSelector.addGoal(5, new FollowTypeSchoolLeaderGoal(this));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import net.minecraftforge.items.ItemStackHandler;

import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

Expand Down Expand Up @@ -186,24 +185,18 @@ public int handleHookRetraction(@Nonnull ItemStack stack) {
}

private List<ItemStack> getLoot(LootContext.Builder builder, ServerWorld serverWorld) {
IFluidState fluidState = this.world.getFluidState(new BlockPos(this));
ResourceLocation lootTableLocation = null;
if (fluidState.isTagged(FluidTags.WATER)) {
lootTableLocation = LootTables.GAMEPLAY_FISHING;
}
ResourceLocation lootTableLocation;
if (this.isLavaHookInLava(this, this.world, new BlockPos(this))) {
if (serverWorld.getWorld().getDimension().isNether()) {
lootTableLocation = AquaLootTables.NETHER_FISHING;
} else {
lootTableLocation = AquaLootTables.LAVA_FISHING;
}
}
if (lootTableLocation == null) {
return new ArrayList<>();
} else {
LootTable lootTable = serverWorld.getServer().getLootTableManager().getLootTableFromLocation(lootTableLocation);
return lootTable.generate(builder.build(LootParameterSets.FISHING));
lootTableLocation = LootTables.GAMEPLAY_FISHING;
}
LootTable lootTable = serverWorld.getServer().getLootTableManager().getLootTableFromLocation(lootTableLocation);
return lootTable.generate(builder.build(LootParameterSets.FISHING));
}

private void spawnLoot(List<ItemStack> lootEntries) {
Expand Down

0 comments on commit 0b87e2b

Please sign in to comment.