13
0
geforkt von Mirrors/Paper

Merge branch 'ver/1.16'

This brings 1.16 back to master. 1.15 is still supported currently.
Dieser Commit ist enthalten in:
Aikar 2020-07-04 19:03:06 -04:00
Commit 9b70c1a7dc
399 geänderte Dateien mit 5123 neuen und 8356 gelöschten Zeilen

Datei anzeigen

@ -10,7 +10,7 @@
<groupId>com.destroystokyo.paper</groupId> <groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-mojangapi</artifactId> <artifactId>paper-mojangapi</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version> <version>1.16.1-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Paper-MojangAPI</name> <name>Paper-MojangAPI</name>

Datei anzeigen

@ -36,11 +36,28 @@ How To (Plugin Developers)
<dependency> <dependency>
<groupId>com.destroystokyo.paper</groupId> <groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId> <artifactId>paper-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version> <version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
``` ```
**Or alternatively, with Gradle:**
* Repository:
```groovy
repositories {
maven {
url 'https://papermc.io/repo/repository/maven-public/'
}
}
```
* Artifact:
```groovy
dependencies {
compileOnly 'com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT'
}
```
How To (Compiling Jar From Source) How To (Compiling Jar From Source)
------ ------
To compile Paper, you need JDK 8, maven, and an internet connection. To compile Paper, you need JDK 8, maven, and an internet connection.

8
SHIT_TO_CHECK.md Normale Datei
Datei anzeigen

@ -0,0 +1,8 @@
# Shit to check
* Mini: "Optimize World Server Map": Figure out how to fill PaperWorldMap, it needs a dim key which doesnt exist anymore?
* Mini: "MC-50319": fix if still works
* Make sure the flat bedrock setting doesn't do anything stupid
* Check DataBits foreach
* lighting is bork (load chunk, fly away, come back, everything or parts are black)
* chunk generation seems slow with a lot of it happening

Datei anzeigen

@ -253,7 +253,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .ensureSize("ARROWS", 3); + .ensureSize("ARROWS", 3);
+ +
+ /** + /**
+ * Cover all 16 colors of beds. + * Covers all colors of beds.
+ */ + */
+ public static final MaterialSetTag BEDS = new MaterialSetTag(keyFor("beds")) + public static final MaterialSetTag BEDS = new MaterialSetTag(keyFor("beds"))
+ .endsWith("_BED") + .endsWith("_BED")
@ -286,14 +286,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .add(Material.COBBLESTONE, Material.MOSSY_COBBLESTONE); + .add(Material.COBBLESTONE, Material.MOSSY_COBBLESTONE);
+ +
+ /** + /**
+ * Covers all 16 colors of concrete. + * Covers all colors of concrete.
+ */ + */
+ public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes")) + public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes"))
+ .endsWith("_CONCRETE") + .endsWith("_CONCRETE")
+ .ensureSize("CONCRETES", 16); + .ensureSize("CONCRETES", 16);
+ +
+ /** + /**
+ * Covers all 16 colors of concrete powder. + * Covers all colors of concrete powder.
+ */ + */
+ public static final MaterialSetTag CONCRETE_POWDER = new MaterialSetTag(keyFor("concrete_powder")) + public static final MaterialSetTag CONCRETE_POWDER = new MaterialSetTag(keyFor("concrete_powder"))
+ .endsWith("_CONCRETE_POWDER") + .endsWith("_CONCRETE_POWDER")
@ -306,28 +306,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .add(Material.COOKED_COD, Material.COOKED_SALMON); + .add(Material.COOKED_COD, Material.COOKED_SALMON);
+ +
+ /** + /**
+ * Covers all 16 dyes. + * Covers all dyes.
+ */ + */
+ public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes")) + public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes"))
+ .endsWith("_DYE") + .endsWith("_DYE")
+ .ensureSize("DYES", 16); + .ensureSize("DYES", 16);
+ +
+ /** + /**
+ * Covers all 6 wood variants of gates. + * Covers all variants of gates.
+ */ + */
+ public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates")) + public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates"))
+ .endsWith("_GATE") + .endsWith("_GATE")
+ .ensureSize("FENCE_GATES", 6); + .ensureSize("FENCE_GATES", 8);
+ +
+ /** + /**
+ * Covers all 6 wood variants and nether brick fence. + * Covers all variants of fences.
+ */ + */
+ public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences")) + public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences"))
+ .endsWith("_FENCE") + .endsWith("_FENCE")
+ .ensureSize("FENCES", 7); + .ensureSize("FENCES", 9);
+ +
+ /** + /**
+ * Covers all 4 variants of fish buckets. + * Covers all variants of fish buckets.
+ */ + */
+ public static final MaterialSetTag FISH_BUCKETS = new MaterialSetTag(keyFor("fish_buckets")) + public static final MaterialSetTag FISH_BUCKETS = new MaterialSetTag(keyFor("fish_buckets"))
+ .add(Material.COD_BUCKET, Material.PUFFERFISH_BUCKET, Material.SALMON_BUCKET, Material.TROPICAL_FISH_BUCKET); + .add(Material.COD_BUCKET, Material.PUFFERFISH_BUCKET, Material.SALMON_BUCKET, Material.TROPICAL_FISH_BUCKET);
@ -341,21 +341,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .ensureSize("GLASS", 17); + .ensureSize("GLASS", 17);
+ +
+ /** + /**
+ * Covers the non-colored glass panes and 16 stained glass panes (panes only). + * Covers the non-colored glass panes and stained glass panes (panes only).
+ */ + */
+ public static final MaterialSetTag GLASS_PANES = new MaterialSetTag(keyFor("glass_panes")) + public static final MaterialSetTag GLASS_PANES = new MaterialSetTag(keyFor("glass_panes"))
+ .endsWith("GLASS_PANE") + .endsWith("GLASS_PANE")
+ .ensureSize("GLASS_PANES", 17); + .ensureSize("GLASS_PANES", 17);
+ +
+ /** + /**
+ * Covers all 16 glazed terracotta blocks. + * Covers all glazed terracotta blocks.
+ */ + */
+ public static final MaterialSetTag GLAZED_TERRACOTTA = new MaterialSetTag(keyFor("glazed_terracotta")) + public static final MaterialSetTag GLAZED_TERRACOTTA = new MaterialSetTag(keyFor("glazed_terracotta"))
+ .endsWith("GLAZED_TERRACOTTA") + .endsWith("GLAZED_TERRACOTTA")
+ .ensureSize("GLAZED_TERRACOTTA", 16); + .ensureSize("GLAZED_TERRACOTTA", 16);
+ +
+ /** + /**
+ * Covers the 16 colors of stained terracotta. + * Covers the colors of stained terracotta.
+ */ + */
+ public static final MaterialSetTag STAINED_TERRACOTTA = new MaterialSetTag(keyFor("stained_terracotta")) + public static final MaterialSetTag STAINED_TERRACOTTA = new MaterialSetTag(keyFor("stained_terracotta"))
+ .endsWith("TERRACOTTA") + .endsWith("TERRACOTTA")
@ -364,7 +364,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .ensureSize("STAINED_TERRACOTTA", 16); + .ensureSize("STAINED_TERRACOTTA", 16);
+ +
+ /** + /**
+ * Covers terracotta along with the 16 stained variants. + * Covers terracotta along with the stained variants.
+ */ + */
+ public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta")) + public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta"))
+ .endsWith("TERRACOTTA") + .endsWith("TERRACOTTA")
@ -379,21 +379,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .ensureSize("GOLDEN_APPLES", 2); + .ensureSize("GOLDEN_APPLES", 2);
+ +
+ /** + /**
+ * Covers the 3 variants of horse armor. + * Covers the variants of horse armor.
+ */ + */
+ public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors")) + public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors"))
+ .endsWith("_HORSE_ARMOR") + .endsWith("_HORSE_ARMOR")
+ .ensureSize("HORSE_ARMORS", 4); + .ensureSize("HORSE_ARMORS", 4);
+ +
+ /** + /**
+ * Covers the 6 variants of infested blocks. + * Covers the variants of infested blocks.
+ */ + */
+ public static final MaterialSetTag INFESTED_BLOCKS = new MaterialSetTag(keyFor("infested_blocks")) + public static final MaterialSetTag INFESTED_BLOCKS = new MaterialSetTag(keyFor("infested_blocks"))
+ .startsWith("INFESTED_") + .startsWith("INFESTED_")
+ .ensureSize("INFESTED_BLOCKS", 6); + .ensureSize("INFESTED_BLOCKS", 6);
+ +
+ /** + /**
+ * Covers the 3 variants of mushroom blocks. + * Covers the variants of mushroom blocks.
+ */ + */
+ public static final MaterialSetTag MUSHROOM_BLOCKS = new MaterialSetTag(keyFor("mushroom_blocks")) + public static final MaterialSetTag MUSHROOM_BLOCKS = new MaterialSetTag(keyFor("mushroom_blocks"))
+ .endsWith("MUSHROOM_BLOCK") + .endsWith("MUSHROOM_BLOCK")
@ -401,24 +401,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .ensureSize("MUSHROOM_BLOCKS", 3); + .ensureSize("MUSHROOM_BLOCKS", 3);
+ +
+ /** + /**
+ * Covers both mushrooms. + * Covers all mushrooms.
+ */ + */
+ public static final MaterialSetTag MUSHROOMS = new MaterialSetTag(keyFor("mushrooms")) + public static final MaterialSetTag MUSHROOMS = new MaterialSetTag(keyFor("mushrooms"))
+ .add(Material.BROWN_MUSHROOM, Material.RED_MUSHROOM); + .add(Material.BROWN_MUSHROOM, Material.RED_MUSHROOM);
+ +
+ /** + /**
+ * Covers all 12 music disc items. + * Covers all music disc items.
+ */ + */
+ public static final MaterialSetTag MUSIC_DISCS = new MaterialSetTag(keyFor("music_discs")) + public static final MaterialSetTag MUSIC_DISCS = new MaterialSetTag(keyFor("music_discs"))
+ .startsWith("MUSIC_DISC_") + .startsWith("MUSIC_DISC_");
+ .ensureSize("MUSIC_DISCS", 12);
+ +
+ /** + /**
+ * Covers all 8 ores. + * Covers all ores.
+ */ + */
+ public static final MaterialSetTag ORES = new MaterialSetTag(keyFor("ores")) + public static final MaterialSetTag ORES = new MaterialSetTag(keyFor("ores"))
+ .add(Material.ANCIENT_DEBRIS)
+ .endsWith("_ORE") + .endsWith("_ORE")
+ .ensureSize("ORES", 8); + .ensureSize("ORES", 10);
+ +
+ /** + /**
+ * Covers all piston typed items and blocks including the piston head and moving piston. + * Covers all piston typed items and blocks including the piston head and moving piston.
@ -435,38 +435,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .ensureSize("POTATOES", 3); + .ensureSize("POTATOES", 3);
+ +
+ /** + /**
+ * Covers all 6 wooden pressure plates and the 2 weighted pressure plates and 1 stone pressure plate. + * Covers all wooden pressure plates and the weighted pressure plates and the stone pressure plate.
+ */ + */
+ public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates")) + public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates"))
+ .endsWith("_PRESSURE_PLATE") + .endsWith("_PRESSURE_PLATE")
+ .ensureSize("PRESSURE_PLATES", 9); + .ensureSize("PRESSURE_PLATES", 12);
+ +
+ /** + /**
+ * Covers the 3 variants of prismarine blocks. + * Covers the variants of prismarine blocks.
+ */ + */
+ public static final MaterialSetTag PRISMARINE = new MaterialSetTag(keyFor("prismarine")) + public static final MaterialSetTag PRISMARINE = new MaterialSetTag(keyFor("prismarine"))
+ .add(Material.PRISMARINE, Material.PRISMARINE_BRICKS, Material.DARK_PRISMARINE); + .add(Material.PRISMARINE, Material.PRISMARINE_BRICKS, Material.DARK_PRISMARINE);
+ +
+ /** + /**
+ * Covers the 3 variants of prismarine slabs. + * Covers the variants of prismarine slabs.
+ */ + */
+ public static final MaterialSetTag PRISMARINE_SLABS = new MaterialSetTag(keyFor("prismarine_slabs")) + public static final MaterialSetTag PRISMARINE_SLABS = new MaterialSetTag(keyFor("prismarine_slabs"))
+ .add(Material.PRISMARINE_SLAB, Material.PRISMARINE_BRICK_SLAB, Material.DARK_PRISMARINE_SLAB); + .add(Material.PRISMARINE_SLAB, Material.PRISMARINE_BRICK_SLAB, Material.DARK_PRISMARINE_SLAB);
+ +
+ /** + /**
+ * Covers the 3 variants of prismarine stairs. + * Covers the variants of prismarine stairs.
+ */ + */
+ public static final MaterialSetTag PRISMARINE_STAIRS = new MaterialSetTag(keyFor("prismarine_stairs")) + public static final MaterialSetTag PRISMARINE_STAIRS = new MaterialSetTag(keyFor("prismarine_stairs"))
+ .add(Material.PRISMARINE_STAIRS, Material.PRISMARINE_BRICK_STAIRS, Material.DARK_PRISMARINE_STAIRS); + .add(Material.PRISMARINE_STAIRS, Material.PRISMARINE_BRICK_STAIRS, Material.DARK_PRISMARINE_STAIRS);
+ +
+ /** + /**
+ * Covers the 3 variants of pumpkins. + * Covers the variants of pumpkins.
+ */ + */
+ public static final MaterialSetTag PUMPKINS = new MaterialSetTag(keyFor("pumpkins")) + public static final MaterialSetTag PUMPKINS = new MaterialSetTag(keyFor("pumpkins"))
+ .add(Material.CARVED_PUMPKIN, Material.JACK_O_LANTERN, Material.PUMPKIN); + .add(Material.CARVED_PUMPKIN, Material.JACK_O_LANTERN, Material.PUMPKIN);
+ +
+ /** + /**
+ * Covers the 4 variants of quartz blocks. + * Covers the variants of quartz blocks.
+ */ + */
+ public static final MaterialSetTag QUARTZ_BLOCKS = new MaterialSetTag(keyFor("quartz_blocks")) + public static final MaterialSetTag QUARTZ_BLOCKS = new MaterialSetTag(keyFor("quartz_blocks"))
+ .add(Material.QUARTZ_BLOCK, Material.QUARTZ_PILLAR, Material.CHISELED_QUARTZ_BLOCK, Material.SMOOTH_QUARTZ); + .add(Material.QUARTZ_BLOCK, Material.QUARTZ_PILLAR, Material.CHISELED_QUARTZ_BLOCK, Material.SMOOTH_QUARTZ);
@ -478,14 +478,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .add(Material.COD, Material.PUFFERFISH, Material.SALMON, Material.TROPICAL_FISH); + .add(Material.COD, Material.PUFFERFISH, Material.SALMON, Material.TROPICAL_FISH);
+ +
+ /** + /**
+ * Covers the 4 variants of red sandstone blocks. + * Covers the variants of red sandstone blocks.
+ */ + */
+ public static final MaterialSetTag RED_SANDSTONES = new MaterialSetTag(keyFor("red_sandstones")) + public static final MaterialSetTag RED_SANDSTONES = new MaterialSetTag(keyFor("red_sandstones"))
+ .endsWith("RED_SANDSTONE") + .endsWith("RED_SANDSTONE")
+ .ensureSize("RED_SANDSTONES", 4); + .ensureSize("RED_SANDSTONES", 4);
+ +
+ /** + /**
+ * Covers the 4 variants of sandstone blocks. + * Covers the variants of sandstone blocks.
+ */ + */
+ public static final MaterialSetTag SANDSTONES = new MaterialSetTag(keyFor("sandstones")) + public static final MaterialSetTag SANDSTONES = new MaterialSetTag(keyFor("sandstones"))
+ .add(Material.SANDSTONE, Material.CHISELED_SANDSTONE, Material.CUT_SANDSTONE, Material.SMOOTH_SANDSTONE); + .add(Material.SANDSTONE, Material.CHISELED_SANDSTONE, Material.CUT_SANDSTONE, Material.SMOOTH_SANDSTONE);
@ -498,7 +498,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ .ensureSize("SPONGES", 2); + .ensureSize("SPONGES", 2);
+ +
+ /** + /**
+ * Covers the non-colored and 16 colored shulker boxes. + * Covers the non-colored and colored shulker boxes.
+ */ + */
+ public static final MaterialSetTag SHULKER_BOXES = new MaterialSetTag(keyFor("shulker_boxes")) + public static final MaterialSetTag SHULKER_BOXES = new MaterialSetTag(keyFor("shulker_boxes"))
+ .endsWith("SHULKER_BOX") + .endsWith("SHULKER_BOX")
@ -518,65 +518,101 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) + public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
+ .endsWith("_SPAWN_EGG") + .endsWith("_SPAWN_EGG")
+ .ensureSize("SPAWN_EGGS", 59); + .ensureSize("SPAWN_EGGS", 63);
+ +
+ /** + /**
+ * Covers all 16 colors of stained glass. + * Covers all colors of stained glass.
+ */ + */
+ public static final MaterialSetTag STAINED_GLASS = new MaterialSetTag(keyFor("stained_glass")) + public static final MaterialSetTag STAINED_GLASS = new MaterialSetTag(keyFor("stained_glass"))
+ .endsWith("_STAINED_GLASS") + .endsWith("_STAINED_GLASS")
+ .ensureSize("STAINED_GLASS", 16); + .ensureSize("STAINED_GLASS", 16);
+ +
+ /** + /**
+ * Covers all 16 colors of stained glass panes. + * Covers all colors of stained glass panes.
+ */ + */
+ public static final MaterialSetTag STAINED_GLASS_PANES = new MaterialSetTag(keyFor("stained_glass_panes")) + public static final MaterialSetTag STAINED_GLASS_PANES = new MaterialSetTag(keyFor("stained_glass_panes"))
+ .endsWith("STAINED_GLASS_PANE") + .endsWith("STAINED_GLASS_PANE")
+ .ensureSize("STAINED_GLASS_PANES", 16); + .ensureSize("STAINED_GLASS_PANES", 16);
+ +
+ /** + /**
+ * Covers all 7 variants of trapdoors. + * Covers all variants of trapdoors.
+ */ + */
+ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors")) + public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors"))
+ .endsWith("_TRAPDOOR") + .endsWith("_TRAPDOOR")
+ .ensureSize("TRAPDOORS", 7); + .ensureSize("TRAPDOORS", 9);
+ +
+ /** + /**
+ * Covers all 6 wood variants of fences. + * Covers all wood variants of fences.
+ */ + */
+ public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences")) + public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences"))
+ .endsWith("_FENCE") + .endsWith("_FENCE")
+ .not(Material.NETHER_BRICK_FENCE) + .not(Material.NETHER_BRICK_FENCE)
+ .ensureSize("WOODEN_FENCES", 6); + .ensureSize("WOODEN_FENCES", 8);
+ +
+ /** + /**
+ * Covers all 6 wood variants of trapdoors. + * Covers all wood variants of trapdoors.
+ */ + */
+ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors")) + public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors"))
+ .endsWith("_TRAPDOOR") + .endsWith("_TRAPDOOR")
+ .not(Material.IRON_TRAPDOOR) + .not(Material.IRON_TRAPDOOR)
+ .ensureSize("WOODEN_TRAPDOORS", 6); + .ensureSize("WOODEN_TRAPDOORS", 8);
+ +
+ /**
+ * Covers the wood variants of gates.
+ */
+ public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates")) + public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates"))
+ .endsWith("_GATE") + .endsWith("_GATE")
+ .ensureSize("WOODEN_GATES", 6); + .ensureSize("WOODEN_GATES", 8);
+ +
+ /**
+ * Covers the variants of purpur.
+ */
+ public static final MaterialSetTag PURPUR = new MaterialSetTag(keyFor("purpur")) + public static final MaterialSetTag PURPUR = new MaterialSetTag(keyFor("purpur"))
+ .startsWith("PURPUR_") + .startsWith("PURPUR_")
+ .ensureSize("PURPUR", 4); + .ensureSize("PURPUR", 4);
+ +
+ /**
+ * Covers the variants of signs.
+ */
+ public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs")) + public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
+ .endsWith("_SIGN") + .endsWith("_SIGN")
+ .ensureSize("SIGNS", 12); + .ensureSize("SIGNS", 16);
+ +
+ /**
+ * Covers the variants of a regular torch.
+ */
+ public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch")) + public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch"))
+ .add(Material.TORCH, Material.WALL_TORCH) + .add(Material.TORCH, Material.WALL_TORCH)
+ .ensureSize("TORCH", 2); + .ensureSize("TORCH", 2);
+ +
+ /**
+ * Covers the variants of a redstone torch.
+ */
+ public static final MaterialSetTag REDSTONE_TORCH = new MaterialSetTag(keyFor("restone_torch")) + public static final MaterialSetTag REDSTONE_TORCH = new MaterialSetTag(keyFor("restone_torch"))
+ .add(Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH) + .add(Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH)
+ .ensureSize("REDSTONE_TORCH", 2); + .ensureSize("REDSTONE_TORCH", 2);
+ +
+ /**
+ * Covers the variants of a soul torch.
+ */
+ public static final MaterialSetTag SOUL_TORCH = new MaterialSetTag(keyFor("soul_torch"))
+ .add(Material.SOUL_TORCH, Material.SOUL_WALL_TORCH)
+ .ensureSize("SOUL_TORCH", 2);
+
+ /**
+ * Covers the variants of torches.
+ */
+ public static final MaterialSetTag TORCHES = new MaterialSetTag(keyFor("torches"))
+ .add(TORCH, REDSTONE_TORCH, SOUL_TORCH)
+ .ensureSize("TORCHES", 6);
+
+ /**
+ * Covers the variants of lanterns.
+ */
+ public static final MaterialSetTag LANTERNS = new MaterialSetTag(keyFor("lanterns"))
+ .add(Material.LANTERN, Material.SOUL_LANTERN)
+ .ensureSize("LANTERNS", 2);
+
+ @SuppressWarnings("unchecked") + @SuppressWarnings("unchecked")
+ public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable")) + public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable"))
+ .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS); + .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS);

Datei anzeigen

