mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-25 02:27:41 +01:00
Add more fallback material
This commit is contained in:
parent
5c62a3f92f
commit
352ec56f5e
@ -33,7 +33,7 @@ import net.citizensnpcs.api.util.SpigotUtil;
|
||||
slots = { @MenuSlot(
|
||||
filter = InventoryAction.UNKNOWN,
|
||||
pat = 'x',
|
||||
material = Material.GLASS_PANE,
|
||||
compatMaterial = { "GLASS_PANE", "FIRE" },
|
||||
title = "<4>Unused") },
|
||||
value = "xxx")
|
||||
public class EndermanEquipperGUI extends InventoryMenuPage {
|
||||
|
@ -30,7 +30,7 @@ import net.citizensnpcs.trait.Saddle;
|
||||
slots = { @MenuSlot(
|
||||
filter = InventoryAction.UNKNOWN,
|
||||
pat = 'x',
|
||||
material = Material.GLASS_PANE,
|
||||
compatMaterial = { "GLASS_PANE", "FIRE" },
|
||||
title = "<4>Unused") },
|
||||
value = "xxx")
|
||||
public class PigEquipperGUI extends InventoryMenuPage {
|
||||
|
@ -88,7 +88,8 @@ public class DropsTrait extends Trait {
|
||||
ctx.getInventory().setItem(islot, drop.drop.clone());
|
||||
}
|
||||
InventoryMenuSlot slot = ctx.getSlot(i * 9 + j);
|
||||
slot.setItemStack(new ItemStack(Material.GLASS_PANE), "Drop chance <e>" + chance + "%");
|
||||
slot.setItemStack(new ItemStack(Util.getFallbackMaterial("GLASS_PANE", "FIRE")),
|
||||
"Drop chance <e>" + chance + "%");
|
||||
slot.addClickHandler(new PercentageSlotHandler((pct) -> {
|
||||
if (chances.containsKey(islot)) {
|
||||
chances.put(islot, pct / 100.0);
|
||||
|
@ -107,6 +107,14 @@ public class Util {
|
||||
return entity instanceof LivingEntity ? ((LivingEntity) entity).getEyeLocation() : entity.getLocation();
|
||||
}
|
||||
|
||||
public static Material getFallbackMaterial(String first, String second) {
|
||||
try {
|
||||
return Material.valueOf(first);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Material.valueOf(second);
|
||||
}
|
||||
}
|
||||
|
||||
public static Random getFastRandom() {
|
||||
return new XORShiftRNG();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user