use of net.minecraft.util.Pair in project Biome-Makeover by Lemonszz.
the class IvyBlock method getNearbyIvyCount.
private Pair<Integer, Integer> getNearbyIvyCount(World world, BlockPos pos) {
int distance = 3;
// -1 because it counts itself and this was easier lol
int count = -1;
for (int x = -distance; x < distance; x++) {
for (int z = -distance; z < distance; z++) {
for (int y = -distance; y < distance; y++) {
if (world.getBlockState(pos.add(x, y, z)).isOf(this))
count++;
}
}
}
int adjacent = 0;
for (Direction dir : Direction.values()) if (world.getBlockState(pos.offset(dir)).isOf(this))
adjacent++;
return new Pair<>(count, adjacent);
}
use of net.minecraft.util.Pair in project allium by hugeblank.
the class Plugin method unload.
public void unload() {
PLUGINS.remove(getId(), this);
this.executor.getState().abandon();
for (Event e : Event.getEvents().values()) {
List<Pair<Plugin, LuaFunction>> listeners = e.getListeners();
listeners.removeIf(pair -> pair.getLeft().equals(this));
PACK.drop(path);
}
}
use of net.minecraft.util.Pair in project Client by MatHax.
the class LeftRightListSettingScreen method initWidgets.
private void initWidgets(Registry<T> registry) {
// Left (all)
WTable left = abc(pairs -> registry.forEach(t -> {
if (skipValue(t) || collection.contains(t))
return;
int words = Utils.search(getValueName(t), filterText);
if (words > 0)
pairs.add(new Pair<>(t, words));
}), true, t -> {
addValue(registry, t);
T v = getAdditionalValue(t);
if (v != null)
addValue(registry, v);
});
if (left.cells.size() > 0)
table.add(theme.verticalSeparator()).expandWidgetY();
// Right (selected)
abc(pairs -> {
for (T value : collection) {
if (skipValue(value))
continue;
int words = Utils.search(getValueName(value), filterText);
if (words > 0)
pairs.add(new Pair<>(value, words));
}
}, false, t -> {
removeValue(registry, t);
T v = getAdditionalValue(t);
if (v != null)
removeValue(registry, v);
});
}
use of net.minecraft.util.Pair in project ThonkUtil by LimeAppleBoat.
the class LivingEntityMixin method pickOutCape.
private Item pickOutCape() {
boolean a = false;
if (((LivingEntity) (Object) this).getType().equals(EntityType.ZOMBIE))
a = true;
if (((LivingEntity) (Object) this).getType().equals(EntityType.HUSK))
a = true;
if (((LivingEntity) (Object) this).getType().equals(EntityType.DROWNED))
a = true;
if (((LivingEntity) (Object) this).getType().equals(EntityType.ZOMBIFIED_PIGLIN))
a = true;
if (((LivingEntity) (Object) this).getType().equals(EntityType.SKELETON))
a = true;
if (((LivingEntity) (Object) this).getType().equals(EntityType.STRAY))
a = true;
if (!a)
return Items.AIR;
ArrayList<Pair<Item, Integer>> capCapes = new ArrayList<>();
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:migration_cape")), 50));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:founders_cape")), 25));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:pan_cape")), 25));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:new_year_2011_cape")), 15));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:minecon_2016_cape")), 7));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:minecon_2015_cape")), 5));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:minecon_2013_cape")), 3));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:minecon_2012_cape")), 2));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:minecon_2011_cape")), 1));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:translator_cape")), 1));
capCapes.add(new Pair<>(Registry.ITEM.get(new Identifier("thonkutil:animated_christmas_2010_cape")), 1));
final Object[] c = capCapes.toArray();
final int b = (int) (Math.random() * c.length);
return ((Pair<Item, Integer>) c[b]).getRight() >= (Math.random() * 100) + 1 ? ((Pair<Item, Integer>) c[b]).getLeft() : Items.AIR;
}
use of net.minecraft.util.Pair in project Polymorph by TheIllusiveC4.
the class AbstractHighlightedRecipeData method getPacketData.
@Override
public Pair<SortedSet<RecipePair>, Identifier> getPacketData() {
SortedSet<RecipePair> recipesList = this.getRecipesList();
Identifier selected = null;
if (!recipesList.isEmpty()) {
selected = this.getSelectedRecipe().map(Recipe::getId).orElse(recipesList.first().getIdentifier());
}
return new Pair<>(recipesList, selected);
}
Aggregations