@ -319,7 +319,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ GoalKey<Phantom> PHANTOM_ATTACK_STRATEGY = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_attack_strategy")); + GoalKey<Phantom> PHANTOM_ATTACK_STRATEGY = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_attack_strategy"));
+ GoalKey<Phantom> PHANTOM_CIRCLE_AROUND_ANCHOR = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_circle_around_anchor")); + GoalKey<Phantom> PHANTOM_CIRCLE_AROUND_ANCHOR = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_circle_around_anchor"));
+ GoalKey<Phantom> PHANTOM_SWEEP_ATTACK = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_sweep_attack")); + GoalKey<Phantom> PHANTOM_SWEEP_ATTACK = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_sweep_attack"));
+ /**
+ * @deprecated removed in 1.16
+ */
+ @Deprecated
+ GoalKey<PigZombie> ANGER = GoalKey.of(PigZombie.class, NamespacedKey.minecraft("anger")); + GoalKey<PigZombie> ANGER = GoalKey.of(PigZombie.class, NamespacedKey.minecraft("anger"));
+ /**
+ * @deprecated removed in 1.16
+ */
+ @Deprecated
+ GoalKey<PigZombie> ANGER_OTHER = GoalKey.of(PigZombie.class, NamespacedKey.minecraft("anger_other")); + GoalKey<PigZombie> ANGER_OTHER = GoalKey.of(PigZombie.class, NamespacedKey.minecraft("anger_other"));
+ GoalKey<PolarBear> POLARBEAR_ATTACK_PLAYERS = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_attack_players")); + GoalKey<PolarBear> POLARBEAR_ATTACK_PLAYERS = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_attack_players"));
+ GoalKey<PolarBear> POLARBEAR_HURT_BY = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_hurt_by")); + GoalKey<PolarBear> POLARBEAR_HURT_BY = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_hurt_by"));
@ -428,6 +436,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ GoalKey<Creature> WATER = GoalKey.of(Creature.class, NamespacedKey.minecraft("water")); + GoalKey<Creature> WATER = GoalKey.of(Creature.class, NamespacedKey.minecraft("water"));
+ GoalKey<Dolphin> WATER_JUMP = GoalKey.of(Dolphin.class, NamespacedKey.minecraft("water_jump")); + GoalKey<Dolphin> WATER_JUMP = GoalKey.of(Dolphin.class, NamespacedKey.minecraft("water_jump"));
+ GoalKey<Zombie> ZOMBIE_ATTACK = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack")); + GoalKey<Zombie> ZOMBIE_ATTACK = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack"));
+ GoalKey<Creature> STROLL_VILLAGE_GOLEM = GoalKey.of(Creature.class, NamespacedKey.minecraft("stroll_village_golem"));
+ GoalKey<Mob> UNIVERSAL_ANGER_RESET = GoalKey.of(Mob.class, NamespacedKey.minecraft("universal_anger_reset"));
+} +}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

Datei anzeigen

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
<version>18.0.0</version> <version>19.0.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
+ <!-- Paper - Add SLF4J --> + <!-- Paper - Add SLF4J -->

Datei anzeigen

@ -10,29 +10,19 @@ diff --git a/src/main/java/org/bukkit/entity/Firework.java b/src/main/java/org/b
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Firework.java --- a/src/main/java/org/bukkit/entity/Firework.java
+++ b/src/main/java/org/bukkit/entity/Firework.java +++ b/src/main/java/org/bukkit/entity/Firework.java
@@ -0,0 +0,0 @@ package org.bukkit.entity; @@ -0,0 +0,0 @@ public interface Firework extends Projectile {
import org.bukkit.inventory.meta.FireworkMeta;
import org.jetbrains.annotations.NotNull;
+import java.util.UUID;
+import org.jetbrains.annotations.Nullable;
+
public interface Firework extends Entity {
/**
@@ -0,0 +0,0 @@ public interface Firework extends Entity {
* @param shotAtAngle the new shotAtAngle * @param shotAtAngle the new shotAtAngle
*/ */
void setShotAtAngle(boolean shotAtAngle); void setShotAtAngle(boolean shotAtAngle);
+ +
+ // Paper start + // Paper start
+ @Nullable + @org.jetbrains.annotations.Nullable
+ public UUID getSpawningEntity(); + public java.util.UUID getSpawningEntity();
+ /** + /**
+ * If this firework is boosting an entity, return it + * If this firework is boosting an entity, return it
+ * @return The entity being boosted + * @return The entity being boosted
+ */ + */
+ @Nullable + @org.jetbrains.annotations.Nullable
+ public LivingEntity getBoostedEntity(); + public LivingEntity getBoostedEntity();
+ // Paper end + // Paper end
} }

Datei anzeigen

@ -9,11 +9,12 @@ diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukki
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Item.java --- a/src/main/java/org/bukkit/entity/Item.java
+++ b/src/main/java/org/bukkit/entity/Item.java +++ b/src/main/java/org/bukkit/entity/Item.java
@@ -0,0 +0,0 @@ import org.bukkit.inventory.ItemStack; @@ -0,0 +0,0 @@ package org.bukkit.entity;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+// Paper start +// Paper start
+import org.jetbrains.annotations.Nullable;
+import java.util.UUID; +import java.util.UUID;
+// Paper end +// Paper end
+ +

Datei anzeigen

