mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
Enhance Beacon Block API
This commit is contained in:
parent
7655e38a47
commit
2a5461deb1
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/TileEntityBeacon.java
|
||||
+++ b/net/minecraft/server/TileEntityBeacon.java
|
||||
@@ -9,19 +9,61 @@
|
||||
@@ -9,19 +9,58 @@
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -20,9 +20,11 @@
|
||||
- private int k = -1;
|
||||
+ public int k = -1; // PAIL: private -> public
|
||||
@Nullable
|
||||
private MobEffectList l;
|
||||
- private MobEffectList l;
|
||||
+ public MobEffectList l; // PAIL: private -> public
|
||||
@Nullable
|
||||
private MobEffectList m;
|
||||
- private MobEffectList m;
|
||||
+ public MobEffectList m; // PAIL: private -> public
|
||||
private ItemStack inventorySlot;
|
||||
private String o;
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
@ -50,20 +52,17 @@
|
||||
+ }
|
||||
+
|
||||
+ public PotionEffect getPrimaryEffect() {
|
||||
+ return CraftPotionUtil.toBukkit(new MobEffect(this.l, getLevel(), getAmplification(), true, true));
|
||||
+ return (this.l != null) ? CraftPotionUtil.toBukkit(new MobEffect(this.l, getLevel(), getAmplification(), true, true)) : null;
|
||||
+ }
|
||||
+
|
||||
+ public PotionEffect getSecondaryEffect() {
|
||||
+ if (hasSecondaryEffect()) {
|
||||
+ return CraftPotionUtil.toBukkit(new MobEffect(this.m, getLevel(), getAmplification(), true, true));
|
||||
+ }
|
||||
+ return null;
|
||||
+ return (hasSecondaryEffect()) ? CraftPotionUtil.toBukkit(new MobEffect(this.m, getLevel(), getAmplification(), true, true)) : null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public TileEntityBeacon() {}
|
||||
|
||||
@@ -40,41 +82,79 @@
|
||||
@@ -40,41 +79,79 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,15 +3,18 @@ package org.bukkit.craftbukkit.block;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import net.minecraft.server.EntityHuman;
|
||||
import net.minecraft.server.MobEffectList;
|
||||
import net.minecraft.server.TileEntityBeacon;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Beacon;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon;
|
||||
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class CraftBeacon extends CraftBlockState implements Beacon {
|
||||
private final CraftWorld world;
|
||||
@ -72,8 +75,18 @@ public class CraftBeacon extends CraftBlockState implements Beacon {
|
||||
return beacon.getPrimaryEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrimaryEffect(PotionEffectType effect) {
|
||||
beacon.l = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PotionEffect getSecondaryEffect() {
|
||||
return beacon.getSecondaryEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecondaryEffect(PotionEffectType effect) {
|
||||
beacon.m = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user