mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
even MOAR progress
This commit is contained in:
parent
c5210433c1
commit
c5794c5351
14 changed files with 113 additions and 225 deletions
|
@ -1,4 +1,4 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From 0000000000000000000000>>>>>>> replacement000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MeFisto94 <MeFisto94@users.noreply.github.com>
|
||||
Date: Tue, 11 Aug 2020 19:17:46 +0200
|
||||
Subject: [PATCH] Add a way to get translation keys for blocks, entities and
|
|
@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
@@ -0,0 +0,0 @@ public interface ItemFactory {
|
||||
*/
|
||||
@Nullable
|
||||
String getI18NDisplayName(@Nullable ItemStack item);
|
||||
@NotNull
|
||||
ItemStack ensureServerConversions(@NotNull ItemStack item);
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that ItemStack for displaying.
|
|
@ -1,58 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Eearslya Sleiarion <eearslya@gmail.com>
|
||||
Date: Sun, 23 Aug 2020 13:04:02 +0200
|
||||
Subject: [PATCH] Add BellRingEvent
|
||||
|
||||
Add a new event, BellRingEvent, to trigger whenever a player rings a
|
||||
village bell. Passes along the bell block and the player who rang it.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BellBlock.java b/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package net.minecraft.world.level.block;
|
||||
|
||||
+import io.papermc.paper.event.block.BellRingEvent;
|
||||
+
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.stats.Stats;
|
||||
@@ -0,0 +0,0 @@ public class BellBlock extends BaseEntityBlock {
|
||||
boolean flag1 = !flag || this.isProperHit(state, enumdirection, movingobjectpositionblock.getLocation().y - (double) blockposition.getY());
|
||||
|
||||
if (flag1) {
|
||||
- boolean flag2 = this.attemptToRing(world, blockposition, enumdirection);
|
||||
+ boolean flag2 = this.handleBellRing(world, blockposition, enumdirection, entityhuman); // Paper
|
||||
|
||||
if (flag2 && entityhuman != null) {
|
||||
entityhuman.awardStat(Stats.BELL_RING);
|
||||
@@ -0,0 +0,0 @@ public class BellBlock extends BaseEntityBlock {
|
||||
}
|
||||
|
||||
public boolean attemptToRing(Level world, BlockPos pos, @Nullable Direction enumdirection) {
|
||||
- BlockEntity tileentity = world.getBlockEntity(pos);
|
||||
+ // Paper start - add ringer param
|
||||
+ return this.handleBellRing(world, pos, enumdirection, null);
|
||||
+ }
|
||||
+ public boolean handleBellRing(Level world, BlockPos blockposition, @Nullable Direction enumdirection, @Nullable Entity ringer) {
|
||||
+ // Paper end
|
||||
+ BlockEntity tileentity = world.getBlockEntity(blockposition);
|
||||
|
||||
if (!world.isClientSide && tileentity instanceof BellBlockEntity) {
|
||||
if (enumdirection == null) {
|
||||
- enumdirection = (Direction) world.getBlockState(pos).getValue(BellBlock.FACING);
|
||||
+ enumdirection = (Direction) world.getBlockState(blockposition).getValue(BellBlock.FACING);
|
||||
}
|
||||
|
||||
+ if (!new BellRingEvent(world.getWorld().getBlockAt(MCUtil.toLocation(world, blockposition)), ringer == null ? null : ringer.getBukkitEntity()).callEvent()) return false; // Paper - BellRingEvent
|
||||
((BellBlockEntity) tileentity).onHit(enumdirection);
|
||||
- world.playSound((Player) null, pos, SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F);
|
||||
+ world.playSound((Player) null, blockposition, SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
|
@ -1,57 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 23 Aug 2020 15:28:35 +0200
|
||||
Subject: [PATCH] Add more Evoker API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Evoker.java b/src/main/java/net/minecraft/world/entity/monster/Evoker.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Evoker.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Evoker.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
public class Evoker extends SpellcasterIllager {
|
||||
|
||||
- private Sheep wololoTarget;
|
||||
+ private Sheep wololoTarget; public final Sheep getWololoTarget() { return this.wololoTarget; } public final void setWololoTarget(Sheep sheep) { this.wololoTarget = sheep; } // Paper - OBFHELPER
|
||||
|
||||
public Evoker(EntityType<? extends Evoker> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -0,0 +0,0 @@ public class Evoker extends SpellcasterIllager {
|
||||
this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6D));
|
||||
this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F));
|
||||
this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F));
|
||||
- this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Raider.class})).canUse());
|
||||
+ this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Raider.class})).setAlertOthers(new Class[0])); // Paper - decompile fix
|
||||
this.targetSelector.addGoal(2, (new NearestAttackableTargetGoal<>(this, Player.class, true)).setUnseenMemoryTicks(300));
|
||||
this.targetSelector.addGoal(3, (new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)).setUnseenMemoryTicks(300));
|
||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, false));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
+import net.minecraft.world.entity.animal.Sheep;
|
||||
import net.minecraft.world.entity.monster.SpellcasterIllager;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -0,0 +0,0 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker {
|
||||
public void setCurrentSpell(Evoker.Spell spell) {
|
||||
getHandle().setIsCastingSpell(spell == null ? SpellcasterIllager.IllagerSpell.NONE : SpellcasterIllager.IllagerSpell.byId(spell.ordinal()));
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public org.bukkit.entity.Sheep getWololoTarget() {
|
||||
+ Sheep sheep = getHandle().getWololoTarget();
|
||||
+ return sheep == null ? null : (org.bukkit.entity.Sheep) sheep.getBukkitEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setWololoTarget(org.bukkit.entity.Sheep sheep) {
|
||||
+ getHandle().setWololoTarget(sheep == null ? null : ((org.bukkit.craftbukkit.entity.CraftSheep) sheep).getHandle());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
28
patches/server/Add-BellRingEvent.patch
Normal file
28
patches/server/Add-BellRingEvent.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Eearslya Sleiarion <eearslya@gmail.com>
|
||||
Date: Sun, 23 Aug 2020 13:04:02 +0200
|
||||
Subject: [PATCH] Add BellRingEvent
|
||||
|
||||
Add a new event, BellRingEvent, to trigger whenever a player rings a
|
||||
village bell. Passes along the bell block and the player who rang it.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BellBlock.java b/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BellBlock.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.stats.Stats;
|
||||
@@ -0,0 +0,0 @@ public class BellBlock extends BaseEntityBlock {
|
||||
direction = world.getBlockState(pos).getValue(FACING);
|
||||
}
|
||||
|
||||
+ if (!new io.papermc.paper.event.block.BellRingEvent(world.getWorld().getBlockAt(MCUtil.toLocation(world, pos)), entity == null ? null : entity.getBukkitEntity()).callEvent()) return false; // Paper - BellRingEvent
|
||||
((BellBlockEntity)blockEntity).onHit(direction);
|
||||
world.playSound((Player)null, pos, SoundEvents.BELL_BLOCK, SoundSource.BLOCKS, 2.0F, 1.0F);
|
||||
world.gameEvent(entity, GameEvent.RING_BELL, pos);
|
|
@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> {
|
||||
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
||||
return Registry.ENTITY_TYPE.getKey(type);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public static Optional<EntityType<?>> byString(String id) {
|
||||
return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id));
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> {
|
||||
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
||||
return this.category;
|
||||
}
|
||||
|
||||
|
@ -25,41 +25,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
public String getDescriptionId() {
|
||||
if (this.descriptionId == null) {
|
||||
this.descriptionId = Util.makeDescriptionId("entity", Registry.ENTITY_TYPE.getKey(this));
|
||||
diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/Item.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/Item.java
|
||||
@@ -0,0 +0,0 @@ public class Item implements ItemLike {
|
||||
private final FoodProperties foodProperties;
|
||||
|
||||
public static int getId(Item item) {
|
||||
- return item == null ? 0 : Registry.ITEM.getId((Object) item);
|
||||
+ return item == null ? 0 : Registry.ITEM.getId(item); // Paper - Fix Decompiler Issue
|
||||
}
|
||||
|
||||
public static Item byId(int id) {
|
||||
@@ -0,0 +0,0 @@ public class Item implements ItemLike {
|
||||
return Registry.ITEM.getKey(this).getPath();
|
||||
}
|
||||
|
||||
+ public String getOrCreateDescriptionId() { return getOrCreateDescriptionId(); } // Paper - OBFHELPER
|
||||
protected String getOrCreateDescriptionId() {
|
||||
if (this.descriptionId == null) {
|
||||
this.descriptionId = Util.makeDescriptionId("item", Registry.ITEM.getKey(this));
|
||||
@@ -0,0 +0,0 @@ public class Item implements ItemLike {
|
||||
return this.getOrCreateDescriptionId();
|
||||
}
|
||||
|
||||
+ public String getDescriptionId(ItemStack itemStack) { return getDescriptionId(itemStack); } // Paper - OBFHELPER
|
||||
public String getDescriptionId(ItemStack stack) {
|
||||
return this.getDescriptionId();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -0,0 +0,0 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
return !this.material.isBuildable() && !this.material.isLiquid();
|
||||
return new TranslatableComponent(this.getDescriptionId());
|
||||
}
|
||||
|
||||
+ public String getOrCreateDescriptionId() { return getDescriptionId(); } // Paper - OBFHELPER
|
35
patches/server/Add-more-Evoker-API.patch
Normal file
35
patches/server/Add-more-Evoker-API.patch
Normal file
|
@ -0,0 +1,35 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 23 Aug 2020 15:28:35 +0200
|
||||
Subject: [PATCH] Add more Evoker API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
+import net.minecraft.world.entity.animal.Sheep;
|
||||
import net.minecraft.world.entity.monster.SpellcasterIllager;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@@ -0,0 +0,0 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker {
|
||||
public void setCurrentSpell(Evoker.Spell spell) {
|
||||
this.getHandle().setIsCastingSpell(spell == null ? SpellcasterIllager.IllagerSpell.NONE : SpellcasterIllager.IllagerSpell.byId(spell.ordinal()));
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public org.bukkit.entity.Sheep getWololoTarget() {
|
||||
+ Sheep sheep = getHandle().getWololoTarget();
|
||||
+ return sheep == null ? null : (org.bukkit.entity.Sheep) sheep.getBukkitEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setWololoTarget(org.bukkit.entity.Sheep sheep) {
|
||||
+ getHandle().setWololoTarget(sheep == null ? null : ((org.bukkit.craftbukkit.entity.CraftSheep) sheep).getHandle());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
|
@ -9,15 +9,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
maxLightningFlashDistance = 512; // Vanilla value
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ public boolean zombiesTargetTurtleEggs = true;
|
||||
+ private void zombiesTargetTurtleEggs() {
|
||||
+ zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
public short keepLoadedRange;
|
||||
private void keepLoadedRange() {
|
||||
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
|
@ -25,14 +25,14 @@ diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.game.ClientboundDisconnectPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundKeepAlivePacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetTitlesPacket;
|
||||
import net.minecraft.server.MCUtil;
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
import net.minecraft.network.protocol.game.ClientboundDisconnectPacket;
|
||||
import net.minecraft.network.protocol.login.ClientboundLoginDisconnectPacket;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.RunningOnDifferentThreadException;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.server.network.ServerLoginPacketListenerImpl;
|
||||
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
}
|
||||
// Paper end
|
||||
|
@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ private static int joinAttemptsThisTick; // Paper
|
||||
+ private static int currTick; // Paper
|
||||
public void tick() {
|
||||
this.p();
|
||||
this.flushQueue();
|
||||
+ // Paper start
|
||||
+ if (currTick != MinecraftServer.currentTick) {
|
||||
+ currTick = MinecraftServer.currentTick;
|
||||
|
@ -56,16 +56,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
if (this.packetListener instanceof ServerGamePacketListenerImpl) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
return new GameProfile(uuid, profile.getName());
|
||||
}
|
||||
|
||||
- static enum State {
|
||||
+ public enum State { // Paper - package private -> public
|
||||
|
||||
HELLO, KEY, AUTHENTICATING, NEGOTIATING, READY_TO_ACCEPT, DELAY_ACCEPT, ACCEPTED;
|
||||
|
|
@ -15,5 +15,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
- Validate.notNull("Entry cannot be null");
|
||||
+ Validate.notNull(entry, "Entry cannot be null"); // Paper
|
||||
|
||||
CraftScoreboard scoreboard = checkState();
|
||||
CraftScoreboard scoreboard = this.checkState();
|
||||
|
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||
synchronized (throttleTracker) {
|
||||
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
||||
throttleTracker.put(address, currentTime);
|
||||
synchronized (ServerHandshakePacketListenerImpl.throttleTracker) {
|
||||
if (ServerHandshakePacketListenerImpl.throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - ServerHandshakePacketListenerImpl.throttleTracker.get(address) < connectionThrottle) {
|
||||
ServerHandshakePacketListenerImpl.throttleTracker.put(address, currentTime);
|
||||
- TranslatableComponent chatmessage = new TranslatableComponent(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
|
||||
+ Component chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage, true)[0]; // Paper - Configurable connection throttle kick message // Paper - Fix hex colors not working in some kick messages
|
||||
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||||
|
@ -37,10 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
if (event.callEvent()) {
|
||||
// If we've failed somehow, let the client know so and go no further.
|
||||
if (event.isFailed()) {
|
||||
- chatmessage = new TranslatableComponent(event.getFailMessage());
|
||||
- TranslatableComponent chatmessage = new TranslatableComponent(event.getFailMessage());
|
||||
+ Component chatmessage = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(event.getFailMessage(), true)[0]; // Paper - Fix hex colors not working in some kick messages
|
||||
this.getNetworkManager().send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||||
this.getNetworkManager().disconnect(chatmessage);
|
||||
this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||||
this.connection.disconnect(chatmessage);
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
@ -23,10 +23,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||
private void zombiesTargetTurtleEggs() {
|
||||
zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs);
|
||||
}
|
||||
+
|
||||
|
||||
+ public boolean useEigencraftRedstone = false;
|
||||
+ private void useEigencraftRedstone() {
|
||||
+ useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false);
|
||||
|
@ -36,7 +35,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ log("Using vanilla redstone algorithm.");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+
|
||||
public short keepLoadedRange;
|
||||
private void keepLoadedRange() {
|
||||
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
@ -863,14 +865,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ j = getMaxCurrentStrength(upd, j);
|
||||
+ int l = 0;
|
||||
+
|
||||
+ wire.setCanProvidePower(false);
|
||||
+ wire.shouldSignal = false;
|
||||
+ // Unfortunately, World.isBlockIndirectlyGettingPowered is complicated,
|
||||
+ // and I'm not ready to try to replicate even more functionality from
|
||||
+ // elsewhere in Minecraft into this accelerator. So sadly, we must
|
||||
+ // suffer the performance hit of this very expensive call. If there
|
||||
+ // is consistency to what this call returns, we may be able to cache it.
|
||||
+ final int k = worldIn.isBlockIndirectlyGettingPowered(upd.self);
|
||||
+ wire.setCanProvidePower(true);
|
||||
+ final int k = worldIn.getBestNeighborSignal(upd.self);
|
||||
+ wire.shouldSignal = true;
|
||||
+
|
||||
+ // The variable 'k' holds the maximum redstone power value of any adjacent blocks.
|
||||
+ // If 'k' has the highest level of all neighbors, then the power level of this
|
||||
|
@ -956,26 +958,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return i > strength ? i : strength;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
}
|
||||
|
||||
+ public void neighborChanged(BlockPos pos, Block blockIn, BlockPos fromPos) { neighborChanged(pos, blockIn, fromPos); } // Paper - OBFHELPER
|
||||
public void neighborChanged(BlockPos sourcePos, Block sourceBlock, BlockPos neighborPos) {
|
||||
if (!this.isClientSide) {
|
||||
BlockState iblockdata = this.getBlockState(sourcePos);
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
return this.getSignal(pos.below(), Direction.DOWN) > 0 ? true : (this.getSignal(pos.above(), Direction.UP) > 0 ? true : (this.getSignal(pos.north(), Direction.NORTH) > 0 ? true : (this.getSignal(pos.south(), Direction.SOUTH) > 0 ? true : (this.getSignal(pos.west(), Direction.WEST) > 0 ? true : this.getSignal(pos.east(), Direction.EAST) > 0))));
|
||||
}
|
||||
|
||||
+ public int isBlockIndirectlyGettingPowered(BlockPos pos) { return this.getBestNeighborSignal(pos); } // Paper - OBFHELPER
|
||||
public int getBestNeighborSignal(BlockPos pos) {
|
||||
int i = 0;
|
||||
Direction[] aenumdirection = Level.DIRECTIONS;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
|
@ -989,11 +971,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -0,0 +0,0 @@ public class RedStoneWireBlock extends Block {
|
||||
private final Map<BlockState, VoxelShape> SHAPES_CACHE = Maps.newHashMap();
|
||||
private static final Vector3f[] COLORS = new Vector3f[16];
|
||||
});
|
||||
private static final float PARTICLE_DENSITY = 0.2F;
|
||||
private final BlockState crossState;
|
||||
- private boolean shouldSignal = true;
|
||||
+ private boolean shouldSignal = true; public final boolean canProvidePower() { return this.shouldSignal; } public final void setCanProvidePower(boolean value) { this.shouldSignal = value; } // Paper - OBFHELPER
|
||||
+ public boolean shouldSignal = true; // Paper private -> public
|
||||
|
||||
public RedStoneWireBlock(BlockBehaviour.Properties settings) {
|
||||
super(settings);
|
||||
|
@ -1031,9 +1013,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ int i = state.getValue(POWER);
|
||||
+ int j = 0;
|
||||
+ j = this.getPower(j, worldIn.getBlockState(pos2));
|
||||
+ this.setCanProvidePower(false);
|
||||
+ int k = worldIn.isBlockIndirectlyGettingPowered(pos1);
|
||||
+ this.setCanProvidePower(true);
|
||||
+ this.shouldSignal = false;
|
||||
+ int k = worldIn.getBestNeighborSignal(pos1);
|
||||
+ this.shouldSignal = true;
|
||||
+
|
||||
+ if (!worldIn.paperConfig.useEigencraftRedstone) {
|
||||
+ // This code is totally redundant to if statements just below the loop.
|
||||
|
@ -1123,8 +1105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
return Math.max(i, j - 1);
|
||||
}
|
||||
|
||||
+ private int getPower(int min, BlockState iblockdata) { return Math.max(min, getPower(iblockdata)); } // Paper - Optimize redstone
|
||||
+ private int getPower(BlockState iblockdata) { return this.getWireSignal(iblockdata); } // Paper - OBFHELPER
|
||||
+ private int getPower(int min, BlockState iblockdata) { return Math.max(min, getWireSignal(iblockdata)); } // Paper - Optimize redstone
|
||||
private int getWireSignal(BlockState state) {
|
||||
return state.is((Block) this) ? (Integer) state.getValue(RedStoneWireBlock.POWER) : 0;
|
||||
}
|
|
@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, UseOnContext itemActionContext) {
|
||||
+ // Paper end
|
||||
+ if (!iblockdata1.is(iblockdata.getBlock())) {
|
||||
if (inPortalDimension(world)) {
|
||||
if (BaseFireBlock.inPortalDimension(world)) {
|
||||
- Optional<PortalShape> optional = PortalShape.findEmptyPortalShape((LevelAccessor) world, pos, Direction.Axis.X);
|
||||
+ Optional<PortalShape> optional = PortalShape.findEmptyPortalShape((LevelAccessor) world, blockposition, Direction.Axis.X);
|
||||
|
||||
|
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
- if (!state.canSurvive(world, pos)) {
|
||||
- fireExtinguished(world, pos); // CraftBukkit - fuel block broke
|
||||
- this.fireExtinguished(world, pos); // CraftBukkit - fuel block broke
|
||||
+ if (!iblockdata.canSurvive(world, blockposition)) {
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.server.MCUtil;
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
+import net.minecraft.world.item.context.UseOnContext;
|
||||
|
@ -77,12 +77,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@Override
|
||||
- public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
- super.onPlace(state, world, pos, oldState, notify);
|
||||
- world.getBlockTicks().a(pos, this, getFireTickDelay(world.random));
|
||||
- world.getBlockTicks().scheduleTick(pos, this, FireBlock.getFireTickDelay(world.random));
|
||||
+ // Paper start - ItemActionContext param
|
||||
+ public void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, UseOnContext itemActionContext) {
|
||||
+ super.onPlace(iblockdata, world, blockposition, iblockdata1, flag, itemActionContext);
|
||||
+ // Paper end
|
||||
+ world.getBlockTicks().a(blockposition, this, getFireTickDelay(world.random));
|
||||
+ world.getBlockTicks().scheduleTick(blockposition, this, getFireTickDelay(world.random));
|
||||
}
|
||||
|
||||
private static int getFireTickDelay(Random random) {
|
||||
|
@ -132,16 +132,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Deprecated public boolean createPortal() { return this.createPortal(null); }
|
||||
+ public boolean createPortal(UseOnContext itemActionContext) {
|
||||
+ // Paper end
|
||||
org.bukkit.World bworld = this.level.getLevel().getWorld();
|
||||
org.bukkit.World bworld = this.level.getMinecraftWorld().getWorld();
|
||||
|
||||
// Copy below for loop
|
||||
@@ -0,0 +0,0 @@ public class PortalShape {
|
||||
BlockPos.betweenClosed(this.bottomLeft, this.bottomLeft.relative(Direction.UP, this.height - 1).relative(this.rightDir, this.width - 1)).forEach((blockposition) -> {
|
||||
blocks.setBlock(blockposition, iblockdata, 18);
|
||||
this.blocks.setBlock(blockposition, iblockdata, 18);
|
||||
});
|
||||
-
|
||||
- PortalCreateEvent event = new PortalCreateEvent((java.util.List<org.bukkit.block.BlockState>) (java.util.List) blocks.getList(), bworld, null, PortalCreateEvent.CreateReason.FIRE);
|
||||
|
||||
- PortalCreateEvent event = new PortalCreateEvent((java.util.List<org.bukkit.block.BlockState>) (java.util.List) this.blocks.getList(), bworld, null, PortalCreateEvent.CreateReason.FIRE);
|
||||
+ PortalCreateEvent event = new PortalCreateEvent((java.util.List<org.bukkit.block.BlockState>) (java.util.List) blocks.getList(), bworld, itemActionContext == null || itemActionContext.getPlayer() == null ? null : itemActionContext.getPlayer().getBukkitEntity(), PortalCreateEvent.CreateReason.FIRE); // Paper - pass entity param
|
||||
this.level.getLevel().getServer().server.getPluginManager().callEvent(event);
|
||||
this.level.getMinecraftWorld().getServer().server.getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
Loading…
Reference in a new issue