Removed redundant code (moved to BCLib lists)
This commit is contained in:
parent
8a1490f00e
commit
9c1c1edb12
10 changed files with 18 additions and 115 deletions
|
@ -1,27 +0,0 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import net.minecraft.world.entity.ai.behavior.ShufflingList;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import ru.betterend.interfaces.ShuffelingListExtended;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(ShufflingList.class)
|
||||
public abstract class ShuffelingListMixin<U> implements ShuffelingListExtended<U> {
|
||||
@Shadow
|
||||
@Final
|
||||
protected List<ShufflingList.WeightedEntry<U>> entries;
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.entries.isEmpty();
|
||||
}
|
||||
|
||||
@Shadow
|
||||
public abstract ShufflingList<U> shuffle();
|
||||
|
||||
public U getOne() {
|
||||
return this.shuffle().stream().findFirst().orElseThrow(RuntimeException::new);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.fabricmc.fabric.impl.biome.InternalBiomeData;
|
||||
import net.fabricmc.fabric.impl.biome.WeightedBiomePicker;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import ru.betterend.interfaces.IBiomeList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(value = WeightedBiomePicker.class, remap = false)
|
||||
public class WeightedBiomePickerMixin implements IBiomeList {
|
||||
private final List<ResourceKey<Biome>> biomes = Lists.newArrayList();
|
||||
|
||||
@Inject(method = "addBiome", at = @At("TAIL"))
|
||||
private void be_addBiome(final ResourceKey<Biome> biome, final double weight, CallbackInfo info) {
|
||||
if (be_isCorrectPicker(WeightedBiomePicker.class.cast(this))) {
|
||||
biomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ResourceKey<Biome>> getBiomes() {
|
||||
return biomes;
|
||||
}
|
||||
|
||||
private boolean be_isCorrectPicker(WeightedBiomePicker picker) {
|
||||
return picker == InternalBiomeData.getEndBiomesMap()
|
||||
.get(Biomes.SMALL_END_ISLANDS) || picker == InternalBiomeData.getEndBarrensMap()
|
||||
.get(Biomes.END_BARRENS);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue