Permalink
Browse files

Fix FALLING_BLOCK in entity_spec() and add "damage" boolean

  • Loading branch information...
PseudoKnight committed Jun 4, 2018
1 parent 69483e7 commit 377fc5fd644d1ac902e78ad847ebf53b67df5a3f
@@ -40,6 +40,20 @@ public void setDropItem(boolean drop) {
f.setDropItem(drop);
}
@Override
public boolean canHurtEntities() {
return f.canHurtEntities();
}
@Override
public void setHurtEntities(boolean hurt) {
try {
f.setHurtEntities(hurt);
} catch(NoSuchMethodError ex) {
// probably prior to 1.8.8
}
}
@Override
public FallingBlock getHandle() {
return f;
@@ -4,14 +4,11 @@
import com.laytonsmith.abstraction.blocks.MCMaterial;
public interface MCFallingBlock extends MCEntity {
byte getBlockData();
int getBlockId();
boolean getDropItem();
MCMaterial getMaterial();
void setDropItem(boolean drop);
boolean canHurtEntities();
void setHurtEntities(boolean hurt);
}
@@ -1860,8 +1860,11 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
break;
case FALLING_BLOCK:
MCFallingBlock block = (MCFallingBlock) entity;
specArray.set(entity_spec.KEY_FALLING_BLOCK_BLOCK, new CInt(block.getMaterial().getName(), t), t);
specArray.set(entity_spec.KEY_FALLING_BLOCK_BLOCK, new CString(block.getMaterial().getName(), t), t);
specArray.set(entity_spec.KEY_FALLING_BLOCK_DROPITEM, CBoolean.get(block.getDropItem()), t);
if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_8_X)) {
specArray.set(entity_spec.KEY_FALLING_BLOCK_DAMAGE, CBoolean.get(block.canHurtEntities()), t);
}
break;
case FIREBALL:
case SMALL_FIREBALL:
@@ -2089,6 +2092,7 @@ public CHVersion since() {
private static final String KEY_EXPERIENCE_ORB_AMOUNT = "amount";
private static final String KEY_FALLING_BLOCK_BLOCK = "block";
private static final String KEY_FALLING_BLOCK_DROPITEM = "dropitem";
private static final String KEY_FALLING_BLOCK_DAMAGE = "damage";
private static final String KEY_FIREBALL_DIRECTION = "direction";
private static final String KEY_GUARDIAN_ELDER = "elder";
private static final String KEY_HORSE_COLOR = "color";
@@ -2462,6 +2466,9 @@ public Construct exec(Target t, Environment environment, Construct... args) thro
case entity_spec.KEY_FALLING_BLOCK_DROPITEM:
block.setDropItem(Static.getBoolean(specArray.get(index, t), t));
break;
case entity_spec.KEY_FALLING_BLOCK_DAMAGE:
block.setHurtEntities(Static.getBoolean(specArray.get(index, t), t));
break;
default:
throwException(index, t);
}
@@ -78,6 +78,7 @@ without knowing the rotations on the other axis or of other body parts beforehan
|
* %KEY_FALLING_BLOCK_BLOCK%: The falling block. Not editable.
* %KEY_FALLING_BLOCK_DROPITEM%: If the falling block will break into an item if it cannot be placed.
* %KEY_FALLING_BLOCK_DAMAGE%: If the falling block can damage entities.
|-
| FIREBALL
|

0 comments on commit 377fc5f

Please sign in to comment.