Remove 10000+ unnecessary object creation
This commit is contained in:
@@ -881,7 +881,7 @@ public class RedstoneWireTurbo {
|
||||
// egg82's amendment
|
||||
// Adding Bukkit's BlockRedstoneEvent - er.. event.
|
||||
if (i != j) {
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(worldIn.getWorld().getBlockAt(upd.self.getX(), upd.self.getY(), upd.self.getZ()), i, j);
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(worldIn.getWorld().getBlockAt(upd.self), i, j); // Akarin
|
||||
worldIn.getServer().getPluginManager().callEvent(event);
|
||||
j = event.getNewCurrent();
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class Block implements IMaterial {
|
||||
if (io.akarin.server.core.AkarinGlobalConfig.fixPhysicsEventBehaviour && ((WorldServer) generatoraccess).hasPhysicsEvent) {
|
||||
CraftWorld world = ((WorldServer) generatoraccess).getWorld();
|
||||
if (world != null) {
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata), world.getBlockAt(sourceBlockPosition.getX(), sourceBlockPosition.getY(), sourceBlockPosition.getZ()));
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition), CraftBlockData.fromData(iblockdata), world.getBlockAt(sourceBlockPosition)); // Akarin
|
||||
((WorldServer) generatoraccess).getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class BlockButtonAbstract extends BlockAttachable {
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
boolean powered = ((Boolean) iblockdata.get(POWERED));
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
int old = (powered) ? 15 : 0;
|
||||
int current = (!powered) ? 15 : 0;
|
||||
|
||||
@@ -132,7 +132,7 @@ public abstract class BlockButtonAbstract extends BlockAttachable {
|
||||
this.b(iblockdata, world, blockposition);
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
@@ -162,7 +162,7 @@ public abstract class BlockButtonAbstract extends BlockAttachable {
|
||||
|
||||
// CraftBukkit start - Call interact event when arrows turn on wooden buttons
|
||||
if (flag1 != flag && flag) {
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
boolean allowed = false;
|
||||
|
||||
// If all of the events are cancelled block the button press, else allow
|
||||
@@ -187,7 +187,7 @@ public abstract class BlockButtonAbstract extends BlockAttachable {
|
||||
if (flag != flag1) {
|
||||
// CraftBukkit start
|
||||
boolean powered = flag1;
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
int old = (powered) ? 15 : 0;
|
||||
int current = (!powered) ? 15 : 0;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class BlockCactus extends Block {
|
||||
}
|
||||
|
||||
public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
|
||||
CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition); // CraftBukkit // Akarin
|
||||
entity.damageEntity(DamageSource.CACTUS, 1.0F);
|
||||
CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ public class BlockCauldron extends Block {
|
||||
private boolean changeLevel(World world, BlockPosition blockposition, IBlockData iblockdata, int i, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
|
||||
int newLevel = Integer.valueOf(MathHelper.clamp(i, 0, 3));
|
||||
CauldronLevelChangeEvent event = new CauldronLevelChangeEvent(
|
||||
world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()),
|
||||
world.getWorld().getBlockAt(blockposition), // Akarin
|
||||
(entity == null) ? null : entity.getBukkitEntity(), reason, iblockdata.get(BlockCauldron.LEVEL), newLevel
|
||||
);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class BlockCommand extends BlockTileEntity {
|
||||
boolean flag = world.isBlockIndirectlyPowered(blockposition);
|
||||
boolean flag1 = tileentitycommand.d();
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
int old = flag1 ? 15 : 0;
|
||||
int current = flag ? 15 : 0;
|
||||
|
||||
|
||||
@@ -168,9 +168,9 @@ public class BlockDoor extends Block {
|
||||
// CraftBukkit start
|
||||
BlockPosition otherHalf = blockposition.shift(iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN);
|
||||
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block blockTop = bworld.getBlockAt(otherHalf.getX(), otherHalf.getY(), otherHalf.getZ());
|
||||
org.bukkit.craftbukkit.CraftWorld bworld = world.getWorld(); // Akarin - CraftWorld
|
||||
org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(blockposition); // Akarin
|
||||
org.bukkit.block.Block blockTop = bworld.getBlockAt(otherHalf); // Akarin
|
||||
|
||||
int power = bukkitBlock.getBlockPower();
|
||||
int powerTop = blockTop.getBlockPower();
|
||||
|
||||
@@ -29,8 +29,8 @@ public class BlockDragonEgg extends BlockFalling {
|
||||
|
||||
if (world.getType(blockposition1).isAir()) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block from = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block to = world.getWorld().getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ());
|
||||
org.bukkit.block.Block from = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
org.bukkit.block.Block to = world.getWorld().getBlockAt(blockposition1); // Akarin
|
||||
BlockFromToEvent event = new BlockFromToEvent(from, to);
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
|
||||
@@ -218,8 +218,8 @@ public class BlockFire extends Block {
|
||||
//IBlockData iblockdata = world.getType(blockposition); // Paper
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block sourceBlock = world.getWorld().getBlockAt(sourceposition.getX(), sourceposition.getY(), sourceposition.getZ());
|
||||
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
org.bukkit.block.Block sourceBlock = world.getWorld().getBlockAt(sourceposition); // Akarin
|
||||
|
||||
BlockBurnEvent event = new BlockBurnEvent(theBlock, sourceBlock);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BlockLeaves extends Block {
|
||||
public void b(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
|
||||
if (!(Boolean) iblockdata.get(BlockLeaves.PERSISTENT) && (Integer) iblockdata.get(BlockLeaves.DISTANCE) == 7) {
|
||||
// CraftBukkit start
|
||||
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition)); // Akarin
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled() || world.getType(blockposition).getBlock() != this) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class BlockLever extends BlockAttachable {
|
||||
} else {
|
||||
// CraftBukkit start - Interact Lever
|
||||
boolean powered = !flag; // Old powered state
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
int old = (powered) ? 15 : 0;
|
||||
int current = (!powered) ? 15 : 0;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ public class BlockMagma extends Block {
|
||||
|
||||
public void stepOn(World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!entity.isFireProof() && entity instanceof EntityLiving && !EnchantmentManager.i((EntityLiving) entity)) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition); // CraftBukkit // Akarin
|
||||
entity.damageEntity(DamageSource.HOT_FLOOR, 1.0F);
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
|
||||
|
||||
// CraftBukkit start
|
||||
if (flag != flag1) {
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
@@ -13,6 +13,8 @@ import java.util.Iterator;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
@@ -119,7 +121,7 @@ public class BlockPiston extends BlockDirectional {
|
||||
|
||||
// CraftBukkit start
|
||||
//if (!this.sticky) { // Paper - Prevents empty sticky pistons from firing retract - history behind is odd
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.<org.bukkit.block.Block>of(), CraftBlock.notchToBlockFace(enumdirection));
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -302,7 +304,7 @@ public class BlockPiston extends BlockDirectional {
|
||||
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.opposite();
|
||||
Set<BlockPosition> set = Sets.newHashSet(list);
|
||||
// CraftBukkit start
|
||||
final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
|
||||
final List<BlockPosition> moved = pistonextendschecker.getMovedBlocks();
|
||||
final List<BlockPosition> broken = pistonextendschecker.getBrokenBlocks();
|
||||
@@ -320,7 +322,7 @@ public class BlockPiston extends BlockDirectional {
|
||||
throw new ArrayIndexOutOfBoundsException(index);
|
||||
}
|
||||
BlockPosition pos = (BlockPosition) (index < moved.size() ? moved.get(index) : broken.get(index - moved.size()));
|
||||
return bblock.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
return ((CraftWorld) bblock.getWorld()).getBlockAt(pos); // Akarin
|
||||
}
|
||||
};
|
||||
org.bukkit.event.block.BlockPistonEvent event;
|
||||
|
||||
@@ -340,7 +340,7 @@ public class BlockPortal extends Block {
|
||||
|
||||
// CraftBukkit start - return boolean
|
||||
public boolean createPortal() {
|
||||
org.bukkit.World bworld = this.a.getMinecraftWorld().getWorld();
|
||||
org.bukkit.craftbukkit.CraftWorld bworld = this.a.getMinecraftWorld().getWorld(); // Akarin
|
||||
|
||||
// Copy below for loop
|
||||
for (int i = 0; i < this.width; ++i) {
|
||||
@@ -348,7 +348,7 @@ public class BlockPortal extends Block {
|
||||
|
||||
for (int j = 0; j < this.height; ++j) {
|
||||
BlockPosition pos = blockposition.up(j);
|
||||
blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
blocks.add(bworld.getBlockAt(pos)); // Akarin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,11 +68,11 @@ public abstract class BlockPressurePlateAbstract extends Block {
|
||||
boolean flag1 = j > 0;
|
||||
|
||||
// CraftBukkit start - Interact Pressure Plate
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.craftbukkit.CraftWorld bworld = world.getWorld(); // Akarin - CraftWorld
|
||||
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
|
||||
if (flag != flag1) {
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j);
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(blockposition), i, j); // Akarin
|
||||
manager.callEvent(eventRedstone);
|
||||
|
||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
|
||||
@@ -65,14 +65,14 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
|
||||
|
||||
// CraftBukkit start - Call interact event when turning on a pressure plate
|
||||
if (this.getPower(world.getType(blockposition)) == 0) {
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.craftbukkit.CraftWorld bworld = world.getWorld(); // Akarin - CraftWorld
|
||||
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
|
||||
if (entity instanceof EntityHuman) {
|
||||
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
} else {
|
||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(blockposition)); // Akarin
|
||||
manager.callEvent((EntityInteractEvent) cancellable);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
|
||||
if (entity instanceof EntityHuman) {
|
||||
cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
} else {
|
||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition)); // Akarin
|
||||
world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BlockRedstoneOre extends Block {
|
||||
super.stepOn(world, blockposition, entity);
|
||||
}
|
||||
} else {
|
||||
EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition)); // Akarin
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
interact(world.getType(blockposition), world, blockposition, entity); // add entity
|
||||
|
||||
@@ -77,7 +77,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
int oldCurrent = ((Boolean) iblockdata.get(BlockRedstoneTorch.LIT)).booleanValue() ? 15 : 0;
|
||||
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
||||
|
||||
@@ -336,7 +336,7 @@ public class BlockRedstoneWire extends Block {
|
||||
|
||||
// CraftBukkit start
|
||||
if (i != j) {
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j);
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition), i, j); // Akarin
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
j = event.getNewCurrent();
|
||||
|
||||
@@ -75,7 +75,7 @@ public class BlockSoil extends Block {
|
||||
if (entity instanceof EntityHuman) {
|
||||
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
} else {
|
||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition)); // Akarin
|
||||
world.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public class BlockSponge extends Block {
|
||||
// CraftBukkit start
|
||||
List<CraftBlockState> blocks = blockList.getList(); // Is a clone
|
||||
if (!blocks.isEmpty()) {
|
||||
final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
|
||||
SpongeAbsorbEvent event = new SpongeAbsorbEvent(bblock, (List<org.bukkit.block.BlockState>) (List) blocks);
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
|
||||
public class BlockTrapdoor extends BlockFacingHorizontal implements IFluidSource, IFluidContainer {
|
||||
@@ -91,7 +93,7 @@ public class BlockTrapdoor extends BlockFacingHorizontal implements IFluidSource
|
||||
if (flag != (Boolean) iblockdata.get(BlockTrapdoor.c)) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block bblock = ((CraftWorld) bworld).getBlockAt(blockposition); // Akarin
|
||||
|
||||
int power = bblock.getBlockPower();
|
||||
int oldPower = (Boolean) iblockdata.get(OPEN) ? 15 : 0;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
||||
|
||||
public class BlockTripwire extends Block {
|
||||
@@ -140,7 +141,7 @@ public class BlockTripwire extends Block {
|
||||
if (flag != flag1 && flag1 && (Boolean)iblockdata.get(ATTACHED)) {
|
||||
org.bukkit.World bworld = world.getWorld();
|
||||
org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
|
||||
org.bukkit.block.Block block = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = ((CraftWorld) bworld).getBlockAt(blockposition); // Akarin
|
||||
boolean allowed = false;
|
||||
|
||||
// If all of the events are cancelled block the tripwire trigger, else allow
|
||||
|
||||
@@ -137,7 +137,7 @@ public class BlockTripwireHook extends Block {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
|
||||
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
|
||||
world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
|
||||
@@ -189,7 +189,7 @@ public class ContainerEnchantTable extends Container {
|
||||
offers[j] = (enchantment != null) ? new EnchantmentOffer(enchantment, this.i[j], this.costs[j]) : null;
|
||||
}
|
||||
|
||||
PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), item, offers, i);
|
||||
PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(position), item, offers, i); // Akarin
|
||||
event.setCancelled(!itemstack.canEnchant());
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -251,7 +251,7 @@ public class ContainerEnchantTable extends Container {
|
||||
}
|
||||
CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), item, this.costs[i], enchants, i);
|
||||
EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), this.world.getWorld().getBlockAt(position), item, this.costs[i], enchants, i); // Akarin
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
int level = event.getExpLevelCost();
|
||||
|
||||
@@ -56,7 +56,7 @@ public class DispenseBehaviorItem implements IDispenseBehavior {
|
||||
entityitem.motZ += world.random.nextGaussian() * 0.007499999832361937D * (double) i;
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(entityitem.motX, entityitem.motY, entityitem.motZ));
|
||||
|
||||
@@ -18,7 +18,7 @@ public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
|
||||
// iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.getPower(), this.a());
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ()));
|
||||
|
||||
@@ -118,7 +118,7 @@ public class DispenserRegistry {
|
||||
// CraftBukkit start
|
||||
World world = isourceblock.getWorld();
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
@@ -168,7 +168,7 @@ public class DispenserRegistry {
|
||||
// CraftBukkit start
|
||||
World world = isourceblock.getWorld();
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1, d2));
|
||||
@@ -220,7 +220,7 @@ public class DispenserRegistry {
|
||||
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d3, d4, d5));
|
||||
@@ -278,7 +278,7 @@ public class DispenserRegistry {
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
Material material = iblockdata.getMaterial();
|
||||
if (world.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || ((iblockdata.getBlock() instanceof IFluidContainer) && ((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, itembucket.fluidType))) {
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z));
|
||||
@@ -347,7 +347,7 @@ public class DispenserRegistry {
|
||||
Item item = fluidtype.b();
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
@@ -393,7 +393,7 @@ public class DispenserRegistry {
|
||||
World world = isourceblock.getWorld();
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
@@ -449,7 +449,7 @@ public class DispenserRegistry {
|
||||
World world = isourceblock.getWorld();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING));
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0));
|
||||
@@ -511,7 +511,7 @@ public class DispenserRegistry {
|
||||
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D));
|
||||
@@ -563,7 +563,7 @@ public class DispenserRegistry {
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
@@ -610,7 +610,7 @@ public class DispenserRegistry {
|
||||
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
@@ -843,7 +843,7 @@ public class DispenserRegistry {
|
||||
EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP;
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block bukkitBlock = isourceblock.getWorld().getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block bukkitBlock = isourceblock.getWorld().getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
@@ -918,7 +918,7 @@ public class DispenserRegistry {
|
||||
// EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
|
||||
// CraftBukkit start
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
|
||||
@@ -433,7 +433,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
// CraftBukkit start - Add blocks to list rather than destroying them
|
||||
// flag1 = this.world.setAir(blockposition) || flag1;
|
||||
flag1 = true;
|
||||
destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
|
||||
destroyedBlocks.add(craftWorld.getBlockAt(blockposition)); // Akarin
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
flag = true;
|
||||
|
||||
@@ -1410,7 +1410,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
org.bukkit.block.Block bed;
|
||||
BlockPosition blockposition = this.bedPosition;
|
||||
if (blockposition != null) {
|
||||
bed = this.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
bed = this.world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
} else {
|
||||
bed = this.world.getWorld().getBlockAt(player.getLocation());
|
||||
}
|
||||
|
||||
@@ -190,14 +190,14 @@ public class Explosion {
|
||||
|
||||
if (this.b) {
|
||||
// CraftBukkit start
|
||||
org.bukkit.World bworld = this.world.getWorld();
|
||||
org.bukkit.craftbukkit.CraftWorld bworld = this.world.getWorld(); // Akarin - CraftWorld
|
||||
org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity();
|
||||
Location location = new Location(bworld, this.posX, this.posY, this.posZ);
|
||||
|
||||
List<org.bukkit.block.Block> blockList = Lists.newArrayList();
|
||||
for (int i1 = this.blocks.size() - 1; i1 >= 0; i1--) {
|
||||
BlockPosition cpos = (BlockPosition) this.blocks.get(i1);
|
||||
org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ());
|
||||
org.bukkit.block.Block bblock = bworld.getBlockAt(cpos); // Akarin
|
||||
if (bblock.getType() != org.bukkit.Material.AIR) {
|
||||
blockList.add(bblock);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ItemArmor extends Item {
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
// CraftBukkit start
|
||||
World world = isourceblock.getWorld();
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityliving.bukkitEntity);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ItemHanging extends Item {
|
||||
if (!world.isClientSide) {
|
||||
// CraftBukkit start - fire HangingPlaceEvent
|
||||
Player who = (itemactioncontext.getEntity() == null) ? null : (Player) itemactioncontext.getEntity().getBukkitEntity();
|
||||
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(blockposition); // Akarin
|
||||
org.bukkit.block.BlockFace blockFace = org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection);
|
||||
|
||||
HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityhanging.getBukkitEntity(), who, blockClicked, blockFace);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ItemLeash extends Item {
|
||||
entityleash = EntityLeash.a(world, blockposition);
|
||||
|
||||
// CraftBukkit start - fire HangingPlaceEvent
|
||||
HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityleash.getBukkitEntity(), entityhuman != null ? (org.bukkit.entity.Player) entityhuman.getBukkitEntity() : null, world.getWorld().getBlockAt(i, j, k), org.bukkit.block.BlockFace.SELF);
|
||||
HangingPlaceEvent event = new HangingPlaceEvent((org.bukkit.entity.Hanging) entityleash.getBukkitEntity(), entityhuman != null ? (org.bukkit.entity.Player) entityhuman.getBukkitEntity() : null, world.getWorld().getBlockAt(blockposition), org.bukkit.block.BlockFace.SELF); // Akarin
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ItemMinecart extends Item {
|
||||
// CraftBukkit start
|
||||
// EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).b);
|
||||
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
org.bukkit.block.Block block2 = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
org.bukkit.block.Block block2 = world.getWorld().getBlockAt(isourceblock.getBlockPosition()); // Akarin
|
||||
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
|
||||
@@ -269,7 +269,7 @@ public final class MCUtil {
|
||||
}
|
||||
|
||||
public static org.bukkit.block.Block toBukkitBlock(World world, BlockPosition pos) {
|
||||
return world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
return world.getWorld().getBlockAt(pos); // Akarin
|
||||
}
|
||||
|
||||
public static BlockPosition toBlockPosition(Location loc) {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PortalTravelAgent {
|
||||
// Paper start
|
||||
BlockPosition pos = new BlockPosition(k1, l1, i2);
|
||||
nmsBlocks.put(pos, flag2 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
|
||||
bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
bukkitBlocks.add(this.world.getWorld().getBlockAt(pos)); // Akarin
|
||||
// Paper end
|
||||
}
|
||||
}
|
||||
@@ -452,7 +452,7 @@ public class PortalTravelAgent {
|
||||
// Paper start
|
||||
BlockPosition pos = new BlockPosition(j3, l3, i4);
|
||||
nmsBlocks.put(pos, flag1 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
|
||||
bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
bukkitBlocks.add(this.world.getWorld().getBlockAt(pos)); // Akarin
|
||||
// Paper end
|
||||
}
|
||||
}
|
||||
@@ -466,7 +466,7 @@ public class PortalTravelAgent {
|
||||
// Paper start
|
||||
BlockPosition pos = new BlockPosition(blockposition_mutableblockposition.getX(), blockposition_mutableblockposition.getY(), blockposition_mutableblockposition.getZ());
|
||||
nmsBlocks.put(pos, Blocks.OBSIDIAN.getBlockData());
|
||||
bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
bukkitBlocks.add(this.world.getWorld().getBlockAt(pos)); // Akarin
|
||||
// Paper end
|
||||
}
|
||||
}
|
||||
@@ -481,7 +481,7 @@ public class PortalTravelAgent {
|
||||
// Paper start
|
||||
BlockPosition pos = new BlockPosition(blockposition_mutableblockposition.getX(), blockposition_mutableblockposition.getY(), blockposition_mutableblockposition.getZ());
|
||||
nmsBlocks.put(pos, iblockdata);
|
||||
bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
||||
bukkitBlocks.add(this.world.getWorld().getBlockAt(pos)); // Akarin
|
||||
// Paper end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class SlotFurnaceResult extends Slot {
|
||||
// CraftBukkit start - fire FurnaceExtractEvent
|
||||
Player player = (Player) a.getBukkitEntity();
|
||||
TileEntityFurnace furnace = ((TileEntityFurnace) this.inventory);
|
||||
org.bukkit.block.Block block = a.world.getWorld().getBlockAt(furnace.position.getX(), furnace.position.getY(), furnace.position.getZ());
|
||||
org.bukkit.block.Block block = a.world.getWorld().getBlockAt(furnace.position); // Akarin
|
||||
|
||||
if (b != 0) {
|
||||
FurnaceExtractEvent event = new FurnaceExtractEvent(player, block, org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(itemstack.getItem()), b, i);
|
||||
|
||||
@@ -216,7 +216,7 @@ public abstract class TileEntity implements KeyedObject { // Paper
|
||||
// Paper end
|
||||
if (world == null) return null;
|
||||
// Spigot start
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(position); // Akarin
|
||||
if (block == null) {
|
||||
org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "No block for owner at %s %d %d %d", new Object[]{world.getWorld(), position.getX(), position.getY(), position.getZ()});
|
||||
return null;
|
||||
|
||||
@@ -147,7 +147,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IWorldInven
|
||||
EntityHuman entityhuman;
|
||||
|
||||
// Paper start - BeaconEffectEvent
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
org.bukkit.block.Block block = world.getWorld().getBlockAt(position); // Akarin
|
||||
PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffect(effects, i, b0, true, true));
|
||||
// Paper end
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl
|
||||
|
||||
if (this.fuelLevel <= 0 && itemstack.getItem() == Items.BLAZE_POWDER) {
|
||||
// CraftBukkit start
|
||||
BrewingStandFuelEvent event = new BrewingStandFuelEvent(world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), CraftItemStack.asCraftMirror(itemstack), 20);
|
||||
BrewingStandFuelEvent event = new BrewingStandFuelEvent(world.getWorld().getBlockAt(position), CraftItemStack.asCraftMirror(itemstack), 20); // Akarin
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
@@ -201,7 +201,7 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl
|
||||
// CraftBukkit start
|
||||
InventoryHolder owner = this.getOwner();
|
||||
if (owner != null) {
|
||||
BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), (org.bukkit.inventory.BrewerInventory) owner.getInventory(), this.fuelLevel);
|
||||
BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(position), (org.bukkit.inventory.BrewerInventory) owner.getInventory(), this.fuelLevel); // Akarin
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
|
||||
@@ -363,7 +363,7 @@ public class TileEntityFurnace extends TileEntityContainer implements IWorldInve
|
||||
CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
|
||||
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
|
||||
|
||||
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), source, result);
|
||||
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(position), source, result); // Akarin
|
||||
this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
|
||||
|
||||
if (furnaceSmeltEvent.isCancelled()) {
|
||||
|
||||
@@ -430,7 +430,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
// CraftBukkit start - capture blockstates
|
||||
CraftBlockState blockstate = null;
|
||||
if (this.captureBlockStates) {
|
||||
blockstate = (CraftBlockState) world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); // Paper - use CB getState to get a suitable snapshot
|
||||
blockstate = (CraftBlockState) world.getBlockAt(blockposition).getState(); // Paper - use CB getState to get a suitable snapshot // Akarin
|
||||
this.capturedBlockStates.add(blockstate);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -531,7 +531,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
iblockdata1.b(this, blockposition, j); // Don't call an event for the old block to limit event spam
|
||||
CraftWorld world = ((WorldServer) this).getWorld();
|
||||
if (world != null && ((WorldServer)this).hasPhysicsEvent && !io.akarin.server.core.AkarinGlobalConfig.fixPhysicsEventBehaviour) { // Paper // Akarin - fixes physics event
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition), CraftBlockData.fromData(iblockdata)); // Akarin
|
||||
this.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
@@ -641,12 +641,12 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
|
||||
public void applyPhysics(BlockPosition blockposition, Block block) {
|
||||
if (captureBlockStates) { return; } // Paper - Cancel all physics during placement
|
||||
this.a(blockposition.west(), block, blockposition);
|
||||
this.a(blockposition.east(), block, blockposition);
|
||||
this.a(blockposition.down(), block, blockposition);
|
||||
this.a(blockposition.up(), block, blockposition);
|
||||
this.a(blockposition.north(), block, blockposition);
|
||||
this.a(blockposition.south(), block, blockposition);
|
||||
this.a(blockposition.shiftX(-1), block, blockposition); // Akarin - west
|
||||
this.a(blockposition.shiftX(2), block, blockposition); // Akarin - east
|
||||
this.a(blockposition.shiftX(-1).shiftY(-1), block, blockposition); // Akarin - down
|
||||
this.a(blockposition.shiftY(2), block, blockposition); // Akarin - up
|
||||
this.a(blockposition.shiftY(-1).shiftZ(-1), block, blockposition); // Akarin - north
|
||||
this.a(blockposition.shiftZ(2), block, blockposition); // Akarin - south
|
||||
}
|
||||
|
||||
public void a(BlockPosition blockposition, Block block, EnumDirection enumdirection) {
|
||||
@@ -685,7 +685,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
||||
// CraftBukkit start
|
||||
CraftWorld world = ((WorldServer) this).getWorld();
|
||||
if (world != null && ((WorldServer)this).hasPhysicsEvent) { // Paper
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata), world.getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()));
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition), CraftBlockData.fromData(iblockdata), world.getBlockAt(blockposition)); // Akarin
|
||||
this.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
|
||||
@@ -116,7 +116,7 @@ public class CraftChunk implements Chunk {
|
||||
}
|
||||
|
||||
BlockPosition position = (BlockPosition) obj;
|
||||
entities[index++] = worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(useSnapshot); // Paper
|
||||
entities[index++] = worldServer.getWorld().getBlockAt(position).getState(useSnapshot); // Paper // Akarin
|
||||
}
|
||||
|
||||
return entities;
|
||||
|
||||
@@ -124,6 +124,11 @@ public class CraftWorld implements World {
|
||||
}
|
||||
}
|
||||
|
||||
// Akarin start
|
||||
public Block getBlockAt(BlockPosition blockPosition) {
|
||||
return CraftBlock.at(world, blockPosition);
|
||||
}
|
||||
// Akarin end
|
||||
public Block getBlockAt(int x, int y, int z) {
|
||||
return CraftBlock.at(world, new BlockPosition(x, y, z));
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class CraftBlockState implements BlockState {
|
||||
}
|
||||
|
||||
public static CraftBlockState getBlockState(net.minecraft.server.World world, net.minecraft.server.BlockPosition pos, int flag) {
|
||||
return new CraftBlockState(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), flag);
|
||||
return new CraftBlockState(world.getWorld().getBlockAt(pos), flag); // Akarin
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
|
||||
@@ -296,7 +296,7 @@ public class CraftEventFactory {
|
||||
|
||||
Block blockClicked = null;
|
||||
if (position != null) {
|
||||
blockClicked = craftWorld.getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
blockClicked = craftWorld.getBlockAt(position); // Akarin
|
||||
} else {
|
||||
switch (action) {
|
||||
case LEFT_CLICK_BLOCK:
|
||||
@@ -586,7 +586,7 @@ public class CraftEventFactory {
|
||||
CraftBlockState state = CraftBlockState.getBlockState(world, target, flag);
|
||||
state.setData(block);
|
||||
|
||||
BlockSpreadEvent event = new BlockSpreadEvent(world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ()), world.getWorld().getBlockAt(source.getX(), source.getY(), source.getZ()), state);
|
||||
BlockSpreadEvent event = new BlockSpreadEvent(world.getWorld().getBlockAt(target), world.getWorld().getBlockAt(source), state); // Akarin
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
@@ -926,7 +926,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static boolean handleBlockGrowEvent(World world, BlockPosition pos, IBlockData newData, int flag) {
|
||||
Block block = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
Block block = world.getWorld().getBlockAt(pos); // Akarin
|
||||
CraftBlockState state = (CraftBlockState) block.getState();
|
||||
state.setData(newData);
|
||||
|
||||
@@ -977,7 +977,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, BlockPosition position, IBlockData newBlock, boolean cancelled) {
|
||||
Block block = entity.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
Block block = entity.world.getWorld().getBlockAt(position); // Akarin
|
||||
|
||||
EntityChangeBlockEvent event = new EntityChangeBlockEvent(entity.getBukkitEntity(), block, CraftBlockData.fromData(newBlock));
|
||||
event.setCancelled(cancelled);
|
||||
@@ -1096,13 +1096,13 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static BlockRedstoneEvent callRedstoneChange(World world, BlockPosition pos, int oldCurrent, int newCurrent) {
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), oldCurrent, newCurrent);
|
||||
BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(pos), oldCurrent, newCurrent); // Akarin
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public static NotePlayEvent callNotePlayEvent(World world, BlockPosition pos, BlockPropertyInstrument instrument, int note) {
|
||||
NotePlayEvent event = new NotePlayEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), org.bukkit.Instrument.getByType((byte) instrument.ordinal()), new org.bukkit.Note(note));
|
||||
NotePlayEvent event = new NotePlayEvent(world.getWorld().getBlockAt(pos), org.bukkit.Instrument.getByType((byte) instrument.ordinal()), new org.bukkit.Note(note)); // Akarin
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
@@ -1114,8 +1114,8 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static BlockIgniteEvent callBlockIgniteEvent(World world, BlockPosition block, BlockPosition source) {
|
||||
org.bukkit.World bukkitWorld = world.getWorld();
|
||||
Block igniter = bukkitWorld.getBlockAt(source.getX(), source.getY(), source.getZ());
|
||||
org.bukkit.craftbukkit.CraftWorld bukkitWorld = world.getWorld(); // Akarin
|
||||
Block igniter = bukkitWorld.getBlockAt(source); // Akarin
|
||||
IgniteCause cause;
|
||||
switch (igniter.getType()) {
|
||||
case LAVA:
|
||||
@@ -1129,7 +1129,7 @@ public class CraftEventFactory {
|
||||
cause = IgniteCause.SPREAD;
|
||||
}
|
||||
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(block.getX(), block.getY(), block.getZ()), cause, igniter);
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(bukkitWorld.getBlockAt(block), cause, igniter); // Akarin
|
||||
if (isWorldGen(world)) return event; // Paper - do not call during world gen
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
@@ -1170,7 +1170,7 @@ public class CraftEventFactory {
|
||||
}
|
||||
|
||||
public static BlockIgniteEvent callBlockIgniteEvent(World world, BlockPosition pos, IgniteCause cause, Entity igniter) {
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), cause, igniter.getBukkitEntity());
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(world.getWorld().getBlockAt(pos), cause, igniter.getBukkitEntity()); // Akarin
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
@@ -1316,7 +1316,7 @@ public class CraftEventFactory {
|
||||
*/
|
||||
public static SpawnerSpawnEvent callSpawnerSpawnEvent(Entity spawnee, BlockPosition pos) {
|
||||
org.bukkit.craftbukkit.entity.CraftEntity entity = spawnee.getBukkitEntity();
|
||||
BlockState state = entity.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState();
|
||||
BlockState state = ((CraftWorld) entity.getWorld()).getBlockAt(pos).getState(); // Akarin
|
||||
if (!(state instanceof org.bukkit.block.CreatureSpawner)) {
|
||||
state = null;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CraftBlockProjectileSource implements BlockProjectileSource {
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return dispenserBlock.getWorld().getWorld().getBlockAt(dispenserBlock.getPosition().getX(), dispenserBlock.getPosition().getY(), dispenserBlock.getPosition().getZ());
|
||||
return dispenserBlock.getWorld().getWorld().getBlockAt(dispenserBlock.getPosition()); // Akarin
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ public class CraftRayTraceResult {
|
||||
Block hitBlock = null;
|
||||
BlockPosition nmsBlockPos = nmsHitResult.getBlockPosition();
|
||||
if (nmsBlockPos != null && world != null) {
|
||||
hitBlock = world.getBlockAt(nmsBlockPos.getX(), nmsBlockPos.getY(), nmsBlockPos.getZ());
|
||||
hitBlock = world.getBlockAt(nmsBlockPos.getX(), nmsBlockPos.getY(), nmsBlockPos.getZ()); // Akarin
|
||||
}
|
||||
return new RayTraceResult(hitPosition, hitBlock, hitBlockFace);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user