Skip to content

Commit

Permalink
add IWorld#removeEntity (#1422)
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlyhj committed Dec 31, 2021
1 parent d5b0dc0 commit 6bd6f22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public interface IWorld extends IBlockAccess {

@ZenMethod
boolean spawnEntity(IEntity entity);

@ZenMethod
default void removeEntity(IEntity entity) {
CraftTweakerAPI.logError(this.getClass().getName() + " does not override IWorld.removeEntity, tell the author to fix that.");
}

@ZenMethod
default IRayTraceResult rayTraceBlocks(IVector3d begin, IVector3d ray, @Optional boolean stopOnLiquid, @Optional boolean ignoreBlockWithoutBoundingBox, @Optional(valueBoolean = true) boolean returnLastUncollidableBlock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ public Object getInternal() {
public boolean spawnEntity(IEntity entity) {
return world.spawnEntity(CraftTweakerMC.getEntity(entity));
}

@Override

@Override
public void removeEntity(IEntity entity) {
world.removeEntity(CraftTweakerMC.getEntity(entity));
}

@Override
public IRayTraceResult rayTraceBlocks(IVector3d begin, IVector3d ray, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock) {
return CraftTweakerMC.getIRayTraceResult(this.world.rayTraceBlocks(CraftTweakerMC.getVec3d(begin), CraftTweakerMC.getVec3d(ray), stopOnLiquid, ignoreBlockWithoutBoundingBox, returnLastUncollidableBlock));
}
Expand Down

0 comments on commit 6bd6f22

Please sign in to comment.