Skip to content
Permalink
Browse files

Add vex charging to entity_spec()

  • Loading branch information
PseudoKnight committed Nov 24, 2019
1 parent 706a3c6 commit 85f41eeea409fcdbef2d6dad731cb44276fbf620
@@ -2,11 +2,21 @@

import com.laytonsmith.abstraction.entities.MCVex;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Vex;

public class BukkitMCVex extends BukkitMCLivingEntity implements MCVex {

public BukkitMCVex(Entity ent) {
super(ent);
}

@Override
public boolean isCharging() {
return ((Vex) getHandle()).isCharging();
}

@Override
public void setCharging(boolean charging) {
((Vex) getHandle()).setCharging(charging);
}
}
@@ -3,4 +3,6 @@
import com.laytonsmith.abstraction.MCLivingEntity;

public interface MCVex extends MCLivingEntity {
boolean isCharging();
void setCharging(boolean charging);
}
@@ -73,6 +73,7 @@
import com.laytonsmith.abstraction.entities.MCTippedArrow;
import com.laytonsmith.abstraction.entities.MCTrident;
import com.laytonsmith.abstraction.entities.MCTropicalFish;
import com.laytonsmith.abstraction.entities.MCVex;
import com.laytonsmith.abstraction.entities.MCVillager;
import com.laytonsmith.abstraction.entities.MCWitherSkull;
import com.laytonsmith.abstraction.entities.MCWolf;
@@ -2035,6 +2036,10 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
specArray.set(entity_spec.KEY_TROPICALFISH_PATTERN, new CString(fish.getPattern().name(), t), t);
specArray.set(entity_spec.KEY_TROPICALFISH_PATTERNCOLOR, new CString(fish.getPatternColor().name(), t), t);
break;
case VEX:
MCVex vex = (MCVex) entity;
specArray.set(entity_spec.KEY_VEX_CHARGING, CBoolean.get(vex.isCharging()), t);
break;
case VILLAGER:
MCVillager villager = (MCVillager) entity;
specArray.set(entity_spec.KEY_VILLAGER_PROFESSION, new CString(villager.getProfession().name(), t), t);
@@ -2160,6 +2165,7 @@ public MSVersion since() {
private static final String KEY_TROPICALFISH_COLOR = "color";
private static final String KEY_TROPICALFISH_PATTERN = "pattern";
private static final String KEY_TROPICALFISH_PATTERNCOLOR = "patterncolor";
private static final String KEY_VEX_CHARGING = "charging";
private static final String KEY_VILLAGER_PROFESSION = "profession";
private static final String KEY_VILLAGER_LEVEL = "level";
private static final String KEY_VILLAGER_EXPERIENCE = "experience";
@@ -3323,6 +3329,18 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
}
}
break;
case VEX:
MCVex vex = (MCVex) entity;
for(String index : specArray.stringKeySet()) {
switch(index.toLowerCase()) {
case entity_spec.KEY_VEX_CHARGING:
vex.setCharging(ArgumentValidation.getBooleanObject(specArray.get(index, t), t));
break;
default:
throwException(index, t);
}
}
break;
case VILLAGER:
MCVillager villager = (MCVillager) entity;
for(String index : specArray.stringKeySet()) {
@@ -269,6 +269,10 @@ without knowing the rotations on the other axis or of other body parts beforehan
* %KEY_TROPICALFISH_PATTERNCOLOR%: The color of the pattern on the fish.
* %KEY_TROPICALFISH_PATTERN%: The pattern type on the fish (can be %FISH_PATTERN%).
|-
| VEX
|
* %KEY_VEX_CHARGING%: Whether or not this vex is charging.
|-
| VILLAGER
|
* %KEY_VILLAGER_PROFESSION%: The profession of the villager (can be %PROFESSION%). This list differs in 1.14 from 1.13.

0 comments on commit 85f41ee

Please sign in to comment.
You can’t perform that action at this time.