From fd6034fbdd1df46c52c2df7b43f49907fc0ed1eb Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 23 Sep 2018 20:22:33 +1000 Subject: [PATCH 01/40] Added the 1.13.1 new blocks. --- build.gradle | 4 +- .../worldedit/world/block/BlockTypes.java | 19 ++- .../sk89q/worldedit/world/item/ItemTypes.java | 5 + .../worldedit/world/registry/blocks.json | 129 +++++++++++++++++- .../sk89q/worldedit/world/registry/items.json | 28 +++- 5 files changed, 170 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 9d91915c1..f9323c59c 100644 --- a/build.gradle +++ b/build.gradle @@ -28,8 +28,8 @@ buildscript { dependencies { classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' - classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.3.0' - classpath 'org.ajoberstar:gradle-git:1.5.1' + classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5' + classpath 'org.ajoberstar:gradle-git:1.7.2' } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java index d8bc3d84a..aec13e4aa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -96,7 +96,7 @@ public final class BlockTypes { public static final BlockType BLUE_WOOL = register("minecraft:blue_wool"); public static final BlockType BONE_BLOCK = register("minecraft:bone_block", state -> state.with(state.getBlockType().getProperty("axis"), "y")); public static final BlockType BOOKSHELF = register("minecraft:bookshelf"); - public static final BlockType BRAIN_CORAL = register("minecraft:brain_coral"); + public static final BlockType BRAIN_CORAL = register("minecraft:brain_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType BRAIN_CORAL_BLOCK = register("minecraft:brain_coral_block"); public static final BlockType BRAIN_CORAL_FAN = register("minecraft:brain_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType BRAIN_CORAL_WALL_FAN = register("minecraft:brain_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); @@ -119,7 +119,7 @@ public final class BlockTypes { public static final BlockType BROWN_WALL_BANNER = register("minecraft:brown_wall_banner", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH)); public static final BlockType BROWN_WOOL = register("minecraft:brown_wool"); public static final BlockType BUBBLE_COLUMN = register("minecraft:bubble_column", state -> state.with(state.getBlockType().getProperty("drag"), true)); - public static final BlockType BUBBLE_CORAL = register("minecraft:bubble_coral"); + public static final BlockType BUBBLE_CORAL = register("minecraft:bubble_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType BUBBLE_CORAL_BLOCK = register("minecraft:bubble_coral_block"); public static final BlockType BUBBLE_CORAL_FAN = register("minecraft:bubble_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType BUBBLE_CORAL_WALL_FAN = register("minecraft:bubble_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); @@ -150,7 +150,7 @@ public final class BlockTypes { public static final BlockType COCOA = register("minecraft:cocoa", state -> state.with(state.getBlockType().getProperty("age"), 0).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); public static final BlockType COMMAND_BLOCK = register("minecraft:command_block", state -> state.with(state.getBlockType().getProperty("conditional"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH)); public static final BlockType COMPARATOR = register("minecraft:comparator", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("mode"), "compare").with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType CONDUIT = register("minecraft:conduit"); + public static final BlockType CONDUIT = register("minecraft:conduit", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType CRACKED_STONE_BRICKS = register("minecraft:cracked_stone_bricks"); public static final BlockType CRAFTING_TABLE = register("minecraft:crafting_table"); public static final BlockType CREEPER_HEAD = register("minecraft:creeper_head", state -> state.with(state.getBlockType().getProperty("rotation"), 0)); @@ -188,19 +188,24 @@ public final class BlockTypes { public static final BlockType DARK_PRISMARINE_SLAB = register("minecraft:dark_prismarine_slab", state -> state.with(state.getBlockType().getProperty("type"), "bottom").with(state.getBlockType().getProperty("waterlogged"), false)); public static final BlockType DARK_PRISMARINE_STAIRS = register("minecraft:dark_prismarine_stairs", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("half"), "bottom").with(state.getBlockType().getProperty("shape"), "straight").with(state.getBlockType().getProperty("waterlogged"), false)); public static final BlockType DAYLIGHT_DETECTOR = register("minecraft:daylight_detector", state -> state.with(state.getBlockType().getProperty("inverted"), false).with(state.getBlockType().getProperty("power"), 0)); + public static final BlockType DEAD_BRAIN_CORAL = register("minecraft:dead_brain_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_BRAIN_CORAL_BLOCK = register("minecraft:dead_brain_coral_block"); public static final BlockType DEAD_BRAIN_CORAL_FAN = register("minecraft:dead_brain_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_BRAIN_CORAL_WALL_FAN = register("minecraft:dead_brain_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_BUBBLE_CORAL = register("minecraft:dead_bubble_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_BUBBLE_CORAL_BLOCK = register("minecraft:dead_bubble_coral_block"); public static final BlockType DEAD_BUBBLE_CORAL_FAN = register("minecraft:dead_bubble_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_BUBBLE_CORAL_WALL_FAN = register("minecraft:dead_bubble_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_BUSH = register("minecraft:dead_bush"); + public static final BlockType DEAD_FIRE_CORAL = register("minecraft:dead_fire_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_FIRE_CORAL_BLOCK = register("minecraft:dead_fire_coral_block"); public static final BlockType DEAD_FIRE_CORAL_FAN = register("minecraft:dead_fire_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_FIRE_CORAL_WALL_FAN = register("minecraft:dead_fire_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_HORN_CORAL = register("minecraft:dead_horn_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_HORN_CORAL_BLOCK = register("minecraft:dead_horn_coral_block"); public static final BlockType DEAD_HORN_CORAL_FAN = register("minecraft:dead_horn_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_HORN_CORAL_WALL_FAN = register("minecraft:dead_horn_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); + public static final BlockType DEAD_TUBE_CORAL = register("minecraft:dead_tube_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_TUBE_CORAL_BLOCK = register("minecraft:dead_tube_coral_block"); public static final BlockType DEAD_TUBE_CORAL_FAN = register("minecraft:dead_tube_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType DEAD_TUBE_CORAL_WALL_FAN = register("minecraft:dead_tube_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); @@ -228,7 +233,7 @@ public final class BlockTypes { public static final BlockType FARMLAND = register("minecraft:farmland", state -> state.with(state.getBlockType().getProperty("moisture"), 0)); public static final BlockType FERN = register("minecraft:fern"); public static final BlockType FIRE = register("minecraft:fire", state -> state.with(state.getBlockType().getProperty("age"), 0).with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("up"), false).with(state.getBlockType().getProperty("west"), false)); - public static final BlockType FIRE_CORAL = register("minecraft:fire_coral"); + public static final BlockType FIRE_CORAL = register("minecraft:fire_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType FIRE_CORAL_BLOCK = register("minecraft:fire_coral_block"); public static final BlockType FIRE_CORAL_FAN = register("minecraft:fire_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType FIRE_CORAL_WALL_FAN = register("minecraft:fire_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); @@ -272,7 +277,7 @@ public final class BlockTypes { public static final BlockType HAY_BLOCK = register("minecraft:hay_block", state -> state.with(state.getBlockType().getProperty("axis"), "y")); public static final BlockType HEAVY_WEIGHTED_PRESSURE_PLATE = register("minecraft:heavy_weighted_pressure_plate", state -> state.with(state.getBlockType().getProperty("power"), 0)); public static final BlockType HOPPER = register("minecraft:hopper", state -> state.with(state.getBlockType().getProperty("enabled"), true).with(state.getBlockType().getProperty("facing"), Direction.DOWN)); - public static final BlockType HORN_CORAL = register("minecraft:horn_coral"); + public static final BlockType HORN_CORAL = register("minecraft:horn_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType HORN_CORAL_BLOCK = register("minecraft:horn_coral_block"); public static final BlockType HORN_CORAL_FAN = register("minecraft:horn_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType HORN_CORAL_WALL_FAN = register("minecraft:horn_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); @@ -577,12 +582,12 @@ public final class BlockTypes { public static final BlockType TALL_GRASS = register("minecraft:tall_grass", state -> state.with(state.getBlockType().getProperty("half"), "lower")); public static final BlockType TALL_SEAGRASS = register("minecraft:tall_seagrass", state -> state.with(state.getBlockType().getProperty("half"), "lower")); public static final BlockType TERRACOTTA = register("minecraft:terracotta"); - public static final BlockType TNT = register("minecraft:tnt"); + public static final BlockType TNT = register("minecraft:tnt", state -> state.with(state.getBlockType().getProperty("unstable"), false)); public static final BlockType TORCH = register("minecraft:torch"); public static final BlockType TRAPPED_CHEST = register("minecraft:trapped_chest", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("type"), "SINGLE").with(state.getBlockType().getProperty("waterlogged"), false)); public static final BlockType TRIPWIRE = register("minecraft:tripwire", state -> state.with(state.getBlockType().getProperty("attached"), false).with(state.getBlockType().getProperty("disarmed"), false).with(state.getBlockType().getProperty("east"), false).with(state.getBlockType().getProperty("north"), false).with(state.getBlockType().getProperty("powered"), false).with(state.getBlockType().getProperty("south"), false).with(state.getBlockType().getProperty("west"), false)); public static final BlockType TRIPWIRE_HOOK = register("minecraft:tripwire_hook", state -> state.with(state.getBlockType().getProperty("attached"), false).with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("powered"), false)); - public static final BlockType TUBE_CORAL = register("minecraft:tube_coral"); + public static final BlockType TUBE_CORAL = register("minecraft:tube_coral", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType TUBE_CORAL_BLOCK = register("minecraft:tube_coral_block"); public static final BlockType TUBE_CORAL_FAN = register("minecraft:tube_coral_fan", state -> state.with(state.getBlockType().getProperty("waterlogged"), true)); public static final BlockType TUBE_CORAL_WALL_FAN = register("minecraft:tube_coral_wall_fan", state -> state.with(state.getBlockType().getProperty("facing"), Direction.NORTH).with(state.getBlockType().getProperty("waterlogged"), true)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java index 918fde039..96ff8897f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java @@ -224,15 +224,20 @@ public final class ItemTypes { public static final ItemType DARK_PRISMARINE_SLAB = register("minecraft:dark_prismarine_slab"); public static final ItemType DARK_PRISMARINE_STAIRS = register("minecraft:dark_prismarine_stairs"); public static final ItemType DAYLIGHT_DETECTOR = register("minecraft:daylight_detector"); + public static final ItemType DEAD_BRAIN_CORAL = register("minecraft:dead_brain_coral"); public static final ItemType DEAD_BRAIN_CORAL_BLOCK = register("minecraft:dead_brain_coral_block"); public static final ItemType DEAD_BRAIN_CORAL_FAN = register("minecraft:dead_brain_coral_fan"); + public static final ItemType DEAD_BUBBLE_CORAL = register("minecraft:dead_bubble_coral"); public static final ItemType DEAD_BUBBLE_CORAL_BLOCK = register("minecraft:dead_bubble_coral_block"); public static final ItemType DEAD_BUBBLE_CORAL_FAN = register("minecraft:dead_bubble_coral_fan"); public static final ItemType DEAD_BUSH = register("minecraft:dead_bush"); + public static final ItemType DEAD_FIRE_CORAL = register("minecraft:dead_fire_coral"); public static final ItemType DEAD_FIRE_CORAL_BLOCK = register("minecraft:dead_fire_coral_block"); public static final ItemType DEAD_FIRE_CORAL_FAN = register("minecraft:dead_fire_coral_fan"); + public static final ItemType DEAD_HORN_CORAL = register("minecraft:dead_horn_coral"); public static final ItemType DEAD_HORN_CORAL_BLOCK = register("minecraft:dead_horn_coral_block"); public static final ItemType DEAD_HORN_CORAL_FAN = register("minecraft:dead_horn_coral_fan"); + public static final ItemType DEAD_TUBE_CORAL = register("minecraft:dead_tube_coral"); public static final ItemType DEAD_TUBE_CORAL_BLOCK = register("minecraft:dead_tube_coral_block"); public static final ItemType DEAD_TUBE_CORAL_FAN = register("minecraft:dead_tube_coral_fan"); public static final ItemType DEBUG_STICK = register("minecraft:debug_stick"); diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json index 3e163855a..93dffaf2d 100644 --- a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json @@ -3949,6 +3949,31 @@ "hasContainer": true } }, + { + "id": "minecraft:dead_brain_coral", + "localizedName": "Dead Brain Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, { "id": "minecraft:dead_brain_coral_block", "localizedName": "Dead Brain Coral Block", @@ -4024,6 +4049,31 @@ "hasContainer": false } }, + { + "id": "minecraft:dead_bubble_coral", + "localizedName": "Dead Bubble Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, { "id": "minecraft:dead_bubble_coral_block", "localizedName": "Dead Bubble Coral Block", @@ -4124,6 +4174,31 @@ "hasContainer": false } }, + { + "id": "minecraft:dead_fire_coral", + "localizedName": "Dead Fire Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, { "id": "minecraft:dead_fire_coral_block", "localizedName": "Dead Fire Coral Block", @@ -4199,6 +4274,31 @@ "hasContainer": false } }, + { + "id": "minecraft:dead_horn_coral", + "localizedName": "Dead Horn Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, { "id": "minecraft:dead_horn_coral_block", "localizedName": "Dead Horn Coral Block", @@ -4274,6 +4374,31 @@ "hasContainer": false } }, + { + "id": "minecraft:dead_tube_coral", + "localizedName": "Dead Tube Coral", + "material": { + "powerSource": false, + "lightValue": 0, + "hardness": 0.0, + "resistance": 0.0, + "ticksRandomly": false, + "fullCube": false, + "slipperiness": 0.6, + "liquid": false, + "solid": true, + "movementBlocker": true, + "burnable": false, + "opaque": true, + "replacedDuringPlacement": false, + "toolRequired": true, + "fragileWhenPushed": false, + "unpushable": false, + "mapColor": "#707070", + "isTranslucent": false, + "hasContainer": false + } + }, { "id": "minecraft:dead_tube_coral_block", "localizedName": "Dead Tube Coral Block", @@ -6995,7 +7120,7 @@ "fragileWhenPushed": true, "unpushable": false, "mapColor": "#ff0000", - "isTranslucent": true, + "isTranslucent": false, "hasContainer": false } }, @@ -14045,7 +14170,7 @@ "fragileWhenPushed": true, "unpushable": false, "mapColor": "#4040ff", - "isTranslucent": true, + "isTranslucent": false, "hasContainer": false } }, diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.json index c9eeb23b8..46829d927 100644 --- a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.json +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.json @@ -803,6 +803,10 @@ "id": "minecraft:daylight_detector", "localizedName": "Air" }, + { + "id": "minecraft:dead_brain_coral", + "localizedName": "Air" + }, { "id": "minecraft:dead_brain_coral_block", "localizedName": "Air" @@ -811,6 +815,10 @@ "id": "minecraft:dead_brain_coral_fan", "localizedName": "Air" }, + { + "id": "minecraft:dead_bubble_coral", + "localizedName": "Air" + }, { "id": "minecraft:dead_bubble_coral_block", "localizedName": "Air" @@ -823,6 +831,10 @@ "id": "minecraft:dead_bush", "localizedName": "Air" }, + { + "id": "minecraft:dead_fire_coral", + "localizedName": "Air" + }, { "id": "minecraft:dead_fire_coral_block", "localizedName": "Air" @@ -831,6 +843,10 @@ "id": "minecraft:dead_fire_coral_fan", "localizedName": "Air" }, + { + "id": "minecraft:dead_horn_coral", + "localizedName": "Air" + }, { "id": "minecraft:dead_horn_coral_block", "localizedName": "Air" @@ -839,6 +855,10 @@ "id": "minecraft:dead_horn_coral_fan", "localizedName": "Air" }, + { + "id": "minecraft:dead_tube_coral", + "localizedName": "Air" + }, { "id": "minecraft:dead_tube_coral_block", "localizedName": "Air" @@ -1749,7 +1769,7 @@ }, { "id": "minecraft:lingering_potion", - "localizedName": "Lingering Potion" + "localizedName": "Lingering Water Bottle" }, { "id": "minecraft:llama_spawn_egg", @@ -2237,7 +2257,7 @@ }, { "id": "minecraft:potion", - "localizedName": "Potion" + "localizedName": "Water Bottle" }, { "id": "minecraft:powered_rail", @@ -2677,7 +2697,7 @@ }, { "id": "minecraft:splash_potion", - "localizedName": "Splash Potion" + "localizedName": "Splash Water Bottle" }, { "id": "minecraft:sponge", @@ -2885,7 +2905,7 @@ }, { "id": "minecraft:tipped_arrow", - "localizedName": "Tipped Arrow" + "localizedName": "Arrow of Poison" }, { "id": "minecraft:tnt", From cc1a54b5f02cb1d02ee7a558686f83a4076cccd6 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 23 Sep 2018 22:48:04 +1000 Subject: [PATCH 02/40] Added an implementation tester to Bukkit, to determine which impl is in use. (For WE,WG,CB to use Paper/Spigot specific APIs) --- .../bukkit/BukkitImplementationTester.java | 90 +++++++++++++++++++ .../worldedit/bukkit/WorldEditPlugin.java | 3 + 2 files changed, 93 insertions(+) create mode 100644 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitImplementationTester.java diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitImplementationTester.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitImplementationTester.java new file mode 100644 index 000000000..186365a9b --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitImplementationTester.java @@ -0,0 +1,90 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +package com.sk89q.worldedit.bukkit; + +/** + * Adds methods to test if different API methods are possible based on implementation. + */ +public class BukkitImplementationTester { + + private BukkitImplementationTester() { + } + + /** + * Known Bukkit implementations + */ + public enum BukkitImplementation { + CRAFTBUKKIT, + SPIGOT, + PAPER, + } + + private static final String implementationMessage = "************************************************" + + "* Note: PaperMC (https://papermc.io/) is *" + + "* recommended for optimal performance with *" + + "* WorldEdit, WorldGuard, or CraftBook. *" + + "************************************************"; + + private static BukkitImplementation implementation; + + /** + * Gets the implementation currently in use on the server. + * + * @return The server implementation + */ + public static BukkitImplementation getImplementation() { + if (implementation == null) { + try { + Class.forName("com.destroystokyo.paper.PaperConfig"); + implementation = BukkitImplementation.PAPER; + } catch (Exception e) { + try { + Class.forName("org.spigotmc.SpigotConfig"); + implementation = BukkitImplementation.SPIGOT; + } catch (Exception e2) { + implementation = BukkitImplementation.CRAFTBUKKIT; + } + } + + if (implementation != BukkitImplementation.PAPER) { +// Bukkit.getServer().getConsoleSender().sendMessage(implementationMessage); // TODO Decide if good idea. + } + } + + return implementation; + } + + /** + * Check if this implementation is compatible with Spigot APIs + * + * @return If compatible with Spigot APIs + */ + public static boolean isSpigotCompatible() { + return getImplementation() == BukkitImplementation.SPIGOT || getImplementation() == BukkitImplementation.PAPER; + } + + /** + * Check if this implementation is compatible with Paper APIs + * + * @return If compatible with Paper APIs + */ + public static boolean isPaperCompatible() { + return getImplementation() == BukkitImplementation.PAPER; + } +} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index c4b017e83..8cc6f544b 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -104,6 +104,9 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter { // platforms to be worried about... at the current time of writing WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent()); + // Setup the BukkitImplementationTester. + BukkitImplementationTester.getImplementation(); + // Enable metrics new Metrics(this); } From 18abaa21a28f34837462f90f69eefc0c31a1334a Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 25 Sep 2018 20:24:10 +1000 Subject: [PATCH 03/40] Update the shadow plugin --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f9323c59c..35db0c9c2 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ buildscript { } dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' + classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4' classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5' classpath 'org.ajoberstar:gradle-git:1.7.2' } From 42e0cceeab4c5c5e348826906ad6fcfc3846a935 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 26 Sep 2018 15:03:01 +1000 Subject: [PATCH 04/40] Bukkit really needs methods to get by key/get key --- .../src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java index 7b0aa4ff6..2f30ed2e9 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java @@ -283,7 +283,7 @@ public class BukkitAdapter { * @return WorldEdit EntityType */ public static EntityType adapt(org.bukkit.entity.EntityType entityType) { - return EntityTypes.get(entityType.getName().toLowerCase()); + return EntityTypes.get(entityType.name().toLowerCase()); } public static org.bukkit.entity.EntityType adapt(EntityType entityType) { From 59584ba10c21fa47b1bd327dcb57f45d050547f1 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Wed, 26 Sep 2018 15:41:27 +1000 Subject: [PATCH 05/40] [Experimental] Don't check for permissions on root parents. --- .../java/com/sk89q/worldedit/util/command/SimpleDispatcher.java | 2 +- .../worldedit/util/command/parametric/ParametricCallable.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java index 1f67fe51c..8bb73a880 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/SimpleDispatcher.java @@ -104,7 +104,7 @@ public class SimpleDispatcher implements Dispatcher { @Override public Object call(String arguments, CommandLocals locals, String[] parentCommands) throws CommandException { // We have permission for this command if we have permissions for subcommands - if (!testPermission(locals)) { + if (parentCommands.length != 0 && !testPermission(locals)) { throw new CommandPermissionsException(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java index 10932717d..39f47b20e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/command/parametric/ParametricCallable.java @@ -182,7 +182,7 @@ class ParametricCallable implements CommandCallable { @Override public Object call(String stringArguments, CommandLocals locals, String[] parentCommands) throws CommandException { // Test permission - if (!testPermission(locals)) { + if (parentCommands.length != 0 && !testPermission(locals)) { throw new CommandPermissionsException(); } From aee011ea89945535dfaf1cc5cd4b0819a32f82d2 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Sun, 30 Sep 2018 14:00:08 +1000 Subject: [PATCH 06/40] Added discord link to README --- README.md | 69 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 3eb26b510..3cbea9496 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,35 @@ -![WorldEdit](http://static.sk89q.com/readme/worldedit.png) -========= - -WorldEdit is Minecraft mod that turns Minecraft into an in-game map editor (sorta, kinda). - -* Make awesome stuff with half the time OR make ***quadriply** awesome* creations with the same time :sparkles: -* Get lost in hundreds of options and functions that even we've forgotten existed -* Utilize Photoshop-like tools like "selection areas" and "brushes" -* Making fjords and other natural wonders with weird names -* Also: fix grief, broken water, missing snow, raging fires, and other :poop: - -WorldEdit is open source!, so if you've just learned how to make a button blink, I probably recommend picking up a book on CS algorithms. The project is licensed using the GNU Lesser General Public License license, v3. - -Compiling ---------- - -See [COMPILING.md](COMPILING.md) for a guide on compiling WorldEdit. - -Contributing ------------- - -We happily accept contributions, especially through pull requests on GitHub. -Submissions must be licensed under the GNU Lesser General Public License v3. - -Please read [CONTRIBUTING.md](CONTRIBUTING.md) for important guidelines to follow. - -Links ------ - -* [Visit our website](http://www.enginehub.org/) -* [IRC channel](http://skq.me/irc/irc.esper.net/sk89q/) (#sk89q on irc.esper.net) -* [Issue tracker](http://youtrack.sk89q.com/issues/WORLDEDIT) -* [Continuous integration](http://builds.enginehub.org) [![Build Status](https://travis-ci.org/sk89q/WorldEdit.svg?branch=master)](https://travis-ci.org/sk89q/WorldEdit) -* [End-user documentation](http://wiki.sk89q.com/wiki/WorldEdit) +![WorldEdit](http://static.sk89q.com/readme/worldedit.png) +========= + +WorldEdit is Minecraft mod that turns Minecraft into an in-game map editor (sorta, kinda). + +* Make awesome stuff with half the time OR make ***quadriply** awesome* creations with the same time :sparkles: +* Get lost in hundreds of options and functions that even we've forgotten existed +* Utilize Photoshop-like tools like "selection areas" and "brushes" +* Making fjords and other natural wonders with weird names +* Also: fix grief, broken water, missing snow, raging fires, and other :poop: + +WorldEdit is open source!, so if you've just learned how to make a button blink, I probably recommend picking up a book on CS algorithms. The project is licensed using the GNU Lesser General Public License license, v3. + +Compiling +--------- + +See [COMPILING.md](COMPILING.md) for a guide on compiling WorldEdit. + +Contributing +------------ + +We happily accept contributions, especially through pull requests on GitHub. +Submissions must be licensed under the GNU Lesser General Public License v3. + +Please read [CONTRIBUTING.md](CONTRIBUTING.md) for important guidelines to follow. + +Links +----- + +* [Visit our website](http://www.enginehub.org/) +* [Discord](https://discord.gg/wvneRVm) +* [IRC channel](http://skq.me/irc/irc.esper.net/sk89q/) (#sk89q on irc.esper.net) +* [Issue tracker](http://youtrack.sk89q.com/issues/WORLDEDIT) +* [Continuous integration](http://builds.enginehub.org) [![Build Status](https://travis-ci.org/sk89q/WorldEdit.svg?branch=master)](https://travis-ci.org/sk89q/WorldEdit) +* [End-user documentation](http://wiki.sk89q.com/wiki/WorldEdit) From 3e1c58c99bf63e7f49d740723944fa4a45341ba3 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 1 Oct 2018 15:17:05 -0700 Subject: [PATCH 07/40] Implement some optional methods in ForgeWorld --- .../com/sk89q/worldedit/forge/ForgeWorld.java | 65 +++++++++++++++++-- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index e5cbcaf4d..676c77b50 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.io.Files; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.BlockVector; +import com.sk89q.worldedit.BlockVector2D; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; @@ -47,6 +48,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.registry.LegacyMapper; import com.sk89q.worldedit.world.weather.WeatherType; +import com.sk89q.worldedit.world.weather.WeatherTypes; + import net.minecraft.block.Block; import net.minecraft.block.BlockLeaves; import net.minecraft.block.BlockOldLeaf; @@ -86,6 +89,7 @@ import net.minecraft.world.gen.feature.WorldGenTaiga1; import net.minecraft.world.gen.feature.WorldGenTaiga2; import net.minecraft.world.gen.feature.WorldGenTrees; import net.minecraft.world.gen.feature.WorldGenerator; +import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.common.DimensionManager; import java.io.File; @@ -93,7 +97,6 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.Random; -import java.util.UUID; import javax.annotation.Nullable; @@ -351,25 +354,75 @@ public class ForgeWorld extends AbstractWorld { return generator != null && generator.generate(getWorld(), random, ForgeAdapter.toBlockPos(position)); } + @Override + public void checkLoadedChunk(Vector pt) { + getWorld().getChunkFromBlockCoords(ForgeAdapter.toBlockPos(pt)); + } + + @Override + public void fixAfterFastMode(Iterable chunks) { + fixLighting(chunks); + } + + @Override + public void fixLighting(Iterable chunks) { + World world = getWorld(); + for (BlockVector2D chunk : chunks) { + world.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ()).resetRelightChecks(); + } + } + + @Override + public boolean playEffect(Vector position, int type, int data) { + getWorld().playEvent(type, ForgeAdapter.toBlockPos(position), data); + return true; + } + @Override public WeatherType getWeather() { - // TODO Weather implementation - return null; + WorldInfo info = getWorld().getWorldInfo(); + if (info.isThundering()) { + return WeatherTypes.THUNDER_STORM; + } + if (info.isRaining()) { + return WeatherTypes.RAIN; + } + return WeatherTypes.CLEAR; } @Override public long getRemainingWeatherDuration() { - return 0; + WorldInfo info = getWorld().getWorldInfo(); + if (info.isThundering()) { + return info.getThunderTime(); + } + if (info.isRaining()) { + return info.getRainTime(); + } + return info.getCleanWeatherTime(); } @Override public void setWeather(WeatherType weatherType) { - + setWeather(weatherType, 0); } @Override public void setWeather(WeatherType weatherType, long duration) { - + WorldInfo info = getWorld().getWorldInfo(); + if (WeatherTypes.THUNDER_STORM.equals(weatherType)) { + info.setCleanWeatherTime(0); + info.setThundering(true); + info.setThunderTime((int) duration); + } else if (WeatherTypes.RAIN.equals(weatherType)) { + info.setCleanWeatherTime(0); + info.setRaining(true); + info.setRainTime((int) duration); + } else if (WeatherTypes.CLEAR.equals(weatherType)) { + info.setRaining(false); + info.setThundering(false); + info.setCleanWeatherTime((int) duration); + } } @Override From 36cbc5d9d0f9f9c692724d724f4f33b15617fd5c Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 1 Oct 2018 15:30:23 -0700 Subject: [PATCH 08/40] Cleanup javadoc warnings in worldedit-core --- .../src/main/java/com/sk89q/worldedit/LocalSession.java | 2 +- .../worldedit/extent/validation/BlockChangeLimiter.java | 6 +++--- .../com/sk89q/worldedit/internal/expression/Expression.java | 2 +- .../java/com/sk89q/worldedit/util/formatting/Style.java | 2 +- .../java/com/sk89q/worldedit/world/block/BlockType.java | 2 +- .../java/com/sk89q/worldedit/world/storage/ChunkStore.java | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index c0f3a5b54..85ca1d12a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -526,7 +526,7 @@ public class LocalSession { * Get the tool assigned to the item. * * @param item the item type - * @return the tool, which may be {@link null} + * @return the tool, which may be {@code null} */ @Nullable public Tool getTool(ItemType item) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java index c3332a250..a25477235 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java @@ -41,7 +41,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent { * Create a new instance. * * @param extent the extent - * @param limit the limit (>= 0) or -1 for no limit + * @param limit the limit (>= 0) or -1 for no limit */ public BlockChangeLimiter(Extent extent, int limit) { super(extent); @@ -51,7 +51,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent { /** * Get the limit. * - * @return the limit (>= 0) or -1 for no limit + * @return the limit (>= 0) or -1 for no limit */ public int getLimit() { return limit; @@ -60,7 +60,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent { /** * Set the limit. * - * @param limit the limit (>= 0) or -1 for no limit + * @param limit the limit (>= 0) or -1 for no limit */ public void setLimit(int limit) { checkArgument(limit >= -1, "limit >= -1 required"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java index 12190d532..463792213 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Expression.java @@ -41,7 +41,7 @@ import java.util.Stack; *

Supported operators:

* *