mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 02:19:19 +00:00
Update Leaf 1.21.6 (#385)
* Init 1.21.6
* Finish API patches
* Apply purpur patches & all paper server patches
* Apply some
* Apply all
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@6aafe29e 1.21.6 dev
PaperMC/Paper@ae7c74ec tweak mob goal keys, generate missing api
PaperMC/Paper@9ea1460b Revert "fix sponge-absorb deleting chest content (#12647)"
Purpur Changes:
PurpurMC/Purpur@eb0ba67d Updated Upstream (Paper)
PurpurMC/Purpur@7c6502dc Updated Upstream (Paper)
PurpurMC/Purpur@aa289e2c Updated Upstream (Paper)
PurpurMC/Purpur@b1d412fb Updated Upstream (Paper)
PurpurMC/Purpur@293e28a0 use empty registryaccess where context is not needed, closes #1676
PurpurMC/Purpur@452bb319 port PaperMC/Paper#12654, closes #1665
PurpurMC/Purpur@849bc79c register test subcommands used for debugging, closes #1675
* Fix build & diff
* Update vanilla attribute size
* [ci/skip] Forget to remove this
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@a24f9b20 1.21.6 dev
PaperMC/Paper@457a0a69 Bump version string and protocol version to 1.21.6 release
PaperMC/Paper@245b5473 Update base to 1.21.6
PaperMC/Paper@b28d77b3 Update Moonrise to 1.21.6
PaperMC/Paper@8318dcb7 Update DataConverter to 1.21.6-rc1
Purpur Changes:
PurpurMC/Purpur@b228e316 Updated Upstream (Paper)
PurpurMC/Purpur@d6562a57 make happy ghast takes-damage-from-water and always-drop-exp options work
PurpurMC/Purpur@08d989b6 inline import
PurpurMC/Purpur@61d7f559 Updated Upstream (Paper)
PurpurMC/Purpur@469a4de5 Merge branch 'ver/1.21.5' into ver/1.21.6
* Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@d2b1158e Set correct world access on BSL snapshots
* Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@023e6c29 Ensure waypoints are per world
PaperMC/Paper@40d5d31c Fix recursively converting JSON Text Components
* Update spigot mapping to remap reobf mapping to mojamp for plugins
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@1fcc4162 Implement FeatureHooks#isChunkSent for Moonrise chunk system
PaperMC/Paper@e4d7178a Implement WaypointTransmitter#isChunkVisible
PaperMC/Paper@8980ead7 Directly walk text component after converting from JSON
PaperMC/Paper@5613ed6d Provide env environment variable and copy spigots sys prop for overriding default repository
PaperMC/Paper@62b7f86d Avoid and discourage use of Maven Central as a CDN (#12689)
PaperMC/Paper@f5534cb7 [ci/skip] Run generators (#12691)
PaperMC/Paper@4781d28b Re-add Log4j Javadocs (#12693)
PaperMC/Paper@74fbcce5 Check type of Material in get/set stats (#12607)
PaperMC/Paper@4b3f967e Improve Fix MC-44654 (#12703)
PaperMC/Paper@a7dd2635 Enable spigot obfuscation support (#12695)
PaperMC/Paper@6a51c44e Cleanup Primed TNT Fix (#12704)
PaperMC/Paper@839c6a18 Fix #11169 (#12706)
PaperMC/Paper@c77d5f99 Fix MC-297591
PaperMC/Paper@219f86ee Implement chunk unload delay config option
PaperMC/Paper@e4eb69b8 Do not allow ticket level decreases to be processed asynchronously
PaperMC/Paper@71b0c768 Adds support for vanilla negative explosions (#12705)
PaperMC/Paper@3750927a [ci/skip] Fix PermissionManager#clearPermissions() docs bad wording (#12657)
PaperMC/Paper@d61a51e8 Add ItemType#getBurnDuration() (#12604)
PaperMC/Paper@29fc8532 Allow empty paths in namespaced keys (#12687)
PaperMC/Paper@4419afb9 fix: Safely handle nanosecond overflow in ClickCallback (#12686)
PaperMC/Paper@56528821 Add `isProxyEnabled` method to ServerConfiguration (#12664)
PaperMC/Paper@c0dda0ea Add `isForceDefaultGameMode` method (#12673)
PaperMC/Paper@e714de63 Fix excess slot updates
PaperMC/Paper@6d0821d2 [ci/skip] Fix docs for Spawner class and cleanup (#12710)
PaperMC/Paper@cceffe3d Release ItemType and BlockType (#12708)
PaperMC/Paper@186e9e33 Relocate CommandMap#registerServerAliases() call to after lifecycle events have been run (#12601)
PaperMC/Paper@5edcf6dd Cleanup/command dispatching (#12713)
Purpur Changes:
PurpurMC/Purpur@baa196f5 Updated Upstream (Paper)
PurpurMC/Purpur@fdd1e980 Updated Upstream (Paper)
PurpurMC/Purpur@439f15db Updated Upstream (Paper)
PurpurMC/Purpur@46a28b93 [ci/skip] update version in README
PurpurMC/Purpur@162bd288 Updated Upstream (Paper)
PurpurMC/Purpur@afcdf9bb Updated Upstream (Paper)
* fix random tick order
Signed-off-by: hayanesuru <hayanesuru@outlook.jp>
* update optimize random tick
* fix mob spawning over limit
* optimize mob spawning
* fix FastBitRadixSort memory leak
* optimize brain collections
* [ci/skip] update comments
* Revert "fix FastBitRadixSort memory leak"
This reverts commit bdea683525.
* optimize brain collections
* fix async mob spawning data race
* [ci/skip] cleanup
* remove hash lookup in optimize random tick
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@803baf0b Support hidden entities in Waypoints (#12715)
PaperMC/Paper@1814d8b4 build: publish to fill (#12717)
PaperMC/Paper@e454fef4 Add support for private constructors in plugin main classes (#12652)
PaperMC/Paper@d0e808f4 Move player to correct position in vehicle move packet handler
PaperMC/Paper@46b4b0b8 Improve keepalive ping system
PaperMC/Paper@38c1ddb5 Add and use FeatureHooks.getAllEntities
PaperMC/Paper@2f083acb Ensure player entity schedulers are ticked when they are dead
PaperMC/Paper@7c90c7c4 Optimise EntityScheduler ticking
PaperMC/Paper@aa6ee44a Re-add global region scheduler tick erroneously removed in last commit
PaperMC/Paper@d7510efc Fix #12722 (#12726)
PaperMC/Paper@0caf75f8 Fix #12721 (#12725)
PaperMC/Paper@bee28792 Adventure 4.23.0 (#12690)
PaperMC/Paper@692e93a9 Fix MC-299110
PaperMC/Paper@ea10fa4a Don't mutate the position of Items for MC-4 Fix (#12702)
PaperMC/Paper@aa6cd74c Remove unnecesary item check for ServerboundPlayerActionPacket RELEASE_USE_ITEM (#12668)
PaperMC/Paper@c9e89f49 Expose arrow velocity in EntityShootBowEvent for mobs (#12688)
PaperMC/Paper@7ec3174a Jump out of experimental phase
PaperMC/Paper@4e1a2555 Update try catch for command handling
PaperMC/Paper@e382e687 Fix 0 yield on explosion events
PaperMC/Paper@35b2c6ec Use dropped item for stats info (#12747)
PaperMC/Paper@bd79e20c [ci/skip] PluginManager#getPlugin and PluginManager#isPluginEnabled are case-insensitive (#12723)
Purpur Changes:
PurpurMC/Purpur@4a5974cf Updated Upstream (Paper)
PurpurMC/Purpur@3893bba0 this is important...
PurpurMC/Purpur@47e758fb Updated Upstream (Paper)
* Update PWT patch
* cleanup
* fix playermobcaps command
* fix Didn't fill chunk buffer in async chunk sending
* cleanup
* fix HurtByTargetGoal npe
* optimize collectSpawningChunks (#382)
* optimize collectSpawningChunks
* add bit set
* cleanup
* cleanup
* cleanup
* cleanup
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@57c202e0 Allow adventure nbt codec to parse all tags
Purpur Changes:
PurpurMC/Purpur@a4776d7b Updated Upstream (Paper)
PurpurMC/Purpur@dfd8a7ad Fix phantom going at high speed when ridden (#1680)
* Fix diff
---------
Signed-off-by: hayanesuru <hayanesuru@outlook.jp>
Co-authored-by: hayanesuru <hayanesuru@outlook.jp>
This commit is contained in:
@@ -0,0 +1,315 @@
|
||||
package org.dreeam.leaf.util.map;
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.entity.schedule.Activity;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
|
||||
public final class ActivityArrayMap<V> implements Map<Activity, V> {
|
||||
public static final int BITS = 25;
|
||||
|
||||
public int bitset = 0;
|
||||
public final Object[] a = new Object[BITS + 1];
|
||||
private int size = 0;
|
||||
|
||||
private transient KeySet keySet;
|
||||
private transient Values valuesCollection;
|
||||
private transient EntrySet entrySet;
|
||||
|
||||
public ActivityArrayMap() {
|
||||
if (BuiltInRegistries.ACTIVITY.size() != BITS + 1) {
|
||||
throw new IllegalStateException("Unexpected registry minecraft:activity size");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public V put(Activity key, V value) {
|
||||
int index = key.id;
|
||||
int mask = 1 << index;
|
||||
@SuppressWarnings("unchecked")
|
||||
V oldValue = (V) a[index];
|
||||
boolean hadValue = oldValue != null;
|
||||
a[index] = value;
|
||||
if (!hadValue && value != null) {
|
||||
size++;
|
||||
bitset |= mask;
|
||||
}
|
||||
if (hadValue && value == null) {
|
||||
size--;
|
||||
bitset &= ~mask;
|
||||
}
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(Object key) {
|
||||
if (key instanceof Activity activity) {
|
||||
@SuppressWarnings("unchecked")
|
||||
V value = (V) a[activity.id];
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return key instanceof Activity activity && a[activity.id] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V remove(Object key) {
|
||||
if (key instanceof Activity activity) {
|
||||
int index = activity.id;
|
||||
@SuppressWarnings("unchecked")
|
||||
V oldValue = (V) a[index];
|
||||
if (oldValue != null) {
|
||||
a[index] = null;
|
||||
bitset &= ~(1 << index);
|
||||
size--;
|
||||
}
|
||||
return oldValue;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
Arrays.fill(a, null);
|
||||
size = 0;
|
||||
bitset = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return size == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
for (Object v : a) {
|
||||
if (Objects.equals(v, value)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends Activity, ? extends V> m) {
|
||||
for (Entry<? extends Activity, ? extends V> e : m.entrySet()) {
|
||||
put(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Activity> keySet() {
|
||||
if (keySet == null) {
|
||||
keySet = new KeySet();
|
||||
}
|
||||
return keySet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<V> values() {
|
||||
if (valuesCollection == null) {
|
||||
valuesCollection = new Values();
|
||||
}
|
||||
return valuesCollection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<Activity, V>> entrySet() {
|
||||
if (entrySet == null) {
|
||||
entrySet = new EntrySet();
|
||||
}
|
||||
return entrySet;
|
||||
}
|
||||
|
||||
private final class KeySet extends AbstractSet<Activity> {
|
||||
@Override
|
||||
public Iterator<Activity> iterator() {
|
||||
return new Iterator<>() {
|
||||
private int index = -1;
|
||||
|
||||
private void advance() {
|
||||
do index++;
|
||||
while (index <= BITS && (bitset & (1 << index)) == 0);
|
||||
}
|
||||
|
||||
{
|
||||
advance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return index <= BITS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Activity next() {
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
Activity activity = BuiltInRegistries.ACTIVITY.byIdOrThrow(index);
|
||||
advance();
|
||||
return activity;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return ActivityArrayMap.this.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return ActivityArrayMap.this.containsKey(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
ActivityArrayMap.this.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private final class Values extends AbstractCollection<V> {
|
||||
@Override
|
||||
public Iterator<V> iterator() {
|
||||
return new Iterator<>() {
|
||||
private int index = -1;
|
||||
|
||||
private void advance() {
|
||||
do index++;
|
||||
while (index <= BITS && (bitset & (1 << index)) == 0);
|
||||
}
|
||||
|
||||
{
|
||||
advance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return index <= BITS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V next() {
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
@SuppressWarnings("unchecked")
|
||||
V value = (V) a[index];
|
||||
advance();
|
||||
return value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return ActivityArrayMap.this.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return ActivityArrayMap.this.containsValue(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
ActivityArrayMap.this.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private final class EntrySet extends AbstractSet<Entry<Activity, V>> {
|
||||
@Override
|
||||
public Iterator<Entry<Activity, V>> iterator() {
|
||||
return new Iterator<>() {
|
||||
private int index = -1;
|
||||
private int last = -1;
|
||||
|
||||
private void advance() {
|
||||
do index++;
|
||||
while (index <= BITS && (bitset & (1 << index)) == 0);
|
||||
}
|
||||
|
||||
{
|
||||
advance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return index <= BITS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<Activity, V> next() {
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
last = index;
|
||||
Activity activity = BuiltInRegistries.ACTIVITY.byIdOrThrow(index);
|
||||
@SuppressWarnings("unchecked")
|
||||
V value = (V) a[index];
|
||||
advance();
|
||||
return new SimpleEntry<>(activity, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (last == -1) throw new IllegalStateException();
|
||||
if (a[last] != null) {
|
||||
a[last] = null;
|
||||
bitset &= ~(1 << last);
|
||||
size--;
|
||||
}
|
||||
last = -1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return ActivityArrayMap.this.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
if (o instanceof Entry<?, ?> entry && entry.getKey() instanceof Activity activity) {
|
||||
@SuppressWarnings("unchecked")
|
||||
V value = (V) a[activity.id];
|
||||
return Objects.equals(value, entry.getValue());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
ActivityArrayMap.this.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof Map<?, ?> other)) return false;
|
||||
if (this.size() != other.size()) return false;
|
||||
|
||||
for (Entry<Activity, V> entry : this.entrySet()) {
|
||||
Activity key = entry.getKey();
|
||||
V value = entry.getValue();
|
||||
if (!Objects.equals(value, other.get(key))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
for (Entry<Activity, V> entry : entrySet()) {
|
||||
hash += entry.hashCode();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package org.dreeam.leaf.util.map;
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.world.entity.schedule.Activity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public final class ActivityBitSet extends AbstractCollection<Activity> implements Set<Activity> {
|
||||
public static final int BITS = 25;
|
||||
|
||||
public int bitset = 0;
|
||||
|
||||
public ActivityBitSet() {
|
||||
if (BuiltInRegistries.ACTIVITY.size() != BITS + 1) {
|
||||
throw new IllegalStateException("Unexpected registry minecraft:activity size");
|
||||
}
|
||||
}
|
||||
|
||||
private static Activity map(int i) {
|
||||
return BuiltInRegistries.ACTIVITY.byIdOrThrow(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(Activity activity) {
|
||||
int mask = 1 << activity.id;
|
||||
if ((bitset & mask) != 0) return false;
|
||||
bitset |= mask;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
if (o instanceof Activity activity) {
|
||||
int mask = 1 << activity.id;
|
||||
if ((bitset & mask) != 0) {
|
||||
bitset &= ~mask;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return (o instanceof Activity activity) && ((bitset & (1 << activity.id)) != 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Iterator<Activity> iterator() {
|
||||
return new Iterator<>() {
|
||||
private int index = 0;
|
||||
|
||||
private void advance() {
|
||||
while (index < BITS && (bitset & (1 << index)) == 0) index++;
|
||||
}
|
||||
{
|
||||
advance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return index < BITS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Activity next() {
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
Activity act = map(index++);
|
||||
advance();
|
||||
return act;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return Integer.bitCount(bitset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
bitset = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof Set<?> s)) return false;
|
||||
if (s.size() != size()) return false;
|
||||
return containsAll(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
for (int i = 0; i < BITS; i++) {
|
||||
if ((bitset & (1 << i)) != 0) {
|
||||
hash += map(i).hashCode();
|
||||
}
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,17 @@ import java.util.AbstractMap.SimpleEntry;
|
||||
// fast array backend map with O(1) get & put & remove
|
||||
public final class AttributeInstanceArrayMap implements Map<Holder<Attribute>, AttributeInstance>, Cloneable {
|
||||
|
||||
private static final int VANILLA_ATTRIBUTE_SIZE = 35; // 1.21.6 (Check this on every Minecraft version)
|
||||
|
||||
private int size = 0;
|
||||
private transient AttributeInstance[] a = new AttributeInstance[32];
|
||||
private transient AttributeInstance[] a = new AttributeInstance[VANILLA_ATTRIBUTE_SIZE];
|
||||
private transient KeySet keys;
|
||||
private transient Values values;
|
||||
private transient EntrySet entries;
|
||||
|
||||
public AttributeInstanceArrayMap() {
|
||||
if (BuiltInRegistries.ATTRIBUTE.size() != 32) {
|
||||
throw new IllegalStateException("Registered custom attribute");
|
||||
if (BuiltInRegistries.ATTRIBUTE.size() != VANILLA_ATTRIBUTE_SIZE) {
|
||||
throw new IllegalStateException("Unexpected registry minecraft:attribute size");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.dreeam.leaf.util.map;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArraySet;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.behavior.Behavior;
|
||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl;
|
||||
|
||||
public class BehaviorControlArraySet<E extends LivingEntity> extends ObjectArraySet<BehaviorControl<? super E>> {
|
||||
private int running;
|
||||
|
||||
public Object[] raw() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public void inc() {
|
||||
running++;
|
||||
}
|
||||
|
||||
public void dec() {
|
||||
running--;
|
||||
}
|
||||
|
||||
public boolean running() {
|
||||
return running != 0;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class GaleGlobalConfiguration extends ConfigurationPart {
|
||||
public Keepalive keepalive;
|
||||
|
||||
public class Keepalive extends ConfigurationPart {
|
||||
public boolean sendMultiple = true; // Gale - Purpur - send multiple keep-alive packets
|
||||
public boolean sendMultiple = false; // Gale - Purpur - send multiple keep-alive packets
|
||||
}
|
||||
|
||||
// Gale start - YAPFA - last tick time - in TPS command
|
||||
|
||||
@@ -82,7 +82,7 @@ public class AppleSkinProtocol implements LeavesProtocol {
|
||||
}
|
||||
|
||||
case "natural_regeneration" -> {
|
||||
boolean regeneration = player.serverLevel().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION);
|
||||
boolean regeneration = player.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION);
|
||||
Boolean previousRegeneration = previousNaturalRegeneration.get(player);
|
||||
if (previousRegeneration == null || regeneration != previousRegeneration) {
|
||||
ProtocolUtils.sendBytebufPacket(player, NATURAL_REGENERATION_KEY, buf -> buf.writeBoolean(regeneration));
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.block.entity.TrialSpawnerBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerData;
|
||||
import net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerStateData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
||||
@@ -21,7 +21,7 @@ public enum MobSpawnerCooldownProvider implements StreamServerDataProvider<Block
|
||||
@Override
|
||||
public @Nullable Integer streamData(@NotNull BlockAccessor accessor) {
|
||||
TrialSpawnerBlockEntity spawner = (TrialSpawnerBlockEntity) accessor.getBlockEntity();
|
||||
TrialSpawnerData spawnerData = spawner.getTrialSpawner().getData();
|
||||
TrialSpawnerStateData spawnerData = spawner.getTrialSpawner().getStateData();
|
||||
ServerLevel level = ((ServerLevel) accessor.getLevel());
|
||||
if (spawner.getTrialSpawner().canSpawnInLevel(level) && level.getGameTime() < spawnerData.cooldownEndsAt) {
|
||||
return (int) (spawnerData.cooldownEndsAt - level.getGameTime());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.leavesmc.leaves.replay;
|
||||
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.local.LocalChannel;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.core.LayeredRegistryAccess;
|
||||
@@ -9,7 +10,6 @@ import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.ConnectionProtocol;
|
||||
import net.minecraft.network.PacketSendListener;
|
||||
import net.minecraft.network.protocol.BundlePacket;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
@@ -87,7 +87,7 @@ public class Recorder extends Connection {
|
||||
metaData.singleplayer = false;
|
||||
metaData.serverName = recorderOption.serverName;
|
||||
metaData.date = startTime;
|
||||
metaData.mcversion = SharedConstants.getCurrentVersion().getName();
|
||||
metaData.mcversion = SharedConstants.getCurrentVersion().name();
|
||||
|
||||
// TODO start event
|
||||
this.savePacket(new ClientboundLoginFinishedPacket(photographer.getGameProfile()), ConnectionProtocol.LOGIN);
|
||||
@@ -169,7 +169,7 @@ public class Recorder extends Connection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(@NotNull Packet<?> packet, @Nullable PacketSendListener callbacks, boolean flush) {
|
||||
public void send(@NotNull Packet<?> packet, @Nullable ChannelFutureListener callbacks, boolean flush) {
|
||||
if (!stopped) {
|
||||
if (packet instanceof BundlePacket<?> packet1) {
|
||||
packet1.subPackets().forEach(subPacket -> send(subPacket, null));
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ReplayFile {
|
||||
public void saveMetaData(@NotNull RecordMetaData data) throws IOException {
|
||||
data.fileFormat = "MCPR";
|
||||
data.fileFormatVersion = RecordMetaData.CURRENT_FILE_FORMAT_VERSION;
|
||||
data.protocol = SharedConstants.getCurrentVersion().getProtocolVersion();
|
||||
data.protocol = SharedConstants.getCurrentVersion().protocolVersion();
|
||||
data.generator = ProtocolUtils.buildProtocolVersion("replay");
|
||||
|
||||
try (Writer writer = new OutputStreamWriter(new FileOutputStream(metaFile), StandardCharsets.UTF_8)) {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ServerPhotographer extends ServerPlayer {
|
||||
|
||||
photographer.recorder.start();
|
||||
MinecraftServer.getServer().getPlayerList().placeNewPhotographer(photographer.recorder, photographer, world);
|
||||
photographer.serverLevel().chunkSource.move(photographer);
|
||||
photographer.level().chunkSource.move(photographer);
|
||||
photographer.setInvisible(true);
|
||||
photographers.add(photographer);
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ServerPhotographer extends ServerPlayer {
|
||||
|
||||
if (this.server.getTickCount() % 10 == 0) {
|
||||
connection.resetPosition();
|
||||
this.serverLevel().chunkSource.move(this);
|
||||
this.level().chunkSource.move(this);
|
||||
}
|
||||
|
||||
if (this.followPlayer != null) {
|
||||
|
||||
Reference in New Issue
Block a user