13
0
geforkt von Mirrors/Paper

Enhance Beacon Block API

Dieser Commit ist enthalten in:
md_5 2016-07-23 10:55:43 +10:00
Ursprung 7655e38a47
Commit 2a5461deb1
2 geänderte Dateien mit 21 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/TileEntityBeacon.java --- a/net/minecraft/server/TileEntityBeacon.java
+++ b/net/minecraft/server/TileEntityBeacon.java +++ b/net/minecraft/server/TileEntityBeacon.java
@@ -9,19 +9,61 @@ @@ -9,19 +9,58 @@
import java.util.Set; import java.util.Set;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -20,9 +20,11 @@
- private int k = -1; - private int k = -1;
+ public int k = -1; // PAIL: private -> public + public int k = -1; // PAIL: private -> public
@Nullable @Nullable
private MobEffectList l; - private MobEffectList l;
+ public MobEffectList l; // PAIL: private -> public
@Nullable @Nullable
private MobEffectList m; - private MobEffectList m;
+ public MobEffectList m; // PAIL: private -> public
private ItemStack inventorySlot; private ItemStack inventorySlot;
private String o; private String o;
+ // CraftBukkit start - add fields and methods + // CraftBukkit start - add fields and methods
@ -50,20 +52,17 @@
+ } + }
+ +
+ public PotionEffect getPrimaryEffect() { + 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() { + public PotionEffect getSecondaryEffect() {
+ if (hasSecondaryEffect()) { + return (hasSecondaryEffect()) ? CraftPotionUtil.toBukkit(new MobEffect(this.m, getLevel(), getAmplification(), true, true)) : null;
+ return CraftPotionUtil.toBukkit(new MobEffect(this.m, getLevel(), getAmplification(), true, true));
+ }
+ return null;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
public TileEntityBeacon() {} public TileEntityBeacon() {}
@@ -40,41 +82,79 @@ @@ -40,41 +79,79 @@
} }

Datei anzeigen

@ -3,15 +3,18 @@ package org.bukkit.craftbukkit.block;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import net.minecraft.server.EntityHuman; import net.minecraft.server.EntityHuman;
import net.minecraft.server.MobEffectList;
import net.minecraft.server.TileEntityBeacon; import net.minecraft.server.TileEntityBeacon;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Beacon; import org.bukkit.block.Beacon;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon; import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon;
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class CraftBeacon extends CraftBlockState implements Beacon { public class CraftBeacon extends CraftBlockState implements Beacon {
private final CraftWorld world; private final CraftWorld world;
@ -72,8 +75,18 @@ public class CraftBeacon extends CraftBlockState implements Beacon {
return beacon.getPrimaryEffect(); return beacon.getPrimaryEffect();
} }
@Override
public void setPrimaryEffect(PotionEffectType effect) {
beacon.l = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
}
@Override @Override
public PotionEffect getSecondaryEffect() { public PotionEffect getSecondaryEffect() {
return beacon.getSecondaryEffect(); return beacon.getSecondaryEffect();
} }
@Override
public void setSecondaryEffect(PotionEffectType effect) {
beacon.m = (effect != null) ? MobEffectList.fromId(effect.getId()) : null;
}
} }