mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-24 18:07:39 +01:00
Update clients when ItemFrame direction is set. Fixes BUKKIT-3371
Hanging entities are placed into the entity tracker and updates are sent out to clients for the initial placement. Thereafter data watchers are configured to monitor the item inside the frame. However, if the direction the ItemFrame facing changes the entity tracker will not send out updates. This commit removes and recreates the ItemFrame entity in the same way that was already done for Painting entities. This causes clients to be updated appropriately.
This commit is contained in:
parent
3e896afe6b
commit
068d8a807b
@ -1,11 +1,14 @@
|
|||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
import net.minecraft.server.EntityItemFrame;
|
import net.minecraft.server.EntityItemFrame;
|
||||||
|
import net.minecraft.server.WorldServer;
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
|
|
||||||
import org.bukkit.Rotation;
|
import org.bukkit.Rotation;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
@ -15,6 +18,17 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
|||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean setFacingDirection(BlockFace face, boolean force) {
|
||||||
|
if (!super.setFacingDirection(face, force)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldServer world = ((CraftWorld) this.getWorld()).getHandle();
|
||||||
|
world.getTracker().untrackEntity(this.getHandle());
|
||||||
|
world.getTracker().track(this.getHandle());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void setItem(org.bukkit.inventory.ItemStack item) {
|
public void setItem(org.bukkit.inventory.ItemStack item) {
|
||||||
if (item == null || item.getTypeId() == 0) {
|
if (item == null || item.getTypeId() == 0) {
|
||||||
getHandle().getDataWatcher().a(2, 5);
|
getHandle().getDataWatcher().a(2, 5);
|
||||||
|
Loading…
Reference in New Issue
Block a user