use of net.minecraft.server.v1_12_R1.Block in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCB3100 method fetchBounds.
@Override
public double[] fetchBounds(final int x, final int y, final int z) {
@SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
if (block == null) {
// TODO: Convention for null bounds -> full ?
return null;
}
// getData from cache.
block.updateShape(iBlockAccess, x, y, z);
// minX, minY, minZ, maxX, maxY, maxZ
return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
use of net.minecraft.server.v1_12_R1.Block in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCBDev method fetchBounds.
@Override
public double[] fetchBounds(final int x, final int y, final int z) {
final Material id = getType(x, y, z);
@SuppressWarnings("deprecation") final net.minecraft.server.v1_12_R1.Block block = net.minecraft.server.v1_12_R1.Block.getById(id.getId());
if (block == null) {
// TODO: Convention for null blocks -> full ?
return null;
}
final BlockPosition pos = new BlockPosition(x, y, z);
// TODO: Deprecation warning below (reason / substitute?).
@SuppressWarnings("deprecation") final AxisAlignedBB bb = block.b(iBlockAccess.getType(pos), iBlockAccess, pos);
if (bb == null) {
// Special case.
return new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 };
// return null;
}
// minX, minY, minZ, maxX, maxY, maxZ
return new double[] { bb.a, bb.b, bb.c, bb.d, bb.e, bb.f };
}
use of net.minecraft.server.v1_12_R1.Block in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCB2922 method fetchBounds.
@Override
public double[] fetchBounds(final int x, final int y, final int z) {
// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R1.Block block = net.minecraft.server.v1_7_R1.Block.e(id);
if (block == null)
return null;
// data from cache.
block.updateShape(iBlockAccess, x, y, z);
// minX, minY, minZ, maxX, maxY, maxZ
return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
use of net.minecraft.server.v1_12_R1.Block in project solinia3-core by mixxit.
the class SoliniaActiveSpell method apply.
public void apply(Plugin plugin) {
try {
ISoliniaSpell soliniaSpell = StateManager.getInstance().getConfigurationManager().getSpell(getSpellId());
if (soliniaSpell == null) {
System.out.print("Spell not found");
return;
}
Entity sourceEntity = Bukkit.getEntity(this.getSourceUuid());
if (sourceEntity == null || (!(sourceEntity instanceof LivingEntity)))
return;
ISoliniaLivingEntity solsource = SoliniaLivingEntityAdapter.Adapt((LivingEntity) sourceEntity);
if (solsource == null)
return;
if (isFirstRun) {
if (soliniaSpell.getCastOnYou() != null && !soliniaSpell.getCastOnYou().equals("") && isOwnerPlayer) {
Player player = Bukkit.getPlayer(getOwnerUuid());
player.sendMessage("* " + ChatColor.GRAY + soliniaSpell.getCastOnYou());
}
if (soliniaSpell.getCastOnOther() != null && !soliniaSpell.getCastOnOther().equals(""))
SoliniaLivingEntityAdapter.Adapt((LivingEntity) Bukkit.getEntity(getOwnerUuid())).emote(ChatColor.GRAY + "* " + this.getLivingEntity().getName() + soliniaSpell.getCastOnOther());
}
for (ActiveSpellEffect spellEffect : getActiveSpellEffects()) {
applySpellEffect(plugin, spellEffect, soliniaSpell, isFirstRun, solsource.getLevel());
}
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of net.minecraft.server.v1_12_R1.Block in project solinia3-core by mixxit.
the class SoliniaLivingEntity method doCheckForEnemies.
@Override
public void doCheckForEnemies() {
if (isPlayer())
return;
if (this.getNpcid() < 1)
return;
if (getBukkitLivingEntity().isDead())
return;
if (!(getBukkitLivingEntity() instanceof Creature))
return;
if (((Creature) getBukkitLivingEntity()).getTarget() != null)
return;
try {
ISoliniaNPC npc = StateManager.getInstance().getConfigurationManager().getNPC(this.getNpcid());
if (npc.getFactionid() == 0)
return;
ISoliniaFaction faction = StateManager.getInstance().getConfigurationManager().getFaction(npc.getFactionid());
if (faction.getName().equals("NEUTRAL") || faction.getName().equals("KOS"))
return;
for (Entity entity : getBukkitLivingEntity().getNearbyEntities(10, 10, 10)) {
if (!(entity instanceof Player))
continue;
if (entity.isDead())
continue;
Player player = (Player) entity;
ISoliniaPlayer solPlayer = SoliniaPlayerAdapter.Adapt(player);
PlayerFactionEntry factionEntry = solPlayer.getFactionEntry(npc.getFactionid());
if (factionEntry != null) {
switch(Utils.getFactionStandingType(factionEntry.getFactionId(), factionEntry.getValue())) {
case FACTION_THREATENLY:
case FACTION_SCOWLS:
if (Utils.isEntityInLineOfSight(player, getBukkitLivingEntity())) {
((Creature) getBukkitLivingEntity()).setTarget(player);
return;
} else {
continue;
}
default:
break;
}
}
}
} catch (CoreStateInitException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Aggregations