Update to Minecraft 1.18-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-22 09:00:00 +11:00
parent a852b81a69
commit 43702a9e10
700 changed files with 10286 additions and 10098 deletions

View File

@@ -36,36 +36,36 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
}
@Override
public IBlockData getType(BlockPosition bp) {
public IBlockData getBlockState(BlockPosition bp) {
IBlockData blockData = dataMap.get(bp);
return (blockData != null) ? blockData : world.getType(bp);
return (blockData != null) ? blockData : world.getBlockState(bp);
}
@Override
public Fluid getFluid(BlockPosition bp) {
public Fluid getFluidState(BlockPosition bp) {
IBlockData blockData = dataMap.get(bp);
return (blockData != null) ? blockData.getFluid() : world.getFluid(bp);
return (blockData != null) ? blockData.getFluidState() : world.getFluidState(bp);
}
@Override
public TileEntity getTileEntity(BlockPosition blockposition) {
public TileEntity getBlockEntity(BlockPosition blockposition) {
// The contains is important to check for null values
if (entityMap.containsKey(blockposition)) {
return entityMap.get(blockposition);
}
return world.getTileEntity(blockposition);
return world.getBlockEntity(blockposition);
}
@Override
public boolean setTypeAndData(BlockPosition position, IBlockData data, int flag) {
position = position.immutableCopy();
public boolean setBlock(BlockPosition position, IBlockData data, int flag) {
position = position.immutable();
// remove first to keep insertion order
list.remove(position);
dataMap.put(position, data);
if (data.isTileEntity()) {
entityMap.put(position, ((ITileEntity) data.getBlock()).createTile(position, data));
if (data.hasBlockEntity()) {
entityMap.put(position, ((ITileEntity) data.getBlock()).newBlockEntity(position, data));
} else {
entityMap.put(position, null);
}
@@ -122,12 +122,12 @@ public class BlockStateListPopulator extends DummyGeneratorAccess {
}
@Override
public boolean a(BlockPosition blockposition, Predicate<IBlockData> predicate) {
return predicate.test(getType(blockposition));
public boolean isStateAtPosition(BlockPosition blockposition, Predicate<IBlockData> predicate) {
return predicate.test(getBlockState(blockposition));
}
@Override
public DimensionManager getDimensionManager() {
return world.getDimensionManager();
public DimensionManager dimensionType() {
return world.dimensionType();
}
}

View File

@@ -146,6 +146,39 @@ public class Commodore
case "NETHER":
super.visitFieldInsn( opcode, owner, "NETHER_WASTES", desc );
return;
case "TALL_BIRCH_FOREST":
super.visitFieldInsn( opcode, owner, "OLD_GROWTH_BIRCH_FOREST", desc );
return;
case "GIANT_TREE_TAIGA":
super.visitFieldInsn( opcode, owner, "OLD_GROWTH_PINE_TAIGA", desc );
return;
case "GIANT_SPRUCE_TAIGA":
super.visitFieldInsn( opcode, owner, "OLD_GROWTH_SPRUCE_TAIGA", desc );
return;
case "SNOWY_TUNDRA":
super.visitFieldInsn( opcode, owner, "SNOWY_PLAINS", desc );
return;
case "JUNGLE_EDGE":
super.visitFieldInsn( opcode, owner, "SPARSE_JUNGLE", desc );
return;
case "STONE_SHORE":
super.visitFieldInsn( opcode, owner, "STONY_SHORE", desc );
return;
case "MOUNTAINS":
super.visitFieldInsn( opcode, owner, "WINDSWEPT_HILLS", desc );
return;
case "WOODED_MOUNTAINS":
super.visitFieldInsn( opcode, owner, "WINDSWEPT_FOREST", desc );
return;
case "GRAVELLY_MOUNTAINS":
super.visitFieldInsn( opcode, owner, "WINDSWEPT_GRAVELLY_HILLS", desc );
return;
case "SHATTERED_SAVANNA":
super.visitFieldInsn( opcode, owner, "WINDSWEPT_SAVANNA", desc );
return;
case "WOODED_BADLANDS_PLATEAU":
super.visitFieldInsn( opcode, owner, "WOODED_BADLANDS", desc );
return;
}
}
@@ -358,6 +391,18 @@ public class Commodore
super.visitMethodInsn( opcode, owner, name, desc, itf );
}
@Override
public void visitLdcInsn(Object value)
{
if ( value instanceof String && ( (String) value ).equals( "com.mysql.jdbc.Driver" ) )
{
super.visitLdcInsn( "com.mysql.cj.jdbc.Driver" );
return;
}
super.visitLdcInsn( value );
}
};
}
}, 0 );

