use of net.minecraft.entity.item.PaintingType in project LoliServer by Loli-Server.
the class CraftPainting method setArt.
@Override
public boolean setArt(Art art, boolean force) {
PaintingEntity painting = this.getHandle();
PaintingType oldArt = painting.motive;
painting.motive = CraftArt.BukkitToNotch(art);
painting.setDirection(painting.getDirection());
if (!force && !painting.survives()) {
// Revert painting since it doesn't fit
painting.motive = oldArt;
painting.setDirection(painting.getDirection());
return false;
}
this.update();
return true;
}
use of net.minecraft.entity.item.PaintingType in project LoliServer by Loli-Server.
the class CraftArt method BukkitToNotch.
public static PaintingType BukkitToNotch(Art art) {
PaintingType nms = artwork.inverse().get(art);
Preconditions.checkArgument(nms != null);
return nms;
}
use of net.minecraft.entity.item.PaintingType in project Magma-1.16.x by magmafoundation.
the class CraftArt method BukkitToNotch.
public static PaintingType BukkitToNotch(Art art) {
PaintingType nms = artwork.inverse().get(art);
Preconditions.checkArgument(nms != null);
return nms;
}
use of net.minecraft.entity.item.PaintingType in project LoliServer by Loli-Server.
the class BukkitInjector method addEnumArt.
public static void addEnumArt() {
int i = Art.values().length;
HashMap<String, Art> BY_NAME = ObfuscationReflectionHelper.getPrivateValue(Art.class, null, "BY_NAME");
HashMap<Integer, Art> BY_ID = ObfuscationReflectionHelper.getPrivateValue(Art.class, null, "BY_ID");
for (PaintingType entry : ForgeRegistries.PAINTING_TYPES) {
int width = entry.getWidth();
int height = entry.getHeight();
ResourceLocation resourceLocation = entry.getRegistryName();
if (!resourceLocation.getNamespace().equals(NamespacedKey.MINECRAFT)) {
String name = normalizeName(resourceLocation.toString());
int id = i - 1;
Art art = EnumHelper.addEnum(Art.class, name, new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE }, new Object[] { id, width, height });
artMap.put(entry, art);
BY_NAME.put(name, art);
BY_ID.put(id, art);
LoliServer.LOGGER.debug("Registered forge PaintingType as Art {}", art);
i++;
}
}
}
use of net.minecraft.entity.item.PaintingType in project Magma-1.16.x by magmafoundation.
the class CraftPainting method setArt.
@Override
public boolean setArt(Art art, boolean force) {
PaintingEntity painting = this.getHandle();
PaintingType oldArt = painting.motive;
painting.motive = CraftArt.BukkitToNotch(art);
painting.setDirection(painting.getDirection());
if (!force && !painting.survives()) {
// Revert painting since it doesn't fit
painting.motive = oldArt;
painting.setDirection(painting.getDirection());
return false;
}
this.update();
return true;
}
Aggregations