Permalink
Browse files

Remove deprecated bite chance (unused since 1.6.4)

  • Loading branch information...
PseudoKnight committed Oct 23, 2017
1 parent fc4bf4e commit 67a9a417c4931a013b230dc27848854f66903368
@@ -13,16 +13,4 @@ public BukkitMCFishHook(Entity e) {
f = (FishHook) e;
}
@Override
public double getBiteChance() {
// only works pre-1.9
return f.getBiteChance();
}
@Override
public void setBiteChance(double chance) {
// only works pre-1.9
f.setBiteChance(chance);
}
}
@@ -3,16 +3,5 @@
import com.laytonsmith.abstraction.MCProjectile;
public interface MCFishHook extends MCProjectile {
/**
* This only refers to with the hook is being reeled in.
* @return chance from 0.0 to 1.0
*/
public double getBiteChance();
/**
* Setting this only has an effect when the hook is reeled in.
* 0.0 represents no chance, 1.0 guarantees that a fish will be caught
* when the hook is pulled in.
* @param chance, must be from 0.0 to 1.0 (inclusive)
*/
public void setBiteChance(double chance);
}
@@ -2019,10 +2019,9 @@ public String docs() {
return "{state: <macro> Can be one of " + StringUtils.Join(MCFishingState.values(), ", ", ", or ")
+ " | player: <macro> The player who is fishing | world: <string match>}"
+ " Fires when a player casts or reels a fishing rod."
+ " {player | world | state | chance | xp | hook: the fishhook entity id"
+ " {player | world | state | xp | hook: the fishhook entity id"
+ " | caught: the id of the snared entity, can be a fish item}"
+ " {chance: the chance of catching a fish from pulling the bobber at random (pre 1.9 only)"
+ " | xp: the exp the player will get from catching a fish}"
+ " {xp: the exp the player will get from catching a fish}"
+ " {}";
}
@@ -2060,7 +2059,6 @@ public BindableEvent convert(CArray manualObject, Target t) {
caught = new CString(event.getCaught().getUniqueId().toString(), t);
}
ret.put("caught", caught);
ret.put("chance", new CDouble(event.getHook().getBiteChance(), t));
return ret;
} else {
throw new EventException("Could not convert to MCPlayerFishEvent");
@@ -2072,14 +2070,6 @@ public boolean modifyEvent(String key, Construct value,
BindableEvent event) {
if (event instanceof MCPlayerFishEvent) {
MCPlayerFishEvent e = (MCPlayerFishEvent) event;
if (key.equals("chance")) {
double chance = Static.getDouble(value, value.getTarget());
if (chance > 1.0 || chance < 0.0) {
throw new CREFormatException("Chance must be between 0.0 and 1.0", value.getTarget());
}
e.getHook().setBiteChance(chance);
return true;
}
if (key.equals("xp")) {
e.setExpToDrop(Static.getInt32(value, value.getTarget()));
return true;
@@ -2705,10 +2705,6 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
MCFireball ball = (MCFireball) entity;
specArray.set(entity_spec.KEY_FIREBALL_DIRECTION, ObjectGenerator.GetGenerator().vector(ball.getDirection(), t), t);
break;
case FISHING_HOOK:
MCFishHook hook = (MCFishHook) entity;
specArray.set(entity_spec.KEY_FISHING_HOOK_CHANCE, new CDouble(hook.getBiteChance(), t), t);
break;
case GUARDIAN:
MCGuardian guardian = (MCGuardian) entity;
specArray.set(entity_spec.KEY_GUARDIAN_ELDER, CBoolean.get(guardian.isElder()), t);
@@ -2923,7 +2919,6 @@ public CHVersion since() {
private static final String KEY_FALLING_BLOCK_BLOCK = "block";
private static final String KEY_FALLING_BLOCK_DROPITEM = "dropitem";
private static final String KEY_FIREBALL_DIRECTION = "direction";
private static final String KEY_FISHING_HOOK_CHANCE = "chance";
private static final String KEY_GUARDIAN_ELDER = "elder";
private static final String KEY_HORSE_COLOR = "color";
private static final String KEY_HORSE_STYLE = "style";
@@ -3301,22 +3296,6 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
}
}
break;
case FISHING_HOOK:
MCFishHook hook = (MCFishHook) entity;
for (String index : specArray.stringKeySet()) {
switch (index.toLowerCase()) {
case entity_spec.KEY_FISHING_HOOK_CHANCE:
try {
hook.setBiteChance(Static.getDouble(specArray.get(index, t), t));
} catch (IllegalArgumentException exception) {
throw new CRERangeException("The chance must be between 0.0 and 1.0", t);
}
break;
default:
throwException(index, t);
}
}
break;
case GUARDIAN:
MCGuardian guardian = (MCGuardian) entity;
for (String index : specArray.stringKeySet()) {
@@ -81,10 +81,6 @@ without knowing the rotations on the other axis or of other body parts beforehan
|
* %KEY_FIREBALL_DIRECTION%: The direction the fireball is heading toward.
|-
| FISHING_HOOK
|
* %KEY_FISHING_HOOK_CHANCE%: The chance of a fish biting (between 0.0 and 1.0, 0.0: no chance, 1.0: instant catch).
|-
| GUARDIAN
|
* %KEY_GUARDIAN_ELDER%: Whether the guardian is an elder guardian. (deprecated)

0 comments on commit 67a9a41

Please sign in to comment.