Skip to content
Permalink
Browse files
Add phantom size to entity_spec
  • Loading branch information
PseudoKnight committed Apr 8, 2020
1 parent c06d22f commit b1511e00079e00634ced32524a27abf9c2ee5b4a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
@@ -167,7 +167,7 @@
<!-- GPL -->
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15-R0.1-SNAPSHOT</version>
<version>1.15.2-R0.1-SNAPSHOT</version>
</dependency>

<!-- Used for storing and retreiving Constructs in a storage transparent medium: JSONs -->
@@ -0,0 +1,25 @@
package com.laytonsmith.abstraction.bukkit.entities;

import com.laytonsmith.abstraction.entities.MCPhantom;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Phantom;

public class BukkitMCPhantom extends BukkitMCLivingEntity implements MCPhantom {

Phantom p;

public BukkitMCPhantom(Entity be) {
super(be);
p = (Phantom) be;
}

@Override
public int getSize() {
return p.getSize();
}

@Override
public void setSize(int size) {
p.setSize(size);
}
}
@@ -0,0 +1,8 @@
package com.laytonsmith.abstraction.entities;

import com.laytonsmith.abstraction.MCLivingEntity;

public interface MCPhantom extends MCLivingEntity {
int getSize();
void setSize(int size);
}
@@ -59,6 +59,7 @@
import com.laytonsmith.abstraction.entities.MCPainting;
import com.laytonsmith.abstraction.entities.MCPanda;
import com.laytonsmith.abstraction.entities.MCParrot;
import com.laytonsmith.abstraction.entities.MCPhantom;
import com.laytonsmith.abstraction.entities.MCPig;
import com.laytonsmith.abstraction.entities.MCPigZombie;
import com.laytonsmith.abstraction.entities.MCProjectile;
@@ -1967,6 +1968,10 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
specArray.set(entity_spec.KEY_GENERIC_SITTING, CBoolean.get(parrot.isSitting()), t);
specArray.set(entity_spec.KEY_PARROT_TYPE, new CString(parrot.getVariant().name(), t), t);
break;
case PHANTOM:
MCPhantom phantom = (MCPhantom) entity;
specArray.set(entity_spec.KEY_PHANTOM_SIZE, new CInt(phantom.getSize(), t), t);
break;
case PIG:
MCPig pig = (MCPig) entity;
specArray.set(entity_spec.KEY_PIG_SADDLED, CBoolean.get(pig.isSaddled()), t);
@@ -2172,6 +2177,7 @@ public MSVersion since() {
private static final String KEY_PANDA_MAINGENE = "maingene";
private static final String KEY_PANDA_HIDDENGENE = "hiddengene";
private static final String KEY_PARROT_TYPE = "type";
private static final String KEY_PHANTOM_SIZE = "size";
private static final String KEY_PIG_SADDLED = "saddled";
private static final String KEY_PIG_ZOMBIE_ANGRY = "angry";
private static final String KEY_PIG_ZOMBIE_ANGER = "anger";
@@ -3079,6 +3085,18 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
}
}
break;
case PHANTOM:
MCPhantom phantom = (MCPhantom) entity;
for(String index : specArray.stringKeySet()) {
switch(index.toLowerCase()) {
case entity_spec.KEY_PHANTOM_SIZE:
phantom.setSize(ArgumentValidation.getInt32(specArray.get(index, t), t));
break;
default:
throwException(index, t);
}
}
break;
case PIG:
MCPig pig = (MCPig) entity;
for(String index : specArray.stringKeySet()) {
@@ -200,6 +200,10 @@ without knowing the rotations on the other axis or of other body parts beforehan
* %KEY_GENERIC_SITTING%: If the parrot is sitting.
* %KEY_PARROT_TYPE%: The type of the parrot (can be %PARROT_TYPE%).
|-
| PHANTOM
|
* %KEY_PHANTOM_SIZE%: The size of the phantom. Clamped to 0 - 64 (default: 0). Phantoms deal (6 + size) damage.
|-
| PIG
|
* %KEY_PIG_SADDLED%: If the pig has a saddle.

0 comments on commit b1511e0

Please sign in to comment.