now it will be hell

This commit is contained in:
Ben Kerllenevich
2022-06-08 13:25:16 -04:00
parent ed5b0fda9e
commit 856416cca4
9 changed files with 45 additions and 22 deletions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Timings stuff
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index e2f60115370f19e935eb3b14d5de99aa4126c6b0..cc9536fbf472f464686343cdab729e37a14b4973 100644
index e2f60115370f19e935eb3b14d5de99aa4126c6b0..9948f685a073a0d82f10d36c298b9f0eed44ac59 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -234,9 +234,13 @@ public class TimingsExport extends Thread {
@@ -19,7 +19,7 @@ index e2f60115370f19e935eb3b14d5de99aa4126c6b0..cc9536fbf472f464686343cdab729e37
- pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null))
+ pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
+ pair("paper", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)),
+ pair("purpur", mapAsJSON(Bukkit.spigot().getPurpurConfig()), null)
+ pair("purpur", mapAsJSON(Bukkit.spigot().getPurpurConfig(), null))
+ // Purpur end
));

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Giants AI settings
diff --git a/src/main/java/net/minecraft/world/entity/monster/Giant.java b/src/main/java/net/minecraft/world/entity/monster/Giant.java
index c1c5e884f00398032196ee71b55b348fcfce21ce..0d26d2388cc1963df9bc361b31a572c12e2f8709 100644
index c1c5e884f00398032196ee71b55b348fcfce21ce..ed032918fb33d60c2d60d4db9275dddf88dd72d9 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
@@ -1,13 +1,36 @@
@@ -87,15 +87,15 @@ index c1c5e884f00398032196ee71b55b348fcfce21ce..0d26d2388cc1963df9bc361b31a572c1
+ public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
+ SpawnGroupData groupData = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
+ if (groupData == null) {
+ populateDefaultEquipmentSlots(difficulty);
+ populateDefaultEquipmentEnchantments(difficulty);
+ populateDefaultEquipmentSlots(this.random, difficulty);
+ populateDefaultEquipmentEnchantments(this.random, difficulty);
+ }
+ return groupData;
+ }
+
+ @Override
+ protected void populateDefaultEquipmentSlots(DifficultyInstance difficulty) {
+ super.populateDefaultEquipmentSlots(difficulty);
+ protected void populateDefaultEquipmentSlots(net.minecraft.util.RandomSource random, DifficultyInstance difficulty) {
+ super.populateDefaultEquipmentSlots(this.random, difficulty);
+ // TODO make configurable
+ if (random.nextFloat() < (level.getDifficulty() == Difficulty.HARD ? 0.1F : 0.05F)) {
+ this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.IRON_SWORD));

View File

@@ -8,7 +8,7 @@ farm Nether Wart. Reimplemented based on a feature of the carpet-extra
mod.
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java b/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
index 17c76c310435f501d350bd99debacd242739196e..c7b9cd17cd2b13da9eedc8fd26a3bbdd8b307681 100644
index 17c76c310435f501d350bd99debacd242739196e..1793852b6587960e260727910ffc30d2d497520f 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/HarvestFarmland.java
@@ -34,6 +34,7 @@ public class HarvestFarmland extends Behavior<Villager> {
@@ -64,7 +64,7 @@ index 17c76c310435f501d350bd99debacd242739196e..c7b9cd17cd2b13da9eedc8fd26a3bbdd
+ // Purpur start
+ if (this.clericWartFarmer) {
+ if (itemstack.getItem() == Items.NETHER_WART) {
+ planted = Blocks.NETHER_WART;
+ iblockdata1 = Blocks.NETHER_WART.defaultBlockState();
+ flag = true;
+ }
+ } else

View File

@@ -46,7 +46,7 @@ index 2abdeb351fbabec7490c1ce806cebf8886b6be61..ada070d8e1a2d328c02455eb9e5ad056
if (enumcolor != null) {
entityshulker.setColor(enumcolor);
diff --git a/src/main/java/net/minecraft/world/item/DyeColor.java b/src/main/java/net/minecraft/world/item/DyeColor.java
index 2d3dbc228a6a7b88167a36ba739d9eb2f03472ba..35ba78df97a5d13a8495ca9a25f2b331310ff47b 100644
index 2d3dbc228a6a7b88167a36ba739d9eb2f03472ba..7621978ab3d90d58e8b7c6807e0e0519062654dc 100644
--- a/src/main/java/net/minecraft/world/item/DyeColor.java
+++ b/src/main/java/net/minecraft/world/item/DyeColor.java
@@ -112,4 +112,10 @@ public enum DyeColor implements StringRepresentable {
@@ -55,7 +55,7 @@ index 2d3dbc228a6a7b88167a36ba739d9eb2f03472ba..35ba78df97a5d13a8495ca9a25f2b331
}
+
+ // Purpur start
+ public static DyeColor random(java.util.Random random) {
+ public static DyeColor random(net.minecraft.util.RandomSource random) {
+ return BY_ID[random.nextInt(BY_ID.length)];
+ }
+ // Purpur end

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Tool actionable options
diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java
index 03a6a99dcc0c8fcc32776dd49cf6092b899bf6ed..e32f9b614324000797f5d9944013af4fe28ce891 100644
index 03a6a99dcc0c8fcc32776dd49cf6092b899bf6ed..33b162108bb088827101e9972b89390fb67feca8 100644
--- a/src/main/java/net/minecraft/world/item/AxeItem.java
+++ b/src/main/java/net/minecraft/world/item/AxeItem.java
@@ -33,22 +33,22 @@ public class AxeItem extends DiggerItem {
@@ -40,11 +40,12 @@ index 03a6a99dcc0c8fcc32776dd49cf6092b899bf6ed..e32f9b614324000797f5d9944013af4f
level.levelEvent(player, 3004, blockPos, 0);
optional4 = optional3;
}
@@ -58,7 +58,15 @@ public class AxeItem extends DiggerItem {
@@ -58,15 +58,23 @@ public class AxeItem extends DiggerItem {
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack);
}
- level.setBlock(blockPos, optional4.get(), 11);
- level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, optional4.get()));
+ // Purpur start
+ org.purpurmc.purpur.tool.Actionable actionable = optional4.get();
+ level.setBlock(blockPos, actionable.into().withPropertiesOf(blockState), 11);
@@ -53,11 +54,11 @@ index 03a6a99dcc0c8fcc32776dd49cf6092b899bf6ed..e32f9b614324000797f5d9944013af4f
+ Block.popResourceFromFace(level, blockPos, context.getClickedFace(), new ItemStack(drop));
+ }
+ });
+ level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, actionable.into().withPropertiesOf(blockState)));
+ // Purpur end
level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(player, optional4.get()));
if (player != null) {
itemStack.hurtAndBreak(1, player, (p) -> {
@@ -66,7 +74,7 @@ public class AxeItem extends DiggerItem {
p.broadcastBreakEvent(context.getHand());
});
}

View File

@@ -30,7 +30,7 @@ index b04d224c23ed0039b86aa4169ce38c4f57cc1a7a..1daffadecee2b830b28377e2549d4229
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java
index 5dc3605fed7fb2ff8cc6c965d1bf99c462e0b14a..714fd2617f4fd2ab45d30fd1c0a0743bea1822ce 100644
index 5dc3605fed7fb2ff8cc6c965d1bf99c462e0b14a..da2f4c561c9539e3f6f9433a6ffb0841923df8a1 100644
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java
@@ -1027,8 +1027,8 @@ public class Blocks {
@@ -44,6 +44,15 @@ index 5dc3605fed7fb2ff8cc6c965d1bf99c462e0b14a..714fd2617f4fd2ab45d30fd1c0a0743b
public static final Block MOSS_CARPET = register("moss_carpet", new CarpetBlock(BlockBehaviour.Properties.of(Material.PLANT, MaterialColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS_CARPET)));
public static final Block MOSS_BLOCK = register("moss_block", new MossBlock(BlockBehaviour.Properties.of(Material.MOSS, MaterialColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS)));
public static final Block BIG_DRIPLEAF = register("big_dripleaf", new BigDripleafBlock(BlockBehaviour.Properties.of(Material.PLANT).strength(0.1F).sound(SoundType.BIG_DRIPLEAF)));
@@ -1091,7 +1091,7 @@ public class Blocks {
}
private static Boolean ocelotOrParrot(BlockState state, BlockGetter world, BlockPos pos, EntityType<?> type) {
- return (boolean)type == EntityType.OCELOT || type == EntityType.PARROT;
+ return type == EntityType.OCELOT || type == EntityType.PARROT; // Purpur - decompile fix
}
private static BedBlock bed(DyeColor color) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 7aa7e6ccbe65b49a29f1938c4fd3c17ce7c24aac..d92a9d187fea8afc1ea0453addda99cd715c034e 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java

View File

@@ -150,7 +150,7 @@ index 2faf634994f355ef1bf07fc70f1a0f4451db5fcc..aa34db072f496e53abef7541156ddf8d
public void setNoCounter(boolean permanent) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index ab5d668cf295d84663ced382cbde8dc940176470..7534889c4169cbd26f7e778cbd3be49bd2640c83 100644
index ab5d668cf295d84663ced382cbde8dc940176470..1e854090c986f480e35fac5c6f347e72904f9ab5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -436,7 +436,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -158,7 +158,7 @@ index ab5d668cf295d84663ced382cbde8dc940176470..7534889c4169cbd26f7e778cbd3be49b
@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {
- this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
+ this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon(), effect.getKey()), EntityPotionEffectEvent.Cause.PLUGIN); // Purpur - add key // Paper - Don't ignore icon
+ this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon(), effect.getKey(), java.util.Optional.empty()), EntityPotionEffectEvent.Cause.PLUGIN); // Purpur - add key // Paper - Don't ignore icon
return true;
}
@@ -237,7 +237,7 @@ index 4d325f61e9171b9e1a069ae69a87ec397735da79..056de387d0971f0b994e562c0b638442
}
this.customEffects.set(index, effect);
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
index acb69821a99aa69bce6d127e10976089c85be223..c5abd73981c5f4b41605eba0d44e6573dfd2a77a 100644
index acb69821a99aa69bce6d127e10976089c85be223..a44fc6122f6e653b149fff52e553d60a049e7432 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
@@ -101,7 +101,7 @@ public class CraftPotionUtil {
@@ -245,7 +245,7 @@ index acb69821a99aa69bce6d127e10976089c85be223..c5abd73981c5f4b41605eba0d44e6573
public static MobEffectInstance fromBukkit(PotionEffect effect) {
MobEffect type = MobEffect.byId(effect.getType().getId());
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.getKey()); // Purpur - add key
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.getKey(), java.util.Optional.empty()); // Purpur - add key
}
public static PotionEffect toBukkit(MobEffectInstance effect) {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Ability for hoe to replant crops and nether warts
diff --git a/src/main/java/net/minecraft/world/level/block/BushBlock.java b/src/main/java/net/minecraft/world/level/block/BushBlock.java
index 03fde6e47c4a347c62fe9b4a3351769aedf874f6..3eb95e9b4870b7dd782f676f50e381bf15f143dc 100644
index 03fde6e47c4a347c62fe9b4a3351769aedf874f6..ca906b0250e5332f7ececf1419ca6d2c1d385adc 100644
--- a/src/main/java/net/minecraft/world/level/block/BushBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BushBlock.java
@@ -48,4 +48,24 @@ public class BushBlock extends Block {
@@ -29,7 +29,7 @@ index 03fde6e47c4a347c62fe9b4a3351769aedf874f6..3eb95e9b4870b7dd782f676f50e381bf
+ Block.popResource(world, pos, itemToDrop);
+ }
+
+ state.spawnAfterBreak((net.minecraft.server.level.ServerLevel) world, pos, itemInHand);
+ state.spawnAfterBreak((net.minecraft.server.level.ServerLevel) world, pos, itemInHand, true);
+ }
+ // Purpur end
}

View File

@@ -17,6 +17,19 @@ index 9f07b6bb89b2f7424d874aca8399c9a31f3bf669..c4677bac7a09133513cbeed9c712b931
// this function is so hot that removing the map lookup call can have an order of magnitude impact on its performance
// tested and confirmed via System.nanoTime()
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> playersInRange = reducedRange ? playerchunk.playersInMobSpawnRange : playerchunk.playersInChunkTickRange;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 53d0ccf95a6e07a00918f05ddaeeca699737d2eb..0e06db15572bf7d23d61f93c0b6de1b78ea4f990 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -286,7 +286,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public double yo;
public double zo;
private Vec3 position;
- private BlockPos blockPosition;
+ public BlockPos blockPosition; // Purpur - private->public
private ChunkPos chunkPosition;
private Vec3 deltaMovement;
public float yRot; // Paper - private->public
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
index 3a633f369af8005de3c06cfa715a42e3b248b2f0..a7b878f97128e530c5b47873dd226490d471406b 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java