View File

@@ -46,7 +46,7 @@ public final class CraftChatMessage {
// Separate pattern with no group 3, new lines are part of previous string
private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE);
// ChatColor.b does not explicitly reset, its more of empty
private static final ChatModifier RESET = ChatModifier.EMPTY.setBold(false).setItalic(false).setUnderline(false).setStrikethrough(false).setRandom(false);
private static final ChatModifier RESET = ChatModifier.EMPTY.withBold(false).withItalic(false).withUnderlined(false).withStrikethrough(false).withObfuscated(false);
private final List<IChatBaseComponent> list = new ArrayList<IChatBaseComponent>();
private IChatMutableComponent currentChatComponent = new ChatComponentText("");
@@ -88,31 +88,31 @@ public final class CraftChatMessage {
hex.append(c);
if (hex.length() == 7) {
modifier = RESET.setColor(ChatHexColor.a(hex.toString()));
modifier = RESET.withColor(ChatHexColor.parseColor(hex.toString()));
hex = null;
}
} else if (format.isFormat() && format != EnumChatFormat.RESET) {
switch (format) {
case BOLD:
modifier = modifier.setBold(Boolean.TRUE);
modifier = modifier.withBold(Boolean.TRUE);
break;
case ITALIC:
modifier = modifier.setItalic(Boolean.TRUE);
modifier = modifier.withItalic(Boolean.TRUE);
break;
case STRIKETHROUGH:
modifier = modifier.setStrikethrough(Boolean.TRUE);
modifier = modifier.withStrikethrough(Boolean.TRUE);
break;
case UNDERLINE:
modifier = modifier.setUnderline(Boolean.TRUE);
modifier = modifier.withUnderlined(Boolean.TRUE);
break;
case OBFUSCATED:
modifier = modifier.setRandom(Boolean.TRUE);
modifier = modifier.withObfuscated(Boolean.TRUE);
break;
default:
throw new AssertionError("Unexpected message format");
}
} else { // Color resets formatting
modifier = RESET.setColor(format);
modifier = RESET.withColor(format);
}
needsAdd = true;
break;
@@ -123,9 +123,9 @@ public final class CraftChatMessage {
if (!(match.startsWith("http://") || match.startsWith("https://"))) {
match = "http://" + match;
}
modifier = modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
modifier = modifier.withClickEvent(new ChatClickable(EnumClickAction.OPEN_URL, match));
appendNewComponent(matcher.end(groupId));
modifier = modifier.setChatClickable((ChatClickable) null);
modifier = modifier.withClickEvent((ChatClickable) null);
}
break;
case 3:
@@ -146,13 +146,13 @@ public final class CraftChatMessage {
}
private void appendNewComponent(int index) {
IChatBaseComponent addition = new ChatComponentText(message.substring(currentIndex, index)).setChatModifier(modifier);
IChatBaseComponent addition = new ChatComponentText(message.substring(currentIndex, index)).setStyle(modifier);
currentIndex = index;
if (currentChatComponent == null) {
currentChatComponent = new ChatComponentText("");
list.add(currentChatComponent);
}
currentChatComponent.addSibling(addition);
currentChatComponent.append(addition);
}
private IChatBaseComponent[] getOutput() {
@@ -181,7 +181,7 @@ public final class CraftChatMessage {
}
public static String toJSON(IChatBaseComponent component) {
return IChatBaseComponent.ChatSerializer.a(component);
return IChatBaseComponent.ChatSerializer.toJson(component);
}
public static String toJSONOrNull(IChatBaseComponent component) {
@@ -192,7 +192,7 @@ public final class CraftChatMessage {
public static IChatBaseComponent fromJSON(String jsonMessage) throws JsonParseException {
// Note: This also parses plain Strings to text components.
// Note: An empty message (empty, or only consisting of whitespace) results in null rather than a parse exception.
return IChatBaseComponent.ChatSerializer.a(jsonMessage);
return IChatBaseComponent.ChatSerializer.fromJson(jsonMessage);
}
public static IChatBaseComponent fromJSONOrNull(String jsonMessage) {
@@ -294,15 +294,15 @@ public final class CraftChatMessage {
boolean hadFormat = false;
for (IChatBaseComponent c : component) {
ChatModifier modi = c.getChatModifier();
ChatModifier modi = c.getStyle();
ChatHexColor color = modi.getColor();
if (!c.getText().isEmpty() || color != null) {
if (!c.getContents().isEmpty() || color != null) {
if (color != null) {
if (color.format != null) {
out.append(color.format);
} else {
out.append(ChatColor.COLOR_CHAR).append("x");
for (char magic : color.b().substring(1).toCharArray()) {
for (char magic : color.serialize().substring(1).toCharArray()) {
out.append(ChatColor.COLOR_CHAR).append(magic);
}
}
@@ -328,11 +328,11 @@ public final class CraftChatMessage {
out.append(EnumChatFormat.STRIKETHROUGH);
hadFormat = true;
}
if (modi.isRandom()) {
if (modi.isObfuscated()) {
out.append(EnumChatFormat.OBFUSCATED);
hadFormat = true;
}
c.b((x) -> {
c.visitSelf((x) -> {
out.append(x);
return Optional.empty();
});
@@ -348,11 +348,11 @@ public final class CraftChatMessage {
private static IChatBaseComponent fixComponent(IChatBaseComponent component, Matcher matcher) {
if (component instanceof ChatComponentText) {
ChatComponentText text = ((ChatComponentText) component);
String msg = text.getText();
String msg = text.getContents();
if (matcher.reset(msg).find()) {
matcher.reset();
ChatModifier modifier = text.getChatModifier();
ChatModifier modifier = text.getStyle();
List<IChatBaseComponent> extras = new ArrayList<IChatBaseComponent>();
List<IChatBaseComponent> extrasOld = new ArrayList<IChatBaseComponent>(text.getSiblings());
component = text = new ChatComponentText("");
@@ -366,24 +366,24 @@ public final class CraftChatMessage {
}
ChatComponentText prev = new ChatComponentText(msg.substring(pos, matcher.start()));
prev.setChatModifier(modifier);
prev.setStyle(modifier);
extras.add(prev);
ChatComponentText link = new ChatComponentText(matcher.group());
ChatModifier linkModi = modifier.setChatClickable(new ChatClickable(EnumClickAction.OPEN_URL, match));
link.setChatModifier(linkModi);
ChatModifier linkModi = modifier.withClickEvent(new ChatClickable(EnumClickAction.OPEN_URL, match));
link.setStyle(linkModi);
extras.add(link);
pos = matcher.end();
}
ChatComponentText prev = new ChatComponentText(msg.substring(pos));
prev.setChatModifier(modifier);
prev.setStyle(modifier);
extras.add(prev);
extras.addAll(extrasOld);
for (IChatBaseComponent c : extras) {
text.addSibling(c);
text.append(c);
}
}
}
@@ -391,7 +391,7 @@ public final class CraftChatMessage {
List<IChatBaseComponent> extras = component.getSiblings();
for (int i = 0; i < extras.size(); i++) {
IChatBaseComponent comp = extras.get(i);
if (comp.getChatModifier() != null && comp.getChatModifier().getClickEvent() == null) {
if (comp.getStyle() != null && comp.getStyle().getClickEvent() == null) {
extras.set(i, fixComponent(comp, matcher));
}
}
@@ -402,7 +402,7 @@ public final class CraftChatMessage {
Object comp = subs[i];
if (comp instanceof IChatBaseComponent) {
IChatBaseComponent c = (IChatBaseComponent) comp;
if (c.getChatModifier() != null && c.getChatModifier().getClickEvent() == null) {
if (c.getStyle() != null && c.getStyle().getClickEvent() == null) {
subs[i] = fixComponent(c, matcher);
}
} else if (comp instanceof String && matcher.reset((String) comp).find()) {

View File

@@ -8,8 +8,8 @@ public final class CraftDamageSource extends DamageSource {
CraftDamageSource newSource = new CraftDamageSource(original.msgId);
// Check ignoresArmor
if (original.ignoresArmor()) {
newSource.setIgnoreArmor();
if (original.isBypassArmor()) {
newSource.bypassArmor();
}
// Check magic

View File

@@ -19,6 +19,6 @@ public class CraftDimensionUtil {
return World.END;
}
return world.getDimensionKey();
return world.dimension();
}
}

View File

@@ -93,11 +93,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
static {
for (Block block : IRegistry.BLOCK) {
BLOCK_MATERIAL.put(block, Material.getMaterial(IRegistry.BLOCK.getKey(block).getKey().toUpperCase(Locale.ROOT)));
BLOCK_MATERIAL.put(block, Material.getMaterial(IRegistry.BLOCK.getKey(block).getPath().toUpperCase(Locale.ROOT)));
}
for (Item item : IRegistry.ITEM) {
ITEM_MATERIAL.put(item, Material.getMaterial(IRegistry.ITEM.getKey(item).getKey().toUpperCase(Locale.ROOT)));
ITEM_MATERIAL.put(item, Material.getMaterial(IRegistry.ITEM.getKey(item).getPath().toUpperCase(Locale.ROOT)));
}
for (FluidType fluid : IRegistry.FLUID) {
@@ -198,11 +198,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
return Material.getMaterial(material);
}
Dynamic<NBTBase> name = new Dynamic<>(DynamicOpsNBT.INSTANCE, NBTTagString.a("minecraft:" + material.toLowerCase(Locale.ROOT)));
Dynamic<NBTBase> converted = DataConverterRegistry.a().update(DataConverterTypes.ITEM_NAME, name, version, this.getDataVersion());
Dynamic<NBTBase> name = new Dynamic<>(DynamicOpsNBT.INSTANCE, NBTTagString.valueOf("minecraft:" + material.toLowerCase(Locale.ROOT)));
Dynamic<NBTBase> converted = DataConverterRegistry.getDataFixer().update(DataConverterTypes.ITEM_NAME, name, version, this.getDataVersion());
if (name.equals(converted)) {
converted = DataConverterRegistry.a().update(DataConverterTypes.BLOCK_NAME, name, version, this.getDataVersion());
converted = DataConverterRegistry.getDataFixer().update(DataConverterTypes.BLOCK_NAME, name, version, this.getDataVersion());
}
return Material.matchMaterial(converted.asString(""));
@@ -224,12 +224,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
* @return string
*/
public String getMappingsVersion() {
return "f0e3dfc7390de285a4693518dd5bd126";
return "f926f0531f0874c1b0bcb6f1f7655751";
}
@Override
public int getDataVersion() {
return SharedConstants.getGameVersion().getWorldVersion();
return SharedConstants.getCurrentVersion().getWorldVersion();
}
@Override
@@ -237,7 +237,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
try {
nmsStack.setTag((NBTTagCompound) MojangsonParser.parse(arguments));
nmsStack.setTag((NBTTagCompound) MojangsonParser.parseTag(arguments));
} catch (CommandSyntaxException ex) {
Logger.getLogger(CraftMagicNumbers.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -248,7 +248,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
private static File getBukkitDataPackFolder() {
return new File(MinecraftServer.getServer().a(SavedFile.DATAPACK_DIR).toFile(), "bukkit");
return new File(MinecraftServer.getServer().getWorldPath(SavedFile.DATAPACK_DIR).toFile(), "bukkit");
}
@Override
@@ -259,10 +259,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
MinecraftKey minecraftkey = CraftNamespacedKey.toMinecraft(key);
JsonElement jsonelement = AdvancementDataWorld.GSON.fromJson(advancement, JsonElement.class);
JsonObject jsonobject = ChatDeserializer.m(jsonelement, "advancement");
net.minecraft.advancements.Advancement.SerializedAdvancement nms = net.minecraft.advancements.Advancement.SerializedAdvancement.a(jsonobject, new LootDeserializationContext(minecraftkey, MinecraftServer.getServer().getLootPredicateManager()));
JsonObject jsonobject = ChatDeserializer.convertToJsonObject(jsonelement, "advancement");
net.minecraft.advancements.Advancement.SerializedAdvancement nms = net.minecraft.advancements.Advancement.SerializedAdvancement.fromJson(jsonobject, new LootDeserializationContext(minecraftkey, MinecraftServer.getServer().getPredicateManager()));
if (nms != null) {
MinecraftServer.getServer().getAdvancementData().advancements.a(Maps.newHashMap(Collections.singletonMap(minecraftkey, nms)));
MinecraftServer.getServer().getAdvancements().advancements.add(Maps.newHashMap(Collections.singletonMap(minecraftkey, nms)));
Advancement bukkit = Bukkit.getAdvancement(key);
if (bukkit != null) {
@@ -275,7 +275,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex);
}
MinecraftServer.getServer().getPlayerList().reload();
MinecraftServer.getServer().getPlayerList().reloadResources();
return bukkit;
}
@@ -290,7 +290,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
return file.delete();
}
private static final List<String> SUPPORTED_API = Arrays.asList("1.13", "1.14", "1.15", "1.16", "1.17");
private static final List<String> SUPPORTED_API = Arrays.asList("1.13", "1.14", "1.15", "1.16", "1.17", "1.18");
@Override
public void checkSupported(PluginDescriptionFile pdf) throws InvalidPluginException {

View File

@@ -26,7 +26,7 @@ public class CraftNBTTagConfigSerializer {
public static Object serialize(NBTBase base) {
if (base instanceof NBTTagCompound) {
Map<String, Object> innerMap = new HashMap<>();
for (String key : ((NBTTagCompound) base).getKeys()) {
for (String key : ((NBTTagCompound) base).getAllKeys()) {
innerMap.put(key, serialize(((NBTTagCompound) base).get(key)));
}
@@ -39,7 +39,7 @@ public class CraftNBTTagConfigSerializer {
return baseList;
} else if (base instanceof NBTTagString) {
return base.asString();
return base.getAsString();
} else if (base instanceof NBTTagInt) { // No need to check for doubles, those are covered by the double itself
return base.toString() + "i";
}
@@ -51,7 +51,7 @@ public class CraftNBTTagConfigSerializer {
if (object instanceof Map) {
NBTTagCompound compound = new NBTTagCompound();
for (Map.Entry<String, Object> entry : ((Map<String, Object>) object).entrySet()) {
compound.set(entry.getKey(), deserialize(entry.getValue()));
compound.put(entry.getKey(), deserialize(entry.getValue()));
}
return compound;
@@ -72,21 +72,21 @@ public class CraftNBTTagConfigSerializer {
if (ARRAY.matcher(string).matches()) {
try {
return new MojangsonParser(new StringReader(string)).parseArray();
return new MojangsonParser(new StringReader(string)).readArrayTag();
} catch (CommandSyntaxException e) {
throw new RuntimeException("Could not deserialize found list ", e);
}
} else if (INTEGER.matcher(string).matches()) { //Read integers on our own
return NBTTagInt.a(Integer.parseInt(string.substring(0, string.length() - 1)));
return NBTTagInt.valueOf(Integer.parseInt(string.substring(0, string.length() - 1)));
} else if (DOUBLE.matcher(string).matches()) {
return NBTTagDouble.a(Double.parseDouble(string.substring(0, string.length() - 1)));
return NBTTagDouble.valueOf(Double.parseDouble(string.substring(0, string.length() - 1)));
} else {
NBTBase nbtBase = MOJANGSON_PARSER.parseLiteral(string);
NBTBase nbtBase = MOJANGSON_PARSER.type(string);
if (nbtBase instanceof NBTTagInt) { // If this returns an integer, it did not use our method from above
return NBTTagString.a(nbtBase.asString()); // It then is a string that was falsely read as an int
return NBTTagString.valueOf(nbtBase.getAsString()); // It then is a string that was falsely read as an int
} else if (nbtBase instanceof NBTTagDouble) {
return NBTTagString.a(String.valueOf(((NBTTagDouble) nbtBase).asDouble())); // Doubles add "d" at the end
return NBTTagString.valueOf(String.valueOf(((NBTTagDouble) nbtBase).getAsDouble())); // Doubles add "d" at the end
} else {
return nbtBase;
}

View File

@@ -12,7 +12,7 @@ public final class CraftNamespacedKey {
if (string == null || string.isEmpty()) {
return null;
}
MinecraftKey minecraft = MinecraftKey.a(string);
MinecraftKey minecraft = MinecraftKey.tryParse(string);
return (minecraft == null) ? null : fromMinecraft(minecraft);
}
@@ -21,7 +21,7 @@ public final class CraftNamespacedKey {
}
public static NamespacedKey fromMinecraft(MinecraftKey minecraft) {
return new NamespacedKey(minecraft.getNamespace(), minecraft.getKey());
return new NamespacedKey(minecraft.getNamespace(), minecraft.getPath());
}
public static MinecraftKey toMinecraft(NamespacedKey key) {

View File

@@ -21,7 +21,7 @@ public final class CraftRayTraceResult {
public static RayTraceResult fromNMS(World world, MovingObjectPosition nmsHitResult) {
if (nmsHitResult == null || nmsHitResult.getType() == EnumMovingObjectType.MISS) return null;
Vec3D nmsHitPos = nmsHitResult.getPos();
Vec3D nmsHitPos = nmsHitResult.getLocation();
Vector hitPosition = new Vector(nmsHitPos.x, nmsHitPos.y, nmsHitPos.z);
BlockFace hitBlockFace = null;
@@ -35,7 +35,7 @@ public final class CraftRayTraceResult {
if (nmsHitResult.getType() == EnumMovingObjectType.BLOCK) {
MovingObjectPositionBlock blockHitResult = (MovingObjectPositionBlock) nmsHitResult;
hitBlockFace = CraftBlock.notchToBlockFace(blockHitResult.getDirection());
nmsBlockPos = blockHitResult.getBlockPosition();
nmsBlockPos = blockHitResult.getBlockPos();
}
if (nmsBlockPos != null && world != null) {
hitBlock = world.getBlockAt(nmsBlockPos.getX(), nmsBlockPos.getY(), nmsBlockPos.getZ());

View File

@@ -18,7 +18,7 @@ public final class CraftVoxelShape implements org.bukkit.util.VoxelShape {
@Override
public Collection<BoundingBox> getBoundingBoxes() {
List<AxisAlignedBB> boxes = shape.toList();
List<AxisAlignedBB> boxes = shape.toAabbs();
List<BoundingBox> craftBoxes = new ArrayList<>(boxes.size());
for (AxisAlignedBB aabb : boxes) {
craftBoxes.add(new BoundingBox(aabb.minX, aabb.minY, aabb.minZ, aabb.maxX, aabb.maxY, aabb.maxZ));

View File

@@ -3,7 +3,6 @@ package org.bukkit.craftbukkit.util;
import java.util.List;
import java.util.Random;
import java.util.function.Predicate;
import java.util.stream.Stream;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.EnumDirection;
import net.minecraft.core.IRegistryCustom;
@@ -17,8 +16,6 @@ import net.minecraft.world.DifficultyDamageScaler;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.level.GeneratorAccessSeed;
import net.minecraft.world.level.TickList;
import net.minecraft.world.level.TickListEmpty;
import net.minecraft.world.level.biome.BiomeBase;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.Block;
@@ -41,6 +38,8 @@ import net.minecraft.world.level.material.FluidType;
import net.minecraft.world.level.material.FluidTypes;
import net.minecraft.world.level.storage.WorldData;
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.ticks.LevelTickAccess;
import net.minecraft.world.ticks.TickListEmpty;
public class DummyGeneratorAccess implements GeneratorAccessSeed {
@@ -50,32 +49,52 @@ public class DummyGeneratorAccess implements GeneratorAccessSeed {
}
@Override
public TickList<Block> getBlockTickList() {
return TickListEmpty.b();
}
@Override
public TickList<FluidType> getFluidTickList() {
return TickListEmpty.b();
}
@Override
public WorldData getWorldData() {
public long getSeed() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public DifficultyDamageScaler getDamageScaler(BlockPosition blockposition) {
public List<? extends StructureStart<?>> startsForFeature(SectionPosition sp, StructureGenerator<?> sg) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public MinecraftServer getMinecraftServer() {
public WorldServer getLevel() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IChunkProvider getChunkProvider() {
public long nextSubTickCount() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public LevelTickAccess<Block> getBlockTicks() {
return TickListEmpty.emptyLevelList();
}
@Override
public LevelTickAccess<FluidType> getFluidTicks() {
return TickListEmpty.emptyLevelList();
}
@Override
public WorldData getLevelData() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public DifficultyDamageScaler getCurrentDifficultyAt(BlockPosition blockposition) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public MinecraftServer getServer() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IChunkProvider getChunkSource() {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -95,27 +114,17 @@ public class DummyGeneratorAccess implements GeneratorAccessSeed {
}
@Override
public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {
public void levelEvent(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) {
// Used by PowderSnowBlock.removeFluid
}
@Override
public void a(Entity entity, GameEvent gameevent, BlockPosition blockposition) {
public void gameEvent(Entity entity, GameEvent gameevent, BlockPosition blockposition) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public WorldServer getLevel() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public WorldServer getMinecraftWorld() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IRegistryCustom t() {
public IRegistryCustom registryAccess() {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -125,37 +134,37 @@ public class DummyGeneratorAccess implements GeneratorAccessSeed {
}
@Override
public <T extends Entity> List<T> a(EntityTypeTest<Entity, T> ett, AxisAlignedBB aabb, Predicate<? super T> prdct) {
public <T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> ett, AxisAlignedBB aabb, Predicate<? super T> prdct) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<? extends EntityHuman> getPlayers() {
public List<? extends EntityHuman> players() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IChunkAccess getChunkAt(int i, int i1, ChunkStatus cs, boolean bln) {
public IChunkAccess getChunk(int i, int i1, ChunkStatus cs, boolean bln) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int a(HeightMap.Type type, int i, int i1) {
public int getHeight(HeightMap.Type type, int i, int i1) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int n_() {
public int getSkyDarken() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public BiomeManager r_() {
public BiomeManager getBiomeManager() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public BiomeBase a(int i, int i1, int i2) {
public BiomeBase getUncachedNoiseBiome(int i, int i1, int i2) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -170,33 +179,33 @@ public class DummyGeneratorAccess implements GeneratorAccessSeed {
}
@Override
public DimensionManager getDimensionManager() {
public DimensionManager dimensionType() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public float a(EnumDirection ed, boolean bln) {
public float getShade(EnumDirection ed, boolean bln) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public LightEngine k_() {
public LightEngine getLightEngine() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public TileEntity getTileEntity(BlockPosition blockposition) {
public TileEntity getBlockEntity(BlockPosition blockposition) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public IBlockData getType(BlockPosition blockposition) {
return Blocks.AIR.getBlockData(); // SPIGOT-6515
public IBlockData getBlockState(BlockPosition blockposition) {
return Blocks.AIR.defaultBlockState(); // SPIGOT-6515
}
@Override
public Fluid getFluid(BlockPosition blockposition) {
return FluidTypes.EMPTY.h(); // SPIGOT-6634
public Fluid getFluidState(BlockPosition blockposition) {
return FluidTypes.EMPTY.defaultFluidState(); // SPIGOT-6634
}
@Override
@@ -205,37 +214,27 @@ public class DummyGeneratorAccess implements GeneratorAccessSeed {
}
@Override
public boolean a(BlockPosition bp, Predicate<IBlockData> prdct) {
public boolean isStateAtPosition(BlockPosition bp, Predicate<IBlockData> prdct) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean b(BlockPosition bp, Predicate<Fluid> prdct) {
public boolean isFluidAtPosition(BlockPosition bp, Predicate<Fluid> prdct) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
return false;
}
@Override
public boolean a(BlockPosition blockposition, boolean flag) {
public boolean removeBlock(BlockPosition blockposition, boolean flag) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean a(BlockPosition blockposition, boolean flag, Entity entity, int i) {
public boolean destroyBlock(BlockPosition blockposition, boolean flag, Entity entity, int i) {
return false; // SPIGOT-6515
}
@Override
public long getSeed() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<? extends StructureStart<?>> a(SectionPosition sectionPosition, StructureGenerator<?> structureGenerator) {
throw new UnsupportedOperationException("Not supported yet.");
}
}