Yatopia/patches/server/0065-lithium-skip-ticking-block-entities-that-are-doing-n.patch

1218 lines
49 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: 2No2Name <50278648+2No2Name@users.noreply.github.com>
Date: Sun, 21 Feb 2021 21:34:18 -0500
Subject: [PATCH] lithium: skip ticking block entities that are doing nothing
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/ListeningList.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/ListeningList.java
new file mode 100644
index 0000000000000000000000000000000000000000..edcc9ec27cc7d8dc5bf04e1f70362b505742570c
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/ListeningList.java
@@ -0,0 +1,255 @@
+package me.jellysquid.mods.lithium.common.util.collections;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.*;
+import java.util.function.Consumer;
+import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
+import java.util.stream.Stream;
+
+public class ListeningList<T> implements List<T> {
+ private final List<T> delegate;
+ private final Runnable changeCallback;
+
+ public ListeningList(List<T> delegate, Runnable changeCallback) {
+ this.delegate = delegate;
+ this.changeCallback = changeCallback;
+ }
+
+ private void onChange() {
+ this.changeCallback.run();
+ }
+
+
+ @Override
+ public int size() {
+ return this.delegate.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return this.delegate.isEmpty();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return this.delegate.contains(o);
+ }
+
+ @NotNull
+ @Override
+ public Iterator<T> iterator() {
+ return this.listIterator();
+ }
+
+ @NotNull
+ @Override
+ public Object[] toArray() {
+ return this.delegate.toArray();
+ }
+
+ @Override
+ public void forEach(Consumer<? super T> consumer) {
+ this.delegate.forEach(consumer);
+ }
+
+ @NotNull
+ @Override
+ public <T1> T1[] toArray(@NotNull T1[] t1s) {
+ //noinspection SuspiciousToArrayCall
+ return this.delegate.toArray(t1s);
+ }
+
+ @Override
+ public boolean add(T t) {
+ boolean add = this.delegate.add(t);
+ this.onChange();
+ //noinspection ConstantConditions
+ return add;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ boolean remove = this.delegate.remove(o);
+ this.onChange();
+ return remove;
+ }
+
+ @Override
+ public boolean containsAll(@NotNull Collection<?> collection) {
+ return this.delegate.containsAll(collection);
+ }
+
+ @Override
+ public boolean addAll(@NotNull Collection<? extends T> collection) {
+ boolean addAll = this.delegate.addAll(collection);
+ this.onChange();
+ return addAll;
+ }
+
+ @Override
+ public boolean addAll(int i, @NotNull Collection<? extends T> collection) {
+ boolean addAll = this.delegate.addAll(i, collection);
+ this.onChange();
+ return addAll;
+ }
+
+ @Override
+ public boolean removeAll(@NotNull Collection<?> collection) {
+ boolean b = this.delegate.removeAll(collection);
+ this.onChange();
+ return b;
+ }
+
+ @Override
+ public boolean removeIf(Predicate<? super T> predicate) {
+ boolean b = this.delegate.removeIf(predicate);
+ this.onChange();
+ return b;
+ }
+
+ @Override
+ public boolean retainAll(@NotNull Collection<?> collection) {
+ boolean b = this.delegate.retainAll(collection);
+ this.onChange();
+ return b;
+ }
+
+ @Override
+ public void replaceAll(UnaryOperator<T> unaryOperator) {
+ this.delegate.replaceAll( unaryOperator);
+ this.onChange();
+ }
+
+ @Override
+ public void sort(Comparator<? super T> comparator) {
+ this.delegate.sort(comparator);
+ this.onChange();
+ }
+
+ @Override
+ public void clear() {
+ this.delegate.clear();
+ this.onChange();
+ }
+
+ @Override
+ public T get(int i) {
+ return this.delegate.get(i);
+ }
+
+ @Override
+ public T set(int i, T t) {
+ T set = this.delegate.set(i, t);
+ this.onChange();
+ return set;
+ }
+
+ @Override
+ public void add(int i, T t) {
+ this.delegate.add(i, t);
+ this.onChange();
+ }
+
+ @Override
+ public T remove(int i) {
+ T remove = this.delegate.remove(i);
+ this.onChange();
+ return remove;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return this.delegate.indexOf(o);
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return this.delegate.lastIndexOf(o);
+ }
+
+ @NotNull
+ @Override
+ public ListIterator<T> listIterator() {
+ return this.listIterator(0);
+ }
+
+ @NotNull
+ @Override
+ public ListIterator<T> listIterator(int i) {
+ return new ListIterator<T>() {
+ final ListIterator<T> itDelegate = ListeningList.this.delegate.listIterator(i);
+
+ @Override
+ public boolean hasNext() {
+ return this.itDelegate.hasNext();
+ }
+
+ @Override
+ public T next() {
+ return this.itDelegate.next();
+ }
+
+ @Override
+ public boolean hasPrevious() {
+ return this.itDelegate.hasPrevious();
+ }
+
+ @Override
+ public T previous() {
+ return this.itDelegate.previous();
+ }
+
+ @Override
+ public int nextIndex() {
+ return this.itDelegate.nextIndex();
+ }
+
+ @Override
+ public int previousIndex() {
+ return this.itDelegate.previousIndex();
+ }
+
+ @Override
+ public void remove() {
+ this.itDelegate.remove();
+ ListeningList.this.onChange();
+ }
+
+ @Override
+ public void set(T t) {
+ this.itDelegate.set(t);
+ ListeningList.this.onChange();
+
+ }
+
+ @Override
+ public void add(T t) {
+ this.itDelegate.add(t);
+ ListeningList.this.onChange();
+ }
+ };
+ }
+
+ @NotNull
+ @Override
+ public List<T> subList(int i, int i1) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Spliterator<T> spliterator() {
+ return this.delegate.spliterator();
+ }
+
+ @Override
+ public Stream<T> stream() {
+ return this.delegate.stream();
+ }
+
+ @Override
+ public Stream<T> parallelStream() {
+ return this.delegate.parallelStream();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/MaskedTickingBlockEntityList.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/MaskedTickingBlockEntityList.java
new file mode 100644
index 0000000000000000000000000000000000000000..7f7e4810a9aca382d75862e56b0cf93157b54b92
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/MaskedTickingBlockEntityList.java
@@ -0,0 +1,320 @@
+package me.jellysquid.mods.lithium.common.util.collections;
+
+import com.google.common.collect.Iterators;
+import it.unimi.dsi.fastutil.ints.IntArrayList;
+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap;
+import it.unimi.dsi.fastutil.objects.ReferenceArrayList;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.*;
+import java.util.function.Predicate;
+
+public class MaskedTickingBlockEntityList<T> implements List<T> {
+ private final Predicate<T> mayContain;
+
+ private final Reference2IntOpenHashMap<T> allElements2Index;
+ private final ReferenceArrayList<T> allElements;
+
+ private final IntArrayList filteredSuccessor;
+ private final BitSet filteredElementsMask;
+
+ private int firstRemovedIndex;
+
+ //Visualization of the internal datastructures
+ //indices: 0 1 2 3 4 5 6 7 8 9
+ //allElements: A B C D - F G H I J //E was fully removed, C,F,G,I were filtered away
+ //filteredMask: 1 1 0 1 0 0 0 1 0 1
+ //successor: 0 1 3 - 7 - - - 9 - - (index offset by 1, due to the first successor having to point to the first element)
+ //Removals from the allElements ArrayList are done by setting the value to null
+ //The successor list is used to iterate through the allElements ArrayList with an increasing index, but skipping long chains of null elements.
+ //The BitSet mask is used to find the predecessor and successor quickly (not asymptotically fast, but fast enough)
+
+ public MaskedTickingBlockEntityList(List<T> list, Predicate<T> mayContain) {
+ this.mayContain = mayContain;
+ this.allElements = new ReferenceArrayList<>();
+ this.allElements2Index = new Reference2IntOpenHashMap<>();
+ this.allElements2Index.defaultReturnValue(-1);
+ this.filteredSuccessor = new IntArrayList();
+ this.filteredElementsMask = new BitSet();
+ this.firstRemovedIndex = Integer.MAX_VALUE;
+
+ for (T t : list) {
+ if (this.mayContain.test(t)) {
+ int index = this.allElements.size();
+ this.allElements.add(t);
+ this.filteredElementsMask.set(index);
+ this.filteredSuccessor.add(index);
+ this.allElements2Index.put(t, index);
+ }
+ }
+ this.filteredSuccessor.add(-1);
+ }
+
+ public void setEntryVisible(T t, boolean value) {
+ this.setEntryVisible(this.allElements2Index.getOrDefault(t, -1), value);
+ }
+
+ public void setEntryVisible(int index, boolean value) {
+ //Visualization of the operations possible
+ //All: A B C D - F G H I J (- for null)
+ //filteredMask:1 1 0 1 0 0 0 1 0 1
+ //indices: 0 1 2 3 4 5 6 7 8 9
+ //successor: 0 1 3 - 7 - - - 9 - - (- for no successor)
+ //Set F visible:
+ //All: A B C D - F G H I J
+ //filteredMask:1 1 0 1 0 1 0 1 0 1 //set mask at F to 1
+ //indices: 0 1 2 3 4 5 6 7 8 9
+ //successor: 0 1 3 - 5 - 7 - 9 - - //update successor of predecessor to F and set F's successor to old successor of predecessor
+ //Set D filtered:
+ //All: A B C D - F G H I J
+ //Mask: 1 1 0 0 0 1 0 1 0 1 //set mask at D to 0
+ //indices: 0 1 2 3 4 5 6 7 8 9
+ //successor: 0 1 5 - - - 7 - 9 - - //update successor of predecessor to old successor of D and remove D's successor value
+
+ //These calls do not modify the size, they can't cause rehashing, they are safe to use during iteration
+ if (index == -1 || value == this.filteredElementsMask.get(index)) {
+ return;
+ }
+
+ this.filteredElementsMask.set(index, value);
+ int predecessor = this.filteredElementsMask.previousSetBit(index - 1);
+ if (value) {
+ int successor = this.filteredSuccessor.getInt(predecessor + 1);
+ this.filteredSuccessor.set(predecessor + 1, index);
+ this.filteredSuccessor.set(index + 1, successor);
+ } else {
+ int successor = this.filteredSuccessor.getInt(index + 1);
+ this.filteredSuccessor.set(predecessor + 1, successor);
+ this.filteredSuccessor.set(index + 1, -2); //no successor as this element cannot be reached
+ }
+ }
+
+ private void compact() {
+ int targetSize = this.size();
+ int newIndex = this.firstRemovedIndex - 1;
+ int lastVisible = this.filteredElementsMask.previousSetBit(newIndex);
+
+
+ for (int i = newIndex + 1; i < this.allElements.size(); i++) {
+ T t = this.allElements.get(i);
+ if (t == null) {
+ continue;
+ }
+ boolean visible = this.filteredElementsMask.get(i);
+ //shift all entries to the lower indices (filling the gaps created by remove() setting null)
+ newIndex++;
+ //i is guaranteed to not be smaller than newIndex, therefore we can write to the same collections
+
+ this.allElements.set(newIndex, t);
+ this.allElements2Index.put(t, newIndex);
+ this.filteredElementsMask.set(newIndex, visible);
+
+ //update the successor links
+ this.filteredSuccessor.set(newIndex + 1, -2); //no successor as there is no next entry yet
+ if (visible) {
+ this.filteredSuccessor.set(lastVisible + 1, newIndex);
+ lastVisible = newIndex;
+ }
+ }
+
+ if (newIndex + 1 != targetSize) {
+ throw new IllegalStateException("Compaction ended up with incorrect size: Should be: " + targetSize + " but is: " + (newIndex + 1));
+ }
+
+ this.filteredSuccessor.set(lastVisible + 1, -1); //-1 means this was the last element
+ this.firstRemovedIndex = Integer.MAX_VALUE;
+
+ this.filteredSuccessor.removeElements(targetSize + 1, this.filteredSuccessor.size());
+ this.allElements.removeElements(targetSize, this.allElements.size());
+ this.filteredElementsMask.clear(targetSize, this.filteredElementsMask.size());
+
+ this.filteredSuccessor.trim(targetSize * 4);
+ this.allElements.trim(targetSize * 4);
+ this.allElements2Index.trim(targetSize * 4);
+ }
+
+ public Iterator<T> filteredIterator() {
+ return new Iterator<T>() {
+ int next = MaskedTickingBlockEntityList.this.filteredSuccessor.getInt(0);
+ T prev;
+
+ @Override
+ public boolean hasNext() {
+ return this.next != -1;
+ }
+
+ @Override
+ public T next() {
+ int next = this.next;
+ T prev = MaskedTickingBlockEntityList.this.allElements.get(next);
+ this.prev = prev;
+ this.next = MaskedTickingBlockEntityList.this.filteredSuccessor.getInt(next + 1);
+ return prev;
+ }
+
+ @Override
+ public void remove() {
+ MaskedTickingBlockEntityList.this.remove(this.prev);
+ }
+ };
+ }
+
+ @Override
+ public int size() {
+ return this.allElements2Index.size();
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return this.size() == 0;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ //noinspection SuspiciousMethodCalls
+ return this.allElements2Index.containsKey(o);
+ }
+
+ @Override
+ public @NotNull Iterator<T> iterator() {
+ return Iterators.unmodifiableIterator(this.allElements2Index.keySet().iterator());
+ }
+
+ @Override
+ public Object[] toArray() {
+ return this.allElements2Index.keySet().toArray();
+ }
+
+ @NotNull
+ @Override
+ public <T1> T1[] toArray(@NotNull T1[] t1s) {
+ //noinspection SuspiciousToArrayCall
+ return this.allElements2Index.keySet().toArray(t1s);
+ }
+
+ @Override
+ public boolean add(T t) {
+ int arraySize = this.allElements.size();
+ int invalidEntries = arraySize - this.size();
+ //Compaction is done during the add operation as it is guaranteed to not happen during iteration
+ if ((arraySize > 2048 && invalidEntries > (arraySize >> 1)) || arraySize >= Integer.MAX_VALUE - 1 && invalidEntries != 0) {
+ this.compact();
+ }
+
+ if (!this.mayContain.test(t)) {
+ return false;
+ }
+
+ int index = this.allElements.size();
+ int i = this.allElements2Index.putIfAbsent(t, index);
+ if (i != -1) {
+ return false;
+ }
+ this.allElements.add(t);
+ this.filteredSuccessor.add(0);//increase size so setEntryVisible doesn't crash with indexOutOfBounds
+ this.setEntryVisible(index, true);
+
+ return true;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ int index = this.allElements2Index.removeInt(o);
+ if (index == -1) {
+ return false;
+ }
+ this.setEntryVisible(index, false);
+ this.allElements.set(index, null);
+ this.firstRemovedIndex = Math.min(this.firstRemovedIndex, index);
+ return true;
+ }
+
+ @Override
+ public boolean containsAll(@NotNull Collection<?> c) {
+ return this.allElements2Index.keySet().containsAll(c);
+ }
+
+ @Override
+ public boolean addAll(@NotNull Collection<? extends T> c) {
+ boolean b = false;
+ for (T t : c) {
+ this.add(t);
+ b = true;
+ }
+ return b;
+ }
+
+ @Override
+ public boolean addAll(int index, @NotNull Collection<? extends T> c) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean removeAll(@NotNull Collection<?> c) {
+ boolean b = false;
+ for (Object t : c) {
+ b |= this.remove(t);
+ }
+ return b;
+ }
+
+ @Override
+ public boolean retainAll(@NotNull Collection<?> c) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void clear() {
+ this.allElements2Index.clear();
+ this.allElements.clear();
+ this.filteredSuccessor.clear();
+ this.filteredElementsMask.clear();
+ this.firstRemovedIndex = Integer.MAX_VALUE;
+ this.filteredSuccessor.add(-1);
+ }
+
+ @Override
+ public T get(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public T set(int index, T element) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void add(int index, T element) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public T remove(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull ListIterator<T> listIterator() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull ListIterator<T> listIterator(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public @NotNull List<T> subList(int fromIndex, int toIndex) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/blockentity/BlockEntitySleepTracker.java b/src/main/java/me/jellysquid/mods/lithium/common/world/blockentity/BlockEntitySleepTracker.java
new file mode 100644
index 0000000000000000000000000000000000000000..c54e1e1f9c6b09022c0f20d5ea4d552bd3ceed55
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/blockentity/BlockEntitySleepTracker.java
@@ -0,0 +1,7 @@
+package me.jellysquid.mods.lithium.common.world.blockentity;
+
+import net.minecraft.world.level.block.entity.TileEntity;
+
+public interface BlockEntitySleepTracker {
+ void setAwake(TileEntity tileEntity, boolean needsTicking);
+}
\ No newline at end of file
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/blockentity/SleepingBlockEntity.java b/src/main/java/me/jellysquid/mods/lithium/common/world/blockentity/SleepingBlockEntity.java
new file mode 100644
index 0000000000000000000000000000000000000000..4e765ab19ffb300b6c810333b2dc797637ae5c1b
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/blockentity/SleepingBlockEntity.java
@@ -0,0 +1,7 @@
+package me.jellysquid.mods.lithium.common.world.blockentity;
+
+public interface SleepingBlockEntity {
+ default boolean canTickOnSide(boolean isClient) {
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index b04a785c70126ad3cc60eff47dffc4a913e0dd87..0ac2e6a5d2492599fad179c60e67369fd2f65647 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
2021-06-03 04:37:38 +02:00
@@ -97,8 +97,11 @@ import org.bukkit.event.block.BlockPhysicsEvent;
// CraftBukkit end
import net.gegy1000.tictacs.NonBlockingWorldAccess; // Yatopia
+import me.jellysquid.mods.lithium.common.util.collections.MaskedTickingBlockEntityList; // Yatopia
+import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker; // Yatopia
+import me.jellysquid.mods.lithium.common.world.blockentity.SleepingBlockEntity; // Yatopia
-public abstract class World implements GeneratorAccess, AutoCloseable, NonBlockingWorldAccess { // Yatopia
+public abstract class World implements GeneratorAccess, AutoCloseable, NonBlockingWorldAccess, BlockEntitySleepTracker { // Yatopia
protected static final Logger LOGGER = LogManager.getLogger();
public static final Codec<ResourceKey<World>> f = MinecraftKey.a.xmap(ResourceKey.b(IRegistry.L), ResourceKey::a);
2021-06-03 04:37:38 +02:00
@@ -107,9 +110,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable, NonBlocki
public static final ResourceKey<World> THE_END = ResourceKey.a(IRegistry.L, new MinecraftKey("the_end"));
private static final EnumDirection[] a = EnumDirection.values();
//public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
- public final List<TileEntity> tileEntityListTick = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(Lists.newArrayList()); // Yatopia
+ public List<TileEntity> tileEntityListTick = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(Lists.newArrayList()); // Yatopia
protected final List<TileEntity> tileEntityListPending = me.jellysquid.mods.lithium.common.util.collections.HashedList.wrapper(Lists.newArrayList()); // Yatopia
protected final java.util.Set<TileEntity> tileEntityListUnload = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>()); // Airplane - use set with faster contains
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ private MaskedTickingBlockEntityList<TileEntity> tileEntityListTick$lithium;
+
+ @Override
+ public void setAwake(TileEntity tileEntity, boolean needsTicking) {
+ this.tileEntityListTick$lithium.setEntryVisible(tileEntity, needsTicking);
+ }
+ // Yatopia end
public final Thread serverThread;
private final boolean debugWorld;
private int d;
@@ -330,6 +341,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable, NonBlocki
this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
+ this.tileEntityListTick$lithium = new MaskedTickingBlockEntityList<>(this.tileEntityListTick, blockEntity -> ((SleepingBlockEntity) blockEntity).canTickOnSide(false)); // Yatopia
+ this.tileEntityListTick = tileEntityListTick$lithium; // Yatopia
}
// Paper start
@@ -994,6 +1007,15 @@ public abstract class World implements GeneratorAccess, AutoCloseable, NonBlocki
}
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ public Iterator<TileEntity> getAwakeBlockEntities(List<TileEntity> list) {
+ if (list == this.tileEntityListTick && list instanceof MaskedTickingBlockEntityList) {
+ return ((MaskedTickingBlockEntityList<TileEntity>) list).filteredIterator();
+ }
+ return list.iterator();
+ }
+ // Yatopia end
+
public void tickBlockEntities() {
GameProfilerFiller gameprofilerfiller = this.getMethodProfiler();
@@ -1016,11 +1038,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable, NonBlocki
this.tickingTileEntities = true;
// Spigot start
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
// Iterator iterator = this.tileEntityListTick.iterator();
+ Iterator iterator = getAwakeBlockEntities(this.tileEntityListTick);
+
int tilesThisCycle = 0;
+ while (iterator.hasNext()) {
+ TileEntity tileentity = (TileEntity) iterator.next();
+ /*
for (tileTickPosition = 0; tileTickPosition < tileEntityListTick.size(); tileTickPosition++) { // Paper - Disable tick limiters
tileTickPosition = (tileTickPosition < tileEntityListTick.size()) ? tileTickPosition : 0;
TileEntity tileentity = (TileEntity) this.tileEntityListTick.get(tileTickPosition);
+ */
+ // Yatopia end
// Spigot start
if (tileentity == null) {
getServer().getLogger().severe("Spigot has detected a null entity and has removed it, preventing a crash");
@@ -1058,8 +1088,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable, NonBlocki
throwable.printStackTrace();
getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
// Paper end
- tilesThisCycle--;
- this.tileEntityListTick.remove(tileTickPosition--);
+ iterator.remove(); // Yatopia
continue;
// Paper end
// Spigot start
@@ -1072,8 +1101,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable, NonBlocki
if (tileentity.isRemoved()) {
// Spigot start
- tilesThisCycle--;
- this.tileEntityListTick.remove(tileTickPosition--);
+ iterator.remove(); // Yatopia
// Spigot end
//this.tileEntityList.remove(tileentity); // Paper - remove unused list
// Paper - prevent double chunk lookups
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
2021-06-03 04:37:38 +02:00
index 93d02ccb87c17404c55884f52ae40c7b7ddfb103..cc9e6b9e5f550f9e633ea124f3dd8cbcf0e43e12 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
2021-06-03 04:37:38 +02:00
@@ -26,8 +26,9 @@ import org.bukkit.inventory.InventoryHolder;
import org.spigotmc.CustomTimingsHandler; // Spigot
import co.aikar.timings.MinecraftTimings; // Paper
import co.aikar.timings.Timing; // Paper
+import me.jellysquid.mods.lithium.common.world.blockentity.SleepingBlockEntity;
-public abstract class TileEntity implements net.minecraft.server.KeyedObject { // Paper
+public abstract class TileEntity implements net.minecraft.server.KeyedObject, SleepingBlockEntity { // Paper // Yatopia
public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
// CraftBukkit start - data containers
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java
2021-06-03 04:37:38 +02:00
index cacef4349a8dba02c2faee77e30f7c938f3d31af..a1651a7155f7fe2f01882a1eee4fbb5a067e1b38 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeehive.java
@@ -23,6 +23,9 @@ import net.minecraft.world.level.block.BlockBeehive;
import net.minecraft.world.level.block.BlockCampfire;
import net.minecraft.world.level.block.BlockFire;
import net.minecraft.world.level.block.state.IBlockData;
+import me.jellysquid.mods.lithium.common.util.collections.ListeningList;
+import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker;
+import java.util.ArrayList;
public class TileEntityBeehive extends TileEntity implements ITickable {
@@ -30,11 +33,24 @@ public class TileEntityBeehive extends TileEntity implements ITickable {
@Nullable
public BlockPosition flowerPos = null;
2021-06-03 04:37:38 +02:00
public int maxBees = 3; // CraftBukkit - allow setting max amount of bees a hive can hold
+ public boolean doInit = true; // Yatopia
+ public boolean isTicking = true; // Yatopia
public TileEntityBeehive() {
super(TileEntityTypes.BEEHIVE);
}
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ public void checkSleepState() {
+ if (this.world != null ) {
+ if ((this.bees.size() == 0) == this.isTicking) {
+ this.isTicking = !this.isTicking;
+ ((BlockEntitySleepTracker) this.world).setAwake(this, this.isTicking);
+ }
+ }
+ }
+ // Yatopia end
+
@Override
public void update() {
if (this.d()) {
Upstream (#484) * Updated Upstream and Sidestream(s) (Paper/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 2a67a9e51 Fix missing CraftMetaBook#toBuilder override 48aa06106 Add more Wandering Trader API (#5020) 8cec462a5 [CI-SKIP] Remove Astei from the MIT list (#5577) 21fbc3196 [CI-SKIP] Add Other textarea to issue templates (#5562) 453e983e4 fix isProxyOnlineMode coverage, don't lookup UUIDs in offline mode (Fixes #2011) 81cc4f928 Send empty commands if tab completion is disabled (Closes #5519) 9ed3e470d Keep moveToWorld with old method signature 99a66a583 [Auto] Updated Upstream (CraftBukkit) 976c6d425 [CI-SKIP] [Auto] Rebuild Patches 51deec726 Drop unneeded portal patch (#5566) 07a18c457 [Auto] Updated Upstream (CraftBukkit) 6733d7875 [Auto] Updated Upstream (Bukkit) 9958447cb [Auto] Updated Upstream (Bukkit) 840e72091 [CI-SKIP] [Auto] Rebuild Patches a33232d4a Add beacon activation and deactivation events (#5121) Purpur Changes: ebc0765 Updated Upstream (Paper) 5bc5dfd Fix #318 - Stonecutter does not damage when sneaking 8366582 Resolve #286 - Add config and API for item immunity to lightning a86555b Updated Upstream (Paper) 8b2607c Config for only sending advancements to affected players (#312) 7ee3393 Add config for the piston push limit (#311) a30e5ac Add config for void damage dealt 786382b Updated Upstream (Paper) 60d8411 [ci-skip] fix patch name b64f536 Config for changing the blocks that turn into paths (#303) 1d3f710 Updated Upstream (Paper) 3af86ad Oopsie 4b0342a Gamemode extra permissions 17c8573 [CI-SKIP] Don't pass ping to demo command output c3481c0 Initialize the credits command output in config a176fe6 Add credits command Empirecraft Changes: b2879a24 Updated Paper * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b3cc88799 Add the ability to clear entities from block storage (#5598) f50171f3b Add missing rarity method on ItemStack (#5594) aeb6e7dd2 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5601) b0a4f353b fix cancelling block falling causing client desync (fixes #5386) (#5419) 8ed45920c Don't annotate type parameters using JetBrains annotations (#5600) d7625d926 Add new methods from PlayerMoveEvent to EntityMoveEvent (#5591) 29785297b Allow for Component suggestion tooltips in AsyncTabCompleteEvent (#5504) 0aea6c2ff Use JsonSerializationContext#serialize instead of recursion for AdventureComponents - fixes #5580 and #5371 8fcef3c1f Return after sending empty commands (#5586) Tuinity Changes: 3350246 Updated Upstream (Paper) f773caf Fix rare ticket level recursion crash 0fa8a0e Starlight Handle concurrent chunk generation and lighting better Airplane Changes: fad74c2 Fix JB annotations for gradle (credit jpenilla) d02f034 Updated Upstream (Tuinity) Purpur Changes: adfe5d3 Updated Upstream (Paper) 7a728f8 Fix #325 - Fix SPIGOT-6278 f5c3dae Updated Upstream (Paper) a80e5b6 Dont create item meta when checking if meta properties exist 90339c5 Add missing netherite from Material#isArmor bedac18 Updated Upstream (Paper, Tuinity, & Airplane) 3b1531a [ci-skip] Add wrapper validation step to actions 73ab4e6 Update the "changing the blocks that turn into paths" defaults to reflect the vanilla defaults. (#322) a24b31b Updated Upstream (Paper) Empirecraft Changes: 87ceb204 Updated Paper a3497a7e Fix some patches 2ed9e7fa Updated Paper d5a47a3d Updated Paper * Updated Upstream and Sidestream(s) (Tuinity) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 1382473 Null check chunk in block changes for Starlight
2021-05-11 05:16:50 +02:00
@@ -309,6 +325,12 @@ public class TileEntityBeehive extends TileEntity implements ITickable {
@Override
public void tick() {
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (this.doInit) {
+ this.doInit = false;
+ this.checkSleepState();
+ }
+ // Yatopia end
if (this.bees.size() == 0) { return; } // Yatopia - TE optimizations
if (!this.world.isClientSide) {
this.y();
Upstream (#484) * Updated Upstream and Sidestream(s) (Paper/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 2a67a9e51 Fix missing CraftMetaBook#toBuilder override 48aa06106 Add more Wandering Trader API (#5020) 8cec462a5 [CI-SKIP] Remove Astei from the MIT list (#5577) 21fbc3196 [CI-SKIP] Add Other textarea to issue templates (#5562) 453e983e4 fix isProxyOnlineMode coverage, don't lookup UUIDs in offline mode (Fixes #2011) 81cc4f928 Send empty commands if tab completion is disabled (Closes #5519) 9ed3e470d Keep moveToWorld with old method signature 99a66a583 [Auto] Updated Upstream (CraftBukkit) 976c6d425 [CI-SKIP] [Auto] Rebuild Patches 51deec726 Drop unneeded portal patch (#5566) 07a18c457 [Auto] Updated Upstream (CraftBukkit) 6733d7875 [Auto] Updated Upstream (Bukkit) 9958447cb [Auto] Updated Upstream (Bukkit) 840e72091 [CI-SKIP] [Auto] Rebuild Patches a33232d4a Add beacon activation and deactivation events (#5121) Purpur Changes: ebc0765 Updated Upstream (Paper) 5bc5dfd Fix #318 - Stonecutter does not damage when sneaking 8366582 Resolve #286 - Add config and API for item immunity to lightning a86555b Updated Upstream (Paper) 8b2607c Config for only sending advancements to affected players (#312) 7ee3393 Add config for the piston push limit (#311) a30e5ac Add config for void damage dealt 786382b Updated Upstream (Paper) 60d8411 [ci-skip] fix patch name b64f536 Config for changing the blocks that turn into paths (#303) 1d3f710 Updated Upstream (Paper) 3af86ad Oopsie 4b0342a Gamemode extra permissions 17c8573 [CI-SKIP] Don't pass ping to demo command output c3481c0 Initialize the credits command output in config a176fe6 Add credits command Empirecraft Changes: b2879a24 Updated Paper * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b3cc88799 Add the ability to clear entities from block storage (#5598) f50171f3b Add missing rarity method on ItemStack (#5594) aeb6e7dd2 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5601) b0a4f353b fix cancelling block falling causing client desync (fixes #5386) (#5419) 8ed45920c Don't annotate type parameters using JetBrains annotations (#5600) d7625d926 Add new methods from PlayerMoveEvent to EntityMoveEvent (#5591) 29785297b Allow for Component suggestion tooltips in AsyncTabCompleteEvent (#5504) 0aea6c2ff Use JsonSerializationContext#serialize instead of recursion for AdventureComponents - fixes #5580 and #5371 8fcef3c1f Return after sending empty commands (#5586) Tuinity Changes: 3350246 Updated Upstream (Paper) f773caf Fix rare ticket level recursion crash 0fa8a0e Starlight Handle concurrent chunk generation and lighting better Airplane Changes: fad74c2 Fix JB annotations for gradle (credit jpenilla) d02f034 Updated Upstream (Tuinity) Purpur Changes: adfe5d3 Updated Upstream (Paper) 7a728f8 Fix #325 - Fix SPIGOT-6278 f5c3dae Updated Upstream (Paper) a80e5b6 Dont create item meta when checking if meta properties exist 90339c5 Add missing netherite from Material#isArmor bedac18 Updated Upstream (Paper, Tuinity, & Airplane) 3b1531a [ci-skip] Add wrapper validation step to actions 73ab4e6 Update the "changing the blocks that turn into paths" defaults to reflect the vanilla defaults. (#322) a24b31b Updated Upstream (Paper) Empirecraft Changes: 87ceb204 Updated Paper a3497a7e Fix some patches 2ed9e7fa Updated Paper d5a47a3d Updated Paper * Updated Upstream and Sidestream(s) (Tuinity) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 1382473 Null check chunk in block changes for Starlight
2021-05-11 05:16:50 +02:00
@@ -329,6 +351,7 @@ public class TileEntityBeehive extends TileEntity implements ITickable {
@Override
public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
super.load(iblockdata, nbttagcompound);
+ this.checkSleepState(); // Yatopia
this.bees.clear();
NBTTagList nbttaglist = nbttagcompound.getList("Bees", 10);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
index 83626417aa9a00096680851a9a14f52f84fc7887..9f37518ada98c8ce64d283b49a9e3a7b6ec9457f 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -21,6 +21,7 @@ import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.World;
import net.minecraft.world.phys.AxisAlignedBB;
import org.apache.commons.lang3.mutable.MutableInt;
+import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker;
public class TileEntityBell extends TileEntity implements ITickable {
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -31,6 +32,8 @@ public class TileEntityBell extends TileEntity implements ITickable {
private List<EntityLiving> h; private List<EntityLiving> getEntitiesAtRing() { return this.h; } // Paper - OBFHELPER
private boolean i; private boolean getShouldReveal() { return this.i; } // Paper - OBFHELPER
private int j;
+ public boolean ringing; // Yatopia
+ public boolean resonating; // Yatopia
public TileEntityBell() {
super(TileEntityTypes.BELL);
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -38,6 +41,11 @@ public class TileEntityBell extends TileEntity implements ITickable {
@Override
public boolean setProperty(int i, int j) {
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (!this.ringing && i == 1 && this.world != null) {
+ ((BlockEntitySleepTracker) this.world).setAwake(this, true);
+ }
+ // Yatopia end
if (i == 1) {
this.f();
this.j = 0;
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -82,6 +90,11 @@ public class TileEntityBell extends TileEntity implements ITickable {
}
}
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (!this.ringing && !this.resonating && this.world != null) {
+ ((BlockEntitySleepTracker)this.world).setAwake(this, false);
+ }
+ // Yatopia end
}
private void d() {
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -89,6 +102,11 @@ public class TileEntityBell extends TileEntity implements ITickable {
}
public void a(EnumDirection enumdirection) {
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (!this.ringing && this.world != null) {
+ ((BlockEntitySleepTracker)this.world).setAwake(this, true);
+ }
+ // Yatopia end
BlockPosition blockposition = this.getPosition();
this.c = enumdirection;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
index 95ca7d9e1eadbe5cc5674ed7352c1ed4d707363d..b5d5f38e520bb5d7912cc86d8ee25858bbd0786b 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
@@ -34,6 +34,7 @@ import org.bukkit.event.inventory.BrewEvent;
import org.bukkit.event.inventory.BrewingStandFuelEvent;
import org.bukkit.inventory.InventoryHolder;
// CraftBukkit end
+import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker;
public class TileEntityBrewingStand extends TileEntityContainer implements IWorldInventory, ITickable {
@@ -50,6 +51,7 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl
private int lastTick = MinecraftServer.currentTick;
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
private int maxStack = 64;
+ public boolean isTicking = true; // Yatopia
public void onOpen(CraftHumanEntity who) {
transaction.add(who);
@@ -72,6 +74,17 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl
return maxStack;
}
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ @Override
+ public void update() {
+ super.update();
+ if (!this.isTicking && this.world != null) {
+ this.isTicking = true;
+ ((BlockEntitySleepTracker)this.world).setAwake(this, true);
+ }
+ }
+ // Yatopia end
+
public void setMaxStackSize(int size) {
maxStack = size;
}
@@ -141,6 +154,12 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl
@Override
public void tick() {
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (this.brewTime == 0 && this.world != null) {
+ this.isTicking = false;
+ ((BlockEntitySleepTracker)this.world).setAwake(this, false);
+ }
+ // Yatopia end
ItemStack itemstack = (ItemStack) this.items.get(4);
if (this.fuelLevel <= 0 && itemstack.getItem() == Items.BLAZE_POWDER) {
@@ -280,6 +299,12 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IWorl
@Override
public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
super.load(iblockdata, nbttagcompound);
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (!this.isTicking && this.world != null) {
+ this.isTicking = true;
+ ((BlockEntitySleepTracker) this.world).setAwake(this, true);
+ }
+ // Yatopia end
this.items = NonNullList.a(this.getSize(), ItemStack.b);
ContainerUtil.b(nbttagcompound, this.items);
this.brewTime = nbttagcompound.getShort("BrewTime");
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java
index 08759f461ec947c0d5655557f49d8717afee6f00..cdff01d4da417ef1be6238d3faaf464ee7884bd5 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java
@@ -27,12 +27,18 @@ import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockCookEvent;
// CraftBukkit end
+import net.minecraft.core.NonNullList;
+import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker;
public class TileEntityCampfire extends TileEntity implements Clearable, ITickable {
private final NonNullList<ItemStack> items;
public final int[] cookingTimes;
public final int[] cookingTotalTimes;
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ public boolean isTicking = true;
+ public boolean doInit = true;
+ // Yatopia end
public TileEntityCampfire() {
super(TileEntityTypes.CAMPFIRE);
@@ -41,8 +47,50 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab
this.cookingTotalTimes = new int[4];
}
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ @Override
+ public void update() {
+ super.update();
+ this.checkSleepState();
+ }
+
+ @Override
+ public void invalidateBlockCache() {
+ super.invalidateBlockCache();
+ this.checkSleepState();
+ }
+
+ public void checkSleepState() {
+ if (this.world == null) {
+ return;
+ }
+ boolean shouldTick = false;
+ NonNullList<ItemStack> beingCooked = this.items;
+ for (int i = 0; i < beingCooked.size(); i++) {
+ ItemStack stack = beingCooked.get(i);
+ if (!stack.isEmpty()) {
+ if (this.cookingTimes[i] > 0 || this.getBlock().get(BlockCampfire.LIT)) {
+ shouldTick = true;
+ break;
+ }
+ }
+ }
+
+ if (shouldTick != this.isTicking) {
+ this.isTicking = shouldTick;
+ ((BlockEntitySleepTracker)this.world).setAwake(this, shouldTick);
+ }
+ }
+ // Yatopia end
+
@Override
public void tick() {
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (this.doInit) {
+ this.doInit = false;
+ this.checkSleepState();
+ }
+ // Yatopia end
boolean flag = (Boolean) this.getBlock().get(BlockCampfire.LIT);
boolean flag1 = this.world.isClientSide;
@@ -149,6 +197,7 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab
@Override
public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
super.load(iblockdata, nbttagcompound);
+ this.checkSleepState(); // Yatopia - lithium: skip ticking block entities that are doing nothing
this.items.clear();
ContainerUtil.b(nbttagcompound, this.items);
int[] aint;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
index 324b752c70e0bd7ea06caa98ec15cdd4e6ea40ae..ebc4385e648e6205b1b6893e818b302a66f1cfea 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
@@ -33,14 +33,27 @@ import net.minecraft.world.level.block.Blocks;
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
+ import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker; // Yatopia
public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITickable
Upstream (#490) * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 151457628 Fix Counter#decrement recursive call (#5665) 21ac7dc98 [Auto] Updated Upstream (CraftBukkit) 18ad2c9dd Add environment variable (PAPER_DISABLE_SERVER_GUI) to disable server gui 6ecbe5776 Rename leftover resource->datapack (#5662) ec90a7859 I give up on trying to teach people to avoid the incorrect ways. dc7b7a160 Fix missing username console death message (#5654) (#5658) c639a52a6 Add basic Datapack API (#5653) (#5653) 99c1d9da6 Updated Upstream (CraftBukkit) (#5652) 2d50c17e2 [CI-SKIP] Add PR rebasing steps (#5634) 2c5f8085e Remove boat interaction event (Fixes #5539) 96ee1fb8f fix WorldSaveEvent not firing with /save-all (#5650) e90e7829e remove unneeded patch (#5641) d875bacc2 Activate warning by default when people are doing silly things (#5642) cb896d471 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5643) ecbf5a38e Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)" 20fc4ab70 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636) 20d8812ea Fix CraftPotionBrewer cache (#5632) cd6ae8816 Add a "Should Burn in Sunlight" API for Phantoms and Skeletons (#5608) 25edfe58b Remove unneeded component conversion for kick msg (#5626) cec386f66 Call PortalCreateEvent when players enter the end (#5618) 453c7f05c Add ItemStack#displayName to get the formatted display name of an ItemStack (#5628) 4efe8b498 Update Java version warning (#5621) e0a021ccc Add ItemStack#getTranslationKey() (#5616) 53d71b717 Add setPotionUseTimeLeft to Witch (#5597) 239935d18 Add Inventory#close (#5610) 29bf6cd41 Updated Upstream (CraftBukkit) ad45f316c Add raw address to AsyncPlayerPreLoginEvent (#5614) 28865335a [Auto] Updated Upstream (CraftBukkit) 750049fa2 Fix incorrect colors in some log messages (#5609) c5fa3f0d4 Add Adventure message to PlayerAdvancementDoneEvent (#5030) 69c09cdb0 Updated Upstream (CraftBukkit) (#5607) Tuinity Changes: 1222573 Fix incorrect status dataconverter for pre 1.13 chunks Airplane Changes: 3dce697 Fix gradle stuff 209bce3 Patches Purpur Changes: 72708f4 Option to disable dragon egg teleporting 5f87a45 Updated Upstream (Paper) 7bfc70d swap heavy logic to end bb9d72d Fix #338 - Phantoms always burning bug 8fa99b3 Configurable critical damage multiplier (#339) dc4a1cb Updated Upstream (Paper & Tuinity) c166841 Configurable powered rail boost modifier (closes #329) (#333) ab9b8ca Updated Upstream (Paper & Airplane) 44e72f7 Let parrots breed using any tempting item 09d98d3 this part is important, too :3 2015fe5 Breedable parrots 552d783 Iron golem poppy calms anger 1fa06a1 Optimize collisions (#328) 1112240 Extend Halloween Optimization (#321) 03f1aec Config for health to impact Creeper explosion radius (#304) 8f7bce4 Add config for hidden from entity selector patch 21906a2 Hide hidden players from entity selector 445496d [ci-skip] fix this too, now.. jfc 3ba8c81 Ya'll didn't see nothing.. 2d4611b Updated Upstream (Paper) beed258 Better offline mode warning (#330) c1efe3c It's meant to be double :facepalm: 3f9958b Implement the Mob Blindness mod 6e98c88 Add missing repo to settings.gradle.kts da5185b Update Gradle to 7.0.1 fbd28d8 Updated Upstream (Paper & Tuinity) cb42dec Updated Upstream (Paper) e883991 Fix compatibility with MyPet Origami Changes: 4c0616d Update Paper * Updated Upstream and Sidestream(s) (Paper) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 45e19ffb0 [Auto] Updated Upstream (CraftBukkit) * Updated Upstream and Sidestream(s) (Paper/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants * Updated Upstream and Sidestream(s) (Paper/Purpur/Paper) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants Paper Changes: 322886c86 Avoid NPE due to PlayerBedFailEnterEvent d3c9a195c removed duplicate ProjectileHitEvent for fireball (#5671) * Updated Upstream and Sidestream(s) (Paper/Airplane/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 2c6b1f048 Revert "Remove itneract event from boat" (Fixes #5677) aae1c54a9 Add command line option to load extra plugin jars not in the plugins folder Airplane Changes: 4a22184 Updated Upstream (Tuinity) Empirecraft Changes: d0aaf527 Updated Paper * Updated Upstream and Sidestream(s) (Airplane/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Airplane Changes: 046ae54 Improve hopper performance via bitset Purpur Changes: c333d3d Add config for the unverified username message (#348) 703b5da Fix invulnerable-while-accepting-resource-pack not being used * Updated Upstream and Sidestream(s) (Paper/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 6c183f1ae [Auto] Updated Upstream (CraftBukkit) Purpur Changes: e0991e0 allow using legacy section symbol in unverified username message 6bd246b Updated Upstream (Paper) * Updated Upstream and Sidestream(s) (Airplane) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Airplane Changes: 5fab6a2 Improvements to fluid & profiler patches * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 41e6073ce [Auto] Updated Upstream (CraftBukkit) 6f93dc95d Add cause to Weather/ThunderChangeEvents (#4832) 507cf19b3 [CI-SKIP] [Auto] Rebuild Patches afe0785bf Added PlayerPurchaseEvent for standalone Merchant GUIs (#5583) 615df3d8a Fix entity motion tag from mob spawners (#5718) 2d34898b5 Add methods for getting default item attributes (#5593) d9766433e Add EntityInsideBlockEvent (#5596) 47d48790d Change return type of ItemStack#editMeta to allow checking for successful vs non-successful edits 7aabe7d56 [CI-SKIP] fix minecart vs minecraft typos (#5713) f775e87b4 [CI-SKIP] ci: update setup-java action (#5710) c58b3b277 ci: replace Java 11 with Java 16 in GH Actions build flow (#5709) 4b72327a6 ItemStack#editMeta 68984b664 Add Unix domain socket support (#5611) 68c67e680 Add Mob#lookAt API (#5633) 4bacecd16 [Auto] Updated Upstream (Bukkit/CraftBukkit) 1f28e6eeb Fix default ChatRenderer when no plugins are installed (#5702) ecb0d32ca Enhance (Async)ChatEvent with per-viewer rendering API (#5684) f3e541ca1 Actually list all missing hard depends (#5701) 11f83fe8e [CI-SKIP] [Auto] Rebuild Patches a36e5d65f MC-148809: Fix incorrect structure block data length 3dcbdc73b Fix force upgrade patch (#5699) dab6ec6cd List all missing hard depends not just first (#5673) aed5031e3 Fix/Optimize world and light datafixes (#5693) 719040d92 [Auto] Updated Upstream (CraftBukkit) Tuinity Changes: f0e91a4 Updated Upstream (Paper) f88659c Fix and optimise world force upgrading Airplane Changes: 636dbff [ci skip] Cleanup mcdev import files c579320 [ci skip] Remove icons 7ada9a4 [skip ci] Need to specify 1.16.5 in the README of course 813df1a Update README daf3f0b Optimize air case for raytracing 1c252a5 Update Tuinity URL 50babee Updated Upstream (Tuinity) 85e0c63 Revert "Allow plugins to stupidly replace server internals" db3fe2c Remove auto import 6b32e01 Allow plugins to stupidly replace server internals f849f00 Flare Update ac10e43 Flare Update 7f3b091 Move check 040fa19 Better checking for useless move packets Purpur Changes: adb0cafe Updated Upstream (Paper) f9ccf6dd Updated Upstream (Paper & Airplane) 1343a050 Updated Upstream (Paper, Tuinity, & Airplane) af2dd61a Updated Upstream (Paper, Tuinity, & Airplane) 1808888a Expand gamemode extra perms some more Empirecraft Changes: 9e2881e6 Don't dismount on teleports... 7ed16bf3 Updated Paper c3d0a1b2 Re-add missing line in Vehicle teleporting patch * drop Improved-oversized-chunk-data-packet-handling.patch
2021-05-27 04:01:31 +02:00
private gg.airplane.structs.ItemListWithBitset items; // Airplane
protected float a;
+ private float getAnimationAngle() { return a; } // Yatopia - OBFHELPER
protected float b;
+ private float getLastAnimationAngle() { return b; } // Yatopia - OBFHELPER
public int viewingCount;
private int j;
+ private int ticksOpen = j; // Yatopia - OBFHELPER
+ private int lastTime; // Yatopia
+
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ public void checkWakeUp() {
+ if ((this.viewingCount != 0 || this.getAnimationAngle() != 0.0F || this.getLastAnimationAngle() != 0) && this.world != null) {
+ ((BlockEntitySleepTracker) this.world).setAwake(this, true);
+ }
+ }
+ // Yatopia end
// CraftBukkit start - add fields and methods
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -137,11 +150,27 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
}
public void tick() {
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ // noinspection ConstantConditions
+ int time = (int) this.world.getTime();
+ // ticksOpen == 0 implies most likely that this is the first tick. We don't want to update the value then.
+ // overflow case is handled by not going to sleep when this.ticksOpen == 0
+ if (this.ticksOpen != 0) {
+ this.ticksOpen += time - this.lastTime - 1;
+ }
+ this.lastTime = time;
+ // Yatopia end
+
int i = this.position.getX();
int j = this.position.getY();
int k = this.position.getZ();
++this.j;
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (this.viewingCount == 0 && this.getAnimationAngle() == 0.0F && this.getLastAnimationAngle() == 0 && this.ticksOpen != 0 && this.world != null) {
+ ((BlockEntitySleepTracker) this.world).setAwake(this, false);
+ }
+ // Yatopia end
}
public void doOpenLogic() {
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -247,6 +276,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
@Override
public boolean setProperty(int i, int j) {
+ this.checkWakeUp(); // Yatopia - lithium: skip ticking block entities that are doing nothing
if (i == 1) {
this.viewingCount = j;
return true;
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -278,7 +308,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
// CraftBukkit end
this.onOpen();
}
-
+ this.checkWakeUp(); // Yatopia - lithium: skip ticking block entities that are doing nothing
}
@Override
Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b94a99b03 Updated Upstream (CraftBukkit) (#5762) f5cb169e0 [Auto] Updated Upstream (CraftBukkit) 407ad043c Add ElderGuardianAppearanceEvent (#5394) a04ad7bfb Fix invulnerable end crystals: MC-108513 (#5734) c894e8bbb Fix issue with soft despawn distance (#5755) 302e5101a Add BellRevealRaiderEvent (#5729) 34e6b2dc3 editMeta: tighten contract via docs (#5714) db2d501ba Do not print spawn loaded chunks 86ffde038 Add getHandRaised to LivingEntity (#5752) 9072c349a Fix broadcast event and add Adventure broadcast (#5477) Tuinity Changes: f7c4249 Fix dangerous end portal logic 3eda860 Updated Upstream (Paper) Airplane Changes: 3e07ea8 Patch container checks for WildChests compat d04adc9 Updated Upstream (Tuinity) 489bb76 Update gradle 0d5670e Merge pull request #24 from HexedHero/spelling-mistake-lightning c605be6 Fix typo Purpur Changes: d2204a3d Updated Upstream (Paper, Tuinity & Airplane) 2b35782c Fix #364 - isCritical always false 6ab78311 Fix empty shulker boxes disappearing when broken afaf8b4f Updated Upstream (Paper) b97feb78 [ci-skip] readme eb77666a Updated Upstream (Paper) Empirecraft Changes: 105217a9 Move more files out of nms package 548a13f4 Move some server patches out nms package f24d7b4c Updated Paper 99745711 Updated Paper deb9886e Add a fix for piglins picking up too much - SPIGOT-6482 8c662d78 Add javadoc description to reload api 1af9bbc8 Adjust comments on vehicle event patch 2aa479b8 cleanup ItemStack isSimilar api patches f344cb62 Updated Paper dbb49189 Re-add EMC User API a6c40eb2 Updated Paper a57940b2 Remove EMC specific User API patches Origami Changes: d0cdf96 Fix issues with disabling the chunk loading of the feature search 529f5b6 Fix creature type despawn distances not applying 1af8601 Fix Endermen being able to load chunks on teleport
2021-06-02 01:00:22 +02:00
@@ -299,6 +329,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic
// CraftBukkit end
this.onOpen();
}
+ this.checkWakeUp(); // Yatopia - lithium: skip ticking block entities that are doing nothing
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnchantTable.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnchantTable.java
index 4b1cb089355b455c6210f2df1af797cc363997cf..0049a675557cbc05e361c12e9fb84a38a3a21160 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnchantTable.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnchantTable.java
@@ -9,6 +9,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.INamableTileEntity;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.block.state.IBlockData;
+import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker;
public class TileEntityEnchantTable extends TileEntity implements INamableTileEntity, ITickable {
@@ -51,6 +52,7 @@ public class TileEntityEnchantTable extends TileEntity implements INamableTileEn
@Override
public void tick() {
if (!org.yatopiamc.yatopia.server.YatopiaConfig.shouldTickEnchantingTables) { return; } // Yatopia - TE optimizations
+ ((BlockEntitySleepTracker) this.world).setAwake(this, false); // Yatopia
this.j = this.i;
this.l = this.k;
EntityHuman entityhuman = this.world.a((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D, 3.0D, false);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java
2021-06-03 04:37:38 +02:00
index 20193ba36c62fdd40ae905d1cea4bfd6d6aebcd7..b0f1c4f1660f3485303f0148bbc06dce4181e6b2 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java
2021-06-03 04:37:38 +02:00
@@ -51,9 +51,11 @@ import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.event.inventory.FurnaceExtractEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent;
// CraftBukkit end
+import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker;
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput, ITickable {
+ private boolean isTicking = true; // Yatopia
private static final int[] g = new int[]{0};
private static final int[] h = new int[]{2, 1};
private static final int[] i = new int[]{1};
2021-06-03 04:37:38 +02:00
@@ -195,6 +197,17 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
private int maxStack = MAX_STACK;
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ @Override
+ public void update() {
+ super.update();
+ if (!this.isTicking && this.world != null) {
+ this.isTicking = true;
+ ((BlockEntitySleepTracker) this.world).setAwake(this, true);
+ }
+ }
+ // Yatopia end
+
public List<ItemStack> getContents() {
return this.items;
}
2021-06-03 04:37:38 +02:00
@@ -257,6 +270,12 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
@Override
public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
super.load(iblockdata, nbttagcompound);
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (!this.isTicking && this.world != null) {
+ this.isTicking = true;
+ ((BlockEntitySleepTracker)this.world).setAwake(this, true);
+ }
+ // Yatopia end
this.items = NonNullList.a(this.getSize(), ItemStack.b);
ContainerUtil.b(nbttagcompound, this.items);
this.burnTime = nbttagcompound.getShort("BurnTime");
2021-06-03 04:37:38 +02:00
@@ -369,7 +388,12 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
if (flag1) {
this.update();
}
-
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (!this.isTicking && this.world != null) {
+ this.isTicking = true;
+ ((BlockEntitySleepTracker)this.world).setAwake(this, true);
+ }
+ // Yatopia end
}
protected boolean canBurn(@Nullable IRecipe<?> irecipe) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityShulkerBox.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityShulkerBox.java
index c1a90eb01689b8b91200ba49d58360d5ea2004c4..8095740f1848443e87fd52c14d19dabb00a3ecd4 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityShulkerBox.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityShulkerBox.java
@@ -33,6 +33,7 @@ import net.minecraft.world.phys.shapes.VoxelShapes;
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
+import me.jellysquid.mods.lithium.common.world.blockentity.BlockEntitySleepTracker;
public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable {
@@ -41,7 +42,9 @@ public class TileEntityShulkerBox extends TileEntityLootable implements IWorldIn
public int viewingCount;
private TileEntityShulkerBox.AnimationPhase i;
private float j;
+ public float animationProgress = j; // Yatopia - OBFHELPER
private float k;
+ public float prevAnimationProgress = k; // Yatopia - OBFHELPER
@Nullable
private EnumColor l;
private boolean m;
@@ -96,6 +99,11 @@ public class TileEntityShulkerBox extends TileEntityLootable implements IWorldIn
this.m();
}
+ // Yatopia start - lithium: skip ticking block entities that are doing nothing
+ if (this.getAnimationPhase() == TileEntityShulkerBox.AnimationPhase.CLOSED && this.prevAnimationProgress == 0f && this.animationProgress == 0f && this.world != null) {
+ ((BlockEntitySleepTracker) this.world).setAwake(this, false);
+ }
+ // Yatopia end
}
protected void h() {
@@ -127,6 +135,7 @@ public class TileEntityShulkerBox extends TileEntityLootable implements IWorldIn
}
+ public TileEntityShulkerBox.AnimationPhase getAnimationPhase() {return this.j(); } // Yatopia - OBFHELPER
public TileEntityShulkerBox.AnimationPhase j() {
return this.i;
}
@@ -209,6 +218,7 @@ public class TileEntityShulkerBox extends TileEntityLootable implements IWorldIn
@Override
public boolean setProperty(int i, int j) {
+ if (this.world != null && i == 1) ((BlockEntitySleepTracker) this.world).setAwake(this, true); // Yatopia
if (i == 1) {
this.viewingCount = j;
if (j == 0) {