@ -26,12 +26,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- Plugin[] plugins = Bukkit.getPluginManager().getPlugins(); - Plugin[] plugins = Bukkit.getPluginManager().getPlugins();
+ // Paper start + // Paper start
+ TreeMap<String, Plugin> plugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + TreeMap<String, Plugin> plugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+
- for (Plugin plugin : plugins) {
+ for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { + for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
+ plugins.put(plugin.getDescription().getName(), plugin); + plugins.put(plugin.getDescription().getName(), plugin);
+ } + }
+
- for (Plugin plugin : plugins) {
+ StringBuilder pluginList = new StringBuilder(); + StringBuilder pluginList = new StringBuilder();
+ for (Map.Entry<String, Plugin> entry : plugins.entrySet()) { + for (Map.Entry<String, Plugin> entry : plugins.entrySet()) {
if (pluginList.length() > 0) { if (pluginList.length() > 0) {
@ -56,4 +56,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return "(" + plugins.size() + "): " + pluginList.toString(); + return "(" + plugins.size() + "): " + pluginList.toString();
+ // Paper end + // Paper end
} }
}
// Spigot start

Datei anzeigen

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper +@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper
public enum Material implements Keyed { public enum Material implements Keyed {
//<editor-fold desc="Materials" defaultstate="collapsed"> //<editor-fold desc="Materials" defaultstate="collapsed">
ACACIA_BOAT(27326, 1), AIR(9648, 0),
@@ -0,0 +0,0 @@ public enum Material implements Keyed { @@ -0,0 +0,0 @@ public enum Material implements Keyed {
} }
} }

Datei anzeigen

@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- <artifactId>spigot-api</artifactId> - <artifactId>spigot-api</artifactId>
+ <groupId>com.destroystokyo.paper</groupId> + <groupId>com.destroystokyo.paper</groupId>
+ <artifactId>paper-api</artifactId> + <artifactId>paper-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version> <version>1.16.1-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
- <name>Spigot-API</name> - <name>Spigot-API</name>
@ -86,13 +86,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-tree</artifactId>
- <version>7.3.1</version>
+ <version>8.0.1</version> <!-- Paper -->
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

Datei anzeigen

@ -12,9 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/HumanEntity.java --- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @@ -0,0 +0,0 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
@Nullable */
public Location getBedSpawnLocation(); public int getSleepTicks();
+
+ // Paper start - Potential bed api + // Paper start - Potential bed api
+ /** + /**
+ * Gets the Location of the player's bed, null if they have not slept + * Gets the Location of the player's bed, null if they have not slept
@ -28,5 +29,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ +
/** /**
* Sets the Location where the player will spawn at their bed. * Attempts to make the entity sleep at the given location.
* * <br>

Datei anzeigen

@ -0,0 +1,77 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MiniDigger | Martin <admin@minidigger.dev>
Date: Sat, 6 Jun 2020 18:13:16 +0200
Subject: [PATCH] Support components in ItemMeta
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@NotNull
String getDisplayName();
+ // Paper start
+ /**
+ * Gets the display name that is set.
+ * <p>
+ * Plugins should check that hasDisplayName() returns <code>true</code>
+ * before calling this method.
+ *
+ * @return the display name that is set
+ */
+ @NotNull
+ net.md_5.bungee.api.chat.BaseComponent[] getDisplayNameComponent();
+ // Paper end
/**
* Sets the display name.
*
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
void setDisplayName(@Nullable String name);
+ // Paper start
+ /**
+ * Sets the display name.
+ *
+ * @param component the name component to set
+ */
+ void setDisplayNameComponent(@Nullable net.md_5.bungee.api.chat.BaseComponent[] component);
+ // Paper end
/**
* Checks for existence of a localized name.
*
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
@Nullable
List<String> getLore();
+ /**
+ * Gets the lore that is set.
+ * <p>
+ * Plugins should check if hasLore() returns <code>true</code> before
+ * calling this method.
+ *
+ * @return a list of lore that is set
+ */
+ @Nullable
+ List<net.md_5.bungee.api.chat.BaseComponent[]> getLoreComponents();
+
/**
* Sets the lore for this item.
* Removes lore when given null.
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
*/
void setLore(@Nullable List<String> lore);
+ /**
+ * Sets the lore for this item.
+ * Removes lore when given null.
+ *
+ * @param lore the lore that will be set
+ */
+ void setLoreComponents(@Nullable List<net.md_5.bungee.api.chat.BaseComponent[]> lore);
+
/**
* Checks for existence of custom model data.
* <p>

Datei anzeigen

@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/pom.xml --- a/pom.xml
+++ b/pom.xml +++ b/pom.xml
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
<version>8.0.1</version> <!-- Paper --> <version>8.0.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
+ <!-- ASM --> + <!-- ASM -->

Datei anzeigen

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
@Nullable @Nullable
public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) { public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) {
Map<EnumItemSlot, ItemStack> map = enchantment.a(entityliving); return a(enchantment, entityliving, (itemstack) -> {
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java

Datei anzeigen

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import com.destroystokyo.paper.profile.PlayerProfile; +import com.destroystokyo.paper.profile.PlayerProfile;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.authlib.exceptions.AuthenticationUnavailableException; import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
import io.netty.channel.ChannelFuture; import java.math.BigInteger;
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;

Datei anzeigen

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super(entitytypes, world); super(entitytypes, world);
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
return this.getEntityType().k().a(f); return this.getEntityType().l().a(f);
} }
+ +
+ // Paper start + // Paper start

Datei anzeigen

@ -40,23 +40,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
NBTTagCompound entityTag; NBTTagCompound entityTag;
CraftMetaArmorStand(CraftMetaItem meta) { CraftMetaArmorStand(CraftMetaItem meta) {
super(meta); @@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem {
+ }
CraftMetaArmorStand armorStand = (CraftMetaArmorStand) meta;
+ // Paper start + // Paper start
+ if (!(meta instanceof CraftMetaArmorStand)) { + this.invisible = armorStand.invisible;
+ return; + this.noBasePlate = armorStand.noBasePlate;
+ } + this.showArms = armorStand.showArms;
+ + this.small = armorStand.small;
+ CraftMetaArmorStand standMeta = (CraftMetaArmorStand) meta; + this.marker = armorStand.marker;
+ this.invisible = standMeta.invisible;
+ this.noBasePlate = standMeta.noBasePlate;
+ this.showArms = standMeta.showArms;
+ this.small = standMeta.small;
+ this.marker = standMeta.marker;
+ // Paper end + // Paper end
this.entityTag = armorStand.entityTag;
} }
CraftMetaArmorStand(NBTTagCompound tag) {
@@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem { @@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem {
if (tag.hasKey(ENTITY_TAG.NBT)) { if (tag.hasKey(ENTITY_TAG.NBT)) {
@ -271,22 +268,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
CraftMetaTropicalFishBucket.VARIANT.NBT,
CraftMetaCrossbow.CHARGED.NBT, CraftMetaCrossbow.CHARGED.NBT,
CraftMetaCrossbow.CHARGED_PROJECTILES.NBT, CraftMetaCrossbow.CHARGED_PROJECTILES.NBT,
- CraftMetaSuspiciousStew.EFFECTS.NBT CraftMetaSuspiciousStew.EFFECTS.NBT,
+ CraftMetaSuspiciousStew.EFFECTS.NBT,
+ // Paper start + // Paper start
+ CraftMetaArmorStand.ENTITY_TAG.NBT, + CraftMetaArmorStand.ENTITY_TAG.NBT,
+ CraftMetaArmorStand.INVISIBLE.NBT, + CraftMetaArmorStand.INVISIBLE.NBT,
+ CraftMetaArmorStand.NO_BASE_PLATE.NBT, + CraftMetaArmorStand.NO_BASE_PLATE.NBT,
+ CraftMetaArmorStand.SHOW_ARMS.NBT, + CraftMetaArmorStand.SHOW_ARMS.NBT,
+ CraftMetaArmorStand.SMALL.NBT, + CraftMetaArmorStand.SMALL.NBT,
+ CraftMetaArmorStand.MARKER.NBT + CraftMetaArmorStand.MARKER.NBT,
+ // Paper end + // Paper end
)); CraftMetaCompass.LODESTONE_DIMENSION.NBT,
} CraftMetaCompass.LODESTONE_POS.NBT,
return HANDLED_TAGS; CraftMetaCompass.LODESTONE_TRACKED.NBT
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java

Datei anzeigen

@ -23,13 +23,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} else { } else {
PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking()); PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking());
+ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker + entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker); this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.track(this.world.getPlayers()); playerchunkmap_entitytracker.track(this.world.getPlayers());
if (entity instanceof EntityPlayer) { if (entity instanceof EntityPlayer) {
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (playerchunkmap_entitytracker1 != null) { if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.a(); playerchunkmap_entitytracker1.a();
@ -55,17 +55,17 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit start public final Convertable.ConversionSession convertable;
private int tickPosition; public final UUID uuid;
boolean hasPhysicsEvent = true; // Paper boolean hasPhysicsEvent = true; // Paper
+ private static Throwable getAddToWorldStackTrace(Entity entity) { + private static Throwable getAddToWorldStackTrace(Entity entity) {
+ return new Throwable(entity + " Added to world at " + new java.util.Date()); + return new Throwable(entity + " Added to world at " + new java.util.Date());
+ } + }
// Add env and gen to constructor @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { return this.chunkProvider.getChunkAt(x, z, false);
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// CraftBukkit start // CraftBukkit start
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
return false; return false;
} else if (this.isUUIDTaken(entity)) { } else if (this.isUUIDTaken(entity)) {
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
} }
} }

Datei anzeigen

@ -8,36 +8,35 @@ diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java --- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java +++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -0,0 +0,0 @@ public class EntityPig extends EntityAnimal { @@ -0,0 +0,0 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible()); }
}
+ // Paper start entitypigzombie.setPersistent();
+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { + // Paper start
+ return; + if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ } + return;
+ // Paper end + }
+ + // Paper end
// CraftBukkit start // CraftBukkit start
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
return; return;
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java --- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
public void onLightningStrike(EntityLightning entitylightning) { EntityVillager.LOGGER.info("Villager {} was struck by lightning {}.", this, entitylightning);
EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world); EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world);
+ // Paper start + // Paper start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
+ return; + return;
+ } + }
+ // Paper end + // Paper end
+ +
entitywitch.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch); entitywitch.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch);
entitywitch.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entitywitch)), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null); entitywitch.prepare(this.world, this.world.getDamageScaler(entitywitch.getChunkCoordinates()), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null);
entitywitch.setNoAI(this.isNoAI()); entitywitch.setNoAI(this.isNoAI());
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java

Datei anzeigen

@ -33,8 +33,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2;
} }
+ public final boolean contains(Vec3D vec3d) { return c(vec3d); } // Paper - OBFHELPER + public final boolean contains(Vec3D vec3d) { return d(vec3d); } // Paper - OBFHELPER
public boolean c(Vec3D vec3d) { public boolean d(Vec3D vec3d) {
return this.e(vec3d.x, vec3d.y, vec3d.z); return this.e(vec3d.x, vec3d.y, vec3d.z);
} }
@@ -0,0 +0,0 @@ public class AxisAlignedBB { @@ -0,0 +0,0 @@ public class AxisAlignedBB {
@ -61,8 +61,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.getPassengers().size() < 1; return this.getPassengers().size() < 1;
} }
+ public final float getCollisionBorderSize() { return aV(); } // Paper - OBFHELPER + public final float getCollisionBorderSize() { return bc(); } // Paper - OBFHELPER
public float aV() { public float bc() {
return 0.0F; return 0.0F;
} }
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}; };
+ public static Predicate<Entity> notSpectator() { return f; } // Paper - OBFHELPER + public static Predicate<Entity> notSpectator() { return f; } // Paper - OBFHELPER
public static final Predicate<Entity> f = (entity) -> { public static final Predicate<Entity> f = (entity) -> {
return !entity.isSpectator(); return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL;
}; };
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

Datei anzeigen

@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
} }
protected abstract void a(NBTTagCompound nbttagcompound); protected abstract void loadData(NBTTagCompound nbttagcompound);
diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityTypes.java --- a/src/main/java/net/minecraft/server/EntityTypes.java
@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean isPersistable() { return a(); } // Paper - OBFHELPER + public boolean isPersistable() { return a(); } // Paper - OBFHELPER
public boolean a() { public boolean a() {
return this.bc; return this.bh;
} }
diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java
new file mode 100644 new file mode 100644

Datei anzeigen

@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster {
private static final DataWatcherObject<Boolean> POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> isIgnitedDW = d; // Paper OBFHELPER private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> isIgnitedDW = d; // Paper OBFHELPER
private int bw; private int bv;
- private int fuseTicks; - private int fuseTicks;
+ public int fuseTicks; // Paper - public + public int fuseTicks; // Paper - public
public int maxFuseTicks = 30; public int maxFuseTicks = 30;
public int explosionRadius = 3; public int explosionRadius = 3;
private int bA; private int bz;
@@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster {
} }

Datei anzeigen

@ -51,7 +51,7 @@ diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java --- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
@@ -0,0 +0,0 @@ public class MobSpawnerPhantom { @@ -0,0 +0,0 @@ public class MobSpawnerPhantom implements MobSpawner {
int k = 1 + random.nextInt(difficultydamagescaler.a().a() + 1); int k = 1 + random.nextInt(difficultydamagescaler.a().a() + 1);
for (int l = 0; l < k; ++l) { for (int l = 0; l < k; ++l) {

Datei anzeigen

@ -11,24 +11,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
package net.minecraft.server; package net.minecraft.server;
+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; +import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; // Paper
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableMap;
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
ItemStack itemstack1 = this.getEquipment(enumitemslot); ItemStack itemstack1 = this.getEquipment(enumitemslot);
if (!ItemStack.matches(itemstack1, itemstack)) { if (!ItemStack.matches(itemstack1, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent + // Paper start - PlayerArmorChangeEvent
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { + if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); + final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); + final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); + new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
+ } + }
+ // Paper end + // Paper end
((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); if (map == null) {
if (!itemstack.isEmpty()) { map = Maps.newEnumMap(EnumItemSlot.class);
this.getAttributeMap().a(itemstack.a(enumitemslot)); }
diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EnumItemSlot.java --- a/src/main/java/net/minecraft/server/EnumItemSlot.java

Datei anzeigen

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
if (damagesource.getEntity() instanceof EntityHuman) { if (damagesource.getEntity() instanceof EntityHuman) {
- ((EntityHuman) damagesource.getEntity()).ey(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired - ((EntityHuman) damagesource.getEntity()).resetAttackCooldown(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired
+ // Paper start - PlayerAttackEntityCooldownResetEvent + // Paper start - PlayerAttackEntityCooldownResetEvent
+ if (damagesource.getEntity() instanceof EntityPlayer) { + if (damagesource.getEntity() instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) damagesource.getEntity(); + EntityPlayer player = (EntityPlayer) damagesource.getEntity();
@ -23,7 +23,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ((EntityHuman) damagesource.getEntity()).resetCooldown(); + ((EntityHuman) damagesource.getEntity()).resetCooldown();
+ } + }
+ // Paper end + // Paper end
+
} }
if (event.isCancelled()) { if (event.isCancelled()) {
return false; return false;

Datei anzeigen

@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/NetworkManager.java --- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
this.i().a(new ChatMessage("multiplayer.disconnect.generic", new Object[0])); this.i().a(new ChatMessage("multiplayer.disconnect.generic"));
} }
this.packetQueue.clear(); // Free up packet queue. this.packetQueue.clear(); // Free up packet queue.
+ // Paper start - Add PlayerConnectionCloseEvent + // Paper start - Add PlayerConnectionCloseEvent

Datei anzeigen

@ -21,9 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Bukkit.getPluginManager().callEvent(ev); Bukkit.getPluginManager().callEvent(ev);
Location loc = ev.getSpawnLocation(); Location loc = ev.getSpawnLocation();
worldserver = ((CraftWorld) loc.getWorld()).getHandle(); @@ -0,0 +0,0 @@ public abstract class PlayerList {
entityplayer.spawnIn(worldserver); entityplayer.spawnIn(worldserver1);
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
- entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ()); - entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ());
+ entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world) + entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world)
entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); entityplayer.setYawPitch(loc.getYaw(), loc.getPitch());

Datei anzeigen

@ -18,9 +18,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
} boolean flag = d8 > 0.0D;
if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) { if (this.player.isOnGround() && !packetplayinflying.b() && flag) {
- this.player.jump(); - this.player.jump();
+ // Paper start - Add player jump event + // Paper start - Add player jump event
+ Player player = this.getPlayer(); + Player player = this.getPlayer();

Datei anzeigen

@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
loadIcon(); loadIcon();
} }
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals"); waterAmbientSpawn = configuration.getInt("spawn-limits.water-ambient");
ambientSpawn = configuration.getInt("spawn-limits.ambient"); ambientSpawn = configuration.getInt("spawn-limits.ambient");
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose")); warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
- TicketType.PLUGIN.loadPeriod = configuration.getInt("chunk-gc.period-in-ticks"); - TicketType.PLUGIN.loadPeriod = configuration.getInt("chunk-gc.period-in-ticks");

Datei anzeigen

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java --- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { @@ -0,0 +0,0 @@ public abstract class EntityArrow extends IProjectile {
} }
} }
@ -30,9 +30,9 @@ diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java --- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -0,0 +0,0 @@ public abstract class EntityFireball extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityFireball extends IProjectile {
++this.g;
MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, true, this.g >= 25, this.shooter, RayTrace.BlockCollisionOption.COLLIDER); MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this::a, RayTrace.BlockCollisionOption.COLLIDER);
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { - if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ // Paper start - Call ProjectileCollideEvent + // Paper start - Call ProjectileCollideEvent
@ -48,50 +48,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.a(movingobjectposition); this.a(movingobjectposition);
// CraftBukkit start - Fire ProjectileHitEvent // CraftBukkit start - Fire ProjectileHitEvent
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
return !entity.isSpectator() && (entity.isInteractable() || entity instanceof EntityItem) && (entity != this.owner || this.g >= 5);
}, RayTrace.BlockCollisionOption.COLLIDER, true);
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ // Paper start - Call ProjectileCollideEvent
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
+ if (event.isCancelled()) {
+ movingobjectposition = null;
+ }
+ }
+ // Paper end
+
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
this.hooked = ((MovingObjectPositionEntity) movingobjectposition).getEntity();
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java --- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile { @@ -0,0 +0,0 @@ public abstract class EntityProjectile extends IProjectile {
this.ap = null;
} }
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && !flag) {
+ // Paper start - Call ProjectileCollideEvent + // Paper start - Call ProjectileCollideEvent
+ if (movingobjectposition instanceof MovingObjectPositionEntity) { + if (movingobjectposition instanceof MovingObjectPositionEntity) {
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition); + com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ movingobjectposition = null; + movingobjectposition = null;
+ }
+ } + }
+ } + if (movingobjectposition != null) {
+ // Paper end + // Paper end
+ this.a(movingobjectposition);
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled + } // Paper
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition()).getBlock() == Blocks.NETHER_PORTAL) { }
this.c(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition());
} else { Vec3D vec3d = this.getMot();
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java

Datei anzeigen

@ -33,7 +33,7 @@ diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java --- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java
@@ -0,0 +0,0 @@ import java.util.zip.GZIPOutputStream; @@ -0,0 +0,0 @@ import io.netty.buffer.ByteBufInputStream; // Paper
public class NBTCompressedStreamTools { public class NBTCompressedStreamTools {

Datei anzeigen

@ -15,17 +15,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent +import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.Map.Entry;
@@ -0,0 +0,0 @@ public class BlockFire extends Block {
world.setTypeAndData(blockposition, (IBlockData) this.a((IBlockAccess) world, blockposition).set(BlockFire.AGE, l), 3); @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
world.setTypeAndData(blockposition, this.a(world, blockposition, l), 3);
} else { } else {
- world.a(blockposition, false); - world.a(blockposition, false);
+ if(iblockdata.getBlock() != Blocks.TNT) world.a(blockposition, false); // Paper - TNTPrimeEvent - We might be cancelling it below, move the setAir down + if(iblockdata.getBlock() != Blocks.TNT) world.a(blockposition, false); // Paper - TNTPrimeEvent - We might be cancelling it below, move the setAir down
} }
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
@@ -0,0 +0,0 @@ public class BlockFire extends Block { @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract {
if (block instanceof BlockTNT) { if (block instanceof BlockTNT) {
BlockTNT blocktnt = (BlockTNT) block; BlockTNT blocktnt = (BlockTNT) block;
@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class BlockTNT extends Block { @@ -0,0 +0,0 @@ public class BlockTNT extends Block {
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (iblockdata1.getBlock() != iblockdata.getBlock()) { if (!iblockdata1.a(iblockdata.getBlock())) {
if (world.isBlockIndirectlyPowered(blockposition)) { if (world.isBlockIndirectlyPowered(blockposition)) {
+ // Paper start - TNTPrimeEvent + // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);; + org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);;
@ -80,12 +80,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
if (!world.isClientSide) { if (!world.isClientSide) {
+ // Paper start - TNTPrimeEvent + // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);; + org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
+ org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null; + org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null;
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent()) + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent())
+ return; + return;
+ // Paper end + // Paper end
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, explosion.getSource());
entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8)); entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8));
@@ -0,0 +0,0 @@ public class BlockTNT extends Block { @@ -0,0 +0,0 @@ public class BlockTNT extends Block {
@ -106,12 +106,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - TNTPrimeEvent + // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); + org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, entityarrow.getBukkitEntity()).callEvent()) { + if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, iprojectile.getBukkitEntity()).callEvent()) {
+ return; + return;
+ } + }
+ // Paper end + // Paper end
+ +
a(world, blockposition, entity1 instanceof EntityLiving ? (EntityLiving) entity1 : null); a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null);
world.a(blockposition, false); world.a(blockposition, false);
} }
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@ -128,10 +128,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class EntityEnderDragon extends EntityInsentient implements IMonster { public class EntityEnderDragon extends EntityInsentient implements IMonster {
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
}); });
craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.a); craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.b);
} }
+ // Paper start - TNTPrimeEvent + // Paper start - TNTPrimeEvent
+ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.x, blockposition.y, blockposition.z); + org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent()) + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent())
+ continue; + continue;
+ // Paper end + // Paper end

Datei anzeigen

@ -8,9 +8,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ import net.minecraft.server.WorldServer; @@ -0,0 +0,0 @@ import net.minecraft.server.WorldNBTStorage;
import net.minecraft.server.WorldServer;
import net.minecraft.server.WorldSettings; import net.minecraft.server.WorldSettings;
import net.minecraft.server.WorldType;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
+import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils;
import org.bukkit.BanList; import org.bukkit.BanList;

Datei anzeigen

@ -35,8 +35,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public static int packetInSpamThreshold = 300; public static int packetInSpamThreshold = 300;
@@ -0,0 +0,0 @@ public class PaperConfig { @@ -0,0 +0,0 @@ public class PaperConfig {
}
} }
tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit);
} }
+ +
+ public static boolean velocitySupport; + public static boolean velocitySupport;
@ -133,6 +133,14 @@ diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java --- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.Waitable;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerPreLoginEvent;
// CraftBukkit end
+import io.netty.buffer.Unpooled; // Paper
public class LoginListener implements PacketLoginInListener {
@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener {
private SecretKey loginKey; private SecretKey loginKey;
private EntityPlayer l; private EntityPlayer l;
@ -148,7 +156,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Velocity support + // Paper start - Velocity support
+ if (com.destroystokyo.paper.PaperConfig.velocitySupport) { + if (com.destroystokyo.paper.PaperConfig.velocitySupport) {
+ this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt(); + this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt();
+ PacketLoginOutCustomPayload packet = new PacketLoginOutCustomPayload(this.velocityLoginMessageId, com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, new PacketDataSerializer(io.netty.buffer.Unpooled.EMPTY_BUFFER)); + PacketLoginOutCustomPayload packet = new PacketLoginOutCustomPayload(this.velocityLoginMessageId, com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, new PacketDataSerializer(Unpooled.EMPTY_BUFFER));
+ this.networkManager.sendPacket(packet); + this.networkManager.sendPacket(packet);
+ return; + return;
+ } + }
@ -202,7 +210,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return; + return;
+ } + }
+ // Paper end + // Paper end
this.disconnect(new ChatMessage("multiplayer.disconnect.unexpected_query_response", new Object[0])); this.disconnect(new ChatMessage("multiplayer.disconnect.unexpected_query_response"));
} }
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java

Datei anzeigen

@ -17,8 +17,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public boolean isLoadedAndInBounds(BlockPosition blockposition) { + public boolean isLoadedAndInBounds(BlockPosition blockposition) {
+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; + return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
+ } + }
+ public Chunk getChunkIfLoaded(BlockPosition blockposition) { +
+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); + public Chunk getChunkIfLoaded(int x, int z) {
+ return ((WorldServer) this).getChunkProvider().getChunkAtIfLoadedImmediately(x, z);
+ }
+ public final Chunk getChunkIfLoaded(BlockPosition blockposition) {
+ return ((WorldServer) this).getChunkProvider().getChunkAtIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
+ } + }
+ +
+ // reduces need to do isLoaded before getType + // reduces need to do isLoaded before getType
@ -38,5 +42,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } // Paper - OBFHELPER + public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } // Paper - OBFHELPER
public boolean a(BlockPosition blockposition) { public boolean a(BlockPosition blockposition) {
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f(); return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
} }
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
public final Convertable.ConversionSession convertable;
public final UUID uuid;
- public Chunk getChunkIfLoaded(int x, int z) {
+ @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
return this.chunkProvider.getChunkAt(x, z, false);
}

Datei anzeigen

@ -30,21 +30,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce {
@Override @Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
+ if (!worldserver.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice + if (!worldserver.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
if ((random.nextInt(3) == 0 || this.a(worldserver, blockposition, 4)) && worldserver.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b((IBlockAccess) worldserver, blockposition) && this.e(iblockdata, (World) worldserver, blockposition)) { if ((random.nextInt(3) == 0 || this.a(worldserver, blockposition, 4)) && worldserver.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b((IBlockAccess) worldserver, blockposition) && this.e(iblockdata, (World) worldserver, blockposition)) {
BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.r(); BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
Throwable throwable = null; EnumDirection[] aenumdirection = EnumDirection.values();
@@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce {
IBlockData iblockdata1 = worldserver.getType(blockposition_pooledblockposition); IBlockData iblockdata1 = worldserver.getType(blockposition_mutableblockposition);
if (iblockdata1.getBlock() == this && !this.e(iblockdata1, (World) worldserver, blockposition_pooledblockposition)) { if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) {
- worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, 20, 40)); - worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, 20, 40));
+ worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay + worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
}
} }
} catch (Throwable throwable1) {
@@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce {
} }
} else { } else {

Datei anzeigen

@ -26,23 +26,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private int h; private int h;
private int i; private int i;
private int j; private int j;
- private boolean k; - private boolean dragonKilled;
+ private boolean k; private void setDragonKilled(boolean dragonKilled) { this.k = dragonKilled; } // Paper - OBFHELPER + private boolean dragonKilled; private void setDragonKilled(boolean dragonKilled) { this.dragonKilled = dragonKilled; } // Paper - OBFHELPER
private boolean l; private boolean previouslyKilled;
public UUID m; // CraftBukkit PAIL private -> public, rename dragonUUID public UUID dragonUUID;
- private boolean n; - private boolean n;
+ private boolean n; private void setScanForLegacyFight(boolean scanForLegacyFight) { this.n = scanForLegacyFight; } private boolean scanForLegacyFight() { return this.n; } // Paper - OBFHELPER + private boolean n; private void setScanForLegacyFight(boolean scanForLegacyFight) { this.n = scanForLegacyFight; } private boolean scanForLegacyFight() { return this.n; } // Paper - OBFHELPER
public BlockPosition o; // CraftBukkit PAIL private -> public, rename portalLocation public BlockPosition exitPortalLocation;
public EnumDragonRespawn p; // CraftBukkit PAIL private -> public, rename respawnPhase public EnumDragonRespawn respawnPhase;
private int q; private int q;
@@ -0,0 +0,0 @@ public class EnderDragonBattle { @@ -0,0 +0,0 @@ public class EnderDragonBattle {
this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon", new Object[0]), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true); this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon"), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true);
this.e = Lists.newArrayList(); this.gateways = Lists.newArrayList();
this.n = true; this.n = true;
+ // Paper start + // Paper start
+ setScanForLegacyFight(worldserver.paperConfig.scanForLegacyEnderDragon); + setScanForLegacyFight(worldserver.paperConfig.scanForLegacyEnderDragon);
+ if (!scanForLegacyFight()) setDragonKilled(true); + if (!scanForLegacyFight()) setDragonKilled(true);
+ // Paper end + // Paper end
this.d = worldserver; this.world = worldserver;
if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) { if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) {
if (nbttagcompound.b("DragonUUID")) { if (nbttagcompound.b("Dragon")) {

Datei anzeigen

@ -34,16 +34,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityInsentient.java --- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
if (entityhuman != null) { int i = this.getEntityType().e().f();
double d0 = entityhuman.h(this); int j = i * i;
- if (d0 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check - if (d0 > (double) j) { // CraftBukkit - remove isTypeNotPersistent() check
+ if (d0 > world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances + if (d0 > (double) world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances
this.die(); this.die();
} }
- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check int k = this.getEntityType().e().g();
int l = k * k;
- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > (double) l) { // CraftBukkit - remove isTypeNotPersistent() check
+ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > world.paperConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances + if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > world.paperConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances
this.die(); this.die();
} else if (d0 < 1024.0D) { } else if (d0 < (double) l) {
this.ticksFarFromPlayer = 0; this.ticksFarFromPlayer = 0;

Datei anzeigen

@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
blockposition = new BlockPosition(d0, this.locY(), d1); blockposition = new BlockPosition(d0, this.locY(), d1);
// CraftBukkit start // CraftBukkit start
- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, 128); - EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128);
+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, world.paperConfig.portalSearchRadius); // Paper - use portal search radius + EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, worldserver.paperConfig.portalSearchRadius); // Paper - use portal search radius
if (event == null) { if (event == null) {
return null; return null;
} }
@ -40,11 +40,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start // CraftBukkit start
Location enter = this.getBukkitEntity().getLocation(); Location enter = this.getBukkitEntity().getLocation();
Location exit = (worldserver1 == null) ? null : new Location(worldserver1.getWorld(), d0, d1, d2, f1, f); Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), d0, d1, d2, f1, f);
- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : 16); - PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == DimensionManager.THE_END ? 0 : 16);
+ int configuredSearchRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalSearchRadius; + com.destroystokyo.paper.PaperWorldConfig config = worldserver != null ? worldserver.paperConfig : worldserver1.paperConfig; // Paper - portal radius
+ int configuredCreateRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalCreateRadius; + PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, config.portalSearchRadius, true, resourcekey == DimensionManager.THE_END ? 0 : config.portalCreateRadius); // Paper - portal radius
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, configuredSearchRadius, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : configuredCreateRadius); // Paper - configurable portal search radius
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || event.getTo() == null) { if (event.isCancelled() || event.getTo() == null) {
return null; return null;
@ -63,10 +62,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Nullable @Nullable
@@ -0,0 +0,0 @@ public class PortalTravelAgent { @@ -0,0 +0,0 @@ public class PortalTravelAgent {
// CraftBukkit end // CraftBukkit end
VillagePlace villageplace = this.world.B(); VillagePlace villageplace = this.world.x();
- villageplace.a(this.world, blockposition, 128); - villageplace.a(this.world, blockposition, 128);
+ villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries + villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries
List<VillagePlaceRecord> list = (List) villageplace.b((villageplacetype) -> { List<VillagePlaceRecord> list = (List) villageplace.b((villageplacetype) -> {
return villageplacetype == VillagePlaceType.u; return villageplacetype == VillagePlaceType.v;
}, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius }, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius

Datei anzeigen

@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
net.minecraft.server.Block block = iblockdata.getBlock(); net.minecraft.server.Block block = iblockdata.getBlock();
@@ -0,0 +0,0 @@ public class CraftBlock implements Block { @@ -0,0 +0,0 @@ public class CraftBlock implements Block {
// Modelled off EntityHuman#hasBlock // Modelled off EntityHuman#hasBlock
if (block != Blocks.AIR && (item == null || iblockdata.getMaterial().isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) { if (block != Blocks.AIR && (item == null || !iblockdata.isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) {
net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem); net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem);
+ if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.server.Block.getCombinedId(block.getBlockData())); // Paper + if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.server.Block.getCombinedId(block.getBlockData())); // Paper
result = true; result = true;

Datei anzeigen

@ -83,7 +83,7 @@ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ import java.util.function.BooleanSupplier; @@ -0,0 +0,0 @@ import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -124,14 +124,6 @@ diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.world.checkSession();
} catch (ExceptionWorldConflict exceptionworldconflict) {
PlayerChunkMap.LOGGER.error("Couldn't save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exceptionworldconflict); // Paper
return false;
}
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
return true; return true;
} catch (Exception exception) { } catch (Exception exception) {
@ -173,15 +165,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
@@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -0,0 +0,0 @@ public final class SpawnerCreature {
entityinsentient = (EntityInsentient) entity; }
} catch (Exception exception) { } catch (Exception exception) {
SpawnerCreature.LOGGER.warn("Failed to create mob", exception); SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
+ ServerInternalException.reportInternalException(exception); // Paper + ServerInternalException.reportInternalException(exception); // Paper
return; return null;
} }
}
@@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -0,0 +0,0 @@ public final class SpawnerCreature {
entity = biomebase_biomemeta.b.a(generatoraccess.getMinecraftWorld()); entity = biomebase_biomemeta.c.a(generatoraccess.getMinecraftWorld());
} catch (Exception exception) { } catch (Exception exception) {
SpawnerCreature.LOGGER.warn("Failed to create mob", exception); SpawnerCreature.LOGGER.warn("Failed to create mob", exception);
+ ServerInternalException.reportInternalException(exception); // Paper + ServerInternalException.reportInternalException(exception); // Paper
@ -200,8 +192,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.Iterator; import java.util.Iterator;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -0,0 +0,0 @@ public class VillageSiege { @@ -0,0 +0,0 @@ public class VillageSiege implements MobSpawner {
entityzombie.prepare(worldserver, worldserver.getDamageScaler(new BlockPosition(entityzombie)), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); entityzombie.prepare(worldserver, worldserver.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null);
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
+ ServerInternalException.reportInternalException(exception); // Paper + ServerInternalException.reportInternalException(exception); // Paper
@ -212,16 +204,17 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ package net.minecraft.server; @@ -0,0 +0,0 @@
package net.minecraft.server;
import co.aikar.timings.Timing; +import co.aikar.timings.Timing;
import co.aikar.timings.Timings; +import co.aikar.timings.Timings;
+import com.destroystokyo.paper.event.server.ServerExceptionEvent; +import com.destroystokyo.paper.event.server.ServerExceptionEvent;
+import com.destroystokyo.paper.exception.ServerInternalException; +import com.destroystokyo.paper.exception.ServerInternalException;
+import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.serialization.Codec;
import java.io.IOException; import java.io.IOException;
import java.util.Collection;
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.exit(); gameprofilerfiller.exit();
} catch (Throwable throwable) { } catch (Throwable throwable) {
@ -274,29 +267,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.bukkit.plugin.IllegalPluginAccessException; import org.bukkit.plugin.IllegalPluginAccessException;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler { @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
try { msg,
task.run();
} catch (final Throwable throwable) {
+ // Paper start
+ String msg = String.format(
+ "Task #%s for %s generated an exception",
+ task.getTaskId(),
+ task.getOwner().getDescription().getFullName());
task.getOwner().getLogger().log(
Level.WARNING,
- String.format(
- "Task #%s for %s generated an exception",
- task.getTaskId(),
- task.getOwner().getDescription().getFullName()),
+ msg,
throwable); throwable);
}
+ task.getOwner().getServer().getPluginManager().callEvent( + task.getOwner().getServer().getPluginManager().callEvent(
+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task)) + new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task)));
+ ); // Paper end
+ // Paper end
} finally { } finally {
currentTask = null; currentTask = null;
} @@ -0,0 +0,0 @@ public class CraftScheduler implements BukkitScheduler {
parsePending(); parsePending();
} else { } else {
debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass())); debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass()));

Datei anzeigen

@ -10,13 +10,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityCow.java +++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -0,0 +0,0 @@ public class EntityCow extends EntityAnimal { @@ -0,0 +0,0 @@ public class EntityCow extends EntityAnimal {
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) { if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) {
// CraftBukkit start - Got milk? // CraftBukkit start - Got milk?
- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET); - org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET);
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand + org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand
if (event.isCancelled()) { if (event.isCancelled()) {
return false; return EnumInteractionResult.PASS;
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ItemBucket.java --- a/src/main/java/net/minecraft/server/ItemBucket.java
@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (iblockdata.getBlock() instanceof IFluidSource) { if (iblockdata.getBlock() instanceof IFluidSource) {
// CraftBukkit start // CraftBukkit start
FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a()); - PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a());
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); + PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); // Paper - add enumhand
if (event.isCancelled()) { if (event.isCancelled()) {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager)
@ -34,14 +34,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
iblockdata = world.getType(blockposition); iblockdata = world.getType(blockposition);
BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1; BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1;
- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit - if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack)) { // CraftBukkit
+ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand + if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand
this.a(world, itemstack, blockposition2); this.a(world, itemstack, blockposition2);
if (entityhuman instanceof EntityPlayer) { if (entityhuman instanceof EntityPlayer) {
CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack); CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack);
@@ -0,0 +0,0 @@ public class ItemBucket extends Item { @@ -0,0 +0,0 @@ public class ItemBucket extends Item {
public void a(World world, ItemStack itemstack, BlockPosition blockposition) {}
// CraftBukkit start
public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) { public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) {
- return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null); - return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null);
+ // Paper start - add enumHand + // Paper start - add enumHand
@ -55,27 +55,93 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (!(this.fluidType instanceof FluidTypeFlowing)) { if (!(this.fluidType instanceof FluidTypeFlowing)) {
return false; return false;
@@ -0,0 +0,0 @@ public class ItemBucket extends Item { @@ -0,0 +0,0 @@ public class ItemBucket extends Item {
boolean flag = iblockdata.a(this.fluidType);
if (!iblockdata.isAir() && !flag && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) { // CraftBukkit start
- return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit if (flag1 && entityhuman != null) {
+ return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit - PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack);
} else { + PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumhand
// CraftBukkit start if (event.isCancelled()) {
if (entityhuman != null) { ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity
- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack); ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); @@ -0,0 +0,0 @@ public class ItemBucket extends Item {
if (event.isCancelled()) { }
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity // CraftBukkit end
((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 if (!flag1) {
- return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit
+ return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand
} else if (world.getDimensionManager().isNether() && this.fluidType.a((Tag) TagsFluid.WATER)) {
int i = blockposition.getX();
int j = blockposition.getY();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
// Paper end
+ // Paper start - moved up from WorldServer
+ public BlockPosition getSpawn() {
+ BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
+
+ if (!this.getWorldBorder().a(blockposition)) {
+ blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
+ }
+
+ return blockposition;
+ }
+ // Paper end
@Override
public boolean s_() {
return this.isClientSide;
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition));
}
- public BlockPosition getSpawn() {
- BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
-
- if (!this.getWorldBorder().a(blockposition)) {
- blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
- }
-
- return blockposition;
- }
+ // Paper - moved up to World
+ //public BlockPosition getSpawn() {
+ // BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c());
+ //
+ // if (!this.getWorldBorder().a(blockposition)) {
+ // blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ()));
+ // }
+ //
+ // return blockposition;
+ //}
+ // Paper end
public LongSet getForceLoadedChunks() {
ForcedChunk forcedchunk = (ForcedChunk) this.getWorldPersistentData().b(ForcedChunk::new, "chunks");
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ public class CraftEventFactory {
public static Entity entityDamage; // For use in EntityDamageByEntityEvent
// helper methods
- private static boolean canBuild(WorldServer world, Player player, int x, int z) {
+ private static boolean canBuild(World world, Player player, int x, int z) {
int spawnSize = Bukkit.getServer().getSpawnRadius();
if (world.getDimensionKey() != World.OVERWORLD) return true;
@@ -0,0 +0,0 @@ public class CraftEventFactory { @@ -0,0 +0,0 @@ public class CraftEventFactory {
} }
private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) { private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) {
+ // Paper start - add enumHand + // Paper start - add enumHand
+ return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); + return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null);
+ } + }

Datei anzeigen

@ -10,9 +10,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/HandshakeListener.java --- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
this.b.close(chatmessage); // CraftBukkit end
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
private final MinecraftServer b;
- private final NetworkManager c;
+ private final NetworkManager c; final NetworkManager getNetworkManager() { return this.c; } // Paper - OBFHELPER
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.b = minecraftserver;
@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener {
this.c.close(chatmessage);
} else { } else {
this.b.setPacketListener(new LoginListener(this.a, this.b)); this.c.setPacketListener(new LoginListener(this.b, this.c));
+ // Paper start - handshake event + // Paper start - handshake event
+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee; + boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee;
+ boolean handledByEvent = false; + boolean handledByEvent = false;
@ -23,15 +32,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // If we've failed somehow, let the client know so and go no further. + // If we've failed somehow, let the client know so and go no further.
+ if (event.isFailed()) { + if (event.isFailed()) {
+ chatmessage = new ChatMessage(event.getFailMessage()); + chatmessage = new ChatMessage(event.getFailMessage());
+ this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); + this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(chatmessage));
+ this.b.close(chatmessage); + this.getNetworkManager().close(chatmessage);
+ return; + return;
+ } + }
+ +
+ packethandshakinginsetprotocol.hostname = event.getServerHostname(); + packethandshakinginsetprotocol.hostname = event.getServerHostname();
+ this.b.socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.b.getSocketAddress()).getPort()); + this.getNetworkManager().socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.getNetworkManager().getSocketAddress()).getPort());
+ this.b.spoofedUUID = event.getUniqueId(); + this.getNetworkManager().spoofedUUID = event.getUniqueId();
+ this.b.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); + this.getNetworkManager().spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
+ handledByEvent = true; // Hooray, we did it! + handledByEvent = true; // Hooray, we did it!
+ } + }
+ } + }

Datei anzeigen

@ -24,26 +24,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public class EntityWitch extends EntityRaider implements IRangedEntity { public class EntityWitch extends EntityRaider implements IRangedEntity {
private static final UUID b = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); private static final UUID b = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E");
- private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); - private static final AttributeModifier bv = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION);
+ private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); private static final AttributeModifier DRINKING_SPEED = bw; // Paper - OBFHELPER + private static final AttributeModifier bv = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION); private static final AttributeModifier DRINKING_SPEED = bv; // Paper - OBFHELPER
private static final DataWatcherObject<Boolean> bx = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> bw = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i);
- private int by; - private int bx;
+ private int by; public int getPotionUseTimeLeft() { return by; } public void setPotionUseTimeLeft(int timeLeft) { by = timeLeft; } // Paper - OBFHELPER + private int bx; public int getPotionUseTimeLeft() { return bx; } public void setPotionUseTimeLeft(int timeLeft) { bx = timeLeft; } // Paper - OBFHELPER
private PathfinderGoalNearestHealableRaider<EntityRaider> bz; private PathfinderGoalNearestHealableRaider<EntityRaider> by;
private PathfinderGoalNearestAttackableTargetWitch<EntityHuman> bA; private PathfinderGoalNearestAttackableTargetWitch<EntityHuman> bz;
@@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { @@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
return SoundEffects.ENTITY_WITCH_DEATH; return SoundEffects.ENTITY_WITCH_DEATH;
} }
+ public void setDrinkingPotion(boolean drinkingPotion) { t(drinkingPotion); } // Paper - OBFHELPER + public void setDrinkingPotion(boolean drinkingPotion) { v(drinkingPotion); } // Paper - OBFHELPER
public void t(boolean flag) { public void v(boolean flag) {
this.getDataWatcher().set(EntityWitch.bx, flag); this.getDataWatcher().set(EntityWitch.bw, flag);
} }
+ public boolean isDrinkingPotion() { return l(); } // Paper - OBFHELPER + public boolean isDrinkingPotion() { return m(); } // Paper - OBFHELPER
public boolean l() { public boolean m() {
return (Boolean) this.getDataWatcher().get(EntityWitch.bx); return (Boolean) this.getDataWatcher().get(EntityWitch.bw);
} }
@@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { @@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity {
} }
@ -53,27 +53,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); - ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry);
- org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); - org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
- this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); - this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack));
+ // Paper start - move all this down into its own method - // Paper end
+// ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); - this.bx = this.getItemInMainHand().k();
+// org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); - this.v(true);
+// this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); - if (!this.isSilent()) {
+// // Paper end - this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
+// this.bB = this.getItemInMainHand().k(); - }
+// this.s(true);
+// this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
+// AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
+//
+// attributeinstance.removeModifier(EntityWitch.bz);
+// attributeinstance.addModifier(EntityWitch.bz);
+ this.setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry));
// Paper end
- this.by = this.getItemInMainHand().k();
- this.t(true);
- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
- AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
- -
- attributeinstance.removeModifier(EntityWitch.bw); - AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
- attributeinstance.addModifier(EntityWitch.bw); -
- attributemodifiable.removeModifier(EntityWitch.bv);
- attributemodifiable.b(EntityWitch.bv);
+ //// Paper start
+ //ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry);
+ //org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
+ //this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack));
+ //// Paper end
+ //this.bx = this.getItemInMainHand().k();
+ //this.v(true);
+ //if (!this.isSilent()) {
+ // this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
+ //}
+ //
+ //AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
+ //
+ //attributemodifiable.removeModifier(EntityWitch.bv);
+ //attributemodifiable.b(EntityWitch.bv);
+ this.setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry));
} }
} }
@ -81,20 +87,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
super.movementTick(); super.movementTick();
} }
+ // Paper start + // Paper start - moved to its own method
+ public void setDrinkingPotion(ItemStack potion) { + public void setDrinkingPotion(ItemStack potion) {
+ setSlot(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(WitchReadyPotionEvent.process((Witch) getBukkitEntity(), CraftItemStack.asCraftMirror(potion)))); + setSlot(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(WitchReadyPotionEvent.process((Witch) getBukkitEntity(), CraftItemStack.asCraftMirror(potion))));
+ setPotionUseTimeLeft(getItemInMainHand().getItemUseMaxDuration()); + setPotionUseTimeLeft(getItemInMainHand().getItemUseMaxDuration());
+ setDrinkingPotion(true); + setDrinkingPotion(true);
+ world.sendSoundEffect(null, locX(), locY(), locZ(), SoundEffects.ENTITY_WITCH_DRINK, getSoundCategory(), 1.0F, 0.8F + random.nextFloat() * 0.4F); + if (!this.isSilent()) {
+ AttributeInstance attributeinstance = getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); + this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
+ attributeinstance.removeModifier(EntityWitch.DRINKING_SPEED); + }
+ attributeinstance.addModifier(EntityWitch.DRINKING_SPEED); + AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
+ attributemodifiable.removeModifier(EntityWitch.bv);
+ attributemodifiable.b(EntityWitch.bv);
+ } + }
+ // Paper end + // Paper end
+ +
@Override @Override
public SoundEffect eq() { public SoundEffect eM() {
return SoundEffects.ENTITY_WITCH_CELEBRATE; return SoundEffects.ENTITY_WITCH_CELEBRATE;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

Datei anzeigen

@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ public boolean isArmsRaisedZombie() { return (this.datawatcher.get(EntityInsentient.b) & 4) != 0; } // Paper - OBFHELPER + public boolean isArmsRaisedZombie() { return (this.datawatcher.get(EntityInsentient.b) & 4) != 0; } // Paper - OBFHELPER
+ public void setArmsRaisedZombie(boolean flag) { this.q(flag); } // Paper - OBFHELPER + public void setArmsRaisedZombie(boolean flag) { this.setAggressive(flag); } // Paper - OBFHELPER
public void q(boolean flag) { public void setAggressive(boolean flag) {
byte b0 = (Byte) this.datawatcher.get(EntityInsentient.b); byte b0 = (Byte) this.datawatcher.get(EntityInsentient.b);
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityZombie.java --- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
private int bC; private int bA;
public int drownedConversionTime; public int drownedConversionTime;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
+ private boolean shouldBurnInDay = true; // Paper + private boolean shouldBurnInDay = true; // Paper
@ -48,15 +48,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
+ +
protected void ev() { protected void eQ() {
this.b(EntityTypes.DROWNED); this.c(EntityTypes.DROWNED);
this.world.a((EntityHuman) null, 1040, new BlockPosition(this), 0); if (!this.isSilent()) {
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
}
} }
+ public boolean shouldBurnInDay() { return K_(); } // Paper - OBFHELPER + public boolean shouldBurnInDay() { return U_(); } // Paper - OBFHELPER
protected boolean K_() { protected boolean U_() {
- return true; - return true;
+ return shouldBurnInDay; + return shouldBurnInDay;
} }
@ -71,8 +71,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public boolean damageEntity(DamageSource damagesource, float f) { public boolean damageEntity(DamageSource damagesource, float f) {
if (super.damageEntity(damagesource, f)) { if (super.damageEntity(damagesource, f)) {
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
nbttagcompound.setBoolean("CanBreakDoors", this.ey()); nbttagcompound.setBoolean("CanBreakDoors", this.eV());
nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bC : -1); nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bA : -1);
nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1); nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1);
+ nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper + nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper
} }

Datei anzeigen

@ -24,7 +24,7 @@ diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java --- a/src/main/java/net/minecraft/server/EntityIronGolem.java
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java +++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
@@ -0,0 +0,0 @@ public class EntityIronGolem extends EntityGolem { @@ -0,0 +0,0 @@ public class EntityIronGolem extends EntityGolem implements IEntityAngerable {
BlockPosition blockposition1 = blockposition.down(); BlockPosition blockposition1 = blockposition.down();
IBlockData iblockdata = iworldreader.getType(blockposition1); IBlockData iblockdata = iworldreader.getType(blockposition1);

Datei anzeigen

@ -22,9 +22,9 @@ diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java --- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java
@@ -0,0 +0,0 @@ public class MobSpawnerPatrol { @@ -0,0 +0,0 @@ public class MobSpawnerPatrol implements MobSpawner {
public MobSpawnerPatrol() {}
@Override
public int a(WorldServer worldserver, boolean flag, boolean flag1) { public int a(WorldServer worldserver, boolean flag, boolean flag1) {
+ if (worldserver.paperConfig.disablePillagerPatrols) return 0; // Paper + if (worldserver.paperConfig.disablePillagerPatrols) return 0; // Paper
if (!flag) { if (!flag) {

Datei anzeigen

@ -23,14 +23,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/BlockPortal.java --- a/src/main/java/net/minecraft/server/BlockPortal.java
+++ b/src/main/java/net/minecraft/server/BlockPortal.java +++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -0,0 +0,0 @@ public class BlockPortal extends Block { @@ -0,0 +0,0 @@ public class BlockPortal extends Block {
Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
if (entity != null) { if (entity != null) {
entity.portalCooldown = entity.getDefaultPortalCooldown();
+ entity.fromNetherPortal = true; // Paper + entity.fromNetherPortal = true; // Paper
+ if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper + if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper
entity.portalCooldown = entity.ba();
} }
} }
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java

Datei anzeigen

@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { - if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) {
+ if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission + if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission
entityhuman.a((TileEntityCommand) tileentity); entityhuman.a((TileEntityCommand) tileentity);
return EnumInteractionResult.SUCCESS; return EnumInteractionResult.a(world.isClientSide);
} else { } else {
diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { @@ -0,0 +0,0 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener {
} }
public boolean a(EntityHuman entityhuman) { public EnumInteractionResult a(EntityHuman entityhuman) {
- if (!entityhuman.isCreativeAndOp()) { - if (!entityhuman.isCreativeAndOp()) {
+ if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission
return false; return EnumInteractionResult.PASS;
} else { } else {
if (entityhuman.getWorld().isClientSide) { if (entityhuman.getWorld().isClientSide) {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
@ -37,19 +37,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer());
if (!this.minecraftServer.getEnableCommandBlock()) { if (!this.minecraftServer.getEnableCommandBlock()) {
this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b);
- } else if (!this.player.isCreativeAndOp()) { - } else if (!this.player.isCreativeAndOp()) {
+ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission
this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b);
} else { } else {
CommandBlockListenerAbstract commandblocklistenerabstract = null; CommandBlockListenerAbstract commandblocklistenerabstract = null;
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandminecart, this, this.player.getWorldServer()); PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandminecart, this, this.player.getWorldServer());
if (!this.minecraftServer.getEnableCommandBlock()) { if (!this.minecraftServer.getEnableCommandBlock()) {
this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b);
- } else if (!this.player.isCreativeAndOp()) { - } else if (!this.player.isCreativeAndOp()) {
+ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission
this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b);
} else { } else {
CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world);
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java

Datei anzeigen

@ -37,23 +37,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/IEntitySelector.java --- a/src/main/java/net/minecraft/server/IEntitySelector.java
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java
@@ -0,0 +0,0 @@ public final class IEntitySelector { @@ -0,0 +0,0 @@ public final class IEntitySelector {
public static final Predicate<Entity> f = (entity) -> { public static final Predicate<Entity> g = (entity) -> {
return !entity.isSpectator(); return !entity.isSpectator();
}; };
+ public static Predicate<EntityHuman> isInsomniac = (player) -> MathHelper.clamp(((EntityPlayer) player).getStatisticManager().getStatisticValue(StatisticList.CUSTOM.get(StatisticList.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper + public static Predicate<EntityHuman> isInsomniac = (player) -> MathHelper.clamp(((EntityPlayer) player).getStatisticManager().getStatisticValue(StatisticList.CUSTOM.get(StatisticList.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper
public static Predicate<Entity> a(double d0, double d1, double d2, double d3) { // Paper start
double d4 = d3 * d3; public static final Predicate<Entity> affectsSpawning = (entity) -> {
diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java --- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
@@ -0,0 +0,0 @@ public class MobSpawnerPhantom { @@ -0,0 +0,0 @@ public class MobSpawnerPhantom implements MobSpawner {
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next(); EntityHuman entityhuman = (EntityHuman) iterator.next();
- if (!entityhuman.isSpectator()) { - if (!entityhuman.isSpectator()) {
+ if (!entityhuman.isSpectator() && (!worldserver.paperConfig.phantomIgnoreCreative || !entityhuman.isCreative())) { // Paper + if (!entityhuman.isSpectator() && (!worldserver.paperConfig.phantomIgnoreCreative || !entityhuman.isCreative())) { // Paper
BlockPosition blockposition = new BlockPosition(entityhuman); BlockPosition blockposition = entityhuman.getChunkCoordinates();
if (!worldserver.worldProvider.f() || blockposition.getY() >= worldserver.getSeaLevel() && worldserver.f(blockposition)) { if (!worldserver.getDimensionManager().hasSkyLight() || blockposition.getY() >= worldserver.getSeaLevel() && worldserver.f(blockposition)) {

Datei anzeigen

@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityInsentient.java --- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
return flag;
} }
+ public boolean isInDaylight() { return this.en(); } // Paper - OBFHELPER + public boolean isInDaylight() { return this.eH(); } // Paper - OBFHELPER
protected boolean en() { protected boolean eH() {
if (this.world.isDay() && !this.world.isClientSide) { if (this.world.isDay() && !this.world.isClientSide) {
float f = this.aI(); float f = this.aO();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java

Datei anzeigen

@ -91,19 +91,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
private int F;
private int G; private int G;
private int H; public final long[] h; public long[] getTickTimes() { return h; } // Paper - OBFHELPER
public final long[] f = new long[100]; public long[] getTickTimes() { return f; } // Paper - OBFHELPER
+ // Paper start + // Paper start
+ public final TickTimes tickTimes5s = new TickTimes(100); + public final TickTimes tickTimes5s = new TickTimes(100);
+ public final TickTimes tickTimes10s = new TickTimes(200); + public final TickTimes tickTimes10s = new TickTimes(200);
+ public final TickTimes tickTimes60s = new TickTimes(1200); + public final TickTimes tickTimes60s = new TickTimes(1200);
+ // Paper end + // Paper end
@Nullable @Nullable
private KeyPair I; private KeyPair H;
@Nullable @Nullable
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.av = this.av * 0.8F + (float) l / 1000000.0F * 0.19999999F; this.ag = this.ag * 0.8F + (float) l / 1000000.0F * 0.19999999F;
long i1 = SystemUtils.getMonotonicNanos(); long i1 = SystemUtils.getMonotonicNanos();
+ // Paper start + // Paper start
@ -116,9 +116,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.methodProfiler.exit(); this.methodProfiler.exit();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
return SERVER; // Paper public SaveData getSaveData() {
return this.saveData;
} }
// CraftBukkit end
+ +
+ // Paper start + // Paper start
+ public static class TickTimes { + public static class TickTimes {

Datei anzeigen

@ -202,4 +202,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now + com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now
// Paper end // Paper end
this.setSpawnAnimals(dedicatedserverproperties.spawnAnimals); this.setPVP(dedicatedserverproperties.pvp);

Datei anzeigen

@ -24,12 +24,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityVillager.java --- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
this.bL = 0; this.bK = 0;
} }
+ public Reputation getReputation() { return this.eN(); } // Paper - OBFHELPER + public Reputation getReputation() { return this.fj(); } // Paper - OBFHELPER
public Reputation eN() { public Reputation fj() {
return this.bG; return this.bF;
} }
diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

Datei anzeigen

@ -23,11 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntitySlime.java --- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster {
} }
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition); ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition);
- boolean flag = SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, generatoraccess.getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot - boolean flag = SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, ((GeneratorAccessSeed) generatoraccess).getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot
+ boolean flag = generatoraccess.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, generatoraccess.getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper + boolean flag = generatoraccess.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, ((GeneratorAccessSeed) generatoraccess).getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper
if (random.nextInt(10) == 0 && flag && blockposition.getY() < 40) { if (random.nextInt(10) == 0 && flag && blockposition.getY() < 40) {
return a(entitytypes, generatoraccess, enummobspawn, blockposition, random); return a(entitytypes, generatoraccess, enummobspawn, blockposition, random);

Datei anzeigen

@ -69,11 +69,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final RegionFileBitSet freeSectors; private final RegionFileBitSet freeSectors;
+ public final File file; + public final File file;
public RegionFile(File file, File file1) throws IOException { public RegionFile(File file, File file1, boolean flag) throws IOException {
this(file.toPath(), file1.toPath(), RegionFileCompression.b); this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag);
} }
public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression) throws IOException { public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression, boolean flag) throws IOException {
+ this.file = java_nio_file_path.toFile(); // Paper + this.file = java_nio_file_path.toFile(); // Paper
this.f = ByteBuffer.allocateDirect(8192); this.f = ByteBuffer.allocateDirect(8192);
+ initOversizedState(); + initOversizedState();

Datei anzeigen

@ -37,11 +37,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) { public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
this.rightArmPose = EntityArmorStand.bu; this.rightArmPose = EntityArmorStand.bt;
this.leftLegPose = EntityArmorStand.bv; this.leftLegPose = EntityArmorStand.bu;
this.rightLegPose = EntityArmorStand.bw; this.rightLegPose = EntityArmorStand.bv;
+ if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking + if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking
this.H = 0.0F; this.G = 0.0F;
} }
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
@ -136,7 +136,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void setRightLegPose(Vector3f vector3f) { public void setRightLegPose(Vector3f vector3f) {
this.rightLegPose = vector3f; this.rightLegPose = vector3f;
this.datawatcher.set(EntityArmorStand.bp, vector3f); this.datawatcher.set(EntityArmorStand.bo, vector3f);
+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking
} }
@ -145,115 +145,13 @@ diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
}
}
- EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
- int k = aenumitemslot.length;
-
- for (int l = 0; l < k; ++l) {
- EnumItemSlot enumitemslot = aenumitemslot[l];
- ItemStack itemstack;
-
- switch (enumitemslot.a()) {
- case HAND:
- itemstack = (ItemStack) this.bu.get(enumitemslot.b());
- break;
- case ARMOR:
- itemstack = (ItemStack) this.bv.get(enumitemslot.b());
- break;
- default:
- continue;
- }
-
- ItemStack itemstack1 = this.getEquipment(enumitemslot);
-
- if (!ItemStack.matches(itemstack1, itemstack)) {
- // Paper start - PlayerArmorChangeEvent
- if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
- final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
- final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
- new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
- }
- // Paper end
- ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1));
- if (!itemstack.isEmpty()) {
- this.getAttributeMap().a(itemstack.a(enumitemslot));
- }
-
- if (!itemstack1.isEmpty()) {
- this.getAttributeMap().b(itemstack1.a(enumitemslot));
- }
-
- switch (enumitemslot.a()) {
- case HAND:
- this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack());
- break;
- case ARMOR:
- this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack());
- }
- }
- }
+ updateEntityEquipment(); // Paper - split into own method
if (this.ticksLived % 20 == 0) {
this.getCombatTracker().g();
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
} }
} }
+ // Paper start - split into own method from above + public void updateEntityEquipment() { q(); }; // Paper
+ public void updateEntityEquipment() { private void q() {
+ EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); Map<EnumItemSlot, ItemStack> map = this.r();
+ int k = aenumitemslot.length;
+ for (int l = 0; l < k; ++l) {
+ EnumItemSlot enumitemslot = aenumitemslot[l];
+ ItemStack itemstack;
+
+ switch (enumitemslot.a()) {
+ case HAND:
+ itemstack = (ItemStack) this.bu.get(enumitemslot.b());
+ break;
+ case ARMOR:
+ itemstack = (ItemStack) this.bv.get(enumitemslot.b());
+ break;
+ default:
+ continue;
+ }
+
+ ItemStack itemstack1 = this.getEquipment(enumitemslot);
+
+ if (!ItemStack.matches(itemstack1, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent
+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1);
+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent();
+ }
+ // Paper end
+ ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1));
+ if (!itemstack.isEmpty()) {
+ this.getAttributeMap().a(itemstack.a(enumitemslot));
+ }
+
+ if (!itemstack1.isEmpty()) {
+ this.getAttributeMap().b(itemstack1.a(enumitemslot));
+ }
+
+ switch (enumitemslot.a()) {
+ case HAND:
+ this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack());
+ break;
+ case ARMOR:
+ this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack());
+ }
+ }
+ }
+ }
+
protected float f(float f, float f1) {
float f2 = MathHelper.g(f - this.aI);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

Datei anzeigen

@ -38,23 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return this.isInWater() || this.isInRain(); return this.isInWater() || this.isInRain();
} }
+ public boolean isInWaterOrRainOrBubble() { return ay(); } // Paper - OBFHELPER + public boolean isInWaterOrRainOrBubble() { return aC(); } // Paper - OBFHELPER
public boolean ay() { public boolean aC() {
return this.isInWater() || this.isInRain() || this.l(); return this.isInWater() || this.isInRain() || this.k();
} }
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster {
@Override
protected void mobTick() {
if (this.ay()) {
- this.damageEntity(DamageSource.DROWN, 1.0F);
+ this.damageEntity(DamageSource.DROWN, 1.0F); // Paper - copied in patch 13 (allow nerfed mobs to jump, float and take water damage)
}
if (this.world.isDay() && this.ticksLived >= this.bA + 600) {
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java --- a/src/main/java/net/minecraft/server/EntityInsentient.java
@ -66,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Nullable public PathfinderGoalFloat goalFloat; // Paper + @Nullable public PathfinderGoalFloat goalFloat; // Paper
public PathfinderGoalSelector targetSelector; public PathfinderGoalSelector targetSelector;
private EntityLiving goalTarget; private EntityLiving goalTarget;
private final EntitySenses bw; private final EntitySenses bv;
@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving {
@Override @Override
protected final void doTick() { protected final void doTick() {
@ -84,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
this.world.getMethodProfiler().enter("sensing"); this.world.getMethodProfiler().enter("sensing");
this.bw.a(); this.bv.a();
this.world.getMethodProfiler().exit(); this.world.getMethodProfiler().exit();
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -102,9 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final boolean validConditions() { return this.a(); } // Paper - OBFHELPER + public final boolean validConditions() { return this.a(); } // Paper - OBFHELPER
@Override @Override
public boolean a() { public boolean a() {
double d0 = (double) this.a.getHeadHeight() < 0.4D ? 0.2D : 0.4D; return this.a.isInWater() && this.a.b((Tag) TagsFluid.WATER) > this.a.cw() || this.a.aN();
@@ -0,0 +0,0 @@ public class PathfinderGoalFloat extends PathfinderGoal {
return this.a.isInWater() && this.a.co() > d0 || this.a.aH();
} }
+ public void update() { this.e(); } // Paper - OBFHELPER + public void update() { this.e(); } // Paper - OBFHELPER

Datei anzeigen

@ -1,23 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mariell Hoversholm <proximyst@proximyst.com>
Date: Sun, 19 Apr 2020 12:25:20 +0200
Subject: [PATCH] Allow sleeping players to float
This change lets players who are in their bed have a position which is above
ground for a longer period of time. This is because of the server not setting
their position to the ground/exit location when entering the bed, resulting in
the server believing they're still in the air.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.player.setLocation(this.l, this.m, this.n, this.player.yaw, this.player.pitch);
++this.e;
this.processedMovePackets = this.receivedMovePackets;
- if (this.B) {
+ if (this.B && !this.player.isSleeping()) { // Paper - #3176 Allow sleeping players to float
if (++this.C > 80) {
PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getDisplayName().getString());
this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message

Datei anzeigen

@ -38,6 +38,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage != null) { + if (com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage != null) {
+ LoginListener.this.disconnect(new ChatComponentText(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage)); + LoginListener.this.disconnect(new ChatComponentText(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage));
+ } else // Paper end + } else // Paper end
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0])); LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable"); LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
} }

Datei anzeigen

@ -197,7 +197,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ IBlockData blockData = ChunkSection.GLOBAL_PALETTE.getObject(i); + IBlockData blockData = ChunkSection.GLOBAL_PALETTE.getObject(i);
+ +
+ if (blockData != null) { + if (blockData != null) {
+ solidGlobal[i] = blockData.getBlock().isOccluding(blockData, emptyChunk, zeroPos) + solidGlobal[i] = blockData.isOccluding(emptyChunk, zeroPos)
+ && blockData.getBlock() != Blocks.SPAWNER && blockData.getBlock() != Blocks.BARRIER && blockData.getBlock() != Blocks.SHULKER_BOX; + && blockData.getBlock() != Blocks.SPAWNER && blockData.getBlock() != Blocks.BARRIER && blockData.getBlock() != Blocks.SHULKER_BOX;
+ // shulker box checks TE. + // shulker box checks TE.
+ } + }
@ -891,19 +891,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ public int read() { + public int read() {
+ int value = (int) (current >>> bitInLongIndex) & mask; + if (bitInLongIndex + bitsPerObject > 64) {
+ bitInLongIndex += bitsPerObject; + bitInLongIndex = 0;
+
+ if (bitInLongIndex > 63) {
+ bitInLongIndex -= 64;
+ longInDataBitsIndex += 8; + longInDataBitsIndex += 8;
+ init(); + init();
+
+ if (bitInLongIndex > 0) {
+ value |= current << bitsPerObject - bitInLongIndex & mask;
+ }
+ } + }
+ +
+ int value = (int) (current >>> bitInLongIndex) & mask;
+ bitInLongIndex += bitsPerObject;
+ return value; + return value;
+ } + }
+} +}
@ -969,29 +964,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ public void write(int value) { + public void write(int value) {
+ if (bitInLongIndex + bitsPerObject > 64) {
+ finish();
+ bitInLongIndex = 0;
+ longInDataBitsIndex += 8;
+ init();
+ }
+
+ current = current & ~(mask << bitInLongIndex) | (value & mask) << bitInLongIndex; + current = current & ~(mask << bitInLongIndex) | (value & mask) << bitInLongIndex;
+ dirty = true; + dirty = true;
+ bitInLongIndex += bitsPerObject; + bitInLongIndex += bitsPerObject;
+
+ if (bitInLongIndex > 63) {
+ finish();
+ bitInLongIndex -= 64;
+ longInDataBitsIndex += 8;
+ init();
+
+ if (bitInLongIndex > 0) {
+ current = current & ~(mask >>> bitsPerObject - bitInLongIndex) | (value & mask) >>> bitsPerObject - bitInLongIndex;
+ dirty = true;
+ }
+ }
+ } + }
+ +
+ public void skip() { + public void skip() {
+ bitInLongIndex += bitsPerObject; + bitInLongIndex += bitsPerObject;
+ +
+ if (bitInLongIndex > 63) { + if (bitInLongIndex > 64) {
+ finish(); + finish();
+ bitInLongIndex -= 64; + bitInLongIndex = bitsPerObject;
+ longInDataBitsIndex += 8; + longInDataBitsIndex += 8;
+ init(); + init();
+ } + }
@ -1039,6 +1029,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
package net.minecraft.server; package net.minecraft.server;
import java.util.function.Predicate;
+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info +import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -1065,8 +1056,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.nonEmptyBlockCount = short0; this.nonEmptyBlockCount = short0;
this.tickingBlockCount = short1; this.tickingBlockCount = short1;
this.e = short2; this.e = short2;
- this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); - this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData());
+ this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world == null ? null : world.chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks), initializeBlocks); // Paper - Anti-Xray - Add predefined block data + this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world == null ? null : world.chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks), initializeBlocks); // Paper - Anti-Xray - Add predefined block data
} }
public final IBlockData getType(int i, int j, int k) { // Paper public final IBlockData getType(int i, int j, int k) { // Paper
@ -1092,10 +1083,10 @@ diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/DataPaletteBlock.java --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java
+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java
@@ -0,0 +0,0 @@ package net.minecraft.server; @@ -0,0 +0,0 @@
import it.unimi.dsi.fastutil.ints.Int2IntMap; package net.minecraft.server;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2IntMap.Entry;
+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info +import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info
import java.util.Arrays; import java.util.Arrays;
import java.util.Objects; import java.util.Objects;
@ -1195,9 +1186,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public synchronized void a(NBTTagList nbttaglist, long[] along) { // Paper - synchronize public synchronized void a(NBTTagList nbttaglist, long[] along) { // Paper - synchronize
this.a(); this.a();
- int i = Math.max(4, MathHelper.d(nbttaglist.size())); - int i = Math.max(4, MathHelper.e(nbttaglist.size()));
+ // Paper - Anti-Xray - TODO: Should this.predefinedObjects.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)? + // Paper - Anti-Xray - TODO: Should this.predefinedObjects.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)?
+ int i = Math.max(4, MathHelper.d(nbttaglist.size() + (this.predefinedObjects == null ? 0 : this.predefinedObjects.length))); // Paper - Anti-Xray - Calculate the size with predefined objects + int i = Math.max(4, MathHelper.e(nbttaglist.size() + (this.predefinedObjects == null ? 0 : this.predefinedObjects.length))); // Paper - Anti-Xray - Calculate the size with predefined objects
- if (i != this.i) { - if (i != this.i) {
+ if (true || i != this.i) { // Paper - Anti-Xray - Not initialized yet + if (true || i != this.i) { // Paper - Anti-Xray - Not initialized yet
@ -1221,13 +1212,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER
private List<NBTTagCompound> g;
private boolean h; private boolean h;
+ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager private boolean i;
- public PacketPlayOutMapChunk() {} - public PacketPlayOutMapChunk() {}
+ // Paper start - Async-Anti-Xray - Set the ready flag to true + // Paper start - Async-Anti-Xray - Set the ready flag to true
+ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager
+ public PacketPlayOutMapChunk() { + public PacketPlayOutMapChunk() {
+ this.ready = true; + this.ready = true;
+ } + }
@ -1238,7 +1228,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
} }
// Paper end // Paper end
public PacketPlayOutMapChunk(Chunk chunk, int i) { public PacketPlayOutMapChunk(Chunk chunk, int i, boolean flag) {
+ ChunkPacketInfo<IBlockData> chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info + ChunkPacketInfo<IBlockData> chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info
ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); ChunkCoordIntPair chunkcoordintpair = chunk.getPos();
@ -1247,12 +1237,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
this.f = new byte[this.a(chunk, i)]; this.f = new byte[this.a(chunk, i)];
- this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); - this.c = this.a(new PacketDataSerializer(this.k()), chunk, i);
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info
+ if (chunkPacketInfo != null) { + if (chunkPacketInfo != null) {
+ chunkPacketInfo.setData(this.getData()); + chunkPacketInfo.setData(this.getData());
+ } + }
+ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); + this.c = this.writeChunk(new PacketDataSerializer(this.k()), chunk, i, chunkPacketInfo);
+ // Paper end + // Paper end
this.g = Lists.newArrayList(); this.g = Lists.newArrayList();
iterator = chunk.getTileEntities().entrySet().iterator(); iterator = chunk.getTileEntities().entrySet().iterator();
@ -1306,9 +1296,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
PlayerChunkMap.LOGGER.error("Couldn't load chunk {}", chunkcoordintpair, exception);
} }
this.g(chunkcoordintpair);
- return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a)); - return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a));
+ return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter + return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter
}, this.executor); }, this.executor);
@ -1403,17 +1393,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public final co.aikar.timings.WorldTimingsHandler timings; // Paper public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPosition lastPhysicsProblem; // Spigot public static BlockPosition lastPhysicsProblem; // Spigot
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return ((ChunkProviderServer) this.chunkProvider).getChunkAt(x, z, false); return (CraftServer) Bukkit.getServer();
} }
- protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { - protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, ResourceKey<DimensionManager> resourcekey1, DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
+ protected World(WorldData worlddata, DimensionManager dimensionmanager, java.util.concurrent.Executor executor, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { // Paper - executor + protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, ResourceKey<DimensionManager> resourcekey1, DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper
+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
this.generator = gen; this.generator = gen;
if (dimensionmanager.world == null) dimensionmanager.world = (WorldServer) this; // Paper
this.world = new CraftWorld((WorldServer) this, gen, env); this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit end // CraftBukkit end
@ -1426,15 +1416,15 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
// Add env and gen to constructor
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(worlddata, dimensionmanager, (world, worldprovider) -> {
+ super(worlddata, dimensionmanager, executor, (world, worldprovider) -> { // Paper - pass executor down
// CraftBukkit start
ChunkGenerator<?> chunkGenerator;
// Add env and gen to constructor, WorldData -> WorldDataServer
public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, ResourceKey<DimensionManager> resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env);
+ super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor
this.pvpMode = minecraftserver.getPVP();
convertable = convertable_conversionsession;
uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@ -1452,8 +1442,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
NBTTagCompound data = new NBTTagCompound(); NBTTagCompound data = new NBTTagCompound();
cs[i].getBlocks().a(data, "Palette", "BlockStates"); cs[i].getBlocks().a(data, "Palette", "BlockStates");
- DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection - DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection
+ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally + DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally
blockids.a(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates")); blockids.a(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates"));
sectionBlockIDs[i] = blockids; sectionBlockIDs[i] = blockids;

Datei anzeigen

@ -8,20 +8,21 @@ diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/j
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java --- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -0,0 +0,0 @@ public class ContainerAnvil extends Container { @@ -0,0 +0,0 @@ public class ContainerAnvil extends ContainerAnvilAbstract {
if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a(TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) { if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a((Tag) TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) {
IBlockData iblockdata1 = BlockAnvil.e(iblockdata); IBlockData iblockdata1 = BlockAnvil.c(iblockdata);
+ // Paper start -
+ com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null); + // Paper start
+ if (!event.callEvent()) { + com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null);
+ return; + if (!event.callEvent()) {
+ } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) { + return;
+ iblockdata1 = null; + } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) {
+ } else { + iblockdata1 = null;
+ iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING)); + } else {
+ } + iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING));
+ // Paper end + }
+ // Paper end
if (iblockdata1 == null) { if (iblockdata1 == null) {
world.a(blockposition, false); world.a(blockposition, false);
world.triggerEffect(1029, blockposition, 0);

Datei anzeigen

@ -46,19 +46,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server + // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server
+ if (!event.isHandled()) { + if (!event.isHandled()) {
+ if (!event.isCancelled()) { + if (!event.isCancelled()) {
+ // Paper end - async tab completion
+ this.minecraftServer.scheduleOnMain(() -> { // Paper - This needs to be on main
+ ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { - this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
if (((Suggestions) suggestions).isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer - if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error - this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
- }); - });
+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error + this.minecraftServer.scheduleOnMain(() -> { // Paper - This needs to be on main
+ }); + ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
+ }); // Paper - This needs to be on main +
+ this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
+ if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
+ });
+ });
+ } + }
+ // Paper start - async tab completion
+ } else if (!completions.isEmpty()) { + } else if (!completions.isEmpty()) {
+ com.mojang.brigadier.suggestion.SuggestionsBuilder builder = new com.mojang.brigadier.suggestion.SuggestionsBuilder(packetplayintabcomplete.c(), stringreader.getTotalLength()); + com.mojang.brigadier.suggestion.SuggestionsBuilder builder = new com.mojang.brigadier.suggestion.SuggestionsBuilder(packetplayintabcomplete.c(), stringreader.getTotalLength());
+ +
@ -67,7 +68,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join())); + player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join()));
+ } + }
+ // Paper end - async tab completion + // Paper end - async tab completion
+
} }
@Override @Override

Datei anzeigen

@ -140,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final Timing chunkUnloadDataSave; + public final Timing chunkUnloadDataSave;
+ +
public WorldTimingsHandler(World server) { public WorldTimingsHandler(World server) {
String name = server.worldData.getName() +" - "; String name = ((WorldDataServer) server.getWorldData()).getName() + " - ";
@@ -0,0 +0,0 @@ public class WorldTimingsHandler { @@ -0,0 +0,0 @@ public class WorldTimingsHandler {
@ -341,7 +341,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package com.destroystokyo.paper.io; +package com.destroystokyo.paper.io;
+ +
+import net.minecraft.server.ChunkCoordIntPair; +import net.minecraft.server.ChunkCoordIntPair;
+import net.minecraft.server.ExceptionWorldConflict;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.NBTTagCompound; +import net.minecraft.server.NBTTagCompound;
+import net.minecraft.server.RegionFile; +import net.minecraft.server.RegionFile;
@ -882,15 +881,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ +
+ // check if another process is writing + // check if another process is writing
+ try { + /*try { TODO: Can we restore this?
+ this.world.checkSession(); + ((WorldServer)this.world).checkSession();
+ } catch (final ExceptionWorldConflict ex) { + } catch (final Exception ex) {
+ LOGGER.fatal("Couldn't save chunk; already in use by another instance of Minecraft?", ex); + LOGGER.fatal("Couldn't save chunk; already in use by another instance of Minecraft?", ex);
+ // we don't need to set the write counter to -1 as we know at this stage there's no point in re-scheduling + // we don't need to set the write counter to -1 as we know at this stage there's no point in re-scheduling
+ // writes since they'll fail anyways. + // writes since they'll fail anyways.
+ return; + return;
+ } + }
+ +*/
+ for (;;) { + for (;;) {
+ final long writeCounter; + final long writeCounter;
+ final NBTTagCompound data; + final NBTTagCompound data;
@ -1575,7 +1574,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // apply fixes + // apply fixes
+ +
+ try { + try {
+ chunkData.chunkData = chunkManager.getChunkData(this.world.getWorldProvider().getDimensionManager(), + chunkData.chunkData = chunkManager.getChunkData(this.world.getTypeKey(),
+ chunkManager.getWorldPersistentDataSupplier(), chunkData.chunkData, chunkPos, this.world); // clone data for safety, file IO thread does not clone + chunkManager.getWorldPersistentDataSupplier(), chunkData.chunkData, chunkPos, this.world); // clone data for safety, file IO thread does not clone
+ } catch (final Throwable ex) { + } catch (final Throwable ex) {
+ PaperFileIOThread.LOGGER.error("Could not apply datafixers for chunk task: " + this.toString(), ex); + PaperFileIOThread.LOGGER.error("Could not apply datafixers for chunk task: " + this.toString(), ex);
@ -1974,7 +1973,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ for (int i = 0; i < threads; ++i) { + for (int i = 0; i < threads; ++i) {
+ this.workers[i] = new QueueExecutorThread<>(this.queue, (long)0.10e6); //0.1ms + this.workers[i] = new QueueExecutorThread<>(this.queue, (long)0.10e6); //0.1ms
+ this.workers[i].setName("Async chunk loader thread #" + i + " for world: " + world.getWorldData().getName()); + this.workers[i].setName("Async chunk loader thread #" + i + " for world: " + world.getWorld().getName());
+ this.workers[i].setPriority(Thread.NORM_PRIORITY - 1); + this.workers[i].setPriority(Thread.NORM_PRIORITY - 1);
+ this.workers[i].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> { + this.workers[i].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> {
+ PaperFileIOThread.LOGGER.fatal("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable); + PaperFileIOThread.LOGGER.fatal("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable);
@ -2534,7 +2533,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static InProgressChunkHolder loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound, boolean distinguish) { + public static InProgressChunkHolder loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound, boolean distinguish) {
+ ArrayDeque<Runnable> tasksToExecuteOnMain = new ArrayDeque<>(); + ArrayDeque<Runnable> tasksToExecuteOnMain = new ArrayDeque<>();
+ // Paper end + // Paper end
ChunkGenerator<?> chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator();
WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager(); WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager();
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level");
@@ -0,0 +0,0 @@ public class ChunkRegionLoader { @@ -0,0 +0,0 @@ public class ChunkRegionLoader {
@ -2560,25 +2559,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (flag) { if (flag) {
if (nbttagcompound2.hasKeyOfType("BlockLight", 7)) { if (nbttagcompound2.hasKeyOfType("BlockLight", 7)) {
- lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("BlockLight"))); - lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("BlockLight")), true);
+ // Paper start - delay this task since we're executing off-main + // Paper start - delay this task since we're executing off-main
+ NibbleArray blockLight = new NibbleArray(nbttagcompound2.getByteArray("BlockLight")); + NibbleArray blockLight = new NibbleArray(nbttagcompound2.getByteArray("BlockLight"));
+ // Note: We move the block light nibble array creation here for perf & in case the compound is modified
+ tasksToExecuteOnMain.add(() -> { + tasksToExecuteOnMain.add(() -> {
+ lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), blockLight); + lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), blockLight, true);
+ }); + });
+ // Paper end + // Paper end - delay this task since we're executing off-main
} }
if (flag2 && nbttagcompound2.hasKeyOfType("SkyLight", 7)) { if (flag2 && nbttagcompound2.hasKeyOfType("SkyLight", 7)) {
- lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("SkyLight"))); - lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("SkyLight")), true);
+ // Paper start - delay this task since we're executing off-main + // Paper start - delay this task since we're executing off-main
+ NibbleArray skyLight = new NibbleArray(nbttagcompound2.getByteArray("SkyLight")); + NibbleArray skyLight = new NibbleArray(nbttagcompound2.getByteArray("SkyLight"));
+ // Note: We move the block light nibble array creation here for perf & in case the compound is modified
+ tasksToExecuteOnMain.add(() -> { + tasksToExecuteOnMain.add(() -> {
+ lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), skyLight); + lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), skyLight, true);
+ }); + });
+ // Paper end + // Paper end - delay this task since we're executing off-main
} }
} }
} }
@ -2597,9 +2594,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- return protochunk1; - return protochunk1;
+ return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading + return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading
} + }
} + }
+
+ // Paper start - async chunk save for unload + // Paper start - async chunk save for unload
+ public static final class AsyncSaveData { + public static final class AsyncSaveData {
+ public final NibbleArray[] blockLight; // null or size of 17 (for indices -1 through 15) + public final NibbleArray[] blockLight; // null or size of 17 (for indices -1 through 15)
@ -2617,9 +2614,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.blockTickList = blockTickList; + this.blockTickList = blockTickList;
+ this.fluidTickList = fluidTickList; + this.fluidTickList = fluidTickList;
+ this.worldTime = worldTime; + this.worldTime = worldTime;
+ } }
+ } }
+
+ // must be called sync + // must be called sync
+ public static AsyncSaveData getAsyncSaveData(WorldServer world, IChunkAccess chunk) { + public static AsyncSaveData getAsyncSaveData(WorldServer world, IChunkAccess chunk) {
+ org.spigotmc.AsyncCatcher.catchOp("preparation of chunk data for async save"); + org.spigotmc.AsyncCatcher.catchOp("preparation of chunk data for async save");
@ -2731,8 +2728,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (ticklist instanceof ProtoChunkTickList) { if (ticklist instanceof ProtoChunkTickList) {
nbttagcompound1.set("ToBeTicked", ((ProtoChunkTickList) ticklist).b()); nbttagcompound1.set("ToBeTicked", ((ProtoChunkTickList) ticklist).b());
} else if (ticklist instanceof TickListChunk) { } else if (ticklist instanceof TickListChunk) {
- nbttagcompound1.set("TileTicks", ((TickListChunk) ticklist).a(worldserver.getTime())); nbttagcompound1.set("TileTicks", ((TickListChunk) ticklist).b());
+ nbttagcompound1.set("TileTicks", ((TickListChunk) ticklist).a(asyncsavedata != null ? asyncsavedata.worldTime : worldserver.getTime())); // Paper - async chunk unloading
+ // Paper start - async chunk save for unload + // Paper start - async chunk save for unload
+ } else if (asyncsavedata != null) { + } else if (asyncsavedata != null) {
+ nbttagcompound1.set("TileTicks", asyncsavedata.blockTickList); + nbttagcompound1.set("TileTicks", asyncsavedata.blockTickList);
@ -2748,15 +2744,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (ticklist1 instanceof ProtoChunkTickList) { if (ticklist1 instanceof ProtoChunkTickList) {
nbttagcompound1.set("LiquidsToBeTicked", ((ProtoChunkTickList) ticklist1).b()); nbttagcompound1.set("LiquidsToBeTicked", ((ProtoChunkTickList) ticklist1).b());
} else if (ticklist1 instanceof TickListChunk) { } else if (ticklist1 instanceof TickListChunk) {
- nbttagcompound1.set("LiquidTicks", ((TickListChunk) ticklist1).a(worldserver.getTime())); nbttagcompound1.set("LiquidTicks", ((TickListChunk) ticklist1).b());
+ nbttagcompound1.set("LiquidTicks", ((TickListChunk) ticklist1).a(asyncsavedata != null ? asyncsavedata.worldTime : worldserver.getTime())); // Paper - async chunk unloading
+ // Paper start - async chunk save for unload + // Paper start - async chunk save for unload
+ } else if (asyncsavedata != null) { + } else if (asyncsavedata != null) {
+ nbttagcompound1.set("LiquidTicks", asyncsavedata.fluidTickList); + nbttagcompound1.set("LiquidTicks", asyncsavedata.fluidTickList);
+ // Paper end + // Paper end
} else { } else {
- nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); - nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair));
+ nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); // Paper - diff on method change (see getAsyncSaveData) + nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); // Paper - diff on method change (see getAsyncSaveData)
} }
nbttagcompound1.set("PostProcessing", a(ichunkaccess.l())); nbttagcompound1.set("PostProcessing", a(ichunkaccess.l()));
@ -2824,23 +2819,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.util.function.Supplier; import java.util.function.Supplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
-public class IChunkLoader implements AutoCloseable { public class IChunkLoader implements AutoCloseable {
+public class IChunkLoader extends RegionFileCache implements AutoCloseable {
- private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER - private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER
+// private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER - nuke IOWorker + // Paper - OBFHELPER - nuke IOWorker
protected final DataFixer b; protected final DataFixer b;
@Nullable @Nullable
- private PersistentStructureLegacy c; - private PersistentStructureLegacy c;
+ private volatile PersistentStructureLegacy c; // Paper - async chunk loading + private volatile PersistentStructureLegacy c; // Paper - async chunk loading
+ +
+ private final Object persistentDataLock = new Object(); // Paper + private final Object persistentDataLock = new Object(); // Paper
+ protected final RegionFileCache regionFileCache;
public IChunkLoader(File file, DataFixer datafixer) { public IChunkLoader(File file, DataFixer datafixer, boolean flag) {
+ super(file); + this.regionFileCache = new RegionFileCache(file, flag); // Paper - nuke IOWorker
this.b = datafixer; this.b = datafixer;
- this.a = new IOWorker(new RegionFileCache(file), "chunk"); - this.a = new IOWorker(file, flag, "chunk");
+// this.a = new IOWorker(new RegionFileCache(file), "chunk"); // Paper - nuke IOWorker + // Paper - nuke IOWorker
} }
// CraftBukkit start // CraftBukkit start
@ -2881,7 +2876,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) { if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
+ synchronized (this.persistentDataLock) { // Paper - Async chunk loading + synchronized (this.persistentDataLock) { // Paper - Async chunk loading
if (this.c == null) { if (this.c == null) {
this.c = PersistentStructureLegacy.a(dimensionmanager.getType(), (WorldPersistentData) supplier.get()); // CraftBukkit - getType this.c = PersistentStructureLegacy.a(resourcekey, (WorldPersistentData) supplier.get());
} }
nbttagcompound = this.c.a(nbttagcompound); nbttagcompound = this.c.a(nbttagcompound);
@ -2890,49 +2885,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
@@ -0,0 +0,0 @@ public class IChunkLoader implements AutoCloseable { @@ -0,0 +0,0 @@ public class IChunkLoader implements AutoCloseable {
return nbttagcompound.hasKeyOfType("DataVersion", 99) ? nbttagcompound.getInt("DataVersion") : -1;
@Nullable
public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
- return this.a.a(chunkcoordintpair);
+ return this.regionFileCache.read(chunkcoordintpair);
} }
- @Nullable
- public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
- return this.a.a(chunkcoordintpair);
- }
-
- public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) { - public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) {
- this.a.a(chunkcoordintpair, nbttagcompound); - this.a.a(chunkcoordintpair, nbttagcompound);
+// Paper start - nuke IOWorker
+// @Nullable
+// public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException {
+// return this.a.a(chunkcoordintpair);
+// }
+//
+ public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { write(chunkcoordintpair, nbttagcompound); } // Paper OBFHELPER + public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { write(chunkcoordintpair, nbttagcompound); } // Paper OBFHELPER
+ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { // Paper - OBFHELPER - (Switched around for safety) + public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { // Paper - OBFHELPER - (Switched around for safety)
+ super.write(chunkcoordintpair, nbttagcompound); + this.regionFileCache.write(chunkcoordintpair, nbttagcompound);
if (this.c != null) { if (this.c != null) {
- this.c.a(chunkcoordintpair.pair());
+ synchronized (this.persistentDataLock) { // Paper - Async chunk loading + synchronized (this.persistentDataLock) { // Paper - Async chunk loading
+ this.c.a(chunkcoordintpair.pair()); } // Paper - Async chunk loading} this.c.a(chunkcoordintpair.pair());
+ } // Paper - Async chunk loading}
} }
-
} - }
- -
- public void i() { - public void i() {
- this.a.a().join(); - this.a.a().join();
- } }
-
- public void close() throws IOException { public void close() throws IOException {
- this.a.close(); - this.a.close();
- } + this.regionFileCache.close();
+// }
+// public void i() {
+// this.a.a().join();
+// }
+//
+// public void close() throws IOException {
+// this.a.close();
+// }
+// Paper end
} }
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -2948,6 +2928,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return 33 + ChunkStatus.getTicketLevelOffset(status); + return 33 + ChunkStatus.getTicketLevelOffset(status);
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -0,0 +0,0 @@ public class Main {
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
*/
+ Class.forName("net.minecraft.server.VillagerTrades");// Paper - load this sync so it won't fail later async
final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.a((thread) -> {
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
@ -2956,18 +2948,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.getUserCache().c(false); // Paper this.getUserCache().c(false); // Paper
} }
// Spigot end // Spigot end
-
+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.close(true, true); // Paper + com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.close(true, true); // Paper
} }
public String getServerIp() { public String getServerIp() {
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
dedicatedserver.setEraseCache(true);
}
+ Class.forName("net.minecraft.server.VillagerTrades");// Paper - load this sync so it won't fail later async
dedicatedserver.serverThread.setPriority(Thread.NORM_PRIORITY+2); // Paper - boost priority
dedicatedserver.serverThread.start();
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/NextTickListEntry.java --- a/src/main/java/net/minecraft/server/NextTickListEntry.java
@ -3067,7 +3052,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final LightEngineThreaded lightEngine; private final LightEngineThreaded lightEngine;
private final IAsyncTaskHandler<Runnable> executor; private final IAsyncTaskHandler<Runnable> executor;
public final ChunkGenerator<?> chunkGenerator; public final ChunkGenerator chunkGenerator;
- private final Supplier<WorldPersistentData> l; - private final Supplier<WorldPersistentData> l;
+ private final Supplier<WorldPersistentData> l; public final Supplier<WorldPersistentData> getWorldPersistentDataSupplier() { return this.l; } // Paper - OBFHELPER + private final Supplier<WorldPersistentData> l; public final Supplier<WorldPersistentData> getWorldPersistentDataSupplier() { return this.l; } // Paper - OBFHELPER
private final VillagePlace m; private final VillagePlace m;
@ -3083,11 +3068,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final PlayerMap playerMap; private final PlayerMap playerMap;
public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities; public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getWorldProvider().f(), threadedmailbox1, this.p.a(threadedmailbox1, false)); this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getDimensionManager().hasSkyLight(), threadedmailbox1, this.p.a(threadedmailbox1, false));
this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler); this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler);
this.l = supplier; this.l = supplier;
- this.m = new VillagePlace(new File(this.w, "poi"), datafixer); - this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag);
+ this.m = new VillagePlace(new File(this.w, "poi"), datafixer, this.world); // Paper + this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper
this.setViewDistance(i); this.setViewDistance(i);
} }
@ -3240,15 +3225,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.lightEngine.queueUpdate(); this.lightEngine.queueUpdate();
this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null); this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null);
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
} }
+ // Paper start - Async chunk io
+ public NBTTagCompound completeChunkData(NBTTagCompound compound, ChunkCoordIntPair chunkcoordintpair) throws IOException {
+ return compound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.getWorldPersistentDataSupplier(), compound, chunkcoordintpair, this.world);
+ }
+ // Paper end
+
private CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> f(ChunkCoordIntPair chunkcoordintpair) { private CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> f(ChunkCoordIntPair chunkcoordintpair) {
- return CompletableFuture.supplyAsync(() -> { - return CompletableFuture.supplyAsync(() -> {
+ // Paper start - Async chunk io + // Paper start - Async chunk io
@ -3259,38 +3237,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- try (Timing ignored2 = this.world.timings.chunkIO.startTimingIfSync()) { // Paper start - timings - try (Timing ignored2 = this.world.timings.chunkIO.startTimingIfSync()) { // Paper start - timings
- nbttagcompound = this.readChunkData(chunkcoordintpair); - nbttagcompound = this.readChunkData(chunkcoordintpair);
- } // Paper end - } // Paper end
- + // Paper start
+ if (ioThrowable != null) {
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(ioThrowable);
+ }
+ chunkHolder.tasks.forEach(Runnable::run);
+ // Paper end
- if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings - if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings
- boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8); - boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8);
+ if (ioThrowable != null) { + if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async
+ com.destroystokyo.paper.io.IOUtil.rethrow(ioThrowable);
+ }
- if (flag) { - if (flag) {
- ProtoChunk protochunk = ChunkRegionLoader.loadChunk(this.world, this.definedStructureManager, this.m, chunkcoordintpair, nbttagcompound); - ProtoChunk protochunk = ChunkRegionLoader.loadChunk(this.world, this.definedStructureManager, this.m, chunkcoordintpair, nbttagcompound);
+ this.getVillagePlace().loadInData(chunkcoordintpair, chunkHolder.poiData); + if (true) {
+ chunkHolder.tasks.forEach(Runnable::run); + ProtoChunk protochunk = chunkHolder.protoChunk;
+ // Paper - async load completes this
+ // Paper end
- protochunk.setLastSaved(this.world.getTime());
- return Either.left(protochunk);
- }
-
- PlayerChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", chunkcoordintpair);
- }} // Paper
+ // Paper start - This is done async
+ if (chunkHolder.protoChunk != null) {
+ chunkHolder.protoChunk.setLastSaved(this.world.getTime());
+ return Either.left(chunkHolder.protoChunk);
+ }
+ // Paper end
} catch (ReportedException reportedexception) {
Throwable throwable = reportedexception.getCause();
protochunk.setLastSaved(this.world.getTime());
this.a(chunkcoordintpair, protochunk.getChunkStatus().getType());
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
this.g(chunkcoordintpair);
return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter
- }, this.executor); - }, this.executor);
+ // Paper start - Async chunk io + // Paper start - Async chunk io
@ -3321,7 +3288,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
} }
private CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> b(PlayerChunk playerchunk, ChunkStatus chunkstatus) { private void g(ChunkCoordIntPair chunkcoordintpair) {
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} }
@ -3330,43 +3297,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.m.a(ichunkaccess.getPos()); this.m.a(ichunkaccess.getPos());
if (!ichunkaccess.isNeedsSaving()) { if (!ichunkaccess.isNeedsSaving()) {
return false; return false;
} else {
- try {
- this.world.checkSession();
- } catch (ExceptionWorldConflict exceptionworldconflict) {
- PlayerChunkMap.LOGGER.error("Couldn't save chunk; already in use by another instance of Minecraft?", exceptionworldconflict);
- com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exceptionworldconflict); // Paper
- return false;
- }
+ // Paper - The save session check is performed on the IO thread
ichunkaccess.setLastSaved(this.world.getTime());
ichunkaccess.setNeedsSaving(false);
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
NBTTagCompound nbttagcompound; ChunkStatus chunkstatus = ichunkaccess.getChunkStatus();
if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) {
+ try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveOverwriteCheck.startTiming()) { // Paper + try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveOverwriteCheck.startTiming()) { // Paper
// Paper start - Optimize save by using status cache if (this.h(chunkcoordintpair)) {
ChunkStatus statusOnDisk = this.getChunkStatusOnDisk(chunkcoordintpair); return false;
if (statusOnDisk != null && statusOnDisk.getType() == ChunkStatus.Type.LEVELCHUNK) {
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} }
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
if (chunkstatus == ChunkStatus.EMPTY && ichunkaccess.h().values().stream().noneMatch(StructureStart::e)) {
return false;
}
+ } // Paper
} }
+ } // Paper
this.world.getMethodProfiler().c("chunkSave"); this.world.getMethodProfiler().c("chunkSave");
- NBTTagCompound nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess);
+ NBTTagCompound nbttagcompound;
+ try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveDataSerialization.startTiming()) { // Paper + try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveDataSerialization.startTiming()) { // Paper
nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess); + nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess);
- this.a(chunkcoordintpair, nbttagcompound);
+ } // Paper + } // Paper
+
- this.a(chunkcoordintpair, nbttagcompound);
+ // Paper start - async chunk io + // Paper start - async chunk io
+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkcoordintpair.x, chunkcoordintpair.z, + com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkcoordintpair.x, chunkcoordintpair.z,
+ null, nbttagcompound, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY); + null, nbttagcompound, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY);
+ // Paper end - async chunk io + // Paper end - async chunk io
this.a(chunkcoordintpair, chunkstatus.getType());
return true; return true;
} catch (Exception exception) { } catch (Exception exception) {
PlayerChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception);
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
return false; return false;
} }
@ -3374,7 +3335,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } // Paper + } // Paper
} }
protected void setViewDistance(int i) { private boolean h(ChunkCoordIntPair chunkcoordintpair) {
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
} }
} }
@ -3417,14 +3378,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public ChunkStatus getChunkStatusOnDiskIfCached(ChunkCoordIntPair chunkPos) { public ChunkStatus getChunkStatusOnDiskIfCached(ChunkCoordIntPair chunkPos) {
- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getRegionFileIfLoaded(chunkPos); - RegionFile regionFile = this.getIOWorker().getRegionFileCache().getRegionFileIfLoaded(chunkPos);
+ synchronized (this) { // Paper + synchronized (this) { // Paper
+ RegionFile regionFile = this.getRegionFileIfLoaded(chunkPos); + RegionFile regionFile = this.regionFileCache.getRegionFileIfLoaded(chunkPos);
return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z);
+ } // Paper + } // Paper
} }
public ChunkStatus getChunkStatusOnDisk(ChunkCoordIntPair chunkPos) throws IOException { public ChunkStatus getChunkStatusOnDisk(ChunkCoordIntPair chunkPos) throws IOException {
- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false); - RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, true);
+ // Paper start - async chunk save for unload + // Paper start - async chunk save for unload
+ IChunkAccess unloadingChunk = this.world.asyncChunkTaskManager.getChunkInSaveProgress(chunkPos.x, chunkPos.z); + IChunkAccess unloadingChunk = this.world.asyncChunkTaskManager.getChunkInSaveProgress(chunkPos.x, chunkPos.z);
+ if (unloadingChunk != null) { + if (unloadingChunk != null) {
@ -3435,20 +3396,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE + NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE
+ .getPendingWrite(this.world, chunkPos.x, chunkPos.z, false); + .getPendingWrite(this.world, chunkPos.x, chunkPos.z, false);
- if (!regionFile.chunkExists(chunkPos)) { - if (regionFile == null || !regionFile.chunkExists(chunkPos)) {
- return null; - return null;
+ if (inProgressWrite != null) { + if (inProgressWrite != null) {
+ return ChunkRegionLoader.getStatus(inProgressWrite); + return ChunkRegionLoader.getStatus(inProgressWrite);
} }
+ // Paper end + // Paper end
+ synchronized (this) { // Paper - async io + synchronized (this) { // Paper - async io
+ RegionFile regionFile = this.getFile(chunkPos, false); + RegionFile regionFile = this.regionFileCache.getFile(chunkPos, true);
+
+ if (!regionFile.chunkExists(chunkPos)) {
+ return null;
+ }
- ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); - ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z);
+ if (regionFile == null || !regionFile.chunkExists(chunkPos)) {
+ return null;
+ }
+
+ ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); + ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z);
- if (status != null) { - if (status != null) {
@ -3470,7 +3431,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void updateChunkStatusOnDisk(ChunkCoordIntPair chunkPos, @Nullable NBTTagCompound compound) throws IOException { public void updateChunkStatusOnDisk(ChunkCoordIntPair chunkPos, @Nullable NBTTagCompound compound) throws IOException {
- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false); - RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false);
+ synchronized (this) { + synchronized (this) {
+ RegionFile regionFile = this.getFile(chunkPos, false); + RegionFile regionFile = this.regionFileCache.getFile(chunkPos, false);
- regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound)); - regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound));
+ regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound)); + regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound));
@ -3506,7 +3467,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ synchronized (world.getChunkProvider().playerChunkMap) { + synchronized (world.getChunkProvider().playerChunkMap) {
+ net.minecraft.server.RegionFile file; + net.minecraft.server.RegionFile file;
+ try { + try {
+ file = world.getChunkProvider().playerChunkMap.getFile(chunkPos, false); + file = world.getChunkProvider().playerChunkMap.regionFileCache.getFile(chunkPos, false);
+ } catch (IOException ex) { + } catch (IOException ex) {
+ throw new RuntimeException(ex); + throw new RuntimeException(ex);
+ } + }
@ -3577,9 +3538,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
this.closed = true; // Paper this.closed = true; // Paper
try { try {
this.c(); this.d();
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
} this.dataFile.close();
} }
} }
+ } finally { // Paper start - Prevent regionfiles from being closed during use + } finally { // Paper start - Prevent regionfiles from being closed during use
@ -3633,7 +3594,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else { } else {
if (this.cache.size() >= com.destroystokyo.paper.PaperConfig.regionFileCacheSize) { // Paper - configurable if (this.cache.size() >= com.destroystokyo.paper.PaperConfig.regionFileCacheSize) { // Paper - configurable
@@ -0,0 +0,0 @@ public final class RegionFileCache implements AutoCloseable { @@ -0,0 +0,0 @@ public final class RegionFileCache implements AutoCloseable {
RegionFile regionfile1 = new RegionFile(file, this.b); RegionFile regionfile1 = new RegionFile(file, this.b, this.c);
this.cache.putAndMoveToFirst(i, regionfile1); this.cache.putAndMoveToFirst(i, regionfile1);
+ // Paper start + // Paper start
@ -3686,9 +3647,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- public void close() throws IOException { - public void close() throws IOException {
+ public synchronized void close() throws IOException { // Paper -> synchronized + public synchronized void close() throws IOException { // Paper -> synchronized
ExceptionSuppressor<IOException> exceptionsuppressor = new ExceptionSuppressor<>();
ObjectIterator objectiterator = this.cache.values().iterator(); ObjectIterator objectiterator = this.cache.values().iterator();
while (objectiterator.hasNext()) {
@@ -0,0 +0,0 @@ public final class RegionFileCache implements AutoCloseable { @@ -0,0 +0,0 @@ public final class RegionFileCache implements AutoCloseable {
} }
@ -3710,39 +3671,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
-public class RegionFileSection<R extends MinecraftSerializable> implements AutoCloseable { -public class RegionFileSection<R> implements AutoCloseable {
+public class RegionFileSection<R extends MinecraftSerializable> extends RegionFileCache implements AutoCloseable { // Paper - nuke IOWorker +public class RegionFileSection<R> extends RegionFileCache implements AutoCloseable { // Paper - nuke IOWorker
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
- private final IOWorker b; - private final IOWorker b;
+// private final IOWorker b; + // Paper - nuke IOWorker
private final Long2ObjectMap<Optional<R>> c = new Long2ObjectOpenHashMap(); private final Long2ObjectMap<Optional<R>> c = new Long2ObjectOpenHashMap();
- private final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet(); - private final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet();
+ protected final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet(); // Paper - private -> protected + protected final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet(); // Paper - private -> protected
private final BiFunction<Runnable, Dynamic<?>, R> e; private final Function<Runnable, Codec<R>> e;
private final Function<Runnable, R> f; private final Function<Runnable, R> f;
private final DataFixer g; private final DataFixer g;
private final DataFixTypes h; private final DataFixTypes h;
public RegionFileSection(File file, BiFunction<Runnable, Dynamic<?>, R> bifunction, Function<Runnable, R> function, DataFixer datafixer, DataFixTypes datafixtypes) { public RegionFileSection(File file, Function<Runnable, Codec<R>> function, Function<Runnable, R> function1, DataFixer datafixer, DataFixTypes datafixtypes, boolean flag) {
+ super(file); // Paper - nuke IOWorker + super(file, flag); // Paper - nuke IOWorker
this.e = bifunction; this.e = function;
this.f = function; this.f = function1;
this.g = datafixer; this.g = datafixer;
this.h = datafixtypes; this.h = datafixtypes;
- this.b = new IOWorker(new RegionFileCache(file), file.getName()); - this.b = new IOWorker(file, flag, file.getName());
+// this.b = new IOWorker(new RegionFileCache(file), file.getName()); // Paper - nuke IOWorker + //this.b = new IOWorker(file, flag, file.getName()); // Paper - nuke IOWorker
} }
protected void a(BooleanSupplier booleansupplier) { protected void a(BooleanSupplier booleansupplier) {
- while (!this.d.isEmpty() && booleansupplier.getAsBoolean()) { while (!this.d.isEmpty() && booleansupplier.getAsBoolean()) {
- ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(this.d.firstLong()).u(); - ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(this.d.firstLong()).r();
+ while (!this.d.isEmpty() && booleansupplier.getAsBoolean()) { // Paper - conflict here to avoid obfhelpers + ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(this.d.firstLong()).r(); // Paper - conflict here to avoid obfhelpers
+ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(this.d.firstLong()).u(); // Paper - conflict here to avoid obfhelpers
this.d(chunkcoordintpair); this.d(chunkcoordintpair);
} }
@@ -0,0 +0,0 @@ public class RegionFileSection<R extends MinecraftSerializable> implements AutoC @@ -0,0 +0,0 @@ public class RegionFileSection<R> implements AutoCloseable {
} }
private void b(ChunkCoordIntPair chunkcoordintpair) { private void b(ChunkCoordIntPair chunkcoordintpair) {
@ -3763,7 +3723,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} catch (IOException ioexception) { } catch (IOException ioexception) {
RegionFileSection.LOGGER.error("Error reading chunk {} data from disk", chunkcoordintpair, ioexception); RegionFileSection.LOGGER.error("Error reading chunk {} data from disk", chunkcoordintpair, ioexception);
return null; return null;
@@ -0,0 +0,0 @@ public class RegionFileSection<R extends MinecraftSerializable> implements AutoC @@ -0,0 +0,0 @@ public class RegionFileSection<R> implements AutoCloseable {
} }
private void d(ChunkCoordIntPair chunkcoordintpair) { private void d(ChunkCoordIntPair chunkcoordintpair) {
@ -3797,19 +3757,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private <T> Dynamic<T> a(ChunkCoordIntPair chunkcoordintpair, DynamicOps<T> dynamicops) { private <T> Dynamic<T> a(ChunkCoordIntPair chunkcoordintpair, DynamicOps<T> dynamicops) {
Map<T, T> map = Maps.newHashMap(); Map<T, T> map = Maps.newHashMap();
@@ -0,0 +0,0 @@ public class RegionFileSection<R extends MinecraftSerializable> implements AutoC @@ -0,0 +0,0 @@ public class RegionFileSection<R> implements AutoCloseable {
public void a(ChunkCoordIntPair chunkcoordintpair) { public void a(ChunkCoordIntPair chunkcoordintpair) {
if (!this.d.isEmpty()) { if (!this.d.isEmpty()) {
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
- long j = SectionPosition.a(chunkcoordintpair, i).v(); - long j = SectionPosition.a(chunkcoordintpair, i).s();
+ long j = SectionPosition.a(chunkcoordintpair, i).v(); // Paper - conflict here to avoid obfhelpers + long j = SectionPosition.a(chunkcoordintpair, i).s(); // Paper - conflict here to avoid obfhelpers
- if (this.d.contains(j)) { - if (this.d.contains(j)) {
+ if (this.d.contains(j)) { // Paper - conflict here to avoid obfhelpers + if (this.d.contains(j)) { // Paper - conflict here to avoid obfhelpers
this.d(chunkcoordintpair); this.d(chunkcoordintpair);
return; return;
} }
@@ -0,0 +0,0 @@ public class RegionFileSection<R extends MinecraftSerializable> implements AutoC @@ -0,0 +0,0 @@ public class RegionFileSection<R> implements AutoCloseable {
} }
@ -3827,7 +3787,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // This is checking if the data exists, then it builds it later in getDataInternal(ChunkCoordIntPair) + // This is checking if the data exists, then it builds it later in getDataInternal(ChunkCoordIntPair)
+ if (!this.d.isEmpty()) { + if (!this.d.isEmpty()) {
+ for (int i = 0; i < 16; ++i) { + for (int i = 0; i < 16; ++i) {
+ long j = SectionPosition.a(chunkcoordintpair, i).v(); + long j = SectionPosition.a(chunkcoordintpair, i).s();
+ +
+ if (this.d.contains(j)) { + if (this.d.contains(j)) {
+ return this.getDataInternal(chunkcoordintpair); + return this.getDataInternal(chunkcoordintpair);
@ -3860,14 +3820,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private final WorldServer world; // Paper + private final WorldServer world; // Paper
+ +
public VillagePlace(File file, DataFixer datafixer) { public VillagePlace(File file, DataFixer datafixer, boolean flag) {
+ // Paper start + // Paper start - add world parameter
+ this(file, datafixer, null); + this(file, datafixer, flag, null);
+ } + }
+ public VillagePlace(File file, DataFixer datafixer, WorldServer world) { + public VillagePlace(File file, DataFixer datafixer, boolean flag, WorldServer world) {
+ // Paper end super(file, VillagePlaceSection::a, VillagePlaceSection::new, datafixer, DataFixTypes.POI_CHUNK, flag);
super(file, VillagePlaceSection::new, VillagePlaceSection::new, datafixer, DataFixTypes.POI_CHUNK); + this.world = world;
+ this.world = world; // Paper + // Paper end - add world parameter
} }
public void a(BlockPosition blockposition, VillagePlaceType villageplacetype) { public void a(BlockPosition blockposition, VillagePlaceType villageplacetype) {
@ -3882,7 +3842,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } else { + } else {
+ //super.a(booleansupplier); // re-implement below + //super.a(booleansupplier); // re-implement below
+ while (!((RegionFileSection)this).d.isEmpty() && booleansupplier.getAsBoolean()) { + while (!((RegionFileSection)this).d.isEmpty() && booleansupplier.getAsBoolean()) {
+ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).u(); + ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).r();
+ +
+ NBTTagCompound data; + NBTTagCompound data;
+ try (co.aikar.timings.Timing ignored1 = this.world.timings.poiSaveDataSerialization.startTiming()) { + try (co.aikar.timings.Timing ignored1 = this.world.timings.poiSaveDataSerialization.startTiming()) {
@ -3936,8 +3896,8 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return new Throwable(entity + " Added to world at " + new java.util.Date()); return this.chunkProvider.getChunkAt(x, z, false);
} }
+ // Paper start - Asynchronous IO + // Paper start - Asynchronous IO
@ -3993,7 +3953,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ RegionFile file; + RegionFile file;
+ +
+ try { + try {
+ file = WorldServer.this.getChunkProvider().playerChunkMap.getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); + file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getFile(new ChunkCoordIntPair(chunkX, chunkZ), false);
+ } catch (java.io.IOException ex) { + } catch (java.io.IOException ex) {
+ throw new RuntimeException(ex); + throw new RuntimeException(ex);
+ } + }
@ -4005,7 +3965,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override + @Override
+ public <T> T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { + public <T> T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) {
+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { + synchronized (WorldServer.this.getChunkProvider().playerChunkMap) {
+ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); + RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ));
+ return function.apply(file); + return function.apply(file);
+ } + }
+ } + }
@ -4013,19 +3973,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; + public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager;
+ // Paper end + // Paper end
+ +
// Add env and gen to constructor // Add env and gen to constructor, WorldData -> WorldDataServer
public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, ResourceKey<DimensionManager> resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
super(worlddata, dimensionmanager, executor, (world, worldprovider) -> { // Paper - pass executor down super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
this.dragonBattle = null;
this.mobSpawnerTrader = this.worldProvider.getDimensionManager().getType() == DimensionManager.OVERWORLD ? new MobSpawnerTrader(this) : null; // CraftBukkit - getType() }
this.getServer().addWorld(this.getWorld()); // CraftBukkit this.getServer().addWorld(this.getWorld()); // CraftBukkit
+ +
+ this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper + this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper
} }
// CraftBukkit start // CraftBukkit start
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
} }
MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> { MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> {
@ -4082,8 +4042,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// fall through to load // fall through to load
// we do this so we do not re-read the chunk data on disk // we do this so we do not re-read the chunk data on disk
@@ -0,0 +0,0 @@ public class CraftWorld implements World { @@ -0,0 +0,0 @@ public class CraftWorld implements World {
public DragonBattle getEnderDragonBattle() {
return new CraftDragonBattle(((WorldProviderTheEnd) worldProvider).o()); // PAIL rename getDragonBattle return (getHandle().getDragonBattle() == null) ? null : new CraftDragonBattle(getHandle().getDragonBattle());
} }
+ // Paper start + // Paper start
+ @Override + @Override

Datei anzeigen

@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override @Override
public void a(NBTTagCompound nbttagcompound) { public void loadData(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.loadData(nbttagcompound);
+ if (this.locY() > 300) this.setPositionRaw(locX(), 257, locZ()); // Paper - bring down to a saner Y level if out of world + if (this.locY() > 300) this.setPositionRaw(locX(), 257, locZ()); // Paper - bring down to a saner Y level if out of world
if (nbttagcompound.hasKeyOfType("playerGameType", 99)) { if (nbttagcompound.hasKeyOfType("playerGameType", 99)) {
if (this.getMinecraftServer().getForceGamemode()) { if (this.getMinecraftServer().getForceGamemode()) {
this.playerInteractManager.setGameMode(this.getMinecraftServer().getGamemode()); this.playerInteractManager.a(this.getMinecraftServer().getGamemode(), EnumGamemode.NOT_SET);

Datei anzeigen

@ -1,22 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 25 Sep 2018 06:53:43 +0200
Subject: [PATCH] Avoid dimension id collisions
getDimensionId() returns the dimension id - 1. So without this patch
we would reuse an existing dimension id, if some other dimension was
unloaded before.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
boolean used = false;
do {
for (WorldServer server : console.getWorlds()) {
- used = server.getWorldProvider().getDimensionManager().getDimensionID() == dimension;
+ used = server.getWorldProvider().getDimensionManager().getDimensionID() + 1 == dimension; // Paper - getDimensionID returns the dimension - 1, so we have to add 1
if (used) {
dimension++;
break;

Datei anzeigen

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityItem extends Entity { @@ -0,0 +0,0 @@ public class EntityItem extends Entity {
private void mergeNearby() { private void mergeNearby() {
if (this.w()) { if (this.z()) {
+ // Paper start - avoid item merge if stack size above max stack size + // Paper start - avoid item merge if stack size above max stack size
+ ItemStack stack = getItemStack(); + ItemStack stack = getItemStack();
+ if (stack.getCount() >= stack.getMaxStackSize()) return; + if (stack.getCount() >= stack.getMaxStackSize()) return;

Datei anzeigen

@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Fri, 21 Feb 2020 18:44:28 +0000
Subject: [PATCH] Backport fix for MC-167561
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -0,0 +0,0 @@ public class EntityWolf extends EntityTameableAnimal {
boolean flag = super.a(entityhuman, enumhand);
if (!flag || this.isBaby()) {
- this.goalSit.setSitting(!this.isSitting());
+ //this.goalSit.setSitting(!this.isSitting()); // Paper start - copied from below
+ if (this.i((EntityLiving) entityhuman) && !this.i(itemstack)) {
+ this.goalSit.setSitting(!this.isSitting());
+ this.jumping = false;
+ this.navigation.o();
+ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
+ }
+ // Paper end - copied from below
}
return flag;
@@ -0,0 +0,0 @@ public class EntityWolf extends EntityTameableAnimal {
return true;
}
+ /* Paper start - Move into above
if (this.i((EntityLiving) entityhuman) && !this.i(itemstack)) {
this.goalSit.setSitting(!this.isSitting());
this.jumping = false;
this.navigation.o();
this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
}
+ */ // Paper end
} else if (item == Items.BONE && !this.isAngry()) {
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack.subtract(1);

Datei anzeigen

@ -316,17 +316,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.mojang.authlib.Agent; +import com.mojang.authlib.*;
+import com.mojang.authlib.GameProfileRepository;
+import com.mojang.authlib.UserAuthentication;
+import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.minecraft.MinecraftSessionService;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilEnvironment;
+ +
+import java.net.Proxy; +import java.net.Proxy;
+ +
+public class PaperAuthenticationService extends YggdrasilAuthenticationService { +public class PaperAuthenticationService extends YggdrasilAuthenticationService {
+ private final Environment environment;
+ public PaperAuthenticationService(Proxy proxy, String clientToken) { + public PaperAuthenticationService(Proxy proxy, String clientToken) {
+ super(proxy, clientToken); + super(proxy, clientToken);
+ this.environment = (Environment)EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD);;
+ } + }
+ +
+ @Override + @Override
@ -336,12 +337,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ @Override + @Override
+ public MinecraftSessionService createMinecraftSessionService() { + public MinecraftSessionService createMinecraftSessionService() {
+ return new PaperMinecraftSessionService(this); + return new PaperMinecraftSessionService(this, this.environment);
+ } + }
+ +
+ @Override + @Override
+ public GameProfileRepository createProfileRepository() { + public GameProfileRepository createProfileRepository() {
+ return new PaperGameProfileRepository(this); + return new PaperGameProfileRepository(this, this.environment);
+ } + }
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java
@ -353,13 +354,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.mojang.authlib.Agent; +import com.mojang.authlib.Agent;
+import com.mojang.authlib.Environment;
+import com.mojang.authlib.ProfileLookupCallback; +import com.mojang.authlib.ProfileLookupCallback;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; +import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
+ +
+public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { +public class PaperGameProfileRepository extends YggdrasilGameProfileRepository {
+ public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService) { + public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) {
+ super(authenticationService); + super(authenticationService, environment);
+ } + }
+ +
+ @Override + @Override
@ -375,6 +377,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ @@ -0,0 +0,0 @@
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.mojang.authlib.Environment;
+import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.minecraft.MinecraftProfileTexture;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
@ -383,8 +386,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import java.util.Map; +import java.util.Map;
+ +
+public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionService { +public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionService {
+ protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService) { + protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService, Environment environment) {
+ super(authenticationService); + super(authenticationService, environment);
+ } + }
+ +
+ @Override + @Override
@ -446,69 +449,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
/** /**
* Calculates distance between 2 entities * Calculates distance between 2 entities
* @param e1 * @param e1
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -0,0 +0,0 @@ public class Main {
}
File file = (File) optionset.valueOf("universe"); // CraftBukkit
- YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString());
+ YggdrasilAuthenticationService yggdrasilauthenticationservice = new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); // Paper
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
DispenserRegistry.init(); this.G = i;
DispenserRegistry.c();
File s = (File) optionset.valueOf("universe"); // CraftBukkit
- YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString());
+ YggdrasilAuthenticationService yggdrasilauthenticationservice = new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY, UUID.randomUUID().toString()); // Paper
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
UserCache usercache = new UserCache(gameprofilerepository, new File(s, MinecraftServer.b.getName()));
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
this.H = i;
} }
+ public final MinecraftSessionService getSessionService() { return this.getMinecraftSessionService(); } // Paper - OBFHELPER + public final MinecraftSessionService getSessionService() { return this.getMinecraftSessionService(); } // Paper - OBFHELPER
public MinecraftSessionService getMinecraftSessionService() { public MinecraftSessionService getMinecraftSessionService() {
return this.minecraftSessionService; return this.minecraftSessionService;
} }
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
private void f() {
// Spigot start
GameProfile profile = this.gameProfile;
+ if (profile != null && profile.isComplete() && profile.getProperties().containsKey("textures")) return; // Paper
b(profile, new Predicate<GameProfile>() {
@Override
@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
} else if (MinecraftServer.getServer() == null) {
callback.apply(gameprofile);
} else {
- GameProfile profile = skinCache.getIfPresent(gameprofile.getName().toLowerCase(java.util.Locale.ROOT));
+ // Paper start
+ com.destroystokyo.paper.profile.CraftPlayerProfile paperProfile = new com.destroystokyo.paper.profile.CraftPlayerProfile(gameprofile);
+ if (sync) {
+ // might complete by cache, but if not, go ahead and do it now, avoid the code below
+ paperProfile.complete(true, true);
+ } else {
+ paperProfile.completeFromCache(false, true);
+ }
+ GameProfile profile = paperProfile.getGameProfile();
+ // Paper end
if (profile != null && Iterables.getFirst(profile.getProperties().get("textures"), (Object) null) != null) {
callback.apply(profile);
@@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa
Callable<GameProfile> callable = new Callable<GameProfile>() {
@Override
public GameProfile call() {
- final GameProfile profile = skinCache.getUnchecked(gameprofile.getName().toLowerCase(java.util.Locale.ROOT));
+ // Paper start
+ paperProfile.complete(true, true);
+ final GameProfile profile = paperProfile.getGameProfile();
+ // Paper end
MinecraftServer.getServer().processQueue.add(new Runnable() {
@Override
public void run() {
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/UserCache.java --- a/src/main/java/net/minecraft/server/UserCache.java

Datei anzeigen

@ -1,29 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Thu, 6 Feb 2020 19:20:27 -0600
Subject: [PATCH] Be more tolerant of invalid attributes
Prior to this commit, the player would be disconnected if they ever encountered an attribute with a name that did
not match Bukkit's expected vanilla scheme. It appears that datapacks can set whatever attribute name they want,
ignoring vanilla's typical scheme.
In a more perfect world the API would expose some way to interact with these attributes, however Bukkit is not
particularly flexible in this area. Perhaps this is an area for future expansion at a later time.
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java
@@ -0,0 +0,0 @@ public class CraftAttributeMap implements Attributable {
public static Attribute fromMinecraft(String nms) {
String[] split = nms.split("\\.", 2);
+ // Paper start - Datapacks can set their own attributes that may not match our expectations, ignore them
+ if (split.length != 2) {
+ return null;
+ }
+ // Paper end
+
String generic = split[0];
String descriptor = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, split[1]); // movementSpeed -> MOVEMENT_SPEED
String fin = generic + "_" + descriptor;

Datei anzeigen

@ -34,7 +34,7 @@ diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/n
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityBee.java --- a/src/main/java/net/minecraft/server/EntityBee.java
+++ b/src/main/java/net/minecraft/server/EntityBee.java +++ b/src/main/java/net/minecraft/server/EntityBee.java
@@ -0,0 +0,0 @@ public class EntityBee extends EntityAnimal implements EntityBird { @@ -0,0 +0,0 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB
public EntityBee(EntityTypes<? extends EntityBee> entitytypes, World world) { public EntityBee(EntityTypes<? extends EntityBee> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@ -51,5 +51,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }; + };
+ // Paper end + // Paper end
this.lookController = new EntityBee.j(this); this.lookController = new EntityBee.j(this);
this.a(PathType.DANGER_FIRE, -1.0F);
this.a(PathType.WATER, -1.0F); this.a(PathType.WATER, -1.0F);
this.a(PathType.COCOA, -1.0F);

Datei anzeigen

@ -26,15 +26,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); + log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled"));
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java --- a/src/main/java/net/minecraft/server/IProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/IProjectile.java
@@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile { @@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity {
if (nbttagcompound.hasKeyOfType("owner", 10)) { protected void loadData(NBTTagCompound nbttagcompound) {
this.shooterId = GameProfileSerializer.b(nbttagcompound.getCompound("owner")); if (nbttagcompound.b("Owner")) {
this.shooter = nbttagcompound.a("Owner");
+ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooter = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
} }
+ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooterId = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit
}
this.d = nbttagcompound.getBoolean("LeftOwner");

Datei anzeigen

@ -31,8 +31,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
- this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata)); - if (!(iblockdata.getBlock() instanceof BlockFireAbstract)) {
+ if (playEffect) this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata)); // Paper + if (playEffect && !(iblockdata.getBlock() instanceof BlockFireAbstract)) { // Paper
if (flag) { this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? this.getTileEntity(blockposition) : null; }

Datei anzeigen

@ -25,9 +25,9 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -0,0 +0,0 @@ import java.util.Iterator; @@ -0,0 +0,0 @@ import java.util.Optional;
import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.stream.Stream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;

Datei anzeigen

@ -15,19 +15,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/StructureGenerator.java --- a/src/main/java/net/minecraft/server/StructureGenerator.java
+++ b/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java
@@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration> @@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
int i2 = l + k * k1;
int j2 = i1 + k * l1;
ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2);
+ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS);
StructureStart<?> structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess);
if (flag1 || flag2) {
ChunkCoordIntPair chunkcoordintpair = this.a(chunkgenerator, seededrandom, j, k, i1, j1);
+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
StructureStart structurestart = world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS).a(this.b());
if (structurestart != null && structurestart.e()) {
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldBorder.java --- a/src/main/java/net/minecraft/server/WorldBorder.java
+++ b/src/main/java/net/minecraft/server/WorldBorder.java +++ b/src/main/java/net/minecraft/server/WorldBorder.java
@@ -0,0 +0,0 @@ public class WorldBorder { @@ -0,0 +0,0 @@ public class WorldBorder {
return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f(); return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
} }
+ // Paper start + // Paper start
@ -43,5 +43,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ +
public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) { public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) {
return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f(); return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h();
} }

Datei anzeigen

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (joinMessage != null && joinMessage.length() > 0) { if (joinMessage != null && joinMessage.length() > 0) {
- for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) { - for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) {
- server.getPlayerList().sendAll(new PacketPlayOutChat(line)); - server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.b));
- } - }
+ // Paper start - Removed sendAll for loop and broadcasted to console also + // Paper start - Removed sendAll for loop and broadcasted to console also
+ server.getPlayerList().sendMessage(CraftChatMessage.fromString(joinMessage)); + server.getPlayerList().sendMessage(CraftChatMessage.fromString(joinMessage));

Datei anzeigen

@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ import com.google.common.collect.Lists; @@ -0,0 +0,0 @@ import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.mojang.datafixers.util.Either; import com.mojang.datafixers.util.Either;
import io.netty.util.concurrent.Future; import com.mojang.serialization.DataResult;
+import java.util.ArrayDeque; // Paper +import java.util.ArrayDeque; // Paper
import java.util.Collection; import java.util.Collection;
+import java.util.Deque; // Paper +import java.util.Deque; // Paper
@ -63,6 +63,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.removeQueue.addAll(entityplayer.removeQueue); + this.removeQueue.addAll(entityplayer.removeQueue);
+ } + }
+ // Paper end + // Paper end
this.cm = entityplayer.cm; this.ck = entityplayer.ck;
this.cr = entityplayer.cr; this.cp = entityplayer.cp;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft()); this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());

Datei anzeigen

@ -13,6 +13,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void setHasWhitelist(boolean flag) { public void setHasWhitelist(boolean flag) {
+ new com.destroystokyo.paper.event.server.WhitelistToggleEvent(flag).callEvent(); + new com.destroystokyo.paper.event.server.WhitelistToggleEvent(flag).callEvent();
this.whitelist.setEnabled(flag); // Paper this.hasWhitelist = flag;
} }

Datei anzeigen

@ -25,19 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) { if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.Z();
this.setYawPitch(this.yaw, this.pitch);
if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.setCustomName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")));
+ this.setCustomName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException
}
this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible"));
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java --- a/src/main/java/net/minecraft/server/MCUtil.java
@ -67,8 +54,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/TileEntityBanner.java --- a/src/main/java/net/minecraft/server/TileEntityBanner.java
+++ b/src/main/java/net/minecraft/server/TileEntityBanner.java +++ b/src/main/java/net/minecraft/server/TileEntityBanner.java
@@ -0,0 +0,0 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity { @@ -0,0 +0,0 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity {
public void load(NBTTagCompound nbttagcompound) { public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) {
super.load(nbttagcompound); super.load(iblockdata, nbttagcompound);
if (nbttagcompound.hasKeyOfType("CustomName", 8)) { if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.a = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")); - this.a = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));
+ this.a = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException + this.a = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException
@ -80,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/TileEntityContainer.java --- a/src/main/java/net/minecraft/server/TileEntityContainer.java
+++ b/src/main/java/net/minecraft/server/TileEntityContainer.java +++ b/src/main/java/net/minecraft/server/TileEntityContainer.java
@@ -0,0 +0,0 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento @@ -0,0 +0,0 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento
super.load(nbttagcompound); super.load(iblockdata, nbttagcompound);
this.chestLock = ChestLock.b(nbttagcompound); this.chestLock = ChestLock.b(nbttagcompound);
if (nbttagcompound.hasKeyOfType("CustomName", 8)) { if (nbttagcompound.hasKeyOfType("CustomName", 8)) {
- this.customName = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")); - this.customName = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"));

Datei anzeigen

@ -16,5 +16,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- protected final List<TileEntity> tileEntityListUnload = Lists.newArrayList(); - protected final List<TileEntity> tileEntityListUnload = Lists.newArrayList();
+ protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); + protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
public final Thread serverThread; public final Thread serverThread;
private int c; private final boolean debugWorld;
protected int i = (new Random()).nextInt(); private int d;

Datei anzeigen

@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { @@ -0,0 +0,0 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity {
this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityDrowned.class})).a(EntityPigZombie.class)); this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityDrowned.class})).a(EntityPigZombie.class));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::i)); this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::j));
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false));
+ if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); // Paper + if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); // Paper
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bw)); this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bv));
} }

Datei anzeigen

@ -8,12 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IPlayerFileData { @@ -0,0 +0,0 @@ public class WorldNBTStorage {
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat"); File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
// Spigot Start // Spigot Start
boolean usingWrongFile = false; boolean usingWrongFile = false;
- if ( !file.exists() ) - if ( !file.exists() )
+ if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first + if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
{ {
file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
if ( file.exists() ) if ( file.exists() )

Datei anzeigen

@ -189,13 +189,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger;
public class ChunkProviderServer extends IChunkProvider { public class ChunkProviderServer extends IChunkProvider {
private static final int b = (int) Math.pow(17.0D, 2.0D); - private static final List<ChunkStatus> b = ChunkStatus.a();
- private static final List<ChunkStatus> c = ChunkStatus.a(); + private static final List<ChunkStatus> b = ChunkStatus.a(); static final List<ChunkStatus> getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER
+ private static final List<ChunkStatus> c = ChunkStatus.a(); static final List<ChunkStatus> getPossibleChunkStatuses() { return ChunkProviderServer.c; } // Paper - OBFHELPER
private final ChunkMapDistance chunkMapDistance; private final ChunkMapDistance chunkMapDistance;
public final ChunkGenerator<?> chunkGenerator; public final ChunkGenerator chunkGenerator;
private final WorldServer world; private final WorldServer world;
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -320,7 +320,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return Integer.compare(v1.location.z, v2.location.z); + return Integer.compare(v1.location.z, v2.location.z);
+ }); + });
+ +
+ worldData.addProperty("name", world.getWorldData().getName()); + worldData.addProperty("name", world.getWorld().getName());
+ worldData.addProperty("view-distance", world.spigotConfig.viewDistance); + worldData.addProperty("view-distance", world.spigotConfig.viewDistance);
+ worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); + worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory);
+ worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); + worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange);

Datei anzeigen

@ -11,12 +11,12 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
public void chunkCheck(Entity entity) { if (entity.ck()) {
this.getMethodProfiler().enter("chunkCheck"); this.getMethodProfiler().enter("chunkCheck");
int i = MathHelper.floor(entity.locX() / 16.0D); int i = MathHelper.floor(entity.locX() / 16.0D);
- int j = MathHelper.floor(entity.locY() / 16.0D); - int j = MathHelper.floor(entity.locY() / 16.0D);
+ int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior; + int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
int k = MathHelper.floor(entity.locZ() / 16.0D); int k = MathHelper.floor(entity.locZ() / 16.0D);
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) { if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {

Datei anzeigen

@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { @@ -0,0 +0,0 @@ public abstract class ChunkMapDistance {
private final ChunkMapDistance.a e = new ChunkMapDistance.a(); private final ChunkMapDistance.a ticketLevelTracker = new ChunkMapDistance.a();
private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); private final ChunkMapDistance.b f = new ChunkMapDistance.b(8);
private final ChunkMapDistance.c g = new ChunkMapDistance.c(33); private final ChunkMapDistance.c g = new ChunkMapDistance.c(33);
- private final Set<PlayerChunk> pendingChunkUpdates = Sets.newHashSet(); - private final Set<PlayerChunk> pendingChunkUpdates = Sets.newHashSet();

Datei anzeigen

@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 1 Jul 2020 03:18:37 -0400 Date: Wed, 1 Jul 2020 03:12:06 -0400
Subject: [PATCH] Clean up duplicated GameProfile Properties Subject: [PATCH] Clean up duplicated GameProfile Properties
We had a bug where we accidently cloned properties resulting in skulls We had a bug where we accidently cloned properties resulting in skulls
@ -13,14 +13,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/GameProfileSerializer.java --- a/src/main/java/net/minecraft/server/GameProfileSerializer.java
+++ b/src/main/java/net/minecraft/server/GameProfileSerializer.java +++ b/src/main/java/net/minecraft/server/GameProfileSerializer.java
@@ -0,0 +0,0 @@ public final class GameProfileSerializer { @@ -0,0 +0,0 @@ public final class GameProfileSerializer {
String s2 = (String) iterator.next(); while (iterator.hasNext()) {
NBTTagList nbttaglist = nbttagcompound1.getList(s2, 10); String s1 = (String) iterator.next();
NBTTagList nbttaglist = nbttagcompound1.getList(s1, 10);
-
- for (int i = 0; i < nbttaglist.size(); ++i) { - for (int i = 0; i < nbttaglist.size(); ++i) {
+ if (nbttaglist.size() == 0) continue; // Paper - remove duplicate properties + if (nbttaglist.size() == 0) continue; // Paper - remove duplicate properties
+ for (int i = nbttaglist.size() -1; i < nbttaglist.size(); ++i) { // Paper - remove duplicate properties + for (int i = nbttaglist.size() - 1; i < nbttaglist.size(); ++i) { // Paper - remove duplicate properties
NBTTagCompound nbttagcompound2 = nbttaglist.getCompound(i); NBTTagCompound nbttagcompound2 = nbttaglist.getCompound(i);
String s3 = nbttagcompound2.getString("Value"); String s2 = nbttagcompound2.getString("Value");
@@ -0,0 +0,0 @@ public final class GameProfileSerializer { @@ -0,0 +0,0 @@ public final class GameProfileSerializer {
Optional<T> optional = iblockstate.b(nbttagcompound.getString(s)); Optional<T> optional = iblockstate.b(nbttagcompound.getString(s));
@ -37,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- private static <T extends Comparable<T>> String a(IBlockState<T> iblockstate, Comparable<?> comparable) { - private static <T extends Comparable<T>> String a(IBlockState<T> iblockstate, Comparable<?> comparable) {
- return iblockstate.a(comparable); - return iblockstate.a(comparable);
+ private static <T extends Comparable<T>> String a(IBlockState<T> iblockstate, Comparable<T> comparable) { // Paper - decompile error + private static <T extends Comparable<T>> String a(IBlockState<T> iblockstate, Comparable<T> comparable) {// Paper - decompile error
+ return iblockstate.a((T) comparable); // Paper - decompile error + return iblockstate.a((T) comparable);// Paper - decompile error
} }
public static NBTTagCompound a(DataFixer datafixer, DataFixTypes datafixtypes, NBTTagCompound nbttagcompound, int i) { public static NBTTagCompound a(DataFixer datafixer, DataFixTypes datafixtypes, NBTTagCompound nbttagcompound, int i) {

Datei anzeigen

@ -60,12 +60,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public abstract class LootSelectorEntry extends LootEntryAbstract { public abstract class LootSelectorEntry extends LootEntryAbstract {
- protected final int c;
- protected final int e; - protected final int e;
- protected final int f; + protected final int c; public int getWeight() { return c; } // Paper - OBFHELPER
+ protected final int e; public int getWeight() { return e; } // Paper - OBFHELPER + protected final int e; public int getQuality() { return e; } // Paper - OBFHELPER
+ protected final int f; public int getQuality() { return f; } // Paper - OBFHELPER protected final LootItemFunction[] f;
protected final LootItemFunction[] g; private final BiFunction<ItemStack, LootTableInfo, ItemStack> g;
private final BiFunction<ItemStack, LootTableInfo, ItemStack> c;
private final LootEntry h = new LootSelectorEntry.c() { private final LootEntry h = new LootSelectorEntry.c() {
@@ -0,0 +0,0 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { @@ -0,0 +0,0 @@ public abstract class LootSelectorEntry extends LootEntryAbstract {
@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public int a(float f) { public int a(float f) {
- return Math.max(MathHelper.d((float) LootSelectorEntry.this.e + (float) LootSelectorEntry.this.f * f), 0); - return Math.max(MathHelper.d((float) LootSelectorEntry.this.c + (float) LootSelectorEntry.this.e * f), 0);
+ // Paper start - Offer an alternative loot formula to refactor how luck bonus applies + // Paper start - Offer an alternative loot formula to refactor how luck bonus applies
+ // SEE: https://luckformula.emc.gs for details and data + // SEE: https://luckformula.emc.gs for details and data
+ if (lastLuck != null && lastLuck == f) { + if (lastLuck != null && lastLuck == f) {
@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return lastWeight; + return lastWeight;
} }
} }
+ private Float lastLuck = null; + private Float lastLuck = null;
+ private int lastWeight = 0; + private int lastWeight = 0;
+ // Paper end + // Paper end
} }

Datei anzeigen

@ -39,7 +39,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING); EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING);
+ // Paper start - configurable bed search radius + // Paper start - configurable bed search radius
+ if (entitytypes == EntityTypes.PLAYER) return findSafePosition(entitytypes, (World) iworldreader, enumdirection, blockposition); + if (entitytypes == EntityTypes.PLAYER) return findSafePosition(entitytypes, (World) iworldreader, enumdirection, blockposition);
+
int j = blockposition.getX(); int j = blockposition.getX();
int k = blockposition.getY(); int k = blockposition.getY();
int l = blockposition.getZ(); int l = blockposition.getZ();
@ -47,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return Optional.empty(); return Optional.empty();
} }
- protected static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { - public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) {
+ private static Optional<Vec3D> findSafePosition(EntityTypes<?> entitytypes, World world, EnumDirection updirection, BlockPosition blockposition){ + private static Optional<Vec3D> findSafePosition(EntityTypes<?> entitytypes, World world, EnumDirection updirection, BlockPosition blockposition){
+ int radius = world.paperConfig.bedSearchRadius; + int radius = world.paperConfig.bedSearchRadius;
+ double angle = Math.PI / 2; + double angle = Math.PI / 2;
@ -143,15 +142,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ +
+ // Paper start -- add maxBelow param + // Paper start -- add maxBelow param
+ protected static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); } + public static Optional<Vec3D> a(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); }
+ protected static Optional<Vec3D> isSafeRespawn(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) { + public static Optional<Vec3D> isSafeRespawn(EntityTypes<?> entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) {
+ // Paper end + // Paper end
VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition); VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition);
if (voxelshape.c(EnumDirection.EnumAxis.Y) > 0.4375D) { if (voxelshape.c(EnumDirection.EnumAxis.Y) > 0.4375D) {
@@ -0,0 +0,0 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { @@ -0,0 +0,0 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity {
} else { } else {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(blockposition); BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
- while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= 2 && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { - while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= 2 && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) {
+ while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= maxBelow && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { // Paper -- configurable max distance to search below + while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= maxBelow && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { // Paper -- configurable max distance to search below

Datei anzeigen

@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional @@ -0,0 +0,0 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional
if (blockposition != null) { if (blockposition != null) {
WorldServer worldserver = loottableinfo.c(); WorldServer worldserver = loottableinfo.getWorld();
+ // Paper start + // Paper start
+ if (!worldserver.paperConfig.enableTreasureMaps) { + if (!worldserver.paperConfig.enableTreasureMaps) {
+ /* + /*
@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return itemstack; + return itemstack;
+ } + }
+ // Paper end + // Paper end
BlockPosition blockposition1 = worldserver.a(this.d, blockposition, this.g, this.h); BlockPosition blockposition1 = worldserver.a(this.e, blockposition, this.h, this.i);
if (blockposition1 != null) { if (blockposition1 != null) {
diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java
@ -55,9 +55,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return null; return null;
} else { } else {
WorldServer worldserver = (WorldServer) entity.world; WorldServer worldserver = (WorldServer) entity.world;
- BlockPosition blockposition = worldserver.a(this.b, new BlockPosition(entity), 100, true); - BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, true);
+ if (!worldserver.paperConfig.enableTreasureMaps) return null; //Paper + if (!worldserver.paperConfig.enableTreasureMaps) return null; // Paper
+ BlockPosition blockposition = worldserver.a(this.b, new BlockPosition(entity), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); //Paper + BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); // Paper
if (blockposition != null) { if (blockposition != null) {
ItemStack itemstack = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true); ItemStack itemstack = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true);

Datei anzeigen

@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ worldloadlistener.setChunkRadius(radiusBlocks / 16); + worldloadlistener.setChunkRadius(radiusBlocks / 16);
+ // Paper end + // Paper end
+ +
MinecraftServer.LOGGER.info("Preparing start region for dimension '{}'/{}", worldserver.getWorldData().getName(), DimensionManager.a(worldserver.worldProvider.getDimensionManager().getType())); // CraftBukkit MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a());
BlockPosition blockposition = worldserver.getSpawn(); BlockPosition blockposition = worldserver.getSpawn();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ worldserver.addTicketsForSpawn(radiusBlocks, blockposition); + worldserver.addTicketsForSpawn(radiusBlocks, blockposition);
} }
+ // Paper end + // Paper end
+ LOGGER.info("Loaded " + chunkproviderserver.b() + " spawn chunks for world " + worldserver.getWorldData().getName()); // Paper + LOGGER.info("Loaded " + chunkproviderserver.b() + " spawn chunks for world " + worldserver.getWorld().getName()); // Paper
// CraftBukkit start // CraftBukkit start
// this.nextTick = SystemUtils.getMonotonicMillis() + 10L; // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
@ -105,8 +105,8 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed {
return ((PersistentIdCounts) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a(); return ((PersistentIdCounts) this.getMinecraftServer().D().getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a();
} }
+ // Paper start - helper function for configurable spawn radius + // Paper start - helper function for configurable spawn radius
@ -180,13 +180,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
+ +
@Override
public void a_(BlockPosition blockposition) { public void a_(BlockPosition blockposition) {
- ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.b(), 0, this.worldData.d())); - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
+ // Paper - configurable spawn radius + // Paper - configurable spawn radius
+ BlockPosition prevSpawn = this.getSpawn(); + BlockPosition prevSpawn = this.getSpawn();
+ //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
super.a_(blockposition); this.worldData.setSpawn(blockposition);
- this.getChunkProvider().removeTicket(TicketType.START, chunkcoordintpair, 11, Unit.INSTANCE); - this.getChunkProvider().removeTicket(TicketType.START, chunkcoordintpair, 11, Unit.INSTANCE);
- this.getChunkProvider().addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE); - this.getChunkProvider().addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
+ if (this.keepSpawnInMemory) { + if (this.keepSpawnInMemory) {
@ -194,10 +194,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); + this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn);
+ this.addTicketsForSpawn(this.paperConfig.keepLoadedRange, blockposition); + this.addTicketsForSpawn(this.paperConfig.keepLoadedRange, blockposition);
+ } + }
+ // Paper end this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition));
} }
public LongSet getForceLoadedChunks() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java

Datei anzeigen

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void allowLeashingUndeadHorse() { private void nonPlayerEntitiesOnScoreboards() {
allowLeashingUndeadHorse = getBoolean("allow-leashing-undead-horse", false); nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false);
} }
+ +
+ public int nonPlayerArrowDespawnRate = -1; + public int nonPlayerArrowDespawnRate = -1;
@ -33,9 +33,9 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java --- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile { @@ -0,0 +0,0 @@ public abstract class EntityArrow extends IProjectile {
protected void i() { protected void h() {
++this.despawnCounter; ++this.despawnCounter;
- if (this.despawnCounter >= ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)) { // Spigot - if (this.despawnCounter >= ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)) { // Spigot
+ if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init? + if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init?

Datei anzeigen

@ -66,21 +66,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>(); private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>();
+ @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule + @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
public PlayerList(MinecraftServer minecraftserver, int i) { public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) {
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this); this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
} }
entityplayer.syncInventory(); entityplayer.syncInventory();
+ // Paper start - Add to collideRule team if needed + // Paper start - Add to collideRule team if needed
+ final Scoreboard scoreboard = this.getServer().getWorldServer(DimensionManager.OVERWORLD).getScoreboard(); + final Scoreboard scoreboard = this.getServer().getWorldServer(World.OVERWORLD).getScoreboard();
+ final ScoreboardTeam collideRuleTeam = scoreboard.getTeam(collideRuleTeamName); + final ScoreboardTeam collideRuleTeam = scoreboard.getTeam(collideRuleTeamName);
+ if (this.collideRuleTeamName != null && collideRuleTeam != null && entityplayer.getScoreboardTeam() == null) { + if (this.collideRuleTeamName != null && collideRuleTeam != null && entityplayer.getScoreboardTeam() == null) {
+ scoreboard.addPlayerToTeam(entityplayer.getName(), collideRuleTeam); + scoreboard.addPlayerToTeam(entityplayer.getName(), collideRuleTeam);
+ } + }
+ // Paper end + // Paper end
// CraftBukkit - Moved from above, added world // CraftBukkit - Moved from above, added world
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ()); PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.worldDataServer.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
} }
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
entityplayer.playerTick(); // SPIGOT-924 entityplayer.playerTick(); // SPIGOT-924
@ -88,7 +88,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Remove from collideRule team if needed + // Paper start - Remove from collideRule team if needed
+ if (this.collideRuleTeamName != null) { + if (this.collideRuleTeamName != null) {
+ final Scoreboard scoreBoard = this.server.getWorldServer(DimensionManager.OVERWORLD).getScoreboard(); + final Scoreboard scoreBoard = this.server.getWorldServer(World.OVERWORLD).getScoreboard();
+ final ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName); + final ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName);
+ if (entityplayer.getScoreboardTeam() == team && team != null) { + if (entityplayer.getScoreboardTeam() == team && team != null) {
+ scoreBoard.removePlayerFromTeam(entityplayer.getName(), team); + scoreBoard.removePlayerFromTeam(entityplayer.getName(), team);
@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Remove collideRule team if it exists + // Paper start - Remove collideRule team if it exists
+ if (this.collideRuleTeamName != null) { + if (this.collideRuleTeamName != null) {
+ final Scoreboard scoreboard = this.getServer().getWorldServer(DimensionManager.OVERWORLD).getScoreboard(); + final Scoreboard scoreboard = this.getServer().getWorldServer(World.OVERWORLD).getScoreboard();
+ final ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName); + final ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName);
+ if (team != null) scoreboard.removeTeam(team); + if (team != null) scoreboard.removeTeam(team);
+ } + }

Datei anzeigen

@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java --- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr @@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Integer> playerIdleTimeout;
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList; public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
public final GeneratorSettings generatorSettings;
+ public final String rconIp; // Paper - Add rcon ip + public final String rconIp; // Paper - Add rcon ip
+ +
@ -19,9 +19,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public DedicatedServerProperties(Properties properties, OptionSet optionset) { public DedicatedServerProperties(Properties properties, OptionSet optionset) {
super(properties, optionset); super(properties, optionset);
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr @@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
}, 29999984);
this.playerIdleTimeout = this.b("player-idle-timeout", 0); this.playerIdleTimeout = this.b("player-idle-timeout", 0);
this.whiteList = this.b("white-list", false); this.whiteList = this.b("white-list", false);
this.generatorSettings = GeneratorSettings.a(properties);
+ // Paper start - Configurable rcon ip + // Paper start - Configurable rcon ip
+ final String rconIp = this.getSettingIfExists("rcon.ip"); + final String rconIp = this.getSettingIfExists("rcon.ip");
+ this.rconIp = rconIp == null ? this.serverIp : rconIp; + this.rconIp = rconIp == null ? this.serverIp : rconIp;
@ -50,10 +50,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java +++ b/src/main/java/net/minecraft/server/RemoteControlListener.java
@@ -0,0 +0,0 @@ public class RemoteControlListener extends RemoteConnectionThread { @@ -0,0 +0,0 @@ public class RemoteControlListener extends RemoteConnectionThread {
this.h = dedicatedserverproperties.rconPort; this.e = dedicatedserverproperties.rconPort;
this.k = dedicatedserverproperties.rconPassword; this.h = dedicatedserverproperties.rconPassword;
- this.i = iminecraftserver.e_(); - this.f = iminecraftserver.h_();
+ this.i = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip + this.f = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip
if (this.i.isEmpty()) { if (this.f.isEmpty()) {
this.i = "0.0.0.0"; this.f = "0.0.0.0";
} }

Datei anzeigen

@ -28,24 +28,24 @@ diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java --- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTransformEvent;
public class EntityZombie extends EntityMonster {
protected static final IAttribute d = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
- private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); - private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE);
+ private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", world.paperConfig.babyZombieMovementModifier, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.c; // Paper - remove static - Make baby speed configurable + private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.c; // Paper - remove static - Make baby speed configurable
private static final DataWatcherObject<Boolean> bw = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
private static final DataWatcherObject<Integer> bx = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); private static final DataWatcherObject<Integer> bv = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b);
public static final DataWatcherObject<Boolean> DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); public static final DataWatcherObject<Boolean> DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
if (this.world != null && !this.world.isClientSide) { if (this.world != null && !this.world.isClientSide) {
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
- attributeinstance.removeModifier(EntityZombie.c); - attributemodifiable.removeModifier(EntityZombie.c);
+ attributeinstance.removeModifier(this.babyModifier); // Paper + attributemodifiable.removeModifier(this.babyModifier); // Paper
if (flag) { if (flag) {
- attributeinstance.addModifier(EntityZombie.c); - attributemodifiable.b(EntityZombie.c);
+ attributeinstance.addModifier(this.babyModifier); // Paper + attributemodifiable.b(this.babyModifier); // Paper
} }
} }

Datei anzeigen

@ -27,14 +27,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/BlockCactus.java --- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -0,0 +0,0 @@ public class BlockCactus extends Block { @@ -0,0 +0,0 @@ public class BlockCactus extends Block {
; ;
} }
- if (i < 3) { - if (i < 3) {
+ if (i < worldserver.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height + if (i < worldserver.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height
int j = (Integer) iblockdata.get(BlockCactus.AGE); int j = (Integer) iblockdata.get(BlockCactus.AGE);
if (j >= (byte) range(3, ((100.0F / worldserver.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot if (j >= (byte) range(3, ((100.0F / worldserver.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java --- a/src/main/java/net/minecraft/server/BlockReed.java

Datei anzeigen

@ -27,18 +27,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster {
@Override @Override
public void b(EntityLiving entityliving) { public void a_(EntityLiving entityliving) {
super.b(entityliving); super.a_(entityliving);
- if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) { - if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
- if (this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) { - if (this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
+ // Paper start + // Paper start
+ if (world.paperConfig.zombieVillagerInfectionChance != 0.0 && (world.paperConfig.zombieVillagerInfectionChance != -1.0 || this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) { + if (world.paperConfig.zombieVillagerInfectionChance != 0.0 && (world.paperConfig.zombieVillagerInfectionChance != -1.0 || this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) {
+ if (world.paperConfig.zombieVillagerInfectionChance == -1.0 && this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) { + if (world.paperConfig.zombieVillagerInfectionChance == -1.0 && this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
+ return;
+ }
+ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) {
return; return;
- } }
+ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) {
+ return;
+ } // Paper end + } // Paper end
EntityVillager entityvillager = (EntityVillager) entityliving; EntityVillager entityvillager = (EntityVillager) entityliving;

Datei anzeigen

@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
throttleTracker.put(address, currentTime); throttleTracker.put(address, currentTime);
- chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting."); - chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
+ chatmessage = new ChatMessage(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message + chatmessage = new ChatMessage(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message
this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
this.b.close(chatmessage); this.c.close(chatmessage);
return; return;

Datei anzeigen

@ -24,19 +24,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/EntityPlayer.java --- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
private long cj = SystemUtils.getMonotonicMillis(); private long ch = SystemUtils.getMonotonicMillis();
private Entity spectatedEntity; private Entity spectatedEntity;
public boolean worldChangeInvuln; public boolean worldChangeInvuln;
- private boolean cm; - private boolean ck;
+ private boolean cm; private void setHasSeenCredits(boolean has) { this.cm = has; } // Paper - OBFHELPER + private boolean ck; private void setHasSeenCredits(boolean has) { this.ck = has; } // Paper - OBFHELPER
private final RecipeBookServer recipeBook; private final RecipeBookServer recipeBook = new RecipeBookServer();
private Vec3D co; private Vec3D cm;
private int cp; private int cn;
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.getWorldServer().removePlayer(this); this.getWorldServer().removePlayer(this);
if (!this.viewingCredits) { if (!this.viewingCredits) {
this.viewingCredits = true; this.viewingCredits = true;
+ if (world.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits + if (world.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, this.cm ? 0.0F : 1.0F)); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.e, this.ck ? 0.0F : 1.0F));
this.cm = true; this.ck = true;
} }

Datei anzeigen

@ -25,14 +25,14 @@ diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/mai
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java --- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity { @@ -0,0 +0,0 @@ public class EntityFishingHook extends IProjectile {
this.aq = MathHelper.nextInt(this.random, 20, 80); this.ap = MathHelper.nextInt(this.random, 20, 80);
} }
} else { } else {
- this.ap = MathHelper.nextInt(this.random, 100, 600); - this.ao = MathHelper.nextInt(this.random, 100, 600);
+ this.ap = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper + this.ao = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper
this.ap -= this.au * 20 * 5; this.ao -= this.av * 20 * 5;
+ this.ap = Math.max(0, this.ap); // Paper - Don't allow negative values + this.ao = Math.max(0, this.ao); // Paper - Don't allow negative values;
} }
} }

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen