use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.
the class RenderMasterStone method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity tileEntity, double d0, double d1, double d2, float f) {
if (tileEntity instanceof TEMasterStone) {
String str = ((TEMasterStone) tileEntity).getCurrentRitual();
MRSRenderer renderer = Rituals.getRendererForKey(str);
if (renderer != null) {
renderer.renderAt(((TEMasterStone) tileEntity), d0, d1, d2);
}
}
}
use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.
the class BlockMasterStone method onBlockHarvested.
@Override
public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TEMasterStone) {
((TEMasterStone) tile).useOnRitualBroken();
}
super.onBlockHarvested(world, x, y, z, meta, player);
}
use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.
the class BlockMasterStone method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are) {
TEMasterStone tileEntity = (TEMasterStone) world.getTileEntity(x, y, z);
if (tileEntity == null || player.isSneaking()) {
return false;
}
ItemStack playerItem = player.getCurrentEquippedItem();
if (playerItem == null) {
return false;
}
Item item = playerItem.getItem();
if (!(item instanceof ActivationCrystal)) {
return false;
}
ActivationCrystal acItem = (ActivationCrystal) item;
// tileEntity.setOwner(acItem.getOwnerName(playerItem));
tileEntity.activateRitual(world, acItem.getCrystalLevel(playerItem), playerItem, player, acItem.getOwnerName(playerItem));
world.markBlockForUpdate(x, y, z);
return true;
}
use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.
the class BlockMasterStone method onBlockDestroyedByExplosion.
@Override
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
super.onBlockDestroyedByExplosion(world, x, y, z, explosion);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TEMasterStone) {
((TEMasterStone) tile).useOnRitualBrokenExplosion();
}
}
use of WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone in project BloodMagic by WayofTime.
the class AlchemicalWizardryEventHooks method onLivingSpawnEvent.
@SubscribeEvent
public void onLivingSpawnEvent(CheckSpawn event) {
if (!(event.entityLiving instanceof EntityMob)) {
return;
}
String respawnRitual = "AW028SpawnWard";
int dimension = event.world.provider.dimensionId;
if (respawnMap.containsKey(dimension)) {
List<CoordAndRange> list = respawnMap.get(dimension);
if (list != null) {
for (CoordAndRange coords : list) {
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(respawnRitual)) {
if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius && event.z > coords.zCoord - coords.horizRadius && event.z < coords.zCoord + coords.horizRadius && event.y > coords.yCoord - coords.vertRadius && event.y < coords.yCoord + coords.vertRadius) {
switch(event.getResult()) {
case ALLOW:
event.setResult(Result.DEFAULT);
break;
case DEFAULT:
event.setResult(Result.DENY);
break;
case DENY:
break;
default:
break;
}
break;
}
} else {
list.remove(coords);
}
}
}
}
if (event.entityLiving instanceof EntityCreeper) {
return;
}
String forceSpawnRitual = "AW029VeilOfEvil";
if (forceSpawnMap.containsKey(dimension)) {
List<CoordAndRange> list = forceSpawnMap.get(dimension);
if (list != null) {
for (CoordAndRange coords : list) {
TileEntity tile = event.world.getTileEntity(coords.xCoord, coords.yCoord, coords.zCoord);
if (tile instanceof TEMasterStone && ((TEMasterStone) tile).isRunning && ((TEMasterStone) tile).getCurrentRitual().equals(forceSpawnRitual)) {
if (event.x > coords.xCoord - coords.horizRadius && event.x < coords.xCoord + coords.horizRadius && event.z > coords.zCoord - coords.horizRadius && event.z < coords.zCoord + coords.horizRadius && event.y > coords.yCoord - coords.vertRadius && event.y < coords.yCoord + coords.vertRadius) {
switch(event.getResult()) {
case ALLOW:
break;
case DEFAULT:
event.setResult(Result.ALLOW);
break;
case DENY:
event.setResult(Result.DEFAULT);
break;
default:
break;
}
break;
}
} else {
list.remove(coords);
}
}
}
}
}
Aggregations