use of net.minecraft.entity.item.PaintingEntity in project ChocolateQuestRepoured by TeamChocoQuest.
the class PreparableEntityInfo method prepareNormal.
@Override
public GeneratableEntityInfo prepareNormal(World world, DungeonPlacement placement) {
Entity entity = EntityList.createEntityFromNBT(this.entityData, world);
double x;
double y;
double z;
if (entity instanceof HangingEntity) {
x = this.entityData.getInteger("TileX");
y = this.entityData.getInteger("TileY");
z = this.entityData.getInteger("TileZ");
if (entity instanceof PaintingEntity && placement.getMirror() != Mirror.NONE) {
int n = ((((PaintingEntity) entity).art.sizeX >> 4) + 1) & 1;
switch(((PaintingEntity) entity).facingDirection.rotateYCCW()) {
case NORTH:
z -= n;
break;
case EAST:
x += n;
break;
case SOUTH:
z += n;
break;
case WEST:
x -= n;
break;
default:
break;
}
}
BlockPos pos = placement.transform((int) x, (int) y, (int) z);
x = pos.getX();
y = pos.getY();
z = pos.getZ();
} else {
ListNBT tagList = this.entityData.getTagList("Pos", Constants.NBT.TAG_DOUBLE);
MutableVec3d vec = placement.transform(tagList.getDoubleAt(0), tagList.getDoubleAt(1), tagList.getDoubleAt(2));
x = vec.x;
y = vec.y;
z = vec.z;
}
float transformedYaw = placement.transform(entity);
entity.setLocationAndAngles(x, y, z, transformedYaw, entity.rotationPitch);
entity.setRenderYawOffset(transformedYaw);
entity.setRotationYawHead(transformedYaw);
return new GeneratableEntityInfo(entity);
}
use of net.minecraft.entity.item.PaintingEntity 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