Skip to content

Commit

Permalink
Fixed Curators being able to pickup items they shouldn´t. Closes #316
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Jul 28, 2021
1 parent bb61b74 commit c41c594
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ public static boolean canCuratorPickup(AtumVillagerEntity entity, ItemStack stac
Item item = stack.getItem();
if (entity.getBrain().hasMemory(MemoryModuleType.ADMIRING_DISABLED) && entity.getBrain().hasMemory(MemoryModuleType.ATTACK_TARGET)) {
return false;
} else if (item.isIn(AtumAPI.Tags.RELIC_NON_DIRTY)) {
return canPickup(entity);
} else {
boolean flag = entity.getVillagerInventory().func_233541_b_(stack);
return canPickup(entity) && flag;
if (item.isIn(AtumAPI.Tags.RELIC_NON_DIRTY)) {
return canPickup(entity);
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ protected int getFoodValueFromInventory() {
public boolean func_230293_i_(ItemStack stack) {
Item item = stack.getItem();
AtumVillagerProfession profession = this.getAtumVillagerData().getAtumProfession();
return (ALLOWED_INVENTORY_ITEMS.contains(item) || (profession.getSpecificItems().contains(item) || (profession == AtumVillagerProfession.CURATOR.get() && AtumVillagerTasks.canCuratorPickup(this, stack))) && this.getVillagerInventory().func_233541_b_(stack));
return (ALLOWED_INVENTORY_ITEMS.contains(item) || (profession.getSpecificItems().contains(item) || (profession == AtumVillagerProfession.CURATOR.get() && (AtumVillagerTasks.canCuratorPickup(this, stack) || ALLOWED_INVENTORY_ITEMS.contains(item)))) && this.getVillagerInventory().func_233541_b_(stack));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class AtumBiomeProvider extends BiomeProvider {

public AtumBiomeProvider(boolean largeBiomes, Registry<Biome> lookupRegistry) {
super(AtumRegistry.BIOME_KEYS.stream().map(lookupRegistry::getOrThrow).collect(Collectors.toList()));

long seed = (new Random()).nextLong(); //Workaround for vanilla bug, not applying seeds to biomes properly. TODO Revisit in 1.17
this.largeBiomes = largeBiomes;
this.lookupRegistry = lookupRegistry;
Expand Down Expand Up @@ -66,19 +67,16 @@ public Biome getNoiseBiome(int x, int y, int z) {
if (biome != null) {
// Dynamic Registry biome (this should always be returned ideally)
return biome;
}
else {
} else {
//fallback to WorldGenRegistry registry if dynamic registry doesn't have biome
if (SharedConstants.developmentMode) {
throw Util.pauseDevMode(new IllegalStateException("Unknown biome id: " + k));
}
else {
} else {
biome = this.lookupRegistry.getValueForKey(BiomeRegistry.getKeyFromID(0));
if(biome == null){
if (biome == null) {
// If this is reached, it is the end of the world lol
return BiomeRegistry.THE_VOID;
}
else{
} else {
// WorldGenRegistry biome (this is not good but we need to return something)
return biome;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@
import net.minecraft.world.gen.area.IArea;
import net.minecraft.world.gen.area.IAreaFactory;
import net.minecraft.world.gen.area.LazyArea;
import net.minecraft.world.gen.layer.EdgeBiomeLayer;
import net.minecraft.world.gen.layer.EdgeLayer;
import net.minecraft.world.gen.layer.HillsLayer;
import net.minecraft.world.gen.layer.IslandLayer;
import net.minecraft.world.gen.layer.Layer;
import net.minecraft.world.gen.layer.LayerUtil;
import net.minecraft.world.gen.layer.SmoothLayer;
import net.minecraft.world.gen.layer.StartRiverLayer;
import net.minecraft.world.gen.layer.ZoomLayer;
import net.minecraft.world.gen.layer.*;

import java.util.function.LongFunction;

Expand Down

0 comments on commit c41c594

Please sign in to comment.