@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/Block.java
|
||||
+++ b/net/minecraft/world/level/block/Block.java
|
||||
@@ -341,7 +341,13 @@
|
||||
@@ -340,7 +340,13 @@
|
||||
EntityItem entityitem = (EntityItem) supplier.get();
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +373,7 @@
|
||||
@@ -366,7 +372,7 @@
|
||||
|
||||
public void playerDestroy(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
|
||||
entityhuman.awardStat(StatisticList.BLOCK_MINED.get(this));
|
||||
@@ -24,21 +24,19 @@
|
||||
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
|
||||
}
|
||||
|
||||
@@ -500,17 +506,25 @@
|
||||
@@ -499,15 +505,23 @@
|
||||
return this.builtInRegistryHolder;
|
||||
}
|
||||
|
||||
- protected void tryDropExperience(WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, IntProvider intprovider) {
|
||||
+ // CraftBukkit start
|
||||
+ protected int tryDropExperience(WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, IntProvider intprovider) {
|
||||
if (EnchantmentManager.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
|
||||
int i = intprovider.sample(worldserver.random);
|
||||
int i = EnchantmentManager.processBlockExperience(worldserver, itemstack, intprovider.sample(worldserver.getRandom()));
|
||||
|
||||
if (i > 0) {
|
||||
- this.popExperience(worldserver, blockposition, i);
|
||||
+ // this.popExperience(worldserver, blockposition, i);
|
||||
+ return i;
|
||||
}
|
||||
if (i > 0) {
|
||||
- this.popExperience(worldserver, blockposition, i);
|
||||
+ // this.popExperience(worldserver, blockposition, i);
|
||||
+ return i;
|
||||
}
|
||||
|
||||
+ return 0;
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.press(iblockdata, world, blockposition);
|
||||
this.playSound(entityhuman, world, blockposition, true);
|
||||
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.BLOCK_ACTIVATE, blockposition);
|
||||
this.press(iblockdata, world, blockposition, entityhuman);
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
}
|
||||
@@ -195,11 +213,36 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCake.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCake.java
|
||||
@@ -100,7 +100,18 @@
|
||||
@@ -97,7 +97,18 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
entityhuman.awardStat(StatisticList.EAT_CAKE_SLICE);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCampfire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCampfire.java
|
||||
@@ -106,7 +106,7 @@
|
||||
@@ -105,7 +105,7 @@
|
||||
@Override
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
|
||||
- entity.hurt(world.damageSources().inFire(), (float) this.fireDamage);
|
||||
+ entity.hurt(world.damageSources().inFire().directBlock(world, blockposition), (float) this.fireDamage); // CraftBukkit
|
||||
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving) {
|
||||
- entity.hurt(world.damageSources().campfire(), (float) this.fireDamage);
|
||||
+ entity.hurt(world.damageSources().campfire().directBlock(world, blockposition), (float) this.fireDamage); // CraftBukkit
|
||||
}
|
||||
|
||||
super.entityInside(iblockdata, world, blockposition, entity);
|
||||
@@ -216,6 +216,11 @@
|
||||
@@ -215,6 +215,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
|
||||
if (!world.isClientSide && iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
if (iinventory == null) {
|
||||
itemstack1 = BlockDropper.DISPENSE_BEHAVIOUR.dispense(sourceblock, itemstack);
|
||||
} else {
|
||||
- itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, itemstack.copy().split(1), enumdirection.getOpposite());
|
||||
- itemstack1 = TileEntityHopper.addItem(tileentitydispenser, iinventory, itemstack.copyWithCount(1), enumdirection.getOpposite());
|
||||
- if (itemstack1.isEmpty()) {
|
||||
+ // CraftBukkit start - Fire event when pushing items into other inventories
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.copy().split(1));
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.copyWithCount(1));
|
||||
+
|
||||
+ org.bukkit.inventory.Inventory destinationInventory;
|
||||
+ // Have to special case large chests as they work oddly
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
--- a/net/minecraft/world/level/block/BlockEndGateway.java
|
||||
+++ b/net/minecraft/world/level/block/BlockEndGateway.java
|
||||
@@ -21,6 +21,10 @@
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockEndGateway extends BlockTileEntity implements Portal {
|
||||
|
||||
public static final MapCodec<BlockEndGateway> CODEC = simpleCodec(BlockEndGateway::new);
|
||||
@@ -110,7 +114,7 @@
|
||||
if (tileentity instanceof TileEntityEndGateway tileentityendgateway) {
|
||||
Vec3D vec3d = tileentityendgateway.getPortalPosition(worldserver, blockposition);
|
||||
|
||||
- return vec3d != null ? new DimensionTransition(worldserver, vec3d, calculateExitMovement(entity), entity.getYRot(), entity.getXRot(), DimensionTransition.PLACE_PORTAL_TICKET) : null;
|
||||
+ return vec3d != null ? new DimensionTransition(worldserver, vec3d, calculateExitMovement(entity), entity.getYRot(), entity.getXRot(), DimensionTransition.PLACE_PORTAL_TICKET, PlayerTeleportEvent.TeleportCause.END_GATEWAY) : null; // CraftBukkit
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -1,41 +1,80 @@
|
||||
--- a/net/minecraft/world/level/block/BlockEnderPortal.java
|
||||
+++ b/net/minecraft/world/level/block/BlockEnderPortal.java
|
||||
@@ -21,6 +21,13 @@
|
||||
@@ -26,6 +26,19 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
+import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockEnderPortal extends BlockTileEntity {
|
||||
public class BlockEnderPortal extends BlockTileEntity implements Portal {
|
||||
|
||||
public static final MapCodec<BlockEnderPortal> CODEC = simpleCodec(BlockEnderPortal::new);
|
||||
@@ -48,13 +55,22 @@
|
||||
@@ -53,6 +66,10 @@
|
||||
@Override
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (world instanceof WorldServer && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
- ResourceKey<World> resourcekey = world.dimension() == World.END ? World.OVERWORLD : World.END;
|
||||
+ ResourceKey<World> resourcekey = world.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
WorldServer worldserver = ((WorldServer) world).getServer().getLevel(resourcekey);
|
||||
|
||||
if (worldserver == null) {
|
||||
- return;
|
||||
+ // return; // CraftBukkit - always fire event in case plugins wish to change it
|
||||
}
|
||||
|
||||
if (entity.canUsePortal(false) && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (entity instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.changeDimension(worldserver);
|
||||
}
|
||||
if (!world.isClientSide && world.dimension() == World.END && entity instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
@@ -69,11 +86,11 @@
|
||||
|
||||
@Override
|
||||
public DimensionTransition getPortalDestination(WorldServer worldserver, Entity entity, BlockPosition blockposition) {
|
||||
- ResourceKey<World> resourcekey = worldserver.dimension() == World.END ? World.OVERWORLD : World.END;
|
||||
+ ResourceKey<World> resourcekey = worldserver.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
WorldServer worldserver1 = worldserver.getServer().getLevel(resourcekey);
|
||||
|
||||
if (worldserver1 == null) {
|
||||
- return null;
|
||||
+ return new DimensionTransition(PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit- always fire event in case plugins wish to change it
|
||||
} else {
|
||||
boolean flag = resourcekey == World.END;
|
||||
BlockPosition blockposition1 = flag ? WorldServer.END_SPAWN_POINT : worldserver1.getSharedSpawnPos();
|
||||
@@ -81,7 +98,7 @@
|
||||
float f = entity.getYRot();
|
||||
|
||||
if (flag) {
|
||||
- EndPlatformFeature.createEndPlatform(worldserver1, BlockPosition.containing(vec3d).below(), true);
|
||||
+ EndPlatformFeature.createEndPlatform(worldserver1, BlockPosition.containing(vec3d).below(), true, entity); // CraftBukkit
|
||||
f = EnumDirection.WEST.toYRot();
|
||||
if (entity instanceof EntityPlayer) {
|
||||
vec3d = vec3d.subtract(0.0D, 1.0D, 0.0D);
|
||||
@@ -90,13 +107,21 @@
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
- return entityplayer.findRespawnPositionAndUseSpawnBlock(false, DimensionTransition.DO_NOTHING);
|
||||
+ return entityplayer.findRespawnPositionAndUseSpawnBlock(false, DimensionTransition.DO_NOTHING, PlayerRespawnEvent.RespawnReason.END_PORTAL); // CraftBukkit
|
||||
}
|
||||
|
||||
vec3d = entity.adjustSpawnLocation(worldserver1, blockposition1).getBottomCenter();
|
||||
}
|
||||
|
||||
- return new DimensionTransition(worldserver1, vec3d, entity.getDeltaMovement(), f, entity.getXRot(), DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET));
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f, entity.getXRot()), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
|
||||
+ if (event == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ Location to = event.getTo();
|
||||
+
|
||||
+ return new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), entity.getDeltaMovement(), to.getYaw(), to.getPitch(), DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET), PlayerTeleportEvent.TeleportCause.END_PORTAL);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
if (!entity.fireImmune()) {
|
||||
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
|
||||
if (entity.getRemainingFireTicks() == 0) {
|
||||
- entity.igniteForSeconds(8);
|
||||
- entity.igniteForSeconds(8.0F);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition), entity.getBukkitEntity(), 8);
|
||||
+ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition), entity.getBukkitEntity(), 8.0F);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLectern.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLectern.java
|
||||
@@ -207,11 +207,12 @@
|
||||
@@ -208,11 +208,12 @@
|
||||
}
|
||||
|
||||
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLever.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLever.java
|
||||
@@ -28,6 +28,8 @@
|
||||
@@ -29,6 +29,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
iblockdata1 = this.pull(iblockdata, world, blockposition);
|
||||
float f = (Boolean) iblockdata1.getValue(BlockLever.POWERED) ? 0.6F : 0.5F;
|
||||
|
||||
this.pull(iblockdata, world, blockposition, (EntityHuman) null);
|
||||
return EnumInteractionResult.CONSUME;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/level/block/BlockMagma.java
|
||||
+++ b/net/minecraft/world/level/block/BlockMagma.java
|
||||
@@ -30,7 +30,7 @@
|
||||
@@ -29,7 +29,7 @@
|
||||
@Override
|
||||
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (!entity.isSteppingCarefully() && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
|
||||
if (!entity.isSteppingCarefully() && entity instanceof EntityLiving) {
|
||||
- entity.hurt(world.damageSources().hotFloor(), 1.0F);
|
||||
+ entity.hurt(world.damageSources().hotFloor().directBlock(world, blockposition), 1.0F); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
--- a/net/minecraft/world/level/block/BlockPortal.java
|
||||
+++ b/net/minecraft/world/level/block/BlockPortal.java
|
||||
@@ -26,6 +26,10 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
@@ -38,6 +38,15 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPortal extends Block {
|
||||
public class BlockPortal extends Block implements Portal {
|
||||
|
||||
public static final MapCodec<BlockPortal> CODEC = simpleCodec(BlockPortal::new);
|
||||
@@ -63,7 +67,8 @@
|
||||
@@ -76,7 +85,8 @@
|
||||
}
|
||||
|
||||
if (worldserver.getBlockState(blockposition).isValidSpawn(worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
|
||||
@@ -21,14 +26,90 @@
|
||||
|
||||
if (entity != null) {
|
||||
entity.setPortalCooldown();
|
||||
@@ -85,6 +90,10 @@
|
||||
@@ -98,6 +108,10 @@
|
||||
@Override
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (entity.canChangeDimensions()) {
|
||||
if (entity.canUsePortal(false)) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
entity.handleInsidePortal(blockposition);
|
||||
entity.setAsInsidePortal(this, blockposition);
|
||||
}
|
||||
|
||||
@@ -115,24 +129,34 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public DimensionTransition getPortalDestination(WorldServer worldserver, Entity entity, BlockPosition blockposition) {
|
||||
- ResourceKey<World> resourcekey = worldserver.dimension() == World.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
+ // CraftBukkit start
|
||||
+ ResourceKey<World> resourcekey = worldserver.getTypeKey() == WorldDimension.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
WorldServer worldserver1 = worldserver.getServer().getLevel(resourcekey);
|
||||
|
||||
if (worldserver1 == null) {
|
||||
- return null;
|
||||
+ return new DimensionTransition(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // always fire event in case plugins wish to change it
|
||||
} else {
|
||||
- boolean flag = worldserver1.dimension() == World.NETHER;
|
||||
+ boolean flag = worldserver1.getTypeKey() == WorldDimension.NETHER;
|
||||
+ // CraftBukkit end
|
||||
WorldBorder worldborder = worldserver1.getWorldBorder();
|
||||
double d0 = DimensionManager.getTeleportationScale(worldserver.dimensionType(), worldserver1.dimensionType());
|
||||
BlockPosition blockposition1 = worldborder.clampToBounds(entity.getX() * d0, entity.getY(), entity.getZ() * d0);
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag ? 16 : 128, 16);
|
||||
+ if (event == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ worldserver1 = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||
+ worldborder = worldserver1.getWorldBorder();
|
||||
+ blockposition1 = worldborder.clampToBounds(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
|
||||
- return this.getExitPortal(worldserver1, entity, blockposition, blockposition1, flag, worldborder);
|
||||
+ return this.getExitPortal(worldserver1, entity, blockposition, blockposition1, flag, worldborder, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- private DimensionTransition getExitPortal(WorldServer worldserver, Entity entity, BlockPosition blockposition, BlockPosition blockposition1, boolean flag, WorldBorder worldborder) {
|
||||
- Optional<BlockPosition> optional = worldserver.getPortalForcer().findClosestPortalPosition(blockposition1, flag, worldborder);
|
||||
+ private DimensionTransition getExitPortal(WorldServer worldserver, Entity entity, BlockPosition blockposition, BlockPosition blockposition1, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
|
||||
+ Optional<BlockPosition> optional = worldserver.getPortalForcer().findClosestPortalPosition(blockposition1, worldborder, searchRadius);
|
||||
BlockUtil.Rectangle blockutil_rectangle;
|
||||
DimensionTransition.a dimensiontransition_a;
|
||||
|
||||
@@ -146,17 +170,22 @@
|
||||
dimensiontransition_a = DimensionTransition.PLAY_PORTAL_SOUND.then((entity1) -> {
|
||||
entity1.placePortalTicket(blockposition2);
|
||||
});
|
||||
- } else {
|
||||
+ } else if (canCreatePortal) {
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = (EnumDirection.EnumAxis) entity.level().getBlockState(blockposition).getOptionalValue(BlockPortal.AXIS).orElse(EnumDirection.EnumAxis.X);
|
||||
- Optional<BlockUtil.Rectangle> optional1 = worldserver.getPortalForcer().createPortal(blockposition1, enumdirection_enumaxis);
|
||||
+ Optional<BlockUtil.Rectangle> optional1 = worldserver.getPortalForcer().createPortal(blockposition1, enumdirection_enumaxis, entity, createRadius);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (optional1.isEmpty()) {
|
||||
- BlockPortal.LOGGER.error("Unable to create a portal, likely target out of worldborder");
|
||||
+ // BlockPortal.LOGGER.error("Unable to create a portal, likely target out of worldborder"); // CraftBukkit
|
||||
return null;
|
||||
}
|
||||
|
||||
blockutil_rectangle = (BlockUtil.Rectangle) optional1.get();
|
||||
dimensiontransition_a = DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET);
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ return null;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return getDimensionTransitionFromExit(entity, blockposition, blockutil_rectangle, worldserver, dimensiontransition_a);
|
||||
@@ -198,7 +227,7 @@
|
||||
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
|
||||
Vec3D vec3d4 = BlockPortalShape.findCollisionFreePosition(vec3d3, worldserver, entity, entitysize);
|
||||
|
||||
- return new DimensionTransition(worldserver, vec3d4, vec3d2, f + (float) i, f1, dimensiontransition_a);
|
||||
+ return new DimensionTransition(worldserver, vec3d4, vec3d2, f + (float) i, f1, dimensiontransition_a, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRedstoneOre.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRedstoneOre.java
|
||||
@@ -22,6 +22,11 @@
|
||||
@@ -21,6 +21,11 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class BlockRedstoneOre extends Block {
|
||||
|
||||
public static final MapCodec<BlockRedstoneOre> CODEC = simpleCodec(BlockRedstoneOre::new);
|
||||
@@ -39,14 +44,27 @@
|
||||
@@ -38,14 +43,27 @@
|
||||
|
||||
@Override
|
||||
protected void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
super.stepOn(world, blockposition, iblockdata, entity);
|
||||
@@ -57,15 +75,20 @@
|
||||
@@ -56,15 +74,20 @@
|
||||
if (world.isClientSide) {
|
||||
spawnParticles(world, blockposition);
|
||||
} else {
|
||||
@@ -65,7 +65,7 @@
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, true), 3);
|
||||
}
|
||||
|
||||
@@ -79,6 +102,11 @@
|
||||
@@ -78,6 +101,11 @@
|
||||
@Override
|
||||
protected void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if ((Boolean) iblockdata.getValue(BlockRedstoneOre.LIT)) {
|
||||
@@ -77,7 +77,7 @@
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, false), 3);
|
||||
}
|
||||
|
||||
@@ -87,12 +115,20 @@
|
||||
@@ -86,10 +114,17 @@
|
||||
@Override
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
@@ -86,12 +86,9 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public int getExpDrop(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
if (flag && EnchantmentManager.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) == 0) {
|
||||
int i = 1 + worldserver.random.nextInt(5);
|
||||
|
||||
- this.popExperience(worldserver, blockposition, i);
|
||||
+ // this.popExperience(worldserver, blockposition, i);
|
||||
+ return i;
|
||||
if (flag) {
|
||||
- this.tryDropExperience(worldserver, blockposition, itemstack, UniformInt.of(1, 5));
|
||||
+ return this.tryDropExperience(worldserver, blockposition, itemstack, UniformInt.of(1, 5));
|
||||
}
|
||||
|
||||
+ return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSign.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSign.java
|
||||
@@ -142,7 +142,7 @@
|
||||
@@ -139,7 +139,7 @@
|
||||
} else if (flag1) {
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!this.otherPlayerIsEditingSign(entityhuman, tileentitysign) && entityhuman.mayBuild() && this.hasEditableText(entityhuman, tileentitysign, flag)) {
|
||||
@@ -9,7 +9,7 @@
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
return EnumInteractionResult.PASS;
|
||||
@@ -188,6 +188,15 @@
|
||||
@@ -185,6 +185,15 @@
|
||||
}
|
||||
|
||||
public void openTextEdit(EntityHuman entityhuman, TileEntitySign tileentitysign, boolean flag) {
|
||||
@@ -25,7 +25,7 @@
|
||||
tileentitysign.setAllowedPlayerEditor(entityhuman.getUUID());
|
||||
entityhuman.openTextEdit(tileentitysign, flag);
|
||||
}
|
||||
@@ -201,6 +210,6 @@
|
||||
@@ -198,6 +207,6 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends TileEntity> BlockEntityTicker<T> getTicker(World world, IBlockData iblockdata, TileEntityTypes<T> tileentitytypes) {
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
explode(world, blockposition, entityhuman);
|
||||
world.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 11);
|
||||
Item item = itemstack.getItem();
|
||||
@@ -125,6 +135,11 @@
|
||||
@@ -123,6 +133,11 @@
|
||||
Entity entity = iprojectile.getOwner();
|
||||
|
||||
if (iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/DecoratedPotBlock.java
|
||||
+++ b/net/minecraft/world/level/block/DecoratedPotBlock.java
|
||||
@@ -238,6 +238,11 @@
|
||||
@@ -239,6 +239,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
|
||||
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world)) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/LightningRodBlock.java
|
||||
+++ b/net/minecraft/world/level/block/LightningRodBlock.java
|
||||
@@ -33,6 +33,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
@@ -22,6 +22,11 @@
|
||||
import net.minecraft.world.level.material.FluidType;
|
||||
import net.minecraft.world.level.material.FluidTypes;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
@@ -12,7 +12,7 @@
|
||||
public class LightningRodBlock extends RodBlock implements IBlockWaterlogged {
|
||||
|
||||
public static final MapCodec<LightningRodBlock> CODEC = simpleCodec(LightningRodBlock::new);
|
||||
@@ -85,6 +90,18 @@
|
||||
@@ -74,6 +79,18 @@
|
||||
}
|
||||
|
||||
public void onLightningStrike(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@@ -31,12 +31,3 @@
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(LightningRodBlock.POWERED, true), 3);
|
||||
this.updateNeighbours(iblockdata, world, blockposition);
|
||||
world.scheduleTick(blockposition, (Block) this, 8);
|
||||
@@ -142,7 +159,7 @@
|
||||
Entity entity = iprojectile.getOwner();
|
||||
|
||||
entitylightning.setCause(entity instanceof EntityPlayer ? (EntityPlayer) entity : null);
|
||||
- world.addFreshEntity(entitylightning);
|
||||
+ ((WorldServer) world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRIDENT); // CraftBukkit
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.TRIDENT_THUNDER, SoundCategory.WEATHER, 5.0F, 1.0F);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
@@ -34,10 +34,13 @@
|
||||
@@ -35,10 +35,13 @@
|
||||
public SculkCatalystBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.SCULK_CATALYST, blockposition, iblockdata);
|
||||
this.catalystListener = new SculkCatalystBlockEntity.CatalystListener(iblockdata, new BlockPositionSource(blockposition));
|
||||
@@ -14,7 +14,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,11 +66,13 @@
|
||||
@@ -64,11 +67,13 @@
|
||||
final SculkSpreader sculkSpreader;
|
||||
private final IBlockData blockState;
|
||||
private final PositionSource positionSource;
|
||||
|
||||
@@ -98,11 +98,11 @@
|
||||
if (flag2 && flag) {
|
||||
- doBrew(world, blockposition, tileentitybrewingstand.items);
|
||||
+ doBrew(world, blockposition, tileentitybrewingstand.items, tileentitybrewingstand); // CraftBukkit
|
||||
setChanged(world, blockposition, iblockdata);
|
||||
} else if (!flag || !itemstack1.is(tileentitybrewingstand.ingredient)) {
|
||||
tileentitybrewingstand.brewTime = 0;
|
||||
@@ -128,7 +188,11 @@
|
||||
}
|
||||
@@ -128,7 +188,11 @@
|
||||
setChanged(world, blockposition, iblockdata);
|
||||
} else if (flag && tileentitybrewingstand.fuel > 0) {
|
||||
--tileentitybrewingstand.fuel;
|
||||
- tileentitybrewingstand.brewTime = 400;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityCampfire.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityCampfire.java
|
||||
@@ -31,6 +31,14 @@
|
||||
@@ -30,6 +30,14 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class TileEntityCampfire extends TileEntity implements Clearable {
|
||||
|
||||
private static final int BURN_COOL_SPEED = 2;
|
||||
@@ -65,6 +73,20 @@
|
||||
@@ -64,6 +72,20 @@
|
||||
}).orElse(itemstack);
|
||||
|
||||
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
|
||||
@@ -36,7 +36,7 @@
|
||||
InventoryUtils.dropItemStack(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
|
||||
tileentitycampfire.items.set(i, ItemStack.EMPTY);
|
||||
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -177,7 +199,11 @@
|
||||
@@ -176,7 +198,11 @@
|
||||
ItemStack itemstack1 = (ItemStack) this.items.get(j);
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
@@ -47,5 +47,5 @@
|
||||
+ this.cookingTime[j] = event.getTotalCookTime(); // i -> event.getTotalCookTime()
|
||||
+ // CraftBukkit end
|
||||
this.cookingProgress[j] = 0;
|
||||
this.items.set(j, itemstack.split(1));
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.a.of(entity, this.getBlockState()));
|
||||
this.items.set(j, itemstack.consumeAndReturn(1, entityliving));
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.a.of(entityliving, this.getBlockState()));
|
||||
|
||||
@@ -1,72 +1,22 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
|
||||
@@ -34,6 +34,15 @@
|
||||
@@ -27,6 +27,10 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class TileEntityEndGateway extends TileEntityEnderPortal {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -163,7 +172,7 @@
|
||||
tileentityendgateway.teleportCooldown = 100;
|
||||
BlockPosition blockposition1;
|
||||
@@ -143,7 +147,7 @@
|
||||
public Vec3D getPortalPosition(WorldServer worldserver, BlockPosition blockposition) {
|
||||
BlockPosition blockposition1;
|
||||
|
||||
- if (tileentityendgateway.exitPortal == null && world.dimension() == World.END) {
|
||||
+ if (tileentityendgateway.exitPortal == null && world.getTypeKey() == WorldDimension.END) { // CraftBukkit - work in alternate worlds
|
||||
blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
|
||||
blockposition1 = blockposition1.above(10);
|
||||
TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
|
||||
@@ -184,7 +193,7 @@
|
||||
|
||||
if (entity2 != null) {
|
||||
entity1 = entity2;
|
||||
- entity.discard();
|
||||
+ entity.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
} else {
|
||||
entity1 = entity;
|
||||
}
|
||||
@@ -192,8 +201,34 @@
|
||||
entity1 = entity.getRootVehicle();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent/EntityTeleportEvent
|
||||
+ if (entity1 instanceof EntityPlayer) {
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity1.getBukkitEntity();
|
||||
+ org.bukkit.Location location = CraftLocation.toBukkit(blockposition1, world.getWorld()).add(0.5D, 0.5D, 0.5D);
|
||||
+ location.setPitch(player.getLocation().getPitch());
|
||||
+ location.setYaw(player.getLocation().getYaw());
|
||||
+
|
||||
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.END_GATEWAY);
|
||||
+ Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
+ if (teleEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ entity1.setPortalCooldown();
|
||||
+ ((EntityPlayer) entity1).connection.teleport(teleEvent.getTo());
|
||||
+ triggerCooldown(world, blockposition, iblockdata, tileentityendgateway); // CraftBukkit - call at end of method
|
||||
+ return;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.event.entity.EntityTeleportEvent teleEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(entity1, blockposition1.getX() + 0.5, blockposition1.getY() + 0.5, blockposition1.getZ() + 0.5);
|
||||
+ if (teleEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
entity1.setPortalCooldown();
|
||||
- entity1.teleportToWithTicket((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D);
|
||||
+ entity1.teleportToWithTicket(teleEvent.getTo().getX(), teleEvent.getTo().getY(), teleEvent.getTo().getZ());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
triggerCooldown(world, blockposition, iblockdata, tileentityendgateway);
|
||||
- if (this.exitPortal == null && worldserver.dimension() == World.END) {
|
||||
+ if (this.exitPortal == null && worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit - work in alternate worlds
|
||||
blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
|
||||
blockposition1 = blockposition1.above(10);
|
||||
TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
|
||||
|
||||
@@ -72,16 +72,16 @@
|
||||
private static boolean isNeverAFurnaceFuel(Item item) {
|
||||
return item.builtInRegistryHolder().is(TagsItem.NON_FLAMMABLE_WOOD);
|
||||
}
|
||||
@@ -285,7 +334,7 @@
|
||||
@@ -286,7 +335,7 @@
|
||||
RecipeHolder recipeholder;
|
||||
|
||||
if (flag2) {
|
||||
- recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).orElse((Object) null);
|
||||
+ recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).orElse(null); // CraftBukkit - decompile error
|
||||
- recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(new SingleRecipeInput(itemstack1), world).orElse((Object) null);
|
||||
+ recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(new SingleRecipeInput(itemstack1), world).orElse(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
recipeholder = null;
|
||||
}
|
||||
@@ -293,9 +342,20 @@
|
||||
@@ -294,9 +343,20 @@
|
||||
int i = tileentityfurnace.getMaxStackSize();
|
||||
|
||||
if (!tileentityfurnace.isLit() && canBurn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
|
||||
@@ -104,7 +104,7 @@
|
||||
flag1 = true;
|
||||
if (flag3) {
|
||||
Item item = itemstack.getItem();
|
||||
@@ -311,11 +371,23 @@
|
||||
@@ -312,11 +372,23 @@
|
||||
}
|
||||
|
||||
if (tileentityfurnace.isLit() && canBurn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
|
||||
@@ -129,7 +129,7 @@
|
||||
tileentityfurnace.setRecipeUsed(recipeholder);
|
||||
}
|
||||
|
||||
@@ -354,17 +426,44 @@
|
||||
@@ -355,17 +427,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,15 +175,15 @@
|
||||
|
||||
if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !((ItemStack) nonnulllist.get(1)).isEmpty() && ((ItemStack) nonnulllist.get(1)).is(Items.BUCKET)) {
|
||||
nonnulllist.set(1, new ItemStack(Items.WATER_BUCKET));
|
||||
@@ -388,6 +487,7 @@
|
||||
@@ -389,6 +488,7 @@
|
||||
}
|
||||
|
||||
private static int getTotalCookTime(World world, TileEntityFurnace tileentityfurnace) {
|
||||
+ if (world == null) return 200; // CraftBukkit - SPIGOT-4302
|
||||
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).map((recipeholder) -> {
|
||||
return ((RecipeCooking) recipeholder.value()).getCookingTime();
|
||||
}).orElse(200);
|
||||
@@ -474,8 +574,8 @@
|
||||
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(tileentityfurnace.getItem(0));
|
||||
|
||||
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> {
|
||||
@@ -477,8 +577,8 @@
|
||||
@Override
|
||||
public void awardUsedRecipes(EntityHuman entityhuman, List<ItemStack> list) {}
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
|
||||
entityplayer.awardRecipes(list);
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -492,6 +592,12 @@
|
||||
@@ -495,6 +595,12 @@
|
||||
}
|
||||
|
||||
public List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(WorldServer worldserver, Vec3D vec3d) {
|
||||
@@ -207,7 +207,7 @@
|
||||
List<RecipeHolder<?>> list = Lists.newArrayList();
|
||||
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -500,14 +606,14 @@
|
||||
@@ -503,14 +609,14 @@
|
||||
|
||||
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((recipeholder) -> {
|
||||
list.add(recipeholder);
|
||||
@@ -224,7 +224,7 @@
|
||||
int j = MathHelper.floor((float) i * f);
|
||||
float f1 = MathHelper.frac((float) i * f);
|
||||
|
||||
@@ -515,6 +621,17 @@
|
||||
@@ -518,6 +624,17 @@
|
||||
++j;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
|
||||
@@ -24,6 +24,14 @@
|
||||
@@ -20,12 +20,56 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.ticks.ContainerSingleItem;
|
||||
|
||||
@@ -14,11 +14,10 @@
|
||||
+
|
||||
public class TileEntityJukeBox extends TileEntity implements Clearable, ContainerSingleItem.a {
|
||||
|
||||
private static final int SONG_END_PADDING = 20;
|
||||
@@ -32,6 +40,42 @@
|
||||
public long tickCount;
|
||||
public long recordStartedTick;
|
||||
public boolean isPlaying;
|
||||
public static final String SONG_ITEM_TAG_ID = "RecordItem";
|
||||
public static final String TICKS_SINCE_SONG_STARTED_TAG_ID = "ticks_since_song_started";
|
||||
private ItemStack item;
|
||||
private final JukeboxSongPlayer jukeboxSongPlayer;
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
+ private int maxStack = MAX_STACK;
|
||||
@@ -58,7 +57,7 @@
|
||||
|
||||
public TileEntityJukeBox(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.JUKEBOX, blockposition, iblockdata);
|
||||
@@ -154,7 +198,7 @@
|
||||
@@ -134,7 +178,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
@@ -67,10 +66,18 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,7 +250,11 @@
|
||||
@@ -153,12 +197,17 @@
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setRecordWithoutPlaying(ItemStack itemstack) {
|
||||
- public void setSongItemWithoutPlaying(ItemStack itemstack) {
|
||||
+ public void setSongItemWithoutPlaying(ItemStack itemstack, long ticksSinceSongStarted) { // CraftBukkit - add argument
|
||||
this.item = itemstack;
|
||||
+ this.jukeboxSongPlayer.song = null; // CraftBukkit - reset
|
||||
JukeboxSong.fromStack(this.level.registryAccess(), itemstack).ifPresent((holder) -> {
|
||||
- this.jukeboxSongPlayer.setSongWithoutPlaying(holder, 0L);
|
||||
+ this.jukeboxSongPlayer.setSongWithoutPlaying(holder, ticksSinceSongStarted); // CraftBukkit - add argument
|
||||
});
|
||||
- this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
|
||||
+ // CraftBukkit start - add null check for level
|
||||
+ if (level != null) {
|
||||
@@ -79,4 +86,4 @@
|
||||
+ // CraftBukkit end
|
||||
this.setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
@@ -179,13 +179,13 @@
|
||||
@@ -206,7 +206,7 @@
|
||||
}
|
||||
|
||||
public void resetAfterBecomingOminous(TrialSpawner trialspawner, WorldServer worldserver) {
|
||||
@@ -9,8 +9,10 @@
|
||||
|
||||
Objects.requireNonNull(worldserver);
|
||||
stream.map(worldserver::getEntity).forEach((entity) -> {
|
||||
if (entity != null) {
|
||||
worldserver.levelEvent(3012, entity.blockPosition(), TrialSpawner.a.NORMAL.encode());
|
||||
@@ -218,7 +218,7 @@
|
||||
entityinsentient.dropPreservedEquipment();
|
||||
}
|
||||
|
||||
- entity.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ entity.remove(Entity.RemovalReason.DISCARDED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - Add bukkit remove cause;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/state/BlockBase.java
|
||||
+++ b/net/minecraft/world/level/block/state/BlockBase.java
|
||||
@@ -174,8 +174,10 @@
|
||||
@@ -173,8 +173,10 @@
|
||||
TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition) : null;
|
||||
LootParams.a lootparams_a = (new LootParams.a(worldserver)).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, explosion.getDirectSourceEntity());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user