mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-26 10:11:32 +01:00
SPIGOT-6273: Expose ItemFrame ItemDropChance through API
By: md_5 <git@md-5.net>
This commit is contained in:
parent
2eda6f0b01
commit
3e80d2e4ec
@ -1,5 +1,14 @@
|
|||||||
--- a/net/minecraft/server/EntityItemFrame.java
|
--- a/net/minecraft/server/EntityItemFrame.java
|
||||||
+++ b/net/minecraft/server/EntityItemFrame.java
|
+++ b/net/minecraft/server/EntityItemFrame.java
|
||||||
|
@@ -10,7 +10,7 @@
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
private static final DataWatcherObject<ItemStack> ITEM = DataWatcher.a(EntityItemFrame.class, DataWatcherRegistry.g);
|
||||||
|
private static final DataWatcherObject<Integer> g = DataWatcher.a(EntityItemFrame.class, DataWatcherRegistry.b);
|
||||||
|
- private float ag = 1.0F;
|
||||||
|
+ public float ag = 1.0F; // PAIL itemDropChance
|
||||||
|
public boolean fixed;
|
||||||
|
|
||||||
|
public EntityItemFrame(EntityTypes<? extends EntityItemFrame> entitytypes, World world) {
|
||||||
@@ -53,16 +53,27 @@
|
@@ -53,16 +53,27 @@
|
||||||
@Override
|
@Override
|
||||||
protected void updateBoundingBox() {
|
protected void updateBoundingBox() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import net.minecraft.server.BlockPosition;
|
import net.minecraft.server.BlockPosition;
|
||||||
import net.minecraft.server.EntityHanging;
|
import net.minecraft.server.EntityHanging;
|
||||||
import net.minecraft.server.EntityItemFrame;
|
import net.minecraft.server.EntityItemFrame;
|
||||||
@ -69,6 +70,17 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
|||||||
return CraftItemStack.asBukkitCopy(getHandle().getItem());
|
return CraftItemStack.asBukkitCopy(getHandle().getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getItemDropChance() {
|
||||||
|
return getHandle().ag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setItemDropChance(float chance) {
|
||||||
|
Preconditions.checkArgument(0.0 <= chance && chance <= 1.0, "Chance outside range [0, 1]");
|
||||||
|
getHandle().ag = chance;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rotation getRotation() {
|
public Rotation getRotation() {
|
||||||
return toBukkitRotation(getHandle().getRotation());
|
return toBukkitRotation(getHandle().getRotation());
|
||||||
|
Loading…
Reference in New Issue
Block a user