promotional bannermobile promotional banner
premium banner
ZenUtils is a crafttweaker addon

Description

NOTE: I'm korean and not good at english. if you see a wrong translation, please comment.

 

ZenUtils is a crafttweaker addon that adds useful methods to crafttweaker

 

current feature

 

-IAxisAlignedBB

-Get Entities from world by IAxisAlignedBB

 

IAxisAlignedBB

ZenGetter
: double minX ,double minY,double minZ,double maxX,double maxY,double maxZ

ZenMethod
:
IAxisAlignedBB contract(double x, double y, double z)
IAxisAlignedBB expand(double x, double y, double z)
IAxisAlignedBB grow(double x, double y, double z)
IAxisAlignedBB grow(double value)
IAxisAlignedBB intersect(IAxisAlignedBB other)
boolean intersects(IAxisAlignedBB other)
IAxisAlignedBB union(IAxisAlignedBB other)
String toString()
IAxisAlignedBB create(double minX, double minY, double minZ, double maxX, double maxY, double maxZ)
IAxisAlignedBB create(IBlockPos pos) 

IWorld Expanded methods

List<IEntityItem> getEntityItemsWithinAABB(IAxisAlignedBB aabb)
List<IEntity> getEntitiesWithinAABB(IWorld world, IAxisAlignedBB aabb)

 Example

ZenScript code

import zenutils.aabb.IAxisAlignedBB;
import crafttweaker.event.PlayerInteractBlockEvent;
import crafttweaker.item.IItemStack;
import crafttweaker.entity.IEntity;
import crafttweaker.entity.IEntityItem;

events.onPlayerInteractBlock(function(event as PlayerInteractBlockEvent){
	if(compareItem(event.player.currentItem,<minecraft:apple>)){
		event.player.sendChat("start");	
		for entity in event.world.getEntityItemsWithinAABB(IAxisAlignedBB.create(event.position).expand(20,20,20)) {
			event.player.sendChat("Item Name: " + entity.item.name);
		}
		event.player.sendChat("end");
	}
}); 

function compareItem(input1 as IItemStack , input2 as IItemStack) as bool{
	if(input1.metadata == input2.metadata && input1.definition.id == input2.definition.id)
		return true;
	return false;
}

 

Result