13
0
geforkt von Mirrors/Paper

SPIGOT-6373: Add getAttachedFace and setAttachedFace to the Shulker API

By: Julian van den Berkmortel <julianvdberkmortel@outlook.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-04-28 11:52:30 +10:00
Ursprung c5af0704d0
Commit 0989d371a0
2 geänderte Dateien mit 21 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityShulker.java
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
@@ -47,6 +47,12 @@
@@ -47,11 +47,17 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@ -13,6 +13,12 @@
public class EntityShulker extends EntityGolem implements IMonster {
private static final UUID bp = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
private static final AttributeModifier bq = new AttributeModifier(EntityShulker.bp, "Covered armor bonus", 20.0D, AttributeModifier.Operation.ADDITION);
- protected static final DataWatcherObject<EnumDirection> b = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.n);
+ public static final DataWatcherObject<EnumDirection> b = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.n); // PAIL protected -> public, rename ATTACH_FACE
protected static final DataWatcherObject<Optional<BlockPosition>> c = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.m);
protected static final DataWatcherObject<Byte> d = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a);
public static final DataWatcherObject<Byte> COLOR = DataWatcher.a(EntityShulker.class, DataWatcherRegistry.a);
@@ -71,7 +77,7 @@
this.goalSelector.a(4, new EntityShulker.a());
this.goalSelector.a(7, new EntityShulker.e());

Datei anzeigen

@ -3,7 +3,9 @@ package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
import net.minecraft.world.entity.monster.EntityShulker;
import org.bukkit.DyeColor;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Shulker;
@ -48,4 +50,16 @@ public class CraftShulker extends CraftGolem implements Shulker {
Preconditions.checkArgument(value >= 0 && value <= 1, "value needs to be in between or equal to 0 and 1");
getHandle().a((int) (value * 100)); // PAIL rename setPeek
}
@Override
public BlockFace getAttachedFace() {
return CraftBlock.notchToBlockFace(getHandle().eL()); // PAIL rename getAttachedFace
}
@Override
public void setAttachedFace(BlockFace face) {
Preconditions.checkNotNull(face, "face cannot be null");
Preconditions.checkArgument(face.isCartesian(), "%s is not a valid block face to attach a shulker to, a cartesian block face is expected", face);
getHandle().getDataWatcher().set(EntityShulker.b, CraftBlock.blockFaceToNotch(face));
}
}