@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user