From 3d6ca55bcf99464833fce067c13d81ffd8d3d6d4 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sat, 6 Jul 2024 23:38:01 -0500 Subject: [PATCH 01/15] fix infinite init.js --- init.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/init.js b/init.js index f4c22db..2e70d57 100644 --- a/init.js +++ b/init.js @@ -11,13 +11,25 @@ const parseArg = require('./utils/parseArguments'); const DECOMPILE_VERSION = parseArg('MC', DEFAULT_MINECRAFT_VERSION); const OLD_VERSION = parseArg('OLD_MC', null); -let MINECRAFT_VERSION = "UNKNOWN"; +let MINECRAFT_VERSION = 'UNKNOWN'; (async function () { try { - if (!checkMinecraftVersion(DECOMPILE_VERSION)) return error(`Using invalid Minecraft version '${DECOMPILE_VERSION}'`); - if (OLD_VERSION && !checkMinecraftVersion(OLD_VERSION)) return error(`Using invalid Minecraft version '${OLD_VERSION}'`); - if (!fs.existsSync('mache/gradlew')) return error('Run git submodule update --init --recursive'); + if (!checkMinecraftVersion(DECOMPILE_VERSION)) { + error(`Using invalid Minecraft version '${DECOMPILE_VERSION}'`); + return process.exit(1); + } + + if (OLD_VERSION && !checkMinecraftVersion(OLD_VERSION)) { + error(`Using invalid Minecraft version '${OLD_VERSION}'`); + return process.exit(1); + } + + if (!fs.existsSync('mache/gradlew')) { + error('Run git submodule update --init --recursive'); + return process.exit(1); + } + MINECRAFT_VERSION = DECOMPILE_VERSION.split('/').pop(); if (process.platform !== 'win32') { From a9a985bd2f9a112f8385e65b2d9706fb36a27654 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sat, 6 Jul 2024 23:45:05 -0500 Subject: [PATCH 02/15] fix minecraft version regex --- config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.js b/config.js index bbfe832..6e0c854 100644 --- a/config.js +++ b/config.js @@ -79,7 +79,7 @@ function cacheExpired(pathToFile, MAX_CACHE_TIME_DAYS = 1) { * @returns {Boolean} true if matches */ function checkMinecraftVersion(version) { - return /(^release\/([0-9]\.[1-3][0-9]\.[0-9]))$|(^snapshot\/([1-3][0-9]w[0-9][0-9][a-z])$)|(^pre\/([0-9]\.[1-3][0-9]\.[0-9]\-pre[0-9])$)/g.test(version); + return /(^release\/([0-9]\.[1-3][0-9](?:\.[0-9])|[0-9]\.[1-3][0-9]))$|(^snapshot\/([1-3][0-9]w[0-9][0-9][a-z])$)|(^pre\/((?:[0-9]\.[1-3][0-9]\.[0-9])|(?:[0-9]\.[1-3][0-9]))\-pre[0-9]$)/g.test(version); } module.exports = { From f31c0217f2cc8e300256d15b360222934fbc3e6f Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 00:16:48 -0500 Subject: [PATCH 03/15] start working on 1.21 --- .../1.21/net/minecraft/ChatFormatting.patch | 13 + .../1.21/net/minecraft/CrashReport.patch | 12 + .../net/minecraft/commands/Commands.patch | 24 + .../1.21/net/minecraft/server/Main.patch | 17 + .../minecraft/server/MinecraftServer.patch | 13 + .../server/dedicated/DedicatedServer.patch | 20 + .../net/minecraft/server/level/ChunkMap.patch | 22 + .../minecraft/server/level/ServerEntity.patch | 44 + .../minecraft/server/level/ServerPlayer.patch | 64 ++ .../server/level/ServerPlayerGameMode.patch | 25 + .../ServerGamePacketListenerImpl.patch | 28 + .../ServerLoginPacketListenerImpl.patch | 18 + .../minecraft/server/players/PlayerList.patch | 27 + .../world/damagesource/DamageSource.patch | 11 + .../minecraft/world/entity/LivingEntity.patch | 36 + .../minecraft/world/entity/animal/Squid.patch | 13 + .../world/entity/animal/sniffer/Sniffer.patch | 13 + .../world/entity/item/ItemEntity.patch | 25 + .../world/entity/monster/Shulker.patch | 13 + .../world/entity/monster/Vindicator.patch | 13 + .../world/entity/monster/hoglin/Hoglin.patch | 13 + .../world/entity/monster/piglin/Piglin.patch | 19 + .../world/entity/player/Player.patch | 25 + .../net/minecraft/world/item/BlockItem.patch | 35 + .../net/minecraft/world/item/ItemStack.patch | 11 + .../minecraft/world/level/BaseSpawner.patch | 21 + .../net/minecraft/world/level/ChunkPos.patch | 45 + .../minecraft/world/level/LevelReader.patch | 18 + .../minecraft/world/level/block/Block.patch | 13 + .../world/level/block/SignBlock.patch | 13 + .../world/level/block/StairBlock.patch | 13 + .../world/level/block/TrapDoorBlock.patch | 22 + .../world/level/chunk/ChunkGenerator.patch | 53 + .../world/level/chunk/ChunkStatus.patch | 13 + .../level/chunk/status/ChunkStatusTasks.patch | 14 + .../level/levelgen/BitRandomSource.patch | 13 + .../world/level/material/FlowingFluid.patch | 91 ++ .../world/level/storage/loot/LootTable.patch | 17 + patches/release/1.21/net/ouja/dish/Dish.java | 146 +++ .../1.21/net/ouja/dish/DishCrashReport.java | 39 + .../1.21/net/ouja/dish/DishProperties.java | 99 ++ .../dish/commands/RegisteredCommands.java | 61 + .../ouja/dish/commands/VersionCommand.java | 18 + .../1.21/net/ouja/dish/entity/DishEntity.java | 303 +++++ .../1.21/net/ouja/dish/entity/DishPlayer.java | 96 ++ .../ouja/dish/entity/monster/DishBlaze.java | 19 + .../ouja/dish/entity/monster/DishCreeper.java | 29 + .../ouja/dish/entity/monster/DishDrowned.java | 19 + .../entity/monster/DishElderGuardian.java | 14 + .../dish/entity/monster/DishEndermite.java | 14 + .../ouja/dish/entity/monster/DishEvoker.java | 19 + .../ouja/dish/entity/monster/DishGhast.java | 24 + .../dish/entity/monster/DishGuardian.java | 14 + .../ouja/dish/entity/monster/DishHoglin.java | 29 + .../ouja/dish/entity/monster/DishHusk.java | 14 + .../dish/entity/monster/DishMagmaCube.java | 14 + .../ouja/dish/entity/monster/DishPhantom.java | 14 + .../dish/entity/monster/DishPiglinBrute.java | 14 + .../dish/entity/monster/DishPillager.java | 19 + .../ouja/dish/entity/monster/DishRavager.java | 14 + .../ouja/dish/entity/monster/DishShulker.java | 19 + .../dish/entity/monster/DishSilverfish.java | 14 + .../dish/entity/monster/DishSkeleton.java | 24 + .../ouja/dish/entity/monster/DishSlime.java | 19 + .../ouja/dish/entity/monster/DishStray.java | 14 + .../net/ouja/dish/entity/monster/DishVex.java | 22 + .../dish/entity/monster/DishVindicator.java | 19 + .../ouja/dish/entity/monster/DishWarden.java | 14 + .../ouja/dish/entity/monster/DishWitch.java | 14 + .../entity/monster/DishWitherSkeleton.java | 14 + .../ouja/dish/entity/monster/DishZoglin.java | 14 + .../ouja/dish/entity/monster/DishZombie.java | 29 + .../dish/entity/monster/DishZombieHorse.java | 14 + .../entity/monster/DishZombieVillager.java | 13 + .../net/ouja/dish/entity/neutral/DishBee.java | 29 + .../dish/entity/neutral/DishCaveSpider.java | 14 + .../ouja/dish/entity/neutral/DishDolphin.java | 14 + .../dish/entity/neutral/DishEnderman.java | 14 + .../ouja/dish/entity/neutral/DishGoat.java | 39 + .../dish/entity/neutral/DishIronGolem.java | 24 + .../ouja/dish/entity/neutral/DishLlama.java | 20 + .../ouja/dish/entity/neutral/DishPanda.java | 44 + .../ouja/dish/entity/neutral/DishPiglin.java | 34 + .../dish/entity/neutral/DishPolarBear.java | 24 + .../ouja/dish/entity/neutral/DishSpider.java | 19 + .../dish/entity/neutral/DishTraderLlama.java | 14 + .../ouja/dish/entity/neutral/DishWolf.java | 29 + .../entity/neutral/DishZombifiedPiglin.java | 14 + .../ouja/dish/entity/passive/DishAllay.java | 14 + .../dish/entity/passive/DishArmadillo.java | 34 + .../ouja/dish/entity/passive/DishAxolotl.java | 24 + .../net/ouja/dish/entity/passive/DishBat.java | 24 + .../ouja/dish/entity/passive/DishCamel.java | 39 + .../net/ouja/dish/entity/passive/DishCat.java | 34 + .../ouja/dish/entity/passive/DishChicken.java | 14 + .../net/ouja/dish/entity/passive/DishCod.java | 14 + .../net/ouja/dish/entity/passive/DishCow.java | 14 + .../ouja/dish/entity/passive/DishDonkey.java | 14 + .../net/ouja/dish/entity/passive/DishFox.java | 19 + .../ouja/dish/entity/passive/DishFrog.java | 19 + .../dish/entity/passive/DishGlowSquid.java | 13 + .../ouja/dish/entity/passive/DishHorse.java | 26 + .../ouja/dish/entity/passive/DishMule.java | 14 + .../dish/entity/passive/DishMushroomCow.java | 22 + .../ouja/dish/entity/passive/DishOcelot.java | 14 + .../ouja/dish/entity/passive/DishParrot.java | 20 + .../net/ouja/dish/entity/passive/DishPig.java | 30 + .../dish/entity/passive/DishPufferfish.java | 19 + .../ouja/dish/entity/passive/DishRabbit.java | 20 + .../ouja/dish/entity/passive/DishSalmon.java | 14 + .../ouja/dish/entity/passive/DishSheep.java | 19 + .../entity/passive/DishSkeletonHorse.java | 19 + .../ouja/dish/entity/passive/DishSniffer.java | 35 + .../dish/entity/passive/DishSnowGolem.java | 24 + .../ouja/dish/entity/passive/DishSquid.java | 19 + .../ouja/dish/entity/passive/DishStrider.java | 30 + .../ouja/dish/entity/passive/DishTadpole.java | 14 + .../dish/entity/passive/DishTropicalFish.java | 19 + .../ouja/dish/entity/passive/DishTurtle.java | 24 + .../dish/entity/passive/DishVillager.java | 14 + .../entity/passive/DishWanderingTrader.java | 14 + .../ouja/dish/network/chat/DishComponent.java | 83 ++ .../net/ouja/dish/plugins/PluginManager.java | 97 ++ .../ouja/dish/plugins/RegisteredEvents.java | 32 + .../server/level/DishClientInformation.java | 81 ++ .../net/ouja/dish/world/DishDamageSource.java | 22 + .../1.21/net/ouja/dish/world/DishLevel.java | 64 ++ .../net/ouja/dish/world/block/DishBlock.java | 27 + .../ouja/dish/world/block/DishBlockInfo.java | 1010 +++++++++++++++++ .../dish/world/block/DishButtonBlock.java | 30 + .../ouja/dish/world/block/DishDoorBlock.java | 32 + .../ouja/dish/world/block/DishSignBlock.java | 60 + .../ouja/dish/world/block/DishStairBlock.java | 26 + .../dish/world/block/DishTrapdoorBlock.java | 38 + .../dish/world/block/entity/DishSignText.java | 54 + .../ouja/dish/world/item/DishItemStack.java | 140 +++ .../dish/world/level/chunk/DishStructure.java | 52 + 137 files changed, 5041 insertions(+) create mode 100644 patches/release/1.21/net/minecraft/ChatFormatting.patch create mode 100644 patches/release/1.21/net/minecraft/CrashReport.patch create mode 100644 patches/release/1.21/net/minecraft/commands/Commands.patch create mode 100644 patches/release/1.21/net/minecraft/server/Main.patch create mode 100644 patches/release/1.21/net/minecraft/server/MinecraftServer.patch create mode 100644 patches/release/1.21/net/minecraft/server/dedicated/DedicatedServer.patch create mode 100644 patches/release/1.21/net/minecraft/server/level/ChunkMap.patch create mode 100644 patches/release/1.21/net/minecraft/server/level/ServerEntity.patch create mode 100644 patches/release/1.21/net/minecraft/server/level/ServerPlayer.patch create mode 100644 patches/release/1.21/net/minecraft/server/level/ServerPlayerGameMode.patch create mode 100644 patches/release/1.21/net/minecraft/server/network/ServerGamePacketListenerImpl.patch create mode 100644 patches/release/1.21/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch create mode 100644 patches/release/1.21/net/minecraft/server/players/PlayerList.patch create mode 100644 patches/release/1.21/net/minecraft/world/damagesource/DamageSource.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/LivingEntity.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/animal/Squid.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/animal/sniffer/Sniffer.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/item/ItemEntity.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/monster/Shulker.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/monster/Vindicator.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/monster/hoglin/Hoglin.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/monster/piglin/Piglin.patch create mode 100644 patches/release/1.21/net/minecraft/world/entity/player/Player.patch create mode 100644 patches/release/1.21/net/minecraft/world/item/BlockItem.patch create mode 100644 patches/release/1.21/net/minecraft/world/item/ItemStack.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/BaseSpawner.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/ChunkPos.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/LevelReader.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/block/Block.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/block/SignBlock.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/block/StairBlock.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/block/TrapDoorBlock.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/chunk/ChunkGenerator.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/chunk/ChunkStatus.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/levelgen/BitRandomSource.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/material/FlowingFluid.patch create mode 100644 patches/release/1.21/net/minecraft/world/level/storage/loot/LootTable.patch create mode 100644 patches/release/1.21/net/ouja/dish/Dish.java create mode 100644 patches/release/1.21/net/ouja/dish/DishCrashReport.java create mode 100644 patches/release/1.21/net/ouja/dish/DishProperties.java create mode 100644 patches/release/1.21/net/ouja/dish/commands/RegisteredCommands.java create mode 100644 patches/release/1.21/net/ouja/dish/commands/VersionCommand.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/DishEntity.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/DishPlayer.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishBlaze.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishCreeper.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishDrowned.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishElderGuardian.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishEndermite.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishEvoker.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishGhast.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishGuardian.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishHoglin.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishHusk.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishMagmaCube.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishPhantom.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishPiglinBrute.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishPillager.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishRavager.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishShulker.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishSilverfish.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishSkeleton.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishSlime.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishStray.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishVex.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishVindicator.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishWarden.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishWitch.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishWitherSkeleton.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishZoglin.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishZombie.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishZombieHorse.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishZombieVillager.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishBee.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishCaveSpider.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishDolphin.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishEnderman.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishGoat.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishIronGolem.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishLlama.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishPanda.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishPiglin.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishPolarBear.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishSpider.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishTraderLlama.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishWolf.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/neutral/DishZombifiedPiglin.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishAllay.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishArmadillo.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishAxolotl.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishBat.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishCamel.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishCat.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishChicken.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishCod.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishCow.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishDonkey.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishFox.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishFrog.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishGlowSquid.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishHorse.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishMule.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishMushroomCow.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishOcelot.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishParrot.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishPig.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishPufferfish.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishRabbit.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishSalmon.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishSheep.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishSkeletonHorse.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishSniffer.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishSnowGolem.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishSquid.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishStrider.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishTadpole.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishTropicalFish.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishTurtle.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishVillager.java create mode 100644 patches/release/1.21/net/ouja/dish/entity/passive/DishWanderingTrader.java create mode 100644 patches/release/1.21/net/ouja/dish/network/chat/DishComponent.java create mode 100644 patches/release/1.21/net/ouja/dish/plugins/PluginManager.java create mode 100644 patches/release/1.21/net/ouja/dish/plugins/RegisteredEvents.java create mode 100644 patches/release/1.21/net/ouja/dish/server/level/DishClientInformation.java create mode 100644 patches/release/1.21/net/ouja/dish/world/DishDamageSource.java create mode 100644 patches/release/1.21/net/ouja/dish/world/DishLevel.java create mode 100644 patches/release/1.21/net/ouja/dish/world/block/DishBlock.java create mode 100644 patches/release/1.21/net/ouja/dish/world/block/DishBlockInfo.java create mode 100644 patches/release/1.21/net/ouja/dish/world/block/DishButtonBlock.java create mode 100644 patches/release/1.21/net/ouja/dish/world/block/DishDoorBlock.java create mode 100644 patches/release/1.21/net/ouja/dish/world/block/DishSignBlock.java create mode 100644 patches/release/1.21/net/ouja/dish/world/block/DishStairBlock.java create mode 100644 patches/release/1.21/net/ouja/dish/world/block/DishTrapdoorBlock.java create mode 100644 patches/release/1.21/net/ouja/dish/world/block/entity/DishSignText.java create mode 100644 patches/release/1.21/net/ouja/dish/world/item/DishItemStack.java create mode 100644 patches/release/1.21/net/ouja/dish/world/level/chunk/DishStructure.java diff --git a/patches/release/1.21/net/minecraft/ChatFormatting.patch b/patches/release/1.21/net/minecraft/ChatFormatting.patch new file mode 100644 index 0000000..474caf2 --- /dev/null +++ b/patches/release/1.21/net/minecraft/ChatFormatting.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net/minecraft/ChatFormatting.java +index cd1fc70..d8eba59 100644 +--- a/src/main/java/net/minecraft/ChatFormatting.java ++++ b/src/main/java/net/minecraft/ChatFormatting.java +@@ -37,7 +37,7 @@ public enum ChatFormatting implements StringRepresentable { + RESET("RESET", 'r', -1, null); + + public static final Codec CODEC = StringRepresentable.fromEnum(ChatFormatting::values); +- public static final char PREFIX_CODE = '§'; ++ public static final char PREFIX_CODE = '\u00a7'; // decompiler error + private static final Map FORMATTING_BY_NAME = Arrays.stream(values()) + .collect(Collectors.toMap(formatting -> cleanName(formatting.name), chatFormatter -> (ChatFormatting)chatFormatter)); + private static final Pattern STRIP_FORMATTING_PATTERN = Pattern.compile("(?i)§[0-9A-FK-OR]"); diff --git a/patches/release/1.21/net/minecraft/CrashReport.patch b/patches/release/1.21/net/minecraft/CrashReport.patch new file mode 100644 index 0000000..28900ee --- /dev/null +++ b/patches/release/1.21/net/minecraft/CrashReport.patch @@ -0,0 +1,12 @@ +diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java +index 990d8c0..73758fc 100644 +--- a/src/main/java/net/minecraft/CrashReport.java ++++ b/src/main/java/net/minecraft/CrashReport.java +@@ -35,6 +35,7 @@ public class CrashReport { + public CrashReport(String title, Throwable exception) { + this.title = title; + this.exception = exception; ++ this.systemReport.setDetail("DishServer", new net.ouja.dish.DishCrashReport()); + } + + public String getTitle() { diff --git a/patches/release/1.21/net/minecraft/commands/Commands.patch b/patches/release/1.21/net/minecraft/commands/Commands.patch new file mode 100644 index 0000000..f7cc015 --- /dev/null +++ b/patches/release/1.21/net/minecraft/commands/Commands.patch @@ -0,0 +1,24 @@ +diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java +index b958c90..0e23552 100644 +--- a/src/main/java/net/minecraft/commands/Commands.java ++++ b/src/main/java/net/minecraft/commands/Commands.java +@@ -144,7 +144,7 @@ public class Commands { + public static final int LEVEL_GAMEMASTERS = 2; + public static final int LEVEL_ADMINS = 3; + public static final int LEVEL_OWNERS = 4; +- private final CommandDispatcher dispatcher = new CommandDispatcher<>(); ++ private static final CommandDispatcher dispatcher = new CommandDispatcher(); // dish -- make this static + + public Commands(Commands.CommandSelection selection, CommandBuildContext context) { + AdvancementCommands.register(this.dispatcher); +@@ -418,8 +418,8 @@ public class Commands { + }; + } + +- public CommandDispatcher getDispatcher() { +- return this.dispatcher; ++ public static CommandDispatcher getDispatcher() { // dish -- make this static so that plugins can use commands ++ return dispatcher; + } + + public static void validateParseResults(ParseResults parseResults) throws CommandSyntaxException { diff --git a/patches/release/1.21/net/minecraft/server/Main.patch b/patches/release/1.21/net/minecraft/server/Main.patch new file mode 100644 index 0000000..c7ebbdf --- /dev/null +++ b/patches/release/1.21/net/minecraft/server/Main.patch @@ -0,0 +1,17 @@ +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index 30ed4b8..26bd788 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -114,6 +114,12 @@ public class Main { + return; + } + ++ // dish -- create a plugins directory ++ if (!new File("plugins").exists()) { ++ Files.createDirectories(Path.of("plugins")); ++ } ++ // dish end ++ + if (!eula.hasAgreedToEULA()) { + LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + return; diff --git a/patches/release/1.21/net/minecraft/server/MinecraftServer.patch b/patches/release/1.21/net/minecraft/server/MinecraftServer.patch new file mode 100644 index 0000000..e280e0c --- /dev/null +++ b/patches/release/1.21/net/minecraft/server/MinecraftServer.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 162e5a8..1a97ce4 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1096,7 +1096,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop seenBy = Sets.newIdentityHashSet(); + + public TrackedEntity(final Entity entity, final int range, final int updateInterval, final boolean trackDelta) { +- this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, updateInterval, trackDelta, this::broadcast); ++ this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, updateInterval, trackDelta, this::broadcast, this.seenBy); // dish -- pass the seenBy field into ServerEntity + this.entity = entity; + this.range = range; + this.lastSectionPos = SectionPos.of(entity); diff --git a/patches/release/1.21/net/minecraft/server/level/ServerEntity.patch b/patches/release/1.21/net/minecraft/server/level/ServerEntity.patch new file mode 100644 index 0000000..91a7900 --- /dev/null +++ b/patches/release/1.21/net/minecraft/server/level/ServerEntity.patch @@ -0,0 +1,44 @@ +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index f779c6e..1dfdd4a 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -56,19 +56,20 @@ public class ServerEntity { + private final boolean trackDelta; + private final Consumer> broadcast; + private final VecDeltaCodec positionCodec = new VecDeltaCodec(); ++ private final Set seenBy; // dish + private int yRotp; + private int xRotp; + private int yHeadRotp; + private Vec3 ap = Vec3.ZERO; + private int tickCount; + private int teleportDelay; +- private List lastPassengers = Collections.emptyList(); ++ private List lastPassengers = com.google.common.collect.ImmutableList.of(); // dish -- use ImmutableList + private boolean wasRiding; + private boolean wasOnGround; + @Nullable + private List> trackedDataValues; + +- public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast) { ++ public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast, Set seenBy) { + this.level = level; + this.broadcast = broadcast; + this.entity = entity; +@@ -80,6 +81,7 @@ public class ServerEntity { + this.yHeadRotp = Mth.floor(entity.getYHeadRot() * 256.0F / 360.0F); + this.wasOnGround = entity.onGround(); + this.trackedDataValues = entity.getEntityData().getNonDefaultValues(); ++ this.seenBy = seenBy; // dish + } + + public void sendChanges() { +@@ -98,7 +100,7 @@ public class ServerEntity { + this.lastPassengers = passengers; + } + +- if (this.entity instanceof ItemFrame itemFrame && this.tickCount % 10 == 0) { ++ if (!this.seenBy.isEmpty() && this.entity instanceof ItemFrame itemFrame && this.tickCount % 10 == 0) { // dish -- only update item frames if players can see them + ItemStack item = itemFrame.getItem(); + if (item.getItem() instanceof MapItem) { + MapId mapId = item.get(DataComponents.MAP_ID); diff --git a/patches/release/1.21/net/minecraft/server/level/ServerPlayer.patch b/patches/release/1.21/net/minecraft/server/level/ServerPlayer.patch new file mode 100644 index 0000000..70ac6e9 --- /dev/null +++ b/patches/release/1.21/net/minecraft/server/level/ServerPlayer.patch @@ -0,0 +1,64 @@ +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index de86986..5efcffb 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -650,10 +650,25 @@ public class ServerPlayer extends Player { + + @Override + public void die(DamageSource cause) { ++ // dish ++ net.ouja.api.event.player.PlayerDeathEvent event = new net.ouja.api.event.player.PlayerDeathEvent( ++ new net.ouja.dish.entity.DishPlayer(this), ++ new net.ouja.api.world.level.block.BlockPos( ++ this.blockPosition().getX(), ++ this.blockPosition().getY(), ++ this.blockPosition().getZ(), ++ new net.ouja.dish.world.DishLevel((ServerLevel)this.level()) ++ ), ++ cause.toDish(), ++ net.ouja.dish.network.chat.DishComponent.fromComponent(this.getCombatTracker().getDeathMessage()) ++ ); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + this.gameEvent(GameEvent.ENTITY_DIE); + boolean _boolean = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); + if (_boolean) { +- Component deathMessage = this.getCombatTracker().getDeathMessage(); ++ Component deathMessage = net.ouja.dish.network.chat.DishComponent.toComponent(event.getDeathMessage()); // dish -- allow plugins to modify the death message + this.connection + .send( + new ClientboundPlayerCombatKillPacket(this.getId(), deathMessage), +@@ -916,6 +931,11 @@ public class ServerPlayer extends Player { + } else if (this.bedBlocked(at, direction)) { + return Either.left(Player.BedSleepingProblem.OBSTRUCTED); + } else { ++ // dish ++ net.ouja.api.event.player.PlayerSleepEvent event = new net.ouja.api.event.player.PlayerSleepEvent(new net.ouja.dish.entity.DishPlayer(this), new net.ouja.api.world.level.block.BlockPos(at.getX(), at.getY(), at.getZ(), new net.ouja.dish.world.DishLevel((ServerLevel)this.level()))); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_HERE); ++ // dish end + this.setRespawnPosition(this.level().dimension(), at, this.getYRot(), false, true); + if (this.level().isDay()) { + return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); +@@ -930,7 +950,7 @@ public class ServerPlayer extends Player { + new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0), + monster -> monster.isPreventingPlayerRest(this) + ); +- if (!entitiesOfClass.isEmpty()) { ++ if (!event.canSleepWhileMonstersAreNear() && !entitiesOfClass.isEmpty()) { // dish -- PlayerSleepEvent modifies if the player can sleep while monsters are near. + return Either.left(Player.BedSleepingProblem.NOT_SAFE); + } + } +@@ -1599,6 +1619,11 @@ public class ServerPlayer extends Player { + if (this.gameMode.getGameModeForPlayer() == GameType.SPECTATOR) { + this.setCamera(targetEntity); + } else { ++ // dish start ++ net.ouja.api.event.player.PlayerAttackEvent event = new net.ouja.api.event.player.PlayerAttackEvent(new net.ouja.dish.entity.DishPlayer(this), new net.ouja.dish.entity.DishEntity((LivingEntity)targetEntity)); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + super.attack(targetEntity); + } + } diff --git a/patches/release/1.21/net/minecraft/server/level/ServerPlayerGameMode.patch b/patches/release/1.21/net/minecraft/server/level/ServerPlayerGameMode.patch new file mode 100644 index 0000000..3730b97 --- /dev/null +++ b/patches/release/1.21/net/minecraft/server/level/ServerPlayerGameMode.patch @@ -0,0 +1,25 @@ +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +index e0a8638..1334d42 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +@@ -229,6 +229,20 @@ public class ServerPlayerGameMode { + } else { + BlockEntity blockEntity = this.level.getBlockEntity(pos); + Block block = blockState.getBlock(); ++ // dish ++ try { ++ net.ouja.dish.world.block.DishBlockInfo dishBlockInfo = new net.ouja.dish.world.block.DishBlockInfo(block, pos, this.level); ++ if (dishBlockInfo.getBlock() != null) { ++ net.ouja.dish.entity.DishPlayer dishPlayer = new net.ouja.dish.entity.DishPlayer(this.player); ++ net.ouja.api.event.player.PlayerBreakBlockEvent event = new net.ouja.api.event.player.PlayerBreakBlockEvent(dishPlayer, dishBlockInfo.getBlock()); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return false; ++ } ++ } catch (Exception e) { ++ // TODO: 10/31/2023 make proper error logging ++ e.printStackTrace(); ++ } ++ // dish end + if (block instanceof GameMasterBlock && !this.player.canUseGameMasterBlocks()) { + this.level.sendBlockUpdated(pos, blockState, blockState, 3); + return false; diff --git a/patches/release/1.21/net/minecraft/server/network/ServerGamePacketListenerImpl.patch b/patches/release/1.21/net/minecraft/server/network/ServerGamePacketListenerImpl.patch new file mode 100644 index 0000000..8c9fce8 --- /dev/null +++ b/patches/release/1.21/net/minecraft/server/network/ServerGamePacketListenerImpl.patch @@ -0,0 +1,28 @@ +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index ec2aed1..fff8085 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -400,6 +400,23 @@ public class ServerGamePacketListenerImpl + double d2 = clampHorizontal(packet.getZ()); + float f = Mth.wrapDegrees(packet.getYRot()); + float f1 = Mth.wrapDegrees(packet.getXRot()); ++ // dish ++ // Not sure if converting the passangers to a stream, then filtering out non players then converting it back to an ArrayList is good for performance. ++ java.util.ArrayList players = rootVehicle.getPassengers().stream().map((e) -> { ++ if (e instanceof Player) return new net.ouja.dish.entity.DishPlayer(((ServerPlayer) e)); ++ return null; ++ }).filter(Objects::nonNull).collect(Collectors.toCollection(java.util.ArrayList::new)); ++ double xOld = clampHorizontal(this.vehicleLastGoodX); ++ double yOld = clampHorizontal(this.vehicleLastGoodY); ++ double zOld = clampHorizontal(this.vehicleLastGoodZ); ++ net.ouja.api.event.vehicle.VehicleMoveEvent event = new net.ouja.api.event.vehicle.VehicleMoveEvent(players, d, d1, d2, xOld, yOld, zOld); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) { ++ rootVehicle.absMoveTo(xOld, yOld, zOld, f, f1); ++ this.send(new ClientboundMoveVehiclePacket(rootVehicle)); ++ return; ++ } ++ // dish end + double d3 = d - this.vehicleFirstGoodX; + double d4 = d1 - this.vehicleFirstGoodY; + double d5 = d2 - this.vehicleFirstGoodZ; diff --git a/patches/release/1.21/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch b/patches/release/1.21/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch new file mode 100644 index 0000000..15f1ea6 --- /dev/null +++ b/patches/release/1.21/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch @@ -0,0 +1,18 @@ +diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +index 1638819..19ffca9 100644 +--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -136,6 +136,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + private void verifyLoginAndFinishConnectionSetup(GameProfile profile) { + PlayerList playerList = this.server.getPlayerList(); + Component component = playerList.canPlayerLogin(this.connection.getRemoteAddress(), profile); ++ // dish ++ net.ouja.api.event.player.PlayerLoginEvent event = new net.ouja.api.event.player.PlayerLoginEvent(new net.ouja.api.auth.GameProfile(profile.getName(), profile.getId()), component != null ? net.ouja.dish.network.chat.DishComponent.fromComponent(component) : null); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.getErrorMessage() != null) { ++ component = net.ouja.dish.network.chat.DishComponent.toComponent(event.getErrorMessage()); // dish -- return custom error message ++ } ++ // dish end + if (component != null) { + this.disconnect(component); + } else { diff --git a/patches/release/1.21/net/minecraft/server/players/PlayerList.patch b/patches/release/1.21/net/minecraft/server/players/PlayerList.patch new file mode 100644 index 0000000..14eabfc --- /dev/null +++ b/patches/release/1.21/net/minecraft/server/players/PlayerList.patch @@ -0,0 +1,27 @@ +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 6021c1b..772f82a 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -214,7 +214,13 @@ public abstract class PlayerList { + mutableComponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), string); + } + +- this.broadcastSystemMessage(mutableComponent.withStyle(ChatFormatting.YELLOW), false); ++ // dish start -- add event listener for players joining ++ net.ouja.api.event.player.PlayerJoinEvent event = new net.ouja.api.event.player.PlayerJoinEvent(new net.ouja.dish.entity.DishPlayer(player), net.ouja.dish.network.chat.DishComponent.fromComponent(mutableComponent)); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.getJoinMessage() != null) { ++ mutableComponent = net.ouja.dish.network.chat.DishComponent.toComponent(event.getJoinMessage()); ++ } ++ // dish end + serverGamePacketListenerImpl.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); + ServerStatus status = this.server.getStatus(); + if (status != null && !cookie.transferred()) { +@@ -224,6 +230,7 @@ public abstract class PlayerList { + player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); + this.players.add(player); + this.playersByUUID.put(player.getUUID(), player); ++ this.broadcastSystemMessage(mutableComponent, false); // dish -- remove ".withStyle()" and move this here so that when players join, they can see their own join message. + this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); + this.sendLevelInfo(player, serverLevel); + serverLevel.addNewPlayer(player); diff --git a/patches/release/1.21/net/minecraft/world/damagesource/DamageSource.patch b/patches/release/1.21/net/minecraft/world/damagesource/DamageSource.patch new file mode 100644 index 0000000..2422f25 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/damagesource/DamageSource.patch @@ -0,0 +1,11 @@ +diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java +index 7fd78c4..b0be3cf 100644 +--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java ++++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java +@@ -133,4 +133,6 @@ public class DamageSource { + public Holder typeHolder() { + return this.type; + } ++ ++ public net.ouja.dish.world.DishDamageSource toDish() { return new net.ouja.dish.world.DishDamageSource(this); } // dish + } diff --git a/patches/release/1.21/net/minecraft/world/entity/LivingEntity.patch b/patches/release/1.21/net/minecraft/world/entity/LivingEntity.patch new file mode 100644 index 0000000..6a23cf9 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/entity/LivingEntity.patch @@ -0,0 +1,36 @@ +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 4e371f1..542ad21 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -1229,6 +1229,10 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + if (this.isDeadOrDying()) { ++ if (!(this instanceof Player)) { // dish -- make sure the entity that died is not a player, then call the EntityDeathEvent. ++ net.ouja.api.event.entity.EntityDeathEvent event = new net.ouja.api.event.entity.EntityDeathEvent(this.toDish(), new net.ouja.api.world.level.block.BlockPos(this.blockPosition().getX(), this.blockPosition().getY(), this.blockPosition().getZ(), new net.ouja.dish.world.DishLevel((ServerLevel)this.level())), source.toDish(), net.ouja.dish.network.chat.DishComponent.fromComponent(this.getCombatTracker().getDeathMessage())); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ } // dish end + if (!this.checkTotemDeathProtection(source)) { + if (flag1) { + this.makeSound(this.getDeathSound()); +@@ -2893,6 +2897,11 @@ public abstract class LivingEntity extends Entity implements Attackable { + public void onItemPickup(ItemEntity itemEntity) { + Entity owner = itemEntity.getOwner(); + if (owner instanceof ServerPlayer) { ++ // dish ++ net.ouja.api.event.player.PlayerPickUpItemEvent event = new net.ouja.api.event.player.PlayerPickUpItemEvent(new net.ouja.dish.entity.DishPlayer((ServerPlayer)this), itemEntity.getItem().toDish()); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer)owner, itemEntity.getItem(), this); + } + } +@@ -3531,6 +3540,8 @@ public abstract class LivingEntity extends Entity implements Attackable { + return false; + } + ++ public net.ouja.dish.entity.DishEntity toDish() { return new net.ouja.dish.entity.DishEntity(this); } // dish ++ + public static record Fallsounds(SoundEvent small, SoundEvent big) { + } + } diff --git a/patches/release/1.21/net/minecraft/world/entity/animal/Squid.patch b/patches/release/1.21/net/minecraft/world/entity/animal/Squid.patch new file mode 100644 index 0000000..844c9fc --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/entity/animal/Squid.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java +index 8fc9ae8..2a287b6 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java +@@ -177,7 +177,7 @@ public class Squid extends WaterAnimal { + return vec3.yRot(-this.yBodyRotO * (float) (Math.PI / 180.0)); + } + +- private void spawnInk() { ++ public void spawnInk() { // dish -- make this public + this.makeSound(this.getSquirtSound()); + Vec3 vec3 = this.rotateVector(new Vec3(0.0, -1.0, 0.0)).add(this.getX(), this.getY(), this.getZ()); + diff --git a/patches/release/1.21/net/minecraft/world/entity/animal/sniffer/Sniffer.patch b/patches/release/1.21/net/minecraft/world/entity/animal/sniffer/Sniffer.patch new file mode 100644 index 0000000..47a02b3 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/entity/animal/sniffer/Sniffer.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +index 2775bcc..f53e832 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java ++++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +@@ -141,7 +141,7 @@ public class Sniffer extends Animal { + return this.position().add(this.getForward().scale(2.25)); + } + +- private Sniffer.State getState() { ++ public Sniffer.State getState() { // dish -- make this public + return this.entityData.get(DATA_STATE); + } + diff --git a/patches/release/1.21/net/minecraft/world/entity/item/ItemEntity.patch b/patches/release/1.21/net/minecraft/world/entity/item/ItemEntity.patch new file mode 100644 index 0000000..cac714a --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/entity/item/ItemEntity.patch @@ -0,0 +1,25 @@ +diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +index 8cadd05..9bb4f42 100644 +--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +@@ -341,6 +341,20 @@ public class ItemEntity extends Entity implements TraceableEntity { + ItemStack item = this.getItem(); + Item item1 = item.getItem(); + int count = item.getCount(); ++ // dish ++ // TODO: 12/11/2023 Check performance ++ net.ouja.dish.entity.DishEntity cachedThrower = new net.ouja.dish.entity.DishEntity((net.minecraft.world.entity.LivingEntity)this.cachedThrower); ++ net.ouja.api.entity.ItemEntity itemEntity = new net.ouja.api.entity.ItemEntity( ++ item.toDish(), ++ this.pickupDelay, ++ this.age, ++ cachedThrower, ++ this.thrower ++ ); ++ net.ouja.api.event.player.PlayerAttemptPickUpItem event = new net.ouja.api.event.player.PlayerAttemptPickUpItem(new net.ouja.dish.entity.DishPlayer((net.minecraft.server.level.ServerPlayer)entity), itemEntity); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ // dish end ++ + if (this.pickupDelay == 0 && (this.target == null || this.target.equals(entity.getUUID())) && entity.getInventory().add(item)) { + entity.take(this, count); + if (item.isEmpty()) { diff --git a/patches/release/1.21/net/minecraft/world/entity/monster/Shulker.patch b/patches/release/1.21/net/minecraft/world/entity/monster/Shulker.patch new file mode 100644 index 0000000..f20fe5a --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/entity/monster/Shulker.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java +index c25ce1d..7ebb66b 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java +@@ -437,7 +437,7 @@ public class Shulker extends AbstractGolem implements VariantHolder> 32); ++ this.toLongKey = asLong(this.x, this.z); // dish + } + + public static ChunkPos minFromRegion(int chunkX, int chunkZ) { +@@ -48,10 +52,10 @@ public class ChunkPos { + } + + public long toLong() { +- return asLong(this.x, this.z); ++ return this.toLongKey; // dish + } + +- public static long asLong(int x, int z) { ++ public static long asLong(int x, int z) { // dish -- this should not change + return x & 4294967295L | (z & 4294967295L) << 32; + } + diff --git a/patches/release/1.21/net/minecraft/world/level/LevelReader.patch b/patches/release/1.21/net/minecraft/world/level/LevelReader.patch new file mode 100644 index 0000000..bd35266 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/LevelReader.patch @@ -0,0 +1,18 @@ +diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java +index 9b242cc..bb9fa38 100644 +--- a/src/main/java/net/minecraft/world/level/LevelReader.java ++++ b/src/main/java/net/minecraft/world/level/LevelReader.java +@@ -39,6 +39,13 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal + return this.getBiomeManager().getBiome(pos); + } + ++ // dish ++ public default BlockState getBlockStateIfLoaded(BlockPos blockpos) { ++ ChunkAccess chunk = this.getChunk(blockpos.getX() >> 4, blockpos.getZ() >> 4, ChunkStatus.FULL, false); ++ return chunk == null ? null : chunk.getBlockState(blockpos); ++ } ++ // dish end ++ + default Stream getBlockStatesIfLoaded(AABB aabb) { + int floor = Mth.floor(aabb.minX); + int floor1 = Mth.floor(aabb.maxX); diff --git a/patches/release/1.21/net/minecraft/world/level/block/Block.patch b/patches/release/1.21/net/minecraft/world/level/block/Block.patch new file mode 100644 index 0000000..09002b6 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/block/Block.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 94f94cd..300009d 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -492,6 +492,8 @@ public class Block extends BlockBehaviour implements ItemLike { + } + } + ++ public net.ouja.api.world.level.block.Block toDish(BlockPos blockPos, Level level) { return new net.ouja.dish.world.block.DishBlockInfo(this, blockPos, level).getBlock(); } // dish ++ + public static final class BlockStatePairKey { + private final BlockState first; + private final BlockState second; diff --git a/patches/release/1.21/net/minecraft/world/level/block/SignBlock.patch b/patches/release/1.21/net/minecraft/world/level/block/SignBlock.patch new file mode 100644 index 0000000..c25700f --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/block/SignBlock.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java +index 4e9d2ec..e086271 100644 +--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java +@@ -150,7 +150,7 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo + } + + @Override +- protected FluidState getFluidState(BlockState state) { ++ public FluidState getFluidState(BlockState state) { // dish -- make this public + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + diff --git a/patches/release/1.21/net/minecraft/world/level/block/StairBlock.patch b/patches/release/1.21/net/minecraft/world/level/block/StairBlock.patch new file mode 100644 index 0000000..41d0fd0 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/block/StairBlock.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/block/StairBlock.java b/src/main/java/net/minecraft/world/level/block/StairBlock.java +index c4a0713..c9f8f58 100644 +--- a/src/main/java/net/minecraft/world/level/block/StairBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/StairBlock.java +@@ -232,7 +232,7 @@ public class StairBlock extends Block implements SimpleWaterloggedBlock { + } + + @Override +- protected FluidState getFluidState(BlockState state) { ++ public FluidState getFluidState(BlockState state) { // dish -- make this public + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + diff --git a/patches/release/1.21/net/minecraft/world/level/block/TrapDoorBlock.patch b/patches/release/1.21/net/minecraft/world/level/block/TrapDoorBlock.patch new file mode 100644 index 0000000..fec06be --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/block/TrapDoorBlock.patch @@ -0,0 +1,22 @@ +diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java +index dda966b..5ce6a1a 100644 +--- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java +@@ -200,4 +200,17 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW + protected BlockSetType getType() { + return this.type; + } ++ ++ // dish -- add a new method for plugins to open trapdoors. It's easier to do this than the use method ++ public void setOpen(@Nullable Player player, Level level, BlockState blockstate, BlockPos blockpos, boolean flag) { ++ if (blockstate.is(this) && blockstate.getValue(TrapDoorBlock.OPEN) != flag) { ++ level.setBlock(blockpos, blockstate.setValue(TrapDoorBlock.OPEN, flag), 2); ++ if (blockstate.getValue(TrapDoorBlock.WATERLOGGED)) { ++ level.scheduleTick(blockpos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); ++ } ++ ++ this.playSound(player, level, blockpos, flag); ++ } ++ } ++ // dish end + } diff --git a/patches/release/1.21/net/minecraft/world/level/chunk/ChunkGenerator.patch b/patches/release/1.21/net/minecraft/world/level/chunk/ChunkGenerator.patch new file mode 100644 index 0000000..612fc31 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/chunk/ChunkGenerator.patch @@ -0,0 +1,53 @@ +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +index 0fd3773..5802b9d 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +@@ -472,11 +472,16 @@ public abstract class ChunkGenerator { + ChunkGeneratorStructureState structureState, + StructureManager structureManager, + ChunkAccess chunk, +- StructureTemplateManager structureTemplateManager ++ StructureTemplateManager structureTemplateManager, ++ ServerLevel serverlevel // dish -- add serverlevel to parameters + ) { + ChunkPos pos = chunk.getPos(); + SectionPos sectionPos = SectionPos.bottomOf(chunk); + RandomState randomState = structureState.randomState(); ++ // dish ++ net.ouja.dish.world.DishLevel dishLevel = new net.ouja.dish.world.DishLevel(serverlevel); ++ net.ouja.api.world.level.chunk.ChunkPos dishChunkPos = new net.ouja.api.world.level.chunk.ChunkPos(pos.x, pos.z, dishLevel); ++ // dish end + structureState.possibleStructureSets() + .forEach( + structureSet -> { +@@ -492,6 +497,12 @@ public abstract class ChunkGenerator { + + if (structurePlacement.isStructureChunk(structureState, pos.x, pos.z)) { + if (list.size() == 1) { ++ // dish ++ net.ouja.dish.world.level.chunk.DishStructure dishStructure = new net.ouja.dish.world.level.chunk.DishStructure(list.get(0).structure().value()); ++ net.ouja.api.event.world.level.chunk.StructureGenerateEvent event = new net.ouja.api.event.world.level.chunk.StructureGenerateEvent(dishStructure, dishChunkPos); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + this.tryGenerateStructure( + list.get(0), + structureManager, +@@ -528,6 +539,17 @@ public abstract class ChunkGenerator { + } + + StructureSet.StructureSelectionEntry structureSelectionEntry3 = list1.get(i1); ++ // dish ++ net.ouja.dish.world.level.chunk.DishStructure dishStructure = new net.ouja.dish.world.level.chunk.DishStructure(structureSelectionEntry3.structure().value()); ++ net.ouja.api.event.world.level.chunk.StructureGenerateEvent event = new net.ouja.api.event.world.level.chunk.StructureGenerateEvent(dishStructure, dishChunkPos); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) { ++ list1.remove(i1); ++ i -= structureSelectionEntry3.weight(); ++ break; ++ } ++ // dish end ++ + if (this.tryGenerateStructure( + structureSelectionEntry3, + structureManager, diff --git a/patches/release/1.21/net/minecraft/world/level/chunk/ChunkStatus.patch b/patches/release/1.21/net/minecraft/world/level/chunk/ChunkStatus.patch new file mode 100644 index 0000000..d0b8370 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/chunk/ChunkStatus.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +index 397d4ca..7ab7c58 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +@@ -40,7 +40,7 @@ public class ChunkStatus { + }); + public static final ChunkStatus STRUCTURE_STARTS = register("structure_starts", ChunkStatus.EMPTY, 0, false, ChunkStatus.PRE_FEATURES, ChunkStatus.ChunkType.PROTOCHUNK, (chunkstatus, executor, serverlevel, chunkgenerator, structuretemplatemanager, threadedlevellightengine, function, list, chunkaccess) -> { + if (serverlevel.getServer().getWorldData().worldGenOptions().generateStructures()) { +- chunkgenerator.createStructures(serverlevel.registryAccess(), serverlevel.getChunkSource().getGeneratorState(), serverlevel.structureManager(), chunkaccess, structuretemplatemanager); ++ chunkgenerator.createStructures(serverlevel.registryAccess(), serverlevel.getChunkSource().getGeneratorState(), serverlevel.structureManager(), chunkaccess, structuretemplatemanager, serverlevel); // dish -- add serverlevel + } + + serverlevel.onStructureStartsAvailable(chunkaccess); diff --git a/patches/release/1.21/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch b/patches/release/1.21/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch new file mode 100644 index 0000000..67fa613 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch @@ -0,0 +1,14 @@ +diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +index d457c3e..5185061 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java ++++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +@@ -40,7 +40,8 @@ public class ChunkStatusTasks { + serverLevel.getChunkSource().getGeneratorState(), + serverLevel.structureManager(), + loadingChunk, +- context.structureManager() ++ context.structureManager(), ++ serverLevel // dish -- add serverlevel + ); + } + diff --git a/patches/release/1.21/net/minecraft/world/level/levelgen/BitRandomSource.patch b/patches/release/1.21/net/minecraft/world/level/levelgen/BitRandomSource.patch new file mode 100644 index 0000000..6fb5e71 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/levelgen/BitRandomSource.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java b/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java +index e2e46f4..a7f7f74 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java +@@ -18,7 +18,7 @@ public interface BitRandomSource extends RandomSource { + if (bound <= 0) { + throw new IllegalArgumentException("Bound must be positive"); + } else if ((bound & bound - 1) == 0) { +- return (int)(bound * this.next(31) >> 31); ++ return (int)((long)bound * (long)this.next(31) >> 31); // fix decompiler error + } else { + int i; + int i1; diff --git a/patches/release/1.21/net/minecraft/world/level/material/FlowingFluid.patch b/patches/release/1.21/net/minecraft/world/level/material/FlowingFluid.patch new file mode 100644 index 0000000..0103fc8 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/material/FlowingFluid.patch @@ -0,0 +1,91 @@ +diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +index 03bc74e..14c9081 100644 +--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java ++++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +@@ -30,6 +30,10 @@ import net.minecraft.world.phys.Vec3; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; + ++/** ++ * Modifications: ++ * - Prevent chunk loading by flowing liquids ++ */ + public abstract class FlowingFluid extends Fluid { + public static final BooleanProperty FALLING = BlockStateProperties.FALLING; + public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_FLOWING; +@@ -113,7 +117,8 @@ public abstract class FlowingFluid extends Fluid { + if (!state.isEmpty()) { + BlockState blockState = level.getBlockState(pos); + BlockPos blockPos = pos.below(); +- BlockState blockState1 = level.getBlockState(blockPos); ++ BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish ++ if (blockState1 == null) return; // dish + FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState1); + if (this.canSpreadTo(level, pos, blockState, Direction.DOWN, blockPos, blockState1, level.getFluidState(blockPos), newLiquid.getType())) { + this.spreadTo(level, blockPos, blockState1, Direction.DOWN, newLiquid); +@@ -139,7 +144,8 @@ public abstract class FlowingFluid extends Fluid { + Direction direction = entry.getKey(); + FluidState fluidState1 = entry.getValue(); + BlockPos blockPos = pos.relative(direction); +- BlockState blockState1 = level.getBlockState(blockPos); ++ BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish ++ if (blockState1 == null) continue; // dish + if (this.canSpreadTo(level, pos, blockState, direction, blockPos, blockState1, level.getFluidState(blockPos), fluidState1.getType())) { + this.spreadTo(level, blockPos, blockState1, direction, fluidState1); + } +@@ -153,7 +159,8 @@ public abstract class FlowingFluid extends Fluid { + + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockPos blockPos = pos.relative(direction); +- BlockState blockState1 = level.getBlockState(blockPos); ++ BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish ++ if (blockState1 == null) continue; + FluidState fluidState = blockState1.getFluidState(); + if (fluidState.getType().isSame(this) && this.canPassThroughWall(direction, level, pos, blockState, blockPos, blockState1)) { + if (fluidState.isSource()) { +@@ -268,10 +275,22 @@ public abstract class FlowingFluid extends Fluid { + if (direction1 != direction) { + BlockPos blockPos = spreadPos.relative(direction1); + short cacheKey = getCacheKey(sourcePos, blockPos); ++ /* + Pair pair = stateCache.computeIfAbsent(cacheKey, key -> { + BlockState blockState1 = level.getBlockState(blockPos); + return Pair.of(blockState1, blockState1.getFluidState()); + }); ++ */ ++ // dish ++ Pair pair = stateCache.get(cacheKey); ++ if (pair == null) { ++ BlockState blockStateD = level.getBlockStateIfLoaded(blockPos); ++ if (blockStateD == null) continue; ++ ++ pair = Pair.of(blockStateD, blockStateD.getFluidState()); ++ stateCache.put(cacheKey, pair); ++ } ++ // dish end + BlockState blockState = pair.getFirst(); + FluidState fluidState = pair.getSecond(); + if (this.canPassThrough(level, this.getFlowing(), spreadPos, currentSpreadState, direction1, blockPos, blockState, fluidState)) { +@@ -341,10 +360,22 @@ public abstract class FlowingFluid extends Fluid { + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockPos blockPos = pos.relative(direction); + short cacheKey = getCacheKey(pos, blockPos); ++ /* + Pair pair = map1.computeIfAbsent(cacheKey, key -> { + BlockState blockState1 = level.getBlockState(blockPos); + return Pair.of(blockState1, blockState1.getFluidState()); + }); ++ */ ++ // dish ++ Pair pair = map1.get(cacheKey); ++ if (pair == null) { ++ BlockState blockStateD = level.getBlockStateIfLoaded(blockPos); ++ if (blockStateD == null) continue; ++ ++ pair = Pair.of(blockStateD, blockStateD.getFluidState()); ++ map1.put(cacheKey, pair); ++ } ++ // dish end + BlockState blockState = pair.getFirst(); + FluidState fluidState = pair.getSecond(); + FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState); diff --git a/patches/release/1.21/net/minecraft/world/level/storage/loot/LootTable.patch b/patches/release/1.21/net/minecraft/world/level/storage/loot/LootTable.patch new file mode 100644 index 0000000..746d597 --- /dev/null +++ b/patches/release/1.21/net/minecraft/world/level/storage/loot/LootTable.patch @@ -0,0 +1,17 @@ +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +index 68eedb4..de3762f 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +@@ -142,6 +142,12 @@ public class LootTable { + RandomSource random = lootContext.getRandom(); + List availableSlots = this.getAvailableSlots(container, random); + this.shuffleAndSplitItems(randomItems, availableSlots.size(), random); ++ // dish ++ // TODO: 11/15/2023 Make container class and allow the plugin to modify the items in the container ++ net.ouja.api.event.world.level.LootGenerateEvent event = new net.ouja.api.event.world.level.LootGenerateEvent(net.ouja.dish.world.item.DishItemStack.convertFromVanilla(randomItems)); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + + for (ItemStack itemStack : randomItems) { + if (availableSlots.isEmpty()) { diff --git a/patches/release/1.21/net/ouja/dish/Dish.java b/patches/release/1.21/net/ouja/dish/Dish.java new file mode 100644 index 0000000..1f4ddca --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/Dish.java @@ -0,0 +1,146 @@ +package net.ouja.dish; + +import com.mojang.logging.LogUtils; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.players.UserBanListEntry; +import net.ouja.api.DishAPI; +import net.ouja.api.entity.Player; +import net.ouja.api.Server; +import net.ouja.api.auth.GameProfile; +import net.ouja.api.commands.Command; +import net.ouja.api.commands.CommandListener; +import net.ouja.api.dedicated.ServerProperties; +import net.ouja.api.event.EventHandler; +import net.ouja.api.event.EventListener; +import net.ouja.api.network.chat.Component; +import net.ouja.api.server.players.BanEntry; +import net.ouja.dish.commands.RegisteredCommands; +import net.ouja.dish.commands.VersionCommand; +import net.ouja.dish.entity.DishPlayer; +import net.ouja.dish.plugins.PluginManager; +import net.ouja.dish.plugins.RegisteredEvents; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +public class Dish implements Server { + private final DedicatedServer server; + private final String dishVersion = getBuild(); + public static final Logger logger = LogUtils.getLogger(); + + public Dish(DedicatedServer server) { + this.server = server; + DishAPI.setServer(this); + logger.info(String.format("Launching Dish server with the version %s (API Version: %s)", dishVersion, DishAPI.getApiVersion())); + initializeDishCommands(); + } + + public static String getBuild() { + try { + InputStream in = Dish.class.getResourceAsStream("/build.txt"); + if (in == null) return "UNKNOWN"; + + return readLines(in)[0]; + } catch (Exception e) { + e.printStackTrace(); + } + + return "UNKNOWN"; + } + + public static String[] readLines(InputStream is) throws IOException { + List list = new ArrayList<>(); + InputStreamReader isr = new InputStreamReader(is, StandardCharsets.US_ASCII); + BufferedReader br = new BufferedReader(isr); + + while(true) { + String line = br.readLine(); + if (line == null) { + return list.toArray(new String[0]); + } + + list.add(line); + } + } + + public void initializePlugins() { + try { + new PluginManager(new File("plugins")); + } catch (IOException e) { + e.printStackTrace(); // todo make an error handler + } + } + + public void initializeDishCommands() { + VersionCommand.register(); + } + + @Override + public @NotNull String getVersion() { + return this.server.getServerVersion(); + } + + @Override + public @NotNull ServerProperties getProperties() { + return new DishProperties(this.server.getProperties()); + } + + @Override + public @NotNull String getDishVersion() { + return this.dishVersion; + } + + @Override + public @NotNull ArrayList getOnlinePlayers() { + return new ArrayList<>(DishPlayer.CACHED_PLAYERS.values()); + } + + @Override + public void registerEvent(EventListener eventListener, Class aClass) { + for (Method method : eventListener.getClass().getMethods()) { + if (method.isAnnotationPresent(EventHandler.class)) { + new RegisteredEvents(method, aClass); + } + } + } + + @Override + public void registerCommand(Command command) { + for (Method method : command.getClass().getMethods()) { + if (method.isAnnotationPresent(CommandListener.class)) { + CommandListener commandListener = method.getAnnotation(CommandListener.class); + if (commandListener != null && commandListener.name() != "") { + new RegisteredCommands(commandListener, method, command.getClass()); + } + } + } + } + + @Override + public void broadcast(Component component) { + for (Player player : DishPlayer.CACHED_PLAYERS.values()) { + player.sendMessage(component); + } + } + + @Override + public boolean isPlayerBanned(GameProfile profile) { + return this.server.getPlayerList().getBans().isBanned(new com.mojang.authlib.GameProfile(profile.getPlayerUUID(), profile.getPlayerName())); + } + + @Override + public BanEntry getBanEntry(GameProfile profile) { + UserBanListEntry entry = this.server.getPlayerList().getBans().get(new com.mojang.authlib.GameProfile(profile.getPlayerUUID(), profile.getPlayerName())); + if (entry == null) return null; + return new BanEntry(entry.getCreated(), entry.getSource(), entry.getExpires(), entry.getReason()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/DishCrashReport.java b/patches/release/1.21/net/ouja/dish/DishCrashReport.java new file mode 100644 index 0000000..02e46c6 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/DishCrashReport.java @@ -0,0 +1,39 @@ +package net.ouja.dish; + +import net.ouja.api.DishAPI; +import net.ouja.dish.plugins.PluginManager; +import net.ouja.dish.plugins.RegisteredEvents; + +import java.util.function.Supplier; + +public class DishCrashReport implements Supplier { + @Override + public String get() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("\n\t\tVersion: " + Dish.getBuild()); + stringBuilder.append("\n\t\tAPI Version: " + DishAPI.getApiVersion()); + stringBuilder.append("\n\t\tLoaded Plugins: " + PluginManager.plugins.size()); + if (!PluginManager.plugins.isEmpty()) { + stringBuilder.append("\n\t\tPlugins:"); + for (String pluginName : PluginManager.plugins) { + stringBuilder.append("\n\t\t\t" + pluginName); + } + } + stringBuilder.append("\n\t\tLoaded Events: " + RegisteredEvents.listeners.size()); + if (!RegisteredEvents.listeners.isEmpty()) { + stringBuilder.append("\n\t\tEvents:"); + // EventType; pluginName.jar + for (int i = 0; i < RegisteredEvents.listeners.size(); i++) { + if (i < 99) { + String fileName = RegisteredEvents.classes.get(i).getProtectionDomain().getCodeSource().getLocation().getFile().split("/plugins/")[1]; + stringBuilder.append("\n\t\t\t" + RegisteredEvents.listeners.get(i).getName() + "; " + fileName); + } else { + stringBuilder.append("\n\t\t\tTruncated loaded events."); + break; + } + } + } + + return stringBuilder.toString(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/DishProperties.java b/patches/release/1.21/net/ouja/dish/DishProperties.java new file mode 100644 index 0000000..c116153 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/DishProperties.java @@ -0,0 +1,99 @@ +package net.ouja.dish; + +import net.minecraft.server.dedicated.DedicatedServerProperties; +import net.ouja.api.dedicated.ServerProperties; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class DishProperties implements ServerProperties { + private final DedicatedServerProperties properties; + + public DishProperties(DedicatedServerProperties properties) { + this.properties = properties; + } + + @Override + public boolean isOnline() { + return this.properties.onlineMode; + } + + @Override + public boolean isHardcore() { + return this.properties.hardcore; + } + + @Override + public @NotNull String getMotd() { + return this.properties.motd; + } + + @Override + public boolean canSpawnAnimals() { + return this.properties.spawnAnimals; + } + + @Override + public boolean canSpawnNpcs() { + return this.properties.spawnNpcs; + } + + @Override + public boolean isPvPEnabled() { + return this.properties.pvp; + } + + @Override + public boolean isFlightEnabled() { + return this.properties.allowFlight; + } + + @Override + public @Nullable Boolean isAnnouncePlayerAchievementsEnabled() { + return this.properties.announcePlayerAchievements; + } + + @Override + public boolean isNetherAllowed() { + return this.properties.allowNether; + } + + @Override + public boolean canSpawnMonsters() { + return this.properties.spawnMonsters; + } + + @Override + public int getSpawnProtection() { + return this.properties.spawnProtection; + } + + @Override + public int getViewDistance() { + return this.properties.viewDistance; + } + + @Override + public int getSimulationDistance() { + return this.properties.simulationDistance; + } + + @Override + public int getMaxPlayers() { + return this.properties.maxPlayers; + } + + @Override + public boolean hideOnlinePlayers() { + return this.properties.hideOnlinePlayers; + } + + @Override + public boolean isWhitelistEnabled() { + return this.properties.enforceWhitelist; + } + + @Override + public boolean acceptsServerTransfers() { + return this.properties.acceptsTransfers; + } +} diff --git a/patches/release/1.21/net/ouja/dish/commands/RegisteredCommands.java b/patches/release/1.21/net/ouja/dish/commands/RegisteredCommands.java new file mode 100644 index 0000000..f913d18 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/commands/RegisteredCommands.java @@ -0,0 +1,61 @@ +package net.ouja.dish.commands; + +import com.mojang.brigadier.builder.ArgumentBuilder; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import net.minecraft.ChatFormatting; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.network.chat.Component; +import net.ouja.api.commands.CommandListener; +import net.ouja.dish.Dish; +import net.ouja.dish.entity.DishPlayer; +import net.ouja.dish.network.chat.DishComponent; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; + +public class RegisteredCommands { + private static final HashMap names = new HashMap<>(); + private static final HashMap> classes = new HashMap<>(); + + public RegisteredCommands(CommandListener commandListener, Method method, Class commandClass) { + String name = commandListener.name(); + if (names.get(name) != null) { + Dish.logger.warn(String.format("[Warning] Command name '%s' already exists. Changing name to '%s%s'%n", name, name, names.size() + 1)); + name = name + (names.size() + 1); + } + + names.put(name, method); + classes.put(name, commandClass); + + LiteralArgumentBuilder command = Commands.literal(name); + String finalName = name; + Commands.getDispatcher().register( + command.executes((cmd) -> { + DishPlayer player = new DishPlayer(cmd.getSource().getPlayer()); + try { + return runCommand(finalName, player, commandListener) ? 1 : 0; + } catch (Exception e) { + Component component = Component.literal("An error occurred when running this command").withStyle(ChatFormatting.RED); + player.sendMessage(DishComponent.fromComponent(component).setColor(String.valueOf(ChatFormatting.RED.getColor().intValue()))); + return 0; + } + }) + ); + } + + public static boolean runCommand(String commandName, DishPlayer player, CommandListener commandListener) throws InstantiationException, IllegalAccessException, InvocationTargetException { + Method method = names.get(commandName); + Class clazz = classes.get(commandName); + if (method == null || clazz == null) return false; + + if (player.isConsole() && !commandListener.allowConsole()) { + System.out.println("Command can't be ran from the console."); + return false; + } + + method.setAccessible(true); + return (boolean)method.invoke(clazz.newInstance(), player); + } +} diff --git a/patches/release/1.21/net/ouja/dish/commands/VersionCommand.java b/patches/release/1.21/net/ouja/dish/commands/VersionCommand.java new file mode 100644 index 0000000..1f1450a --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/commands/VersionCommand.java @@ -0,0 +1,18 @@ +package net.ouja.dish.commands; + +import net.minecraft.commands.Commands; +import net.minecraft.network.chat.Component; +import net.ouja.api.DishAPI; +import net.ouja.dish.Dish; + +public class VersionCommand { + public static void register() { + Commands.getDispatcher().register(Commands.literal("version").executes((commandcontext) -> { + commandcontext.getSource().sendSuccess(() -> { + return Component.literal(String.format("DishServer version is '%s' implementing API '%s'", Dish.getBuild(), DishAPI.getApiVersion())); + }, false); + + return 1; + })); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/DishEntity.java b/patches/release/1.21/net/ouja/dish/entity/DishEntity.java new file mode 100644 index 0000000..a33c502 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/DishEntity.java @@ -0,0 +1,303 @@ +package net.ouja.dish.entity; + +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.EntityType; +import net.ouja.api.entity.Entity; +import net.ouja.api.entity.EntityTypes; +import net.ouja.dish.entity.monster.*; +import net.ouja.dish.entity.neutral.*; +import net.ouja.dish.entity.passive.*; +import org.jetbrains.annotations.Nullable; + +import java.util.UUID; + +public class DishEntity implements Entity { + private net.minecraft.world.entity.LivingEntity entity; + + public DishEntity(net.minecraft.world.entity.LivingEntity entity) { + this.entity = entity; + } + + @Override + public int getId() { + return entity.getId(); + } + + @Override + // todo: finish adding other entity types i.e. ChestBoat, Llama_spit, etc... + public Entity getEntity() { + EntityType entityType = this.entity.getType(); + // Passive mobs + if (entityType == EntityType.ALLAY) { + return new DishAllay(this.entity); + } + else if (entityType == EntityType.ARMADILLO) { + return new DishArmadillo(this.entity); + } + else if (entityType == EntityType.AXOLOTL) { + return new DishAxolotl(this.entity); + } + else if (entityType == EntityType.BAT) { + return new DishBat(this.entity); + } + else if (entityType == EntityType.CAMEL) { + return new DishCamel(this.entity); + } + else if (entityType == EntityType.CAT) { + return new DishCat(this.entity); + } + else if (entityType == EntityType.CHICKEN) { + return new DishChicken(this.entity); + } + else if (entityType == EntityType.COD) { + return new DishCod(this.entity); + } + else if (entityType == EntityType.COW) { + return new DishCow(this.entity); + } + else if (entityType == EntityType.DONKEY) { + return new DishDonkey(this.entity); + } + else if (entityType == EntityType.FOX) { + return new DishFox(this.entity); + } + else if (entityType == EntityType.FROG) { + return new DishFrog(this.entity); + } + else if (entityType == EntityType.GLOW_SQUID) { + return new DishGlowSquid(this.entity); + } + else if (entityType == EntityType.HORSE) { + return new DishHorse(this.entity); + } + else if (entityType == EntityType.MOOSHROOM) { + return new DishMushroomCow(this.entity); + } + else if (entityType == EntityType.MULE) { + return new DishMule(this.entity); + } + else if (entityType == EntityType.OCELOT) { + return new DishOcelot(this.entity); + } + else if (entityType == EntityType.PARROT) { + return new DishParrot(this.entity); + } + else if (entityType == EntityType.PIG) { + return new DishPig(this.entity); + } + else if (entityType == EntityType.PUFFERFISH) { + return new DishPufferfish(this.entity); + } + else if (entityType == EntityType.RABBIT) { + return new DishRabbit(this.entity); + } + else if (entityType == EntityType.SALMON) { + return new DishSalmon(this.entity); + } + else if (entityType == EntityType.SHEEP) { + return new DishSheep(this.entity); + } + else if (entityType == EntityType.SKELETON_HORSE) { + return new DishSkeletonHorse(this.entity); + } + else if (entityType == EntityType.SNIFFER) { + return new DishSniffer(this.entity); + } + else if (entityType == EntityType.SNOW_GOLEM) { + return new DishSnowGolem(this.entity); + } + else if (entityType == EntityType.SQUID) { + return new DishSquid(this.entity); + } + else if (entityType == EntityType.STRIDER) { + return new DishStrider(this.entity); + } + else if (entityType == EntityType.TADPOLE) { + return new DishTadpole(this.entity); + } + else if (entityType == EntityType.TROPICAL_FISH) { + return new DishTropicalFish(this.entity); + } + else if (entityType == EntityType.TURTLE) { + return new DishTurtle(this.entity); + } + else if (entityType == EntityType.VILLAGER) { + return new DishVillager(this.entity); + } + else if (entityType == EntityType.WANDERING_TRADER) { + return new DishWanderingTrader(this.entity); + } + // Neutral mobs + else if (entityType == EntityType.BEE) { + return new DishBee(this.entity); + } + else if (entityType == EntityType.CAVE_SPIDER) { + return new DishCaveSpider(this.entity); + } + else if (entityType == EntityType.DOLPHIN) { + return new DishDolphin(this.entity); + } + else if (entityType == EntityType.ENDERMAN) { + return new DishEnderman(this.entity); + } + else if (entityType == EntityType.GOAT) { + return new DishGoat(this.entity); + } + else if (entityType == EntityType.IRON_GOLEM) { + return new DishIronGolem(this.entity); + } + else if (entityType == EntityType.LLAMA) { + return new DishLlama(this.entity); + } + else if (entityType == EntityType.PANDA) { + return new DishPanda(this.entity); + } + else if (entityType == EntityType.PIGLIN) { + return new DishPiglin(this.entity); + } + else if (entityType == EntityType.POLAR_BEAR) { + return new DishPolarBear(this.entity); + } + else if (entityType == EntityType.SPIDER) { + return new DishSpider(this.entity); + } + else if (entityType == EntityType.TRADER_LLAMA) { + return new DishTraderLlama(this.entity); + } + else if (entityType == EntityType.WOLF) { + return new DishWolf(this.entity); + } + else if (entityType == EntityType.ZOMBIFIED_PIGLIN) { + return new DishZombifiedPiglin(this.entity); + } + // Monster mobs + else if (entityType == EntityType.BLAZE) { + return new DishBlaze(this.entity); + } + else if (entityType == EntityType.CREEPER) { + return new DishCreeper(this.entity); + } + else if (entityType == EntityType.DROWNED) { + return new DishDrowned(this.entity); + } + else if (entityType == EntityType.ELDER_GUARDIAN) { + return new DishElderGuardian(this.entity); + } + else if (entityType == EntityType.ENDERMITE) { + return new DishEndermite(this.entity); + } + else if (entityType == EntityType.EVOKER) { + return new DishEvoker(this.entity); + } + else if (entityType == EntityType.GHAST) { + return new DishGhast(this.entity); + } + else if (entityType == EntityType.GUARDIAN) { + return new DishGuardian(this.entity); + } + else if (entityType == EntityType.HOGLIN) { + return new DishHoglin(this.entity); + } + else if (entityType == EntityType.HUSK) { + return new DishHusk(this.entity); + } + else if (entityType == EntityType.MAGMA_CUBE) { + return new DishMagmaCube(this.entity); + } + else if (entityType == EntityType.PHANTOM) { + return new DishPhantom(this.entity); + } + else if (entityType == EntityType.PIGLIN_BRUTE) { + return new DishPiglinBrute(this.entity); + } + else if (entityType == EntityType.PILLAGER) { + return new DishPillager(this.entity); + } + else if (entityType == EntityType.RAVAGER) { + return new DishRavager(this.entity); + } + else if (entityType == EntityType.SHULKER) { + return new DishShulker(this.entity); + } + else if (entityType == EntityType.SILVERFISH) { + return new DishSilverfish(this.entity); + } + else if (entityType == EntityType.SKELETON) { + return new DishSkeleton(this.entity); + } + else if (entityType == EntityType.SLIME) { + return new DishSlime(this.entity); + } + else if (entityType == EntityType.STRAY) { + return new DishStray(this.entity); + } + else if (entityType == EntityType.VEX) { + return new DishVex(this.entity); + } + else if (entityType == EntityType.VINDICATOR) { + return new DishVindicator(this.entity); + } + else if (entityType == EntityType.WARDEN) { + return new DishWarden(this.entity); + } + else if (entityType == EntityType.WITCH) { + return new DishWitch(this.entity); + } + else if (entityType == EntityType.WITHER_SKELETON) { + return new DishWitherSkeleton(this.entity); + } + else if (entityType == EntityType.ZOGLIN) { + return new DishZoglin(this.entity); + } + else if (entityType == EntityType.ZOMBIE) { + return new DishZombie(this.entity); + } + else if (entityType == EntityType.ZOMBIE_HORSE) { + return new DishZombieHorse(this.entity); + } + else if (entityType == EntityType.ZOMBIE_VILLAGER) { + return new DishZombieVillager(this.entity); + } + else if (entityType == EntityType.PLAYER) { + return new DishPlayer((ServerPlayer)this.entity); + } + else if (entityType == EntityType.ENDER_DRAGON || entityType == EntityType.WITHER || entityType == EntityType.BREEZE) { + return this; + } + else { + return null; + } + } + + @Override + @Nullable + public EntityTypes getType() { + if (this.entity == null) return null; + return EntityTypes.valueOf(this.entity.getType().getDescription().getString().toUpperCase().replace(" ", "_")); + } + + @Override + public boolean isSilent() { + return this.entity.isSilent(); + } + + @Override + public void setSilent(boolean b) { + this.entity.setSilent(b); + } + + @Override + public UUID getUUID() { + return this.entity.getUUID(); + } + + @Override + public float getHealth() { + return this.entity.getHealth(); + } + + @Override + public void setHealth(float health) { + this.entity.setHealth(health); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/DishPlayer.java b/patches/release/1.21/net/ouja/dish/entity/DishPlayer.java new file mode 100644 index 0000000..6c1e212 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/DishPlayer.java @@ -0,0 +1,96 @@ +package net.ouja.dish.entity; + +import net.minecraft.core.GlobalPos; +import net.minecraft.server.level.ClientInformation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.ouja.api.entity.Player; +import net.ouja.api.world.Level; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.dish.network.chat.DishComponent; +import net.ouja.dish.server.level.DishClientInformation; +import net.ouja.dish.world.DishLevel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.UUID; + +public class DishPlayer extends DishEntity implements Player { + private net.minecraft.server.level.ServerPlayer player; + public static HashMap CACHED_PLAYERS = new HashMap<>(); + + public DishPlayer(ServerPlayer player) { + super(player); + this.player = player; + if (player != null) { + CACHED_PLAYERS.putIfAbsent(player.getUUID(), this); + } + } + + @Override + public @NotNull String getName() { + return player.getName().getString(); + } + + @Override + public @NotNull UUID getUUID() { + return player.getUUID(); + } + + @Override + public Level getLevel() { + if (isConsole()) return null; + return new DishLevel(player.getServer().getLevel(player.getCommandSenderWorld().dimension())); + } + + @Override + public boolean isConsole() { + return this.player == null; + } + + @Override + public void sendMessage(net.ouja.api.network.chat.Component component) { + this.player.sendSystemMessage(new DishComponent(component)); + } + + @Nullable + @Override + public BlockPos lastDeathLocation() { + GlobalPos globalPos = this.player.getLastDeathLocation().get(); + if (globalPos == null) return null; + return new BlockPos(globalPos.pos().getX(), globalPos.pos().getX(), globalPos.pos().getX(), new DishLevel((ServerLevel)this.player.level())); + } + + @Override + public double getReach() { + return this.player.blockInteractionRange(); + } + + @Override + public float getScale() { + return this.player.getScale(); + } + + @Override + public void setReach(double reach) { + if (reach >= 0) { + this.player.getAttribute(Attributes.BLOCK_INTERACTION_RANGE).setBaseValue(reach); + } + } + + @Override + public void setScale(float scale) { + if (scale >= 0) { + this.player.getAttribute(Attributes.SCALE).setBaseValue(scale); + } + } + + @NotNull + @Override + public DishClientInformation getClientInformation() { + ClientInformation info = this.player.clientInformation(); + return new DishClientInformation(info); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishBlaze.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishBlaze.java new file mode 100644 index 0000000..96e1e7c --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishBlaze.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Blaze; +import net.ouja.dish.entity.DishEntity; + +public class DishBlaze extends DishEntity implements net.ouja.api.entity.monster.Blaze { + private Blaze blaze; + + public DishBlaze(LivingEntity entity) { + super(entity); + this.blaze = (Blaze)entity; + } + + @Override + public boolean isOnFire() { + return this.blaze.isOnFire(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishCreeper.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishCreeper.java new file mode 100644 index 0000000..a086963 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishCreeper.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Creeper; +import net.ouja.dish.entity.DishEntity; + +public class DishCreeper extends DishEntity implements net.ouja.api.entity.monster.Creeper { + private Creeper creeper; + + public DishCreeper(LivingEntity entity) { + super(entity); + this.creeper = (Creeper)entity; + } + + @Override + public boolean isCharged() { + return this.creeper.isPowered(); + } + + @Override + public boolean isIgnited() { + return this.creeper.isIgnited(); + } + + @Override + public void ignite() { + this.creeper.ignite(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishDrowned.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishDrowned.java new file mode 100644 index 0000000..67cde95 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishDrowned.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Drowned; +import net.ouja.dish.entity.DishEntity; + +public class DishDrowned extends DishEntity implements net.ouja.api.entity.monster.Drowned { + private Drowned drowned; + + public DishDrowned(LivingEntity entity) { + super(entity); + this.drowned = (Drowned)entity; + } + + @Override + public boolean isSwimming() { + return this.drowned.isVisuallySwimming(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishElderGuardian.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishElderGuardian.java new file mode 100644 index 0000000..c766ac0 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishElderGuardian.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.ElderGuardian; +import net.ouja.dish.entity.DishEntity; + +public class DishElderGuardian extends DishEntity implements net.ouja.api.entity.monster.ElderGuardian { + private ElderGuardian elderGuardian; + + public DishElderGuardian(LivingEntity entity) { + super(entity); + this.elderGuardian = (ElderGuardian)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishEndermite.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishEndermite.java new file mode 100644 index 0000000..9d310e3 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishEndermite.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Endermite; +import net.ouja.dish.entity.DishEntity; + +public class DishEndermite extends DishEntity implements net.ouja.api.entity.monster.Endermite { + private Endermite endermite; + + public DishEndermite(LivingEntity entity) { + super(entity); + this.endermite = (Endermite)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishEvoker.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishEvoker.java new file mode 100644 index 0000000..898865d --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishEvoker.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Evoker; +import net.ouja.dish.entity.DishEntity; + +public class DishEvoker extends DishEntity implements net.ouja.api.entity.monster.Evoker { + private Evoker evoker; + + public DishEvoker(LivingEntity entity) { + super(entity); + this.evoker = (Evoker)entity; + } + + @Override + public boolean isCastingSpell() { + return this.evoker.isCastingSpell(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishGhast.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishGhast.java new file mode 100644 index 0000000..8190814 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishGhast.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Ghast; +import net.ouja.dish.entity.DishEntity; + +public class DishGhast extends DishEntity implements net.ouja.api.entity.monster.Ghast { + private Ghast ghast; + + public DishGhast(LivingEntity entity) { + super(entity); + this.ghast = (Ghast)entity; + } + + @Override + public boolean isCharged() { + return this.ghast.isCharging(); + } + + @Override + public void setCharged(boolean b) { + this.ghast.setCharging(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishGuardian.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishGuardian.java new file mode 100644 index 0000000..6381401 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishGuardian.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Guardian; +import net.ouja.dish.entity.DishEntity; + +public class DishGuardian extends DishEntity implements net.ouja.api.entity.monster.Guardian { + private Guardian guardian; + + public DishGuardian(LivingEntity entity) { + super(entity); + this.guardian = (Guardian)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishHoglin.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishHoglin.java new file mode 100644 index 0000000..26efdb5 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishHoglin.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.hoglin.Hoglin; +import net.ouja.dish.entity.DishEntity; + +public class DishHoglin extends DishEntity implements net.ouja.api.entity.monster.Hoglin { + private Hoglin hoglin; + + public DishHoglin(LivingEntity entity) { + super(entity); + this.hoglin = (Hoglin)entity; + } + + @Override + public void setImmuneToZombification(boolean b) { + this.hoglin.setImmuneToZombification(b); + } + + @Override + public boolean isImmuneToZombification() { + return this.hoglin.isImmuneToZombification(); + } + + @Override + public boolean isConverting() { + return this.hoglin.isConverting(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishHusk.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishHusk.java new file mode 100644 index 0000000..cc1fb8a --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishHusk.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Husk; +import net.ouja.dish.entity.DishEntity; + +public class DishHusk extends DishEntity implements net.ouja.api.entity.monster.Husk { + private Husk husk; + + public DishHusk(LivingEntity entity) { + super(entity); + this.husk = (Husk)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishMagmaCube.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishMagmaCube.java new file mode 100644 index 0000000..026db1a --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishMagmaCube.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.MagmaCube; +import net.ouja.dish.entity.DishEntity; + +public class DishMagmaCube extends DishEntity implements net.ouja.api.entity.monster.MagmaCube { + private MagmaCube magmaCube; + + public DishMagmaCube(LivingEntity entity) { + super(entity); + this.magmaCube = (MagmaCube)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishPhantom.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishPhantom.java new file mode 100644 index 0000000..4a0d826 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishPhantom.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Phantom; +import net.ouja.dish.entity.DishEntity; + +public class DishPhantom extends DishEntity implements net.ouja.api.entity.monster.Phantom { + private Phantom phantom; + + public DishPhantom(LivingEntity entity) { + super(entity); + this.phantom = (Phantom)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishPiglinBrute.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishPiglinBrute.java new file mode 100644 index 0000000..75ec5a9 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishPiglinBrute.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.piglin.PiglinBrute; +import net.ouja.dish.entity.DishEntity; + +public class DishPiglinBrute extends DishEntity implements net.ouja.api.entity.monster.PiglinBrute { + private PiglinBrute piglinBrute; + + public DishPiglinBrute(LivingEntity entity) { + super(entity); + this.piglinBrute = (PiglinBrute)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishPillager.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishPillager.java new file mode 100644 index 0000000..fc99dae --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishPillager.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Pillager; +import net.ouja.dish.entity.DishEntity; + +public class DishPillager extends DishEntity implements net.ouja.api.entity.monster.Pillager { + private Pillager pillager; + + public DishPillager(LivingEntity entity) { + super(entity); + this.pillager = (Pillager)entity; + } + + @Override + public boolean isChargingCrossbow() { + return this.pillager.isChargingCrossbow(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishRavager.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishRavager.java new file mode 100644 index 0000000..b570063 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishRavager.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Ravager; +import net.ouja.dish.entity.DishEntity; + +public class DishRavager extends DishEntity implements net.ouja.api.entity.monster.Ravager { + private Ravager ravager; + + public DishRavager(LivingEntity entity) { + super(entity); + this.ravager = (Ravager)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishShulker.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishShulker.java new file mode 100644 index 0000000..59469c6 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishShulker.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Shulker; +import net.ouja.dish.entity.DishEntity; + +public class DishShulker extends DishEntity implements net.ouja.api.entity.monster.Shulker { + private Shulker shulker; + + public DishShulker(LivingEntity entity) { + super(entity); + this.shulker = (Shulker)entity; + } + + @Override + public boolean isClosed() { + return this.shulker.isClosed(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishSilverfish.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishSilverfish.java new file mode 100644 index 0000000..1fe67c2 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishSilverfish.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Silverfish; +import net.ouja.dish.entity.DishEntity; + +public class DishSilverfish extends DishEntity implements net.ouja.api.entity.monster.Silverfish { + private Silverfish silverfish; + + public DishSilverfish(LivingEntity entity) { + super(entity); + this.silverfish = (Silverfish)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishSkeleton.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishSkeleton.java new file mode 100644 index 0000000..2a03add --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishSkeleton.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Skeleton; +import net.ouja.dish.entity.DishEntity; + +public class DishSkeleton extends DishEntity implements net.ouja.api.entity.monster.Skeleton { + private Skeleton skeleton; + + public DishSkeleton(LivingEntity entity) { + super(entity); + this.skeleton = (Skeleton)entity; + } + + @Override + public boolean isShaking() { + return this.skeleton.isShaking(); + } + + @Override + public void setShaking(boolean b) { + this.skeleton.setFreezeConverting(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishSlime.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishSlime.java new file mode 100644 index 0000000..064cca1 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishSlime.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Slime; +import net.ouja.dish.entity.DishEntity; + +public class DishSlime extends DishEntity implements net.ouja.api.entity.monster.Slime { + private Slime slime; + + public DishSlime(LivingEntity entity) { + super(entity); + this.slime = (Slime)entity; + } + + @Override + public int getSize() { + return this.slime.getSize(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishStray.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishStray.java new file mode 100644 index 0000000..e69df7f --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishStray.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Stray; +import net.ouja.dish.entity.DishEntity; + +public class DishStray extends DishEntity implements net.ouja.api.entity.monster.Stray { + private Stray stray; + + public DishStray(LivingEntity entity) { + super(entity); + this.stray = (Stray)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishVex.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishVex.java new file mode 100644 index 0000000..1369b65 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishVex.java @@ -0,0 +1,22 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Vex; +import net.ouja.dish.entity.DishEntity; +import org.jetbrains.annotations.Nullable; + +public class DishVex extends DishEntity implements net.ouja.api.entity.monster.Vex { + private Vex vex; + + public DishVex(LivingEntity entity) { + super(entity); + this.vex = (Vex)entity; + } + + @Override + @Nullable + public net.ouja.api.entity.Entity getOwner() { + if (this.vex.getOwner() == null) return null; + return new DishEntity(this.vex.getOwner()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishVindicator.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishVindicator.java new file mode 100644 index 0000000..68b2e98 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishVindicator.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Vindicator; +import net.ouja.dish.entity.DishEntity; + +public class DishVindicator extends DishEntity implements net.ouja.api.entity.monster.Vindicator { + private Vindicator vindicator; + + public DishVindicator(LivingEntity entity) { + super(entity); + this.vindicator = (Vindicator)entity; + } + + @Override + public boolean isJohnny() { + return this.vindicator.isJohnny(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishWarden.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishWarden.java new file mode 100644 index 0000000..aa71aba --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishWarden.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.warden.Warden; +import net.ouja.dish.entity.DishEntity; + +public class DishWarden extends DishEntity implements net.ouja.api.entity.monster.Warden { + private Warden warden; + + public DishWarden(LivingEntity entity) { + super(entity); + this.warden = (Warden)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishWitch.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishWitch.java new file mode 100644 index 0000000..06111f9 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishWitch.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Witch; +import net.ouja.dish.entity.DishEntity; + +public class DishWitch extends DishEntity implements net.ouja.api.entity.monster.Witch { + private Witch witch; + + public DishWitch(LivingEntity entity) { + super(entity); + this.witch = (Witch)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishWitherSkeleton.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishWitherSkeleton.java new file mode 100644 index 0000000..f35dfee --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishWitherSkeleton.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.WitherSkeleton; +import net.ouja.dish.entity.DishEntity; + +public class DishWitherSkeleton extends DishEntity implements net.ouja.api.entity.monster.WitherSkeleton { + private WitherSkeleton witherSkeleton; + + public DishWitherSkeleton(LivingEntity entity) { + super(entity); + this.witherSkeleton = (WitherSkeleton)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishZoglin.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishZoglin.java new file mode 100644 index 0000000..03b39f7 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishZoglin.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Zoglin; +import net.ouja.dish.entity.DishEntity; + +public class DishZoglin extends DishEntity implements net.ouja.api.entity.monster.Zoglin { + private Zoglin zoglin; + + public DishZoglin(LivingEntity entity) { + super(entity); + this.zoglin = (Zoglin)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishZombie.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishZombie.java new file mode 100644 index 0000000..ae8b412 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishZombie.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Zombie; +import net.ouja.dish.entity.DishEntity; + +public class DishZombie extends DishEntity implements net.ouja.api.entity.monster.Zombie { + private Zombie zombie; + + public DishZombie(LivingEntity entity) { + super(entity); + this.zombie = (Zombie)entity; + } + + @Override + public boolean isConverting() { + return this.zombie.isUnderWaterConverting(); + } + + @Override + public boolean canBreakDoors() { + return this.zombie.canBreakDoors(); + } + + @Override + public void setCanBreakDoors(boolean b) { + this.zombie.setCanBreakDoors(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishZombieHorse.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishZombieHorse.java new file mode 100644 index 0000000..865cb3d --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishZombieHorse.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.ZombieHorse; +import net.ouja.dish.entity.DishEntity; + +public class DishZombieHorse extends DishEntity implements net.ouja.api.entity.monster.ZombieHorse { + private ZombieHorse zombieHorse; + + public DishZombieHorse(LivingEntity entity) { + super(entity); + this.zombieHorse = (ZombieHorse)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishZombieVillager.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishZombieVillager.java new file mode 100644 index 0000000..8b743f4 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishZombieVillager.java @@ -0,0 +1,13 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.ZombieVillager; + +public class DishZombieVillager extends DishZombie implements net.ouja.api.entity.monster.ZombieVillager { + private ZombieVillager zombieVillager; + + public DishZombieVillager(LivingEntity entity) { + super(entity); + this.zombieVillager = (ZombieVillager)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishBee.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishBee.java new file mode 100644 index 0000000..1f34df6 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishBee.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Bee; +import net.ouja.dish.entity.DishEntity; + +public class DishBee extends DishEntity implements net.ouja.api.entity.neutral.Bee { + private Bee bee; + + public DishBee(LivingEntity entity) { + super(entity); + this.bee = (Bee)entity; + } + + @Override + public boolean hasNectar() { + return this.bee.hasNectar(); + } + + @Override + public boolean hasStung() { + return this.bee.hasStung(); + } + + @Override + public boolean isAngry() { + return this.bee.isAngry(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishCaveSpider.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishCaveSpider.java new file mode 100644 index 0000000..1c58fea --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishCaveSpider.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.CaveSpider; +import net.ouja.dish.entity.DishEntity; + +public class DishCaveSpider extends DishEntity implements net.ouja.api.entity.neutral.CaveSpider { + private CaveSpider caveSpider; + + public DishCaveSpider(LivingEntity entity) { + super(entity); + this.caveSpider = (CaveSpider)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishDolphin.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishDolphin.java new file mode 100644 index 0000000..62e4360 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishDolphin.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Dolphin; +import net.ouja.dish.entity.DishEntity; + +public class DishDolphin extends DishEntity { + private Dolphin dolphin; + + public DishDolphin(LivingEntity entity) { + super(entity); + this.dolphin = (Dolphin)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishEnderman.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishEnderman.java new file mode 100644 index 0000000..c71a750 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishEnderman.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.EnderMan; +import net.ouja.dish.entity.DishEntity; + +public class DishEnderman extends DishEntity { + private EnderMan enderMan; + + public DishEnderman(LivingEntity entity) { + super(entity); + this.enderMan = (EnderMan)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishGoat.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishGoat.java new file mode 100644 index 0000000..2002f3e --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishGoat.java @@ -0,0 +1,39 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.goat.Goat; +import net.ouja.dish.entity.DishEntity; + +public class DishGoat extends DishEntity implements net.ouja.api.entity.neutral.Goat { + private Goat goat; + + public DishGoat(LivingEntity entity) { + super(entity); + this.goat = (Goat)entity; + } + + @Override + public boolean hasLeftHorn() { + return this.goat.hasLeftHorn(); + } + + @Override + public boolean hasRightHorn() { + return this.goat.hasRightHorn(); + } + + @Override + public void addHorns() { + this.goat.addHorns(); + } + + @Override + public void removeHorns() { + this.goat.removeHorns(); + } + + @Override + public boolean isScreamingGoat() { + return this.goat.isScreamingGoat(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishIronGolem.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishIronGolem.java new file mode 100644 index 0000000..0067562 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishIronGolem.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.IronGolem; +import net.ouja.dish.entity.DishEntity; + +public class DishIronGolem extends DishEntity implements net.ouja.api.entity.neutral.IronGolem { + private IronGolem ironGolem; + + public DishIronGolem(LivingEntity entity) { + super(entity); + this.ironGolem = (IronGolem)entity; + } + + @Override + public boolean isPlayerCreated() { + return this.ironGolem.isPlayerCreated(); + } + + @Override + public Crack getCrackiness() { + return Crack.valueOf(this.ironGolem.getCrackiness().name()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishLlama.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishLlama.java new file mode 100644 index 0000000..cc1510c --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishLlama.java @@ -0,0 +1,20 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.Llama; +import net.ouja.api.entity.neutral.LlamaVariants; +import net.ouja.dish.entity.DishEntity; + +public class DishLlama extends DishEntity implements net.ouja.api.entity.neutral.Llama { + private Llama llama; + + public DishLlama(LivingEntity entity) { + super(entity); + this.llama = (Llama)entity; + } + + @Override + public LlamaVariants getVariant() { + return LlamaVariants.valueOf(this.llama.getVariant().name()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishPanda.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishPanda.java new file mode 100644 index 0000000..d07cc2f --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishPanda.java @@ -0,0 +1,44 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Panda; +import net.ouja.dish.entity.DishEntity; + +public class DishPanda extends DishEntity implements net.ouja.api.entity.neutral.Panda { + private Panda panda; + + public DishPanda(LivingEntity entity) { + super(entity); + this.panda = (Panda)entity; + } + + @Override + public boolean isSitting() { + return this.panda.isSitting(); + } + + @Override + public boolean isSneezing() { + return this.panda.isSneezing(); + } + + @Override + public boolean isOnBack() { + return this.panda.isOnBack(); + } + + @Override + public boolean isEating() { + return this.panda.isEating(); + } + + @Override + public boolean isRolling() { + return this.panda.isRolling(); + } + + @Override + public void sneeze(boolean b) { + this.panda.sneeze(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishPiglin.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishPiglin.java new file mode 100644 index 0000000..4ad4f86 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishPiglin.java @@ -0,0 +1,34 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.piglin.Piglin; +import net.ouja.dish.entity.DishEntity; + +public class DishPiglin extends DishEntity implements net.ouja.api.entity.neutral.Piglin { + private Piglin piglin; + + public DishPiglin(LivingEntity entity) { + super(entity); + this.piglin = (Piglin)entity; + } + + @Override + public boolean canHunt() { + return this.piglin.canHunt(); + } + + @Override + public void setCanHunt(boolean b) { + this.piglin.setCannotHunt(b); + } + + @Override + public boolean isDancing() { + return this.piglin.isDancing(); + } + + @Override + public void setDancing(boolean b) { + this.piglin.setDancing(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishPolarBear.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishPolarBear.java new file mode 100644 index 0000000..603cde0 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishPolarBear.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.PolarBear; +import net.ouja.dish.entity.DishEntity; + +public class DishPolarBear extends DishEntity implements net.ouja.api.entity.neutral.PolarBear { + private PolarBear polarBear; + + public DishPolarBear(LivingEntity entity) { + super(entity); + this.polarBear = (PolarBear)entity; + } + + @Override + public boolean isStanding() { + return this.polarBear.isStanding(); + } + + @Override + public void setStanding(boolean b) { + this.polarBear.setStanding(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishSpider.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishSpider.java new file mode 100644 index 0000000..fb50e74 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishSpider.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Spider; +import net.ouja.dish.entity.DishEntity; + +public class DishSpider extends DishEntity implements net.ouja.api.entity.neutral.Spider { + private Spider spider; + + public DishSpider(LivingEntity entity) { + super(entity); + this.spider = (Spider)entity; + } + + @Override + public boolean isClimbing() { + return this.spider.isClimbing(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishTraderLlama.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishTraderLlama.java new file mode 100644 index 0000000..2f57626 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishTraderLlama.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.TraderLlama; +import net.ouja.dish.entity.DishEntity; + +public class DishTraderLlama extends DishEntity implements net.ouja.api.entity.neutral.TraderLlama { + private TraderLlama traderLlama; + + public DishTraderLlama(LivingEntity entity) { + super(entity); + this.traderLlama = (TraderLlama)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishWolf.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishWolf.java new file mode 100644 index 0000000..e29c493 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishWolf.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Wolf; +import net.ouja.dish.entity.DishEntity; + +public class DishWolf extends DishEntity implements net.ouja.api.entity.neutral.Wolf { + private Wolf wolf; + + public DishWolf(LivingEntity entity) { + super(entity); + this.wolf = (Wolf)entity; + } + + @Override + public boolean isWet() { + return this.wolf.isWet(); + } + + @Override + public float getTailAngle() { + return this.wolf.getTailAngle(); + } + + @Override + public boolean isInterested() { + return this.wolf.isInterested(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/neutral/DishZombifiedPiglin.java b/patches/release/1.21/net/ouja/dish/entity/neutral/DishZombifiedPiglin.java new file mode 100644 index 0000000..6130b23 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/neutral/DishZombifiedPiglin.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.ZombifiedPiglin; +import net.ouja.dish.entity.DishEntity; + +public class DishZombifiedPiglin extends DishEntity implements net.ouja.api.entity.neutral.ZombifiedPiglin { + private ZombifiedPiglin zombifiedPiglin; + + public DishZombifiedPiglin(LivingEntity entity) { + super(entity); + this.zombifiedPiglin = (ZombifiedPiglin)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishAllay.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishAllay.java new file mode 100644 index 0000000..93138cc --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishAllay.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.allay.Allay; +import net.ouja.dish.entity.DishEntity; + +public class DishAllay extends DishEntity implements net.ouja.api.entity.passive.Allay { + private Allay allay; + + public DishAllay(LivingEntity entity) { + super(entity); + this.allay = (Allay)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishArmadillo.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishArmadillo.java new file mode 100644 index 0000000..2ee6cea --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishArmadillo.java @@ -0,0 +1,34 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.armadillo.Armadillo; +import net.ouja.dish.entity.DishEntity; + +public class DishArmadillo extends DishEntity implements net.ouja.api.entity.passive.Armadillo { + private final Armadillo armadillo; + + public DishArmadillo(LivingEntity entity) { + super(entity); + this.armadillo = (Armadillo)entity; + } + + @Override + public boolean isScared() { + return this.armadillo.isScared(); + } + + @Override + public void setScared(boolean scared) { + this.armadillo.switchToState(scared ? Armadillo.ArmadilloState.SCARED : Armadillo.ArmadilloState.IDLE); + } + + @Override + public void rollUp() { + this.armadillo.rollUp(); + } + + @Override + public void rollOut() { + this.armadillo.rollOut(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishAxolotl.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishAxolotl.java new file mode 100644 index 0000000..08b0df2 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishAxolotl.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.axolotl.Axolotl; +import net.ouja.dish.entity.DishEntity; + +public class DishAxolotl extends DishEntity implements net.ouja.api.entity.passive.Axolotl { + private Axolotl axolotl; + + public DishAxolotl(LivingEntity entity) { + super(entity); + this.axolotl = (Axolotl)entity; + } + + @Override + public String getVariant() { + return this.axolotl.getVariant().getName(); + } + + @Override + public boolean isFromBucket() { + return this.axolotl.fromBucket(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishBat.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishBat.java new file mode 100644 index 0000000..dc7b6bf --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishBat.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ambient.Bat; +import net.ouja.dish.entity.DishEntity; + +public class DishBat extends DishEntity implements net.ouja.api.entity.passive.Bat { + private Bat bat; + + public DishBat(LivingEntity entity) { + super(entity); + this.bat = (Bat)entity; + } + + @Override + public boolean isResting() { + return this.bat.isResting(); + } + + @Override + public void setResting(boolean b) { + this.bat.setResting(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishCamel.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishCamel.java new file mode 100644 index 0000000..b7f5726 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishCamel.java @@ -0,0 +1,39 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.camel.Camel; +import net.ouja.dish.entity.DishEntity; + +public class DishCamel extends DishEntity implements net.ouja.api.entity.passive.Camel { + private Camel camel; + + public DishCamel(LivingEntity entity) { + super(entity); + this.camel = (Camel)entity; + } + + @Override + public boolean isSitting() { + return this.camel.isCamelSitting(); + } + + @Override + public boolean isDashing() { + return this.camel.isDashing(); + } + + @Override + public void setDashing(boolean b) { + this.camel.setDashing(b); + } + + @Override + public void sitDown() { + this.camel.sitDown(); + } + + @Override + public void standUp() { + this.camel.standUp(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishCat.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishCat.java new file mode 100644 index 0000000..c48cb32 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishCat.java @@ -0,0 +1,34 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Cat; +import net.ouja.dish.entity.DishEntity; + +public class DishCat extends DishEntity implements net.ouja.api.entity.passive.Cat { + private Cat cat; + + public DishCat(LivingEntity entity) { + super(entity); + this.cat = (net.minecraft.world.entity.animal.Cat)entity; + } + + @Override + public String getBreed() { + return cat.getVariant().toString(); + } + + @Override + public boolean isLaying() { + return cat.isLying(); + } + + @Override + public void hiss() { + cat.hiss(); + } + + @Override + public void setLaying(boolean b) { + cat.setLying(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishChicken.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishChicken.java new file mode 100644 index 0000000..71a3223 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishChicken.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Chicken; +import net.ouja.dish.entity.DishEntity; + +public class DishChicken extends DishEntity implements net.ouja.api.entity.passive.Chicken { + private Chicken chicken; + + public DishChicken(LivingEntity entity) { + super(entity); + this.chicken = (Chicken)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishCod.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishCod.java new file mode 100644 index 0000000..61be7f6 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishCod.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Cod; +import net.ouja.dish.entity.DishEntity; + +public class DishCod extends DishEntity implements net.ouja.api.entity.passive.Cod { + private Cod cod; + + public DishCod(LivingEntity entity) { + super(entity); + this.cod = (Cod)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishCow.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishCow.java new file mode 100644 index 0000000..562ff67 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishCow.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Cow; +import net.ouja.dish.entity.DishEntity; + +public class DishCow extends DishEntity implements net.ouja.api.entity.passive.Cow { + private Cow cow; + + public DishCow(LivingEntity entity) { + super(entity); + this.cow = (Cow)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishDonkey.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishDonkey.java new file mode 100644 index 0000000..177ca85 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishDonkey.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.Donkey; +import net.ouja.dish.entity.DishEntity; + +public class DishDonkey extends DishEntity implements net.ouja.api.entity.passive.Donkey { + private Donkey donkey; + + public DishDonkey(LivingEntity entity) { + super(entity); + this.donkey = (Donkey)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishFox.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishFox.java new file mode 100644 index 0000000..b004669 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishFox.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Fox; +import net.ouja.dish.entity.DishEntity; + +public class DishFox extends DishEntity implements net.ouja.api.entity.passive.Fox { + private Fox fox; + + public DishFox(LivingEntity entity) { + super(entity); + this.fox = (Fox)entity; + } + + @Override + public String getVariant() { + return this.fox.getVariant().getSerializedName(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishFrog.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishFrog.java new file mode 100644 index 0000000..9f8c567 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishFrog.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.frog.Frog; +import net.ouja.dish.entity.DishEntity; + +public class DishFrog extends DishEntity implements net.ouja.api.entity.passive.Frog { + private Frog frog; + + public DishFrog(LivingEntity entity) { + super(entity); + this.frog = (Frog)entity; + } + + @Override + public String getVariant() { + return this.frog.getVariant().toString(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishGlowSquid.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishGlowSquid.java new file mode 100644 index 0000000..6165e85 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishGlowSquid.java @@ -0,0 +1,13 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.GlowSquid; + +public class DishGlowSquid extends DishSquid implements net.ouja.api.entity.passive.GlowSquid { + private GlowSquid glowSquid; + + public DishGlowSquid(LivingEntity entity) { + super(entity); + this.glowSquid = (GlowSquid)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishHorse.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishHorse.java new file mode 100644 index 0000000..9c2df85 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishHorse.java @@ -0,0 +1,26 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.Horse; +import net.ouja.api.entity.passive.HorseMarkings; +import net.ouja.api.entity.passive.HorseTypes; +import net.ouja.dish.entity.DishEntity; + +public class DishHorse extends DishEntity implements net.ouja.api.entity.passive.Horse { + private Horse horse; + + public DishHorse(LivingEntity entity) { + super(entity); + this.horse = (Horse)entity; + } + + @Override + public HorseTypes getVariant() { + return HorseTypes.valueOf(this.horse.getVariant().name()); + } + + @Override + public HorseMarkings getMarkings() { + return HorseMarkings.valueOf(this.horse.getMarkings().name()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishMule.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishMule.java new file mode 100644 index 0000000..1eeb258 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishMule.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.Mule; +import net.ouja.dish.entity.DishEntity; + +public class DishMule extends DishEntity implements net.ouja.api.entity.passive.Mule { + private Mule mule; + + public DishMule(LivingEntity entity) { + super(entity); + this.mule = (Mule)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishMushroomCow.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishMushroomCow.java new file mode 100644 index 0000000..925e5c2 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishMushroomCow.java @@ -0,0 +1,22 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.MushroomCow; +import net.ouja.api.entity.passive.MooshroomCow; +import net.ouja.api.entity.passive.MooshroomCowTypes; +import net.ouja.dish.entity.DishEntity; + +public class DishMushroomCow extends DishEntity implements MooshroomCow { + private MushroomCow mushroomCow; + + public DishMushroomCow(LivingEntity entity) { + super(entity); + this.mushroomCow = (MushroomCow)entity; + this.mushroomCow.getVariant(); + } + + @Override + public MooshroomCowTypes getVariant() { + return MooshroomCowTypes.valueOf(this.mushroomCow.getVariant().name()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishOcelot.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishOcelot.java new file mode 100644 index 0000000..28ce08a --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishOcelot.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Ocelot; +import net.ouja.dish.entity.DishEntity; + +public class DishOcelot extends DishEntity implements net.ouja.api.entity.passive.Ocelot { + private Ocelot ocelot; + + public DishOcelot(LivingEntity entity) { + super(entity); + this.ocelot = (Ocelot)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishParrot.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishParrot.java new file mode 100644 index 0000000..a6aee12 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishParrot.java @@ -0,0 +1,20 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Parrot; +import net.ouja.api.entity.passive.ParrotTypes; +import net.ouja.dish.entity.DishEntity; + +public class DishParrot extends DishEntity implements net.ouja.api.entity.passive.Parrot { + private Parrot parrot; + + public DishParrot(LivingEntity entity) { + super(entity); + this.parrot = (Parrot)entity; + } + + @Override + public ParrotTypes getVariant() { + return ParrotTypes.valueOf(this.parrot.getVariant().name()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishPig.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishPig.java new file mode 100644 index 0000000..1751144 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishPig.java @@ -0,0 +1,30 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Pig; +import net.ouja.dish.entity.DishEntity; + +public class DishPig extends DishEntity implements net.ouja.api.entity.passive.Pig { + private Pig pig; + + public DishPig(LivingEntity entity) { + super(entity); + this.pig = (Pig)entity; + } + + @Override + public boolean canSaddle() { + return this.pig.isSaddleable(); + } + + @Override + public boolean isSaddled() { + return this.pig.isSaddled(); + } + + @Override + public void equipSaddle() { + this.pig.equipSaddle(SoundSource.BLOCKS); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishPufferfish.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishPufferfish.java new file mode 100644 index 0000000..d3ed781 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishPufferfish.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Pufferfish; +import net.ouja.dish.entity.DishEntity; + +public class DishPufferfish extends DishEntity implements net.ouja.api.entity.passive.Pufferfish { + private Pufferfish pufferfish; + + public DishPufferfish(LivingEntity entity) { + super(entity); + this.pufferfish = (Pufferfish)entity; + } + + @Override + public int getPuffState() { + return this.pufferfish.getPuffState(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishRabbit.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishRabbit.java new file mode 100644 index 0000000..4f87ab7 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishRabbit.java @@ -0,0 +1,20 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Rabbit; +import net.ouja.api.entity.passive.RabbitVariants; +import net.ouja.dish.entity.DishEntity; + +public class DishRabbit extends DishEntity implements net.ouja.api.entity.passive.Rabbit { + private Rabbit rabbit; + + public DishRabbit(LivingEntity entity) { + super(entity); + this.rabbit = (Rabbit)entity; + } + + @Override + public RabbitVariants getVariant() { + return RabbitVariants.valueOf(this.rabbit.getVariant().name()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishSalmon.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishSalmon.java new file mode 100644 index 0000000..5c110b4 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishSalmon.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Salmon; +import net.ouja.dish.entity.DishEntity; + +public class DishSalmon extends DishEntity implements net.ouja.api.entity.passive.Salmon { + private Salmon salmon; + + public DishSalmon(LivingEntity entity) { + super(entity); + this.salmon = (Salmon)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishSheep.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishSheep.java new file mode 100644 index 0000000..81a50f0 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishSheep.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Sheep; +import net.ouja.dish.entity.DishEntity; + +public class DishSheep extends DishEntity implements net.ouja.api.entity.passive.Sheep { + private Sheep sheep; + + public DishSheep(LivingEntity entity) { + super(entity); + this.sheep = (Sheep)entity; + } + + @Override + public boolean isSheared() { + return this.sheep.isSheared(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishSkeletonHorse.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishSkeletonHorse.java new file mode 100644 index 0000000..59860c4 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishSkeletonHorse.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.SkeletonHorse; +import net.ouja.dish.entity.DishEntity; + +public class DishSkeletonHorse extends DishEntity implements net.ouja.api.entity.passive.SkeletonHorse { + private SkeletonHorse skeletonHorse; + + public DishSkeletonHorse(LivingEntity entity) { + super(entity); + this.skeletonHorse = (SkeletonHorse)entity; + } + + @Override + public boolean isTrap() { + return this.skeletonHorse.isTrap(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishSniffer.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishSniffer.java new file mode 100644 index 0000000..a53f22b --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishSniffer.java @@ -0,0 +1,35 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.sniffer.Sniffer; +import net.ouja.api.entity.passive.SnifferState; +import net.ouja.dish.entity.DishEntity; + +public class DishSniffer extends DishEntity implements net.ouja.api.entity.passive.Sniffer { + private Sniffer sniffer; + + public DishSniffer(LivingEntity entity) { + super(entity); + this.sniffer = (Sniffer)entity; + } + + @Override + public boolean isPanicked() { + return this.sniffer.isPanicking(); + } + + @Override + public boolean isSearching() { + return this.sniffer.isSearching(); + } + + @Override + public boolean isTempted() { + return this.sniffer.isTempted(); + } + + @Override + public SnifferState getState() { + return SnifferState.valueOf(this.sniffer.getState().name()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishSnowGolem.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishSnowGolem.java new file mode 100644 index 0000000..2dff40d --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishSnowGolem.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.SnowGolem; +import net.ouja.dish.entity.DishEntity; + +public class DishSnowGolem extends DishEntity implements net.ouja.api.entity.passive.SnowGolem { + private SnowGolem snowGolem; + + public DishSnowGolem(LivingEntity entity) { + super(entity); + this.snowGolem = (SnowGolem)entity; + } + + @Override + public boolean isWearingPumpkin() { + return this.snowGolem.hasPumpkin(); + } + + @Override + public void setWearingPumpkin(boolean b) { + this.snowGolem.setPumpkin(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishSquid.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishSquid.java new file mode 100644 index 0000000..a7f3395 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishSquid.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Squid; +import net.ouja.dish.entity.DishEntity; + +public class DishSquid extends DishEntity implements net.ouja.api.entity.passive.Squid { + private Squid squid; + + public DishSquid(LivingEntity entity) { + super(entity); + this.squid = (Squid)entity; + } + + @Override + public void ink() { + this.squid.spawnInk(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishStrider.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishStrider.java new file mode 100644 index 0000000..57f1679 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishStrider.java @@ -0,0 +1,30 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Strider; +import net.ouja.dish.entity.DishEntity; + +public class DishStrider extends DishEntity implements net.ouja.api.entity.passive.Strider { + private Strider strider; + + public DishStrider(LivingEntity entity) { + super(entity); + this.strider = (Strider)entity; + } + + @Override + public boolean canSaddle() { + return this.strider.isSaddleable(); + } + + @Override + public boolean isSaddled() { + return this.strider.isSaddled(); + } + + @Override + public void equipSaddle() { + this.strider.equipSaddle(SoundSource.BLOCKS); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishTadpole.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishTadpole.java new file mode 100644 index 0000000..2e667ab --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishTadpole.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.frog.Tadpole; +import net.ouja.dish.entity.DishEntity; + +public class DishTadpole extends DishEntity implements net.ouja.api.entity.passive.Tadpole { + private Tadpole tadpole; + + public DishTadpole(LivingEntity entity) { + super(entity); + this.tadpole = (Tadpole)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishTropicalFish.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishTropicalFish.java new file mode 100644 index 0000000..4cc5ad1 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishTropicalFish.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.TropicalFish; +import net.ouja.dish.entity.DishEntity; + +public class DishTropicalFish extends DishEntity implements net.ouja.api.entity.passive.TropicalFish { + private TropicalFish tropicalFish; + + public DishTropicalFish(LivingEntity entity) { + super(entity); + this.tropicalFish = (TropicalFish)entity; + } + + @Override + public net.ouja.api.entity.passive.TropicalFish.Variants getVariant() { + return net.ouja.api.entity.passive.TropicalFish.Variants.valueOf(this.tropicalFish.getVariant().name()); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishTurtle.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishTurtle.java new file mode 100644 index 0000000..2156252 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishTurtle.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Turtle; +import net.ouja.dish.entity.DishEntity; + +public class DishTurtle extends DishEntity implements net.ouja.api.entity.passive.Turtle { + private Turtle turtle; + + public DishTurtle(LivingEntity entity) { + super(entity); + this.turtle = (Turtle)entity; + } + + @Override + public boolean hasEgg() { + return this.turtle.hasEgg(); + } + + @Override + public boolean isLayingEgg() { + return this.turtle.isLayingEgg(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishVillager.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishVillager.java new file mode 100644 index 0000000..2dd626d --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishVillager.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.npc.Villager; +import net.ouja.dish.entity.DishEntity; + +public class DishVillager extends DishEntity implements net.ouja.api.entity.passive.Villager { + private Villager villager; + + public DishVillager(LivingEntity entity) { + super(entity); + this.villager = (Villager)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishWanderingTrader.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishWanderingTrader.java new file mode 100644 index 0000000..e33072d --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishWanderingTrader.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.npc.WanderingTrader; +import net.ouja.dish.entity.DishEntity; + +public class DishWanderingTrader extends DishEntity implements net.ouja.api.entity.passive.WanderingTrader { + private WanderingTrader wanderingTrader; + + public DishWanderingTrader(LivingEntity entity) { + super(entity); + this.wanderingTrader = (WanderingTrader)entity; + } +} diff --git a/patches/release/1.21/net/ouja/dish/network/chat/DishComponent.java b/patches/release/1.21/net/ouja/dish/network/chat/DishComponent.java new file mode 100644 index 0000000..22a2e1e --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/network/chat/DishComponent.java @@ -0,0 +1,83 @@ +package net.ouja.dish.network.chat; + +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.ComponentContents; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; +import net.minecraft.network.chat.TextColor; +import net.minecraft.util.FormattedCharSequence; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public class DishComponent implements Component { + private final Component component; + + public DishComponent(net.ouja.api.network.chat.Component fakeComponent) { + this.component = Component.literal(fakeComponent.getString()) + .setStyle( + Style.EMPTY + .withColor(TextColor.parseColor(fakeComponent.getColor()).getOrThrow()) + .withBold(fakeComponent.isBold()) + .withUnderlined(fakeComponent.isUnderlined()) + .withStrikethrough(fakeComponent.isStrikeThrough()) + .withItalic(fakeComponent.isItalic()) + ); + } + + @Override + public Style getStyle() { + return this.component.getStyle(); + } + + @Override + public ComponentContents getContents() { + return this.component.getContents(); + } + + @Override + public @NotNull String getString() { + return this.component.getString(); + } + + @Override + public List getSiblings() { + return this.component.getSiblings(); + } + + @Override + public FormattedCharSequence getVisualOrderText() { + return this.component.getVisualOrderText(); + } + + /** + * Converts a vanilla component into Dish's version of component + * @param component vanilla component class + * @return DishComponent + */ + public static net.ouja.api.network.chat.Component fromComponent(Component component) { + return net.ouja.api.network.chat.Component.create(component.getString(), component.getStyle().isBold(), component.getStyle().isUnderlined(), component.getStyle().isStrikethrough(), component.getStyle().isItalic()); + } + + public static net.ouja.api.network.chat.Component[] fromComponent(Component[] componentsIn) { + net.ouja.api.network.chat.Component[] components = new net.ouja.api.network.chat.Component[componentsIn.length]; + + for (int i = 0; i < components.length; i++) { + Component component = componentsIn[i]; + components[i] = fromComponent(component); + } + + return components; + } + + public static MutableComponent toComponent(net.ouja.api.network.chat.Component component) { + Style style = Style.EMPTY + .withColor(TextColor.parseColor(component.getColor()).getOrThrow()) + .withBold(component.isBold()) + .withUnderlined(component.isUnderlined()) + .withStrikethrough(component.isStrikeThrough()) + .withItalic(component.isItalic()); + return Component.literal(component.getString()).withStyle(style); + } +} diff --git a/patches/release/1.21/net/ouja/dish/plugins/PluginManager.java b/patches/release/1.21/net/ouja/dish/plugins/PluginManager.java new file mode 100644 index 0000000..045e796 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/plugins/PluginManager.java @@ -0,0 +1,97 @@ +package net.ouja.dish.plugins; + +import net.ouja.api.plugin.JavaPlugin; +import net.ouja.api.plugin.Plugin; +import net.ouja.dish.Dish; +import org.yaml.snakeyaml.Yaml; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Map; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +public class PluginManager { + private int MAX_CONFIG_VERSION = 1; + + public static ArrayList plugins = new ArrayList<>(); + + public PluginManager(File pluginsDir) throws IOException { + for (File file : pluginsDir.listFiles()) { + if (file.isFile() && file.getName().endsWith(".jar")) { + JarFile jar = new JarFile(file.getAbsolutePath()); + Enumeration entries = jar.entries(); + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + if (entry.getName().equalsIgnoreCase("dish.yml") || entry.getName().equalsIgnoreCase("dish.yaml")) { + InputStream is = jar.getInputStream(entry); + Map data = readConfigurationFile(is); + boolean isValid = isConfigValid(data, file.getName()); + if (!isValid) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] is not valid, skipping...", file.getName())); + continue; + } + try { + ClassLoader loader = URLClassLoader.newInstance( + new URL[]{file.getAbsoluteFile().toURI().toURL()}, + getClass().getClassLoader() + ); + Class jarClass = Class.forName(data.get("main-class").toString(), true, loader); + Class pluginClass; + try { + pluginClass = jarClass.asSubclass(JavaPlugin.class); + } catch (ClassCastException e) { + throw new ClassCastException("main class for plugin_name could not extend to JavaPlugin"); + } + Plugin plugin = ((Plugin)pluginClass.newInstance()); + plugin.onEnable(); + plugins.add(file.getName()); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InstantiationException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + } + } + } + } + + public Map readConfigurationFile(InputStream is) { + Yaml yaml = new Yaml(); + return yaml.load(is); + } + + public boolean isConfigValid(Map data, String pluginName) { + try { + if (data.get("config-version").toString() != null && (Integer.parseInt(data.get("config-version").toString()) > MAX_CONFIG_VERSION || Integer.parseInt(data.get("config-version").toString()) < 0)) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] Invalid config-version used in dish.yaml", pluginName)); + return false; + } + + if (Integer.parseInt(data.get("config-version").toString()) == 1) { + // used if needed + } + + if (data.get("main-class") == null) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] Missing main-class in dish.yaml", pluginName)); + return false; + } + + if (data.get("id") == null) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] Missing id in dish.yaml", pluginName)); + return false; + } + + return true; + } catch (Exception e) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] Invalid dish.yaml\n%s", pluginName, e.getMessage())); + return false; + } + } +} diff --git a/patches/release/1.21/net/ouja/dish/plugins/RegisteredEvents.java b/patches/release/1.21/net/ouja/dish/plugins/RegisteredEvents.java new file mode 100644 index 0000000..9b0a5de --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/plugins/RegisteredEvents.java @@ -0,0 +1,32 @@ +package net.ouja.dish.plugins; + +import net.ouja.api.event.EventListener; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + +public class RegisteredEvents { + public static final ArrayList listeners = new ArrayList<>(); + public static final ArrayList> classes = new ArrayList<>(); + + public RegisteredEvents(Method method, Class reflectorClass) { + listeners.add(method); + classes.add(reflectorClass); + } + + public static void callEvent(EventListener eventListener) { + for (int i = 0; i < listeners.size(); i++) { + Method method = listeners.get(i); + Class clazz = classes.get(i); + if (method.getParameterTypes()[0].toString().equals(eventListener.getClass().toString())) { + try { + method.setAccessible(true); + method.invoke(clazz.newInstance(), eventListener); + } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) { + throw new RuntimeException(e); + } + } + } + } +} diff --git a/patches/release/1.21/net/ouja/dish/server/level/DishClientInformation.java b/patches/release/1.21/net/ouja/dish/server/level/DishClientInformation.java new file mode 100644 index 0000000..5d3efd9 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/server/level/DishClientInformation.java @@ -0,0 +1,81 @@ +package net.ouja.dish.server.level; + +import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.entity.player.ChatVisiblity; +import net.ouja.api.server.level.ClientInformation; +import org.jetbrains.annotations.NotNull; + +public class DishClientInformation implements ClientInformation { + private final String language; + private final int viewDistance; + private final ChatVisiblity chatVisibility; + private final boolean chatColors; + private final int modelCustomisation; + private final HumanoidArm mainHand; + private final boolean textFilteringEnabled; + private final boolean allowsListing; + + public DishClientInformation(String language, int viewDistance, ChatVisiblity chatVisibility, boolean chatColors, int modelCustomisation, HumanoidArm mainHand, boolean textFilteringEnabled, boolean allowsListing) { + this.language = language; + this.viewDistance = viewDistance; + this.chatVisibility = chatVisibility; + this.chatColors = chatColors; + this.modelCustomisation = modelCustomisation; + this.mainHand = mainHand; + this.textFilteringEnabled = textFilteringEnabled; + this.allowsListing = allowsListing; + } + + public DishClientInformation(@NotNull net.minecraft.server.level.ClientInformation mcInfo) { + this( + mcInfo.language(), + mcInfo.viewDistance(), + mcInfo.chatVisibility(), + mcInfo.chatColors(), + mcInfo.modelCustomisation(), + mcInfo.mainHand(), + mcInfo.textFilteringEnabled(), + mcInfo.allowsListing() + ); + } + + @Override + public String getLanguage() { + return language; + } + + @Override + public int getViewDistance() { + return viewDistance; + } + + @Override + public int getChatVisibility() { + return chatVisibility.getId(); + } + + @Override + public boolean isChatColors() { + return chatColors; + } + + @Override + public int getModelCustomisation() { + return modelCustomisation; + } + + @Override + public String getMainHand() { + return mainHand.getSerializedName(); + } + + @Override + public boolean isTextFilteringEnabled() { + return textFilteringEnabled; + } + + @Override + public boolean isAllowsListing() { + return allowsListing; + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/DishDamageSource.java b/patches/release/1.21/net/ouja/dish/world/DishDamageSource.java new file mode 100644 index 0000000..02ea744 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/DishDamageSource.java @@ -0,0 +1,22 @@ +package net.ouja.dish.world; + +import net.minecraft.world.entity.LivingEntity; +import net.ouja.api.entity.Entity; +import net.ouja.api.world.DamageSource; +import net.ouja.dish.entity.DishEntity; +import org.jetbrains.annotations.Nullable; + +public class DishDamageSource implements DamageSource { + private final net.minecraft.world.damagesource.DamageSource damageSource; + + public DishDamageSource(net.minecraft.world.damagesource.DamageSource damageSource) { + this.damageSource = damageSource; + } + + @Nullable + @Override + public Entity getEntity() { + if (this.damageSource.getEntity() == null) return null; + return new DishEntity((LivingEntity)this.damageSource.getEntity()).getEntity(); // call .getEntity() so that it removes "getEntity().getEntity();" for plugins + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/DishLevel.java b/patches/release/1.21/net/ouja/dish/world/DishLevel.java new file mode 100644 index 0000000..6b6df3e --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/DishLevel.java @@ -0,0 +1,64 @@ +package net.ouja.dish.world; + +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.ouja.api.entity.Player; +import net.ouja.api.world.Level; +import net.ouja.dish.entity.DishPlayer; + +import java.util.ArrayList; +import java.util.List; + +public class DishLevel implements Level { + private ServerLevel level; + + public DishLevel(ServerLevel level) { + this.level = level; + } + + @Override + public String getName() { + return this.level.dimensionType().effectsLocation().getPath(); + } + + @Override + public long getSeed() { + return this.level.getSeed(); + } + + @Override + public List getPlayers() { + List dishPlayers = new ArrayList<>(this.level.players().size()); + for (ServerPlayer player : this.level.players()) { + dishPlayers.add(new DishPlayer(player)); + } + return dishPlayers; + } + + @Override + public boolean isDay() { + return this.level.isDay(); + } + + @Override + public boolean isNight() { + return this.level.isNight(); + } + + @Override + public long getGameTime() { + return this.level.getGameTime(); + } + + @Override + public long getDayTime() { + return this.level.getDayTime(); + } + + @Override + public DimensionType dimension() { + if (this.level.dimension() == net.minecraft.world.level.Level.NETHER) return DimensionType.NETHER; + if (this.level.dimension() == net.minecraft.world.level.Level.END) return DimensionType.END; + return DimensionType.OVERWORLD; + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/block/DishBlock.java b/patches/release/1.21/net/ouja/dish/world/block/DishBlock.java new file mode 100644 index 0000000..ff59569 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/block/DishBlock.java @@ -0,0 +1,27 @@ +package net.ouja.dish.world.block; + +import net.ouja.api.world.level.block.Block; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; + +public class DishBlock implements Block { + private final BlockPos pos; + private final BlockTypes blockType; + private final net.minecraft.world.level.block.Block block; + + public DishBlock(BlockPos pos, BlockTypes blockType, net.minecraft.world.level.block.Block block) { + this.pos = pos; + this.blockType = blockType; + this.block = block; + } + + @Override + public BlockPos getBlockPos() { + return this.pos; + } + + @Override + public BlockTypes getType() { + return blockType; + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/block/DishBlockInfo.java b/patches/release/1.21/net/ouja/dish/world/block/DishBlockInfo.java new file mode 100644 index 0000000..8d8c2b6 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/block/DishBlockInfo.java @@ -0,0 +1,1010 @@ +package net.ouja.dish.world.block; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ButtonBlock; +import net.minecraft.world.level.block.DoorBlock; +import net.minecraft.world.level.block.SignBlock; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.TrapDoorBlock; +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.ouja.api.world.level.block.BlockInfo; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.dish.world.DishLevel; + +public class DishBlockInfo implements BlockInfo { + private final Block block; + private final net.minecraft.core.BlockPos blockPos; + private final Level level; + + public DishBlockInfo(Block block, net.minecraft.core.BlockPos blockPos, Level level) { + this.block = block; + this.blockPos = blockPos; + this.level = level; + } + + private net.ouja.api.world.level.block.Block getBlockClass() { + BlockPos dishBlockPos = new BlockPos(this.blockPos.getX(), this.blockPos.getY(), this.blockPos.getY(), new DishLevel((ServerLevel) this.level)); + BlockTypes blockType = BlockTypes.valueOf(BuiltInRegistries.BLOCK.getKey(block).getPath().toUpperCase()); + if (this.block instanceof StairBlock) return new DishStairBlock(dishBlockPos, blockType, this.block); + if (this.block instanceof SignBlock) { + SignBlockEntity signBlockEntity = (SignBlockEntity) this.level.getBlockEntity(this.blockPos); + return new DishSignBlock(dishBlockPos, blockType, this.block, signBlockEntity); + } + if (this.block instanceof ButtonBlock) return new DishButtonBlock(dishBlockPos, blockType, this.block); + if (this.block instanceof DoorBlock) return new DishDoorBlock(dishBlockPos, blockType, this.block, this.level); + if (this.block instanceof TrapDoorBlock) return new DishTrapdoorBlock(dishBlockPos, blockType, this.block, this.level); + + return new DishBlock(dishBlockPos, blockType, this.block); + + // TODO: 11/1/2023 add specific types to it's own class. This is here to keep track +// return switch (blockType) { +// case ACACIA_BUTTON -> null; +// case ACACIA_DOOR -> null; +// case ACACIA_FENCE -> null; +// case ACACIA_FENCE_GATE -> null; +// case ACACIA_LEAVES -> null; +// case ACACIA_LOG -> null; +// case ACACIA_PLANKS -> null; +// case ACACIA_PRESSURE_PLATE -> null; +// case ACACIA_SAPLING -> null; +// case ACACIA_SLAB -> null; +// case ACACIA_TRAPDOOR -> null; +// case ACACIA_WOOD -> null; +// case ACTIVATOR_RAIL -> null; +// case AIR -> new DishBlock(dishBlockPos, blockType, this.block); +// case ALLIUM -> null; +// case AMETHYST_BLOCK -> null; +// case AMETHYST_CLUSTER -> null; +// case ANCIENT_DEBRIS -> null; +// case ANDESITE -> null; +// case ANDESITE_SLAB -> null; +// case ANDESITE_WALL -> null; +// case ANVIL -> null; +// case ATTACHED_MELON_STEM -> null; +// case ATTACHED_PUMPKIN_STEM -> null; +// case AZALEA -> null; +// case AZALEA_LEAVES -> null; +// case AZURE_BLUET -> null; +// case BAMBOO -> null; +// case BAMBOO_BLOCK -> null; +// case BAMBOO_BUTTON -> null; +// case BAMBOO_DOOR -> null; +// case BAMBOO_FENCE -> null; +// case BAMBOO_FENCE_GATE -> null; +// case BAMBOO_MOSAIC -> null; +// case BAMBOO_MOSAIC_SLAB -> null; +// case BAMBOO_PLANKS -> null; +// case BAMBOO_PRESSURE_PLATE -> null; +// case BAMBOO_SAPLING -> null; +// case BAMBOO_SLAB -> null; +// case BAMBOO_TRAPDOOR -> null; +// case BARREL -> null; +// case BARRIER -> null; +// case BASALT -> null; +// case BEACON -> null; +// case BEDROCK -> null; +// case BEEHIVE -> null; +// case BEETROOTS -> null; +// case BEE_NEST -> null; +// case BELL -> null; +// case BIG_DRIPLEAF -> null; +// case BIG_DRIPLEAF_STEM -> null; +// case BIRCH_BUTTON -> null; +// case BIRCH_DOOR -> null; +// case BIRCH_FENCE -> null; +// case BIRCH_FENCE_GATE -> null; +// case BIRCH_LEAVES -> null; +// case BIRCH_LOG -> null; +// case BIRCH_PLANKS -> null; +// case BIRCH_PRESSURE_PLATE -> null; +// case BIRCH_SAPLING -> null; +// case BIRCH_SLAB -> null; +// case BIRCH_TRAPDOOR -> null; +// case BIRCH_WOOD -> null; +// case BLACKSTONE -> null; +// case BLACKSTONE_SLAB -> null; +// case BLACKSTONE_WALL -> null; +// case BLACK_BANNER -> null; +// case BLACK_BED -> null; +// case BLACK_CANDLE -> null; +// case BLACK_CANDLE_CAKE -> null; +// case BLACK_CARPET -> null; +// case BLACK_CONCRETE -> null; +// case BLACK_CONCRETE_POWDER -> null; +// case BLACK_GLAZED_TERRACOTTA -> null; +// case BLACK_SHULKER_BOX -> null; +// case BLACK_STAINED_GLASS -> null; +// case BLACK_STAINED_GLASS_PANE -> null; +// case BLACK_TERRACOTTA -> null; +// case BLACK_WALL_BANNER -> null; +// case BLACK_WOOL -> null; +// case BLAST_FURNACE -> null; +// case BLUE_BANNER -> null; +// case BLUE_BED -> null; +// case BLUE_CANDLE -> null; +// case BLUE_CANDLE_CAKE -> null; +// case BLUE_CARPET -> null; +// case BLUE_CONCRETE -> null; +// case BLUE_CONCRETE_POWDER -> null; +// case BLUE_GLAZED_TERRACOTTA -> null; +// case BLUE_ICE -> null; +// case BLUE_ORCHID -> null; +// case BLUE_SHULKER_BOX -> null; +// case BLUE_STAINED_GLASS -> null; +// case BLUE_STAINED_GLASS_PANE -> null; +// case BLUE_TERRACOTTA -> null; +// case BLUE_WALL_BANNER -> null; +// case BLUE_WOOL -> null; +// case BONE_BLOCK -> null; +// case BOOKSHELF -> null; +// case BRAIN_CORAL -> null; +// case BRAIN_CORAL_BLOCK -> null; +// case BRAIN_CORAL_FAN -> null; +// case BRAIN_CORAL_WALL_FAN -> null; +// case BREWING_STAND -> null; +// case BRICKS -> null; +// case BRICK_SLAB -> null; +// case BRICK_WALL -> null; +// case BROWN_BANNER -> null; +// case BROWN_BED -> null; +// case BROWN_CANDLE -> null; +// case BROWN_CANDLE_CAKE -> null; +// case BROWN_CARPET -> null; +// case BROWN_CONCRETE -> null; +// case BROWN_CONCRETE_POWDER -> null; +// case BROWN_GLAZED_TERRACOTTA -> null; +// case BROWN_MUSHROOM -> null; +// case BROWN_MUSHROOM_BLOCK -> null; +// case BROWN_SHULKER_BOX -> null; +// case BROWN_STAINED_GLASS -> null; +// case BROWN_STAINED_GLASS_PANE -> null; +// case BROWN_TERRACOTTA -> null; +// case BROWN_WALL_BANNER -> null; +// case BROWN_WOOL -> null; +// case BUBBLE_COLUMN -> null; +// case BUBBLE_CORAL -> null; +// case BUBBLE_CORAL_BLOCK -> null; +// case BUBBLE_CORAL_FAN -> null; +// case BUBBLE_CORAL_WALL_FAN -> null; +// case BUDDING_AMETHYST -> null; +// case CACTUS -> null; +// case CAKE -> null; +// case CALCITE -> null; +// case CALIBRATED_SCULK_SENSOR -> null; +// case CAMPFIRE -> null; +// case CANDLE -> null; +// case CANDLE_CAKE -> null; +// case CARROTS -> null; +// case CARTOGRAPHY_TABLE -> null; +// case CARVED_PUMPKIN -> null; +// case CAULDRON -> null; +// case CAVE_AIR -> null; +// case CAVE_VINES -> null; +// case CAVE_VINES_PLANT -> null; +// case CHAIN -> null; +// case CHAIN_COMMAND_BLOCK -> null; +// case CHERRY_BUTTON -> null; +// case CHERRY_DOOR -> null; +// case CHERRY_FENCE -> null; +// case CHERRY_FENCE_GATE -> null; +// case CHERRY_LEAVES -> null; +// case CHERRY_LOG -> null; +// case CHERRY_PLANKS -> null; +// case CHERRY_PRESSURE_PLATE -> null; +// case CHERRY_SAPLING -> null; +// case CHERRY_SLAB -> null; +// case CHERRY_TRAPDOOR -> null; +// case CHERRY_WOOD -> null; +// case CHEST -> null; +// case CHIPPED_ANVIL -> null; +// case CHISELED_BOOKSHELF -> null; +// case CHISELED_COPPER -> null; +// case CHISELED_DEEPSLATE -> null; +// case CHISELED_NETHER_BRICKS -> null; +// case CHISELED_POLISHED_BLACKSTONE -> null; +// case CHISELED_QUARTZ_BLOCK -> null; +// case CHISELED_RED_SANDSTONE -> null; +// case CHISELED_SANDSTONE -> null; +// case CHISELED_STONE_BRICKS -> null; +// case CHISELED_TUFF -> null; +// case CHISELED_TUFF_BRICKS -> null; +// case CHORUS_FLOWER -> null; +// case CHORUS_PLANT -> null; +// case CLAY -> null; +// case COAL_BLOCK -> null; +// case COAL_ORE -> null; +// case COARSE_DIRT -> null; +// case COBBLED_DEEPSLATE -> null; +// case COBBLED_DEEPSLATE_SLAB -> null; +// case COBBLED_DEEPSLATE_WALL -> null; +// case COBBLESTONE -> null; +// case COBBLESTONE_SLAB -> null; +// case COBBLESTONE_WALL -> null; +// case COBWEB -> null; +// case COCOA -> null; +// case COMMAND_BLOCK -> null; +// case COMPARATOR -> null; +// case COMPOSTER -> null; +// case CONDUIT -> null; +// case COPPER_BLOCK -> null; +// case COPPER_BULB -> null; +// case COPPER_DOOR -> null; +// case COPPER_GRATE -> null; +// case COPPER_ORE -> null; +// case COPPER_TRAPDOOR -> null; +// case CORNFLOWER -> null; +// case CRACKED_DEEPSLATE_BRICKS -> null; +// case CRACKED_DEEPSLATE_TILES -> null; +// case CRACKED_NETHER_BRICKS -> null; +// case CRACKED_POLISHED_BLACKSTONE_BRICKS -> null; +// case CRACKED_STONE_BRICKS -> null; +// case CRAFTER -> null; +// case CRAFTING_TABLE -> null; +// case CREEPER_HEAD -> null; +// case CREEPER_WALL_HEAD -> null; +// case CRIMSON_BUTTON -> null; +// case CRIMSON_DOOR -> null; +// case CRIMSON_FENCE -> null; +// case CRIMSON_FENCE_GATE -> null; +// case CRIMSON_FUNGUS -> null; +// case CRIMSON_HYPHAE -> null; +// case CRIMSON_NYLIUM -> null; +// case CRIMSON_PLANKS -> null; +// case CRIMSON_PRESSURE_PLATE -> null; +// case CRIMSON_ROOTS -> null; +// case CRIMSON_SLAB -> null; +// case CRIMSON_STEM -> null; +// case CRIMSON_TRAPDOOR -> null; +// case CRYING_OBSIDIAN -> null; +// case CUT_COPPER -> null; +// case CUT_COPPER_SLAB -> null; +// case CUT_RED_SANDSTONE -> null; +// case CUT_RED_SANDSTONE_SLAB -> null; +// case CUT_SANDSTONE -> null; +// case CUT_SANDSTONE_SLAB -> null; +// case CYAN_BANNER -> null; +// case CYAN_BED -> null; +// case CYAN_CANDLE -> null; +// case CYAN_CANDLE_CAKE -> null; +// case CYAN_CARPET -> null; +// case CYAN_CONCRETE -> null; +// case CYAN_CONCRETE_POWDER -> null; +// case CYAN_GLAZED_TERRACOTTA -> null; +// case CYAN_SHULKER_BOX -> null; +// case CYAN_STAINED_GLASS -> null; +// case CYAN_STAINED_GLASS_PANE -> null; +// case CYAN_TERRACOTTA -> null; +// case CYAN_WALL_BANNER -> null; +// case CYAN_WOOL -> null; +// case DAMAGED_ANVIL -> null; +// case DANDELION -> null; +// case DARK_OAK_BUTTON -> null; +// case DARK_OAK_DOOR -> null; +// case DARK_OAK_FENCE -> null; +// case DARK_OAK_FENCE_GATE -> null; +// case DARK_OAK_LEAVES -> null; +// case DARK_OAK_LOG -> null; +// case DARK_OAK_PLANKS -> null; +// case DARK_OAK_PRESSURE_PLATE -> null; +// case DARK_OAK_SAPLING -> null; +// case DARK_OAK_SLAB -> null; +// case DARK_OAK_TRAPDOOR -> null; +// case DARK_OAK_WOOD -> null; +// case DARK_PRISMARINE -> null; +// case DARK_PRISMARINE_SLAB -> null; +// case DAYLIGHT_DETECTOR -> null; +// case DEAD_BRAIN_CORAL -> null; +// case DEAD_BRAIN_CORAL_BLOCK -> null; +// case DEAD_BRAIN_CORAL_FAN -> null; +// case DEAD_BRAIN_CORAL_WALL_FAN -> null; +// case DEAD_BUBBLE_CORAL -> null; +// case DEAD_BUBBLE_CORAL_BLOCK -> null; +// case DEAD_BUBBLE_CORAL_FAN -> null; +// case DEAD_BUBBLE_CORAL_WALL_FAN -> null; +// case DEAD_BUSH -> null; +// case DEAD_FIRE_CORAL -> null; +// case DEAD_FIRE_CORAL_BLOCK -> null; +// case DEAD_FIRE_CORAL_FAN -> null; +// case DEAD_FIRE_CORAL_WALL_FAN -> null; +// case DEAD_HORN_CORAL -> null; +// case DEAD_HORN_CORAL_BLOCK -> null; +// case DEAD_HORN_CORAL_FAN -> null; +// case DEAD_HORN_CORAL_WALL_FAN -> null; +// case DEAD_TUBE_CORAL -> null; +// case DEAD_TUBE_CORAL_BLOCK -> null; +// case DEAD_TUBE_CORAL_FAN -> null; +// case DEAD_TUBE_CORAL_WALL_FAN -> null; +// case DECORATED_POT -> null; +// case DEEPSLATE -> null; +// case DEEPSLATE_BRICKS -> null; +// case DEEPSLATE_BRICK_SLAB -> null; +// case DEEPSLATE_BRICK_WALL -> null; +// case DEEPSLATE_COAL_ORE -> null; +// case DEEPSLATE_COPPER_ORE -> null; +// case DEEPSLATE_DIAMOND_ORE -> null; +// case DEEPSLATE_EMERALD_ORE -> null; +// case DEEPSLATE_GOLD_ORE -> null; +// case DEEPSLATE_IRON_ORE -> null; +// case DEEPSLATE_LAPIS_ORE -> null; +// case DEEPSLATE_REDSTONE_ORE -> null; +// case DEEPSLATE_TILES -> null; +// case DEEPSLATE_TILE_SLAB -> null; +// case DEEPSLATE_TILE_WALL -> null; +// case DETECTOR_RAIL -> null; +// case DIAMOND_BLOCK -> null; +// case DIAMOND_ORE -> null; +// case DIORITE -> null; +// case DIORITE_SLAB -> null; +// case DIORITE_WALL -> null; +// case DIRT -> new DishBlock(dishBlockPos, blockType, this.block); +// case DIRT_PATH -> null; +// case DISPENSER -> null; +// case DRAGON_EGG -> null; +// case DRAGON_HEAD -> null; +// case DRAGON_WALL_HEAD -> null; +// case DRIED_KELP_BLOCK -> null; +// case DRIPSTONE_BLOCK -> null; +// case DROPPER -> null; +// case EMERALD_BLOCK -> null; +// case EMERALD_ORE -> null; +// case ENCHANTING_TABLE -> null; +// case ENDER_CHEST -> null; +// case END_GATEWAY -> null; +// case END_PORTAL -> null; +// case END_PORTAL_FRAME -> null; +// case END_ROD -> null; +// case END_STONE -> null; +// case END_STONE_BRICKS -> null; +// case END_STONE_BRICK_SLAB -> null; +// case END_STONE_BRICK_WALL -> null; +// case EXPOSED_CHISELED_COPPER -> null; +// case EXPOSED_COPPER -> null; +// case EXPOSED_COPPER_BULB -> null; +// case EXPOSED_COPPER_DOOR -> null; +// case EXPOSED_COPPER_GRATE -> null; +// case EXPOSED_COPPER_TRAPDOOR -> null; +// case EXPOSED_CUT_COPPER -> null; +// case EXPOSED_CUT_COPPER_SLAB -> null; +// case FARMLAND -> null; +// case FERN -> null; +// case FIRE -> null; +// case FIRE_CORAL -> null; +// case FIRE_CORAL_BLOCK -> null; +// case FIRE_CORAL_FAN -> null; +// case FIRE_CORAL_WALL_FAN -> null; +// case FLETCHING_TABLE -> null; +// case FLOWERING_AZALEA -> null; +// case FLOWERING_AZALEA_LEAVES -> null; +// case FLOWER_POT -> null; +// case FROGSPAWN -> null; +// case FROSTED_ICE -> null; +// case FURNACE -> null; +// case GILDED_BLACKSTONE -> null; +// case GLASS -> null; +// case GLASS_PANE -> null; +// case GLOWSTONE -> null; +// case GLOW_LICHEN -> null; +// case GOLD_BLOCK -> null; +// case GOLD_ORE -> null; +// case GRANITE -> null; +// case GRANITE_SLAB -> null; +// case GRANITE_WALL -> null; +// case GRASS -> null; +// case GRASS_BLOCK -> null; +// case GRAVEL -> null; +// case GRAY_BANNER -> null; +// case GRAY_BED -> null; +// case GRAY_CANDLE -> null; +// case GRAY_CANDLE_CAKE -> null; +// case GRAY_CARPET -> null; +// case GRAY_CONCRETE -> null; +// case GRAY_CONCRETE_POWDER -> null; +// case GRAY_GLAZED_TERRACOTTA -> null; +// case GRAY_SHULKER_BOX -> null; +// case GRAY_STAINED_GLASS -> null; +// case GRAY_STAINED_GLASS_PANE -> null; +// case GRAY_TERRACOTTA -> null; +// case GRAY_WALL_BANNER -> null; +// case GRAY_WOOL -> null; +// case GREEN_BANNER -> null; +// case GREEN_BED -> null; +// case GREEN_CANDLE -> null; +// case GREEN_CANDLE_CAKE -> null; +// case GREEN_CARPET -> null; +// case GREEN_CONCRETE -> null; +// case GREEN_CONCRETE_POWDER -> null; +// case GREEN_GLAZED_TERRACOTTA -> null; +// case GREEN_SHULKER_BOX -> null; +// case GREEN_STAINED_GLASS -> null; +// case GREEN_STAINED_GLASS_PANE -> null; +// case GREEN_TERRACOTTA -> null; +// case GREEN_WALL_BANNER -> null; +// case GREEN_WOOL -> null; +// case GRINDSTONE -> null; +// case HANGING_ROOTS -> null; +// case HAY_BLOCK -> null; +// case HEAVY_WEIGHTED_PRESSURE_PLATE -> null; +// case HONEYCOMB_BLOCK -> null; +// case HONEY_BLOCK -> null; +// case HOPPER -> null; +// case HORN_CORAL -> null; +// case HORN_CORAL_BLOCK -> null; +// case HORN_CORAL_FAN -> null; +// case HORN_CORAL_WALL_FAN -> null; +// case ICE -> null; +// case INFESTED_CHISELED_STONE_BRICKS -> null; +// case INFESTED_COBBLESTONE -> null; +// case INFESTED_CRACKED_STONE_BRICKS -> null; +// case INFESTED_DEEPSLATE -> null; +// case INFESTED_MOSSY_STONE_BRICKS -> null; +// case INFESTED_STONE -> null; +// case INFESTED_STONE_BRICKS -> null; +// case IRON_BARS -> null; +// case IRON_BLOCK -> null; +// case IRON_DOOR -> null; +// case IRON_ORE -> null; +// case IRON_TRAPDOOR -> null; +// case JACK_O_LANTERN -> null; +// case JIGSAW -> null; +// case JUKEBOX -> null; +// case JUNGLE_BUTTON -> null; +// case JUNGLE_DOOR -> null; +// case JUNGLE_FENCE -> null; +// case JUNGLE_FENCE_GATE -> null; +// case JUNGLE_LEAVES -> null; +// case JUNGLE_LOG -> null; +// case JUNGLE_PLANKS -> null; +// case JUNGLE_PRESSURE_PLATE -> null; +// case JUNGLE_SAPLING -> null; +// case JUNGLE_SLAB -> null; +// case JUNGLE_TRAPDOOR -> null; +// case JUNGLE_WOOD -> null; +// case KELP -> null; +// case KELP_PLANT -> null; +// case LADDER -> null; +// case LANTERN -> null; +// case LAPIS_BLOCK -> null; +// case LAPIS_ORE -> null; +// case LARGE_AMETHYST_BUD -> null; +// case LARGE_FERN -> null; +// case LAVA -> null; +// case LAVA_CAULDRON -> null; +// case LECTERN -> null; +// case LEVER -> null; +// case LIGHT -> null; +// case LIGHTNING_ROD -> null; +// case LIGHT_BLUE_BANNER -> null; +// case LIGHT_BLUE_BED -> null; +// case LIGHT_BLUE_CANDLE -> null; +// case LIGHT_BLUE_CANDLE_CAKE -> null; +// case LIGHT_BLUE_CARPET -> null; +// case LIGHT_BLUE_CONCRETE -> null; +// case LIGHT_BLUE_CONCRETE_POWDER -> null; +// case LIGHT_BLUE_GLAZED_TERRACOTTA -> null; +// case LIGHT_BLUE_SHULKER_BOX -> null; +// case LIGHT_BLUE_STAINED_GLASS -> null; +// case LIGHT_BLUE_STAINED_GLASS_PANE -> null; +// case LIGHT_BLUE_TERRACOTTA -> null; +// case LIGHT_BLUE_WALL_BANNER -> null; +// case LIGHT_BLUE_WOOL -> null; +// case LIGHT_GRAY_BANNER -> null; +// case LIGHT_GRAY_BED -> null; +// case LIGHT_GRAY_CANDLE -> null; +// case LIGHT_GRAY_CANDLE_CAKE -> null; +// case LIGHT_GRAY_CARPET -> null; +// case LIGHT_GRAY_CONCRETE -> null; +// case LIGHT_GRAY_CONCRETE_POWDER -> null; +// case LIGHT_GRAY_GLAZED_TERRACOTTA -> null; +// case LIGHT_GRAY_SHULKER_BOX -> null; +// case LIGHT_GRAY_STAINED_GLASS -> null; +// case LIGHT_GRAY_STAINED_GLASS_PANE -> null; +// case LIGHT_GRAY_TERRACOTTA -> null; +// case LIGHT_GRAY_WALL_BANNER -> null; +// case LIGHT_GRAY_WOOL -> null; +// case LIGHT_WEIGHTED_PRESSURE_PLATE -> null; +// case LILAC -> null; +// case LILY_OF_THE_VALLEY -> null; +// case LILY_PAD -> null; +// case LIME_BANNER -> null; +// case LIME_BED -> null; +// case LIME_CANDLE -> null; +// case LIME_CANDLE_CAKE -> null; +// case LIME_CARPET -> null; +// case LIME_CONCRETE -> null; +// case LIME_CONCRETE_POWDER -> null; +// case LIME_GLAZED_TERRACOTTA -> null; +// case LIME_SHULKER_BOX -> null; +// case LIME_STAINED_GLASS -> null; +// case LIME_STAINED_GLASS_PANE -> null; +// case LIME_TERRACOTTA -> null; +// case LIME_WALL_BANNER -> null; +// case LIME_WOOL -> null; +// case LODESTONE -> null; +// case LOOM -> null; +// case MAGENTA_BANNER -> null; +// case MAGENTA_BED -> null; +// case MAGENTA_CANDLE -> null; +// case MAGENTA_CANDLE_CAKE -> null; +// case MAGENTA_CARPET -> null; +// case MAGENTA_CONCRETE -> null; +// case MAGENTA_CONCRETE_POWDER -> null; +// case MAGENTA_GLAZED_TERRACOTTA -> null; +// case MAGENTA_SHULKER_BOX -> null; +// case MAGENTA_STAINED_GLASS -> null; +// case MAGENTA_STAINED_GLASS_PANE -> null; +// case MAGENTA_TERRACOTTA -> null; +// case MAGENTA_WALL_BANNER -> null; +// case MAGENTA_WOOL -> null; +// case MAGMA_BLOCK -> null; +// case MANGROVE_BUTTON -> null; +// case MANGROVE_DOOR -> null; +// case MANGROVE_FENCE -> null; +// case MANGROVE_FENCE_GATE -> null; +// case MANGROVE_LEAVES -> null; +// case MANGROVE_LOG -> null; +// case MANGROVE_PLANKS -> null; +// case MANGROVE_PRESSURE_PLATE -> null; +// case MANGROVE_PROPAGULE -> null; +// case MANGROVE_ROOTS -> null; +// case MANGROVE_SLAB -> null; +// case MANGROVE_TRAPDOOR -> null; +// case MANGROVE_WOOD -> null; +// case MEDIUM_AMETHYST_BUD -> null; +// case MELON -> null; +// case MELON_STEM -> null; +// case MOSSY_COBBLESTONE -> null; +// case MOSSY_COBBLESTONE_SLAB -> null; +// case MOSSY_COBBLESTONE_WALL -> null; +// case MOSSY_STONE_BRICKS -> null; +// case MOSSY_STONE_BRICK_SLAB -> null; +// case MOSSY_STONE_BRICK_WALL -> null; +// case MOSS_BLOCK -> null; +// case MOSS_CARPET -> null; +// case MOVING_PISTON -> null; +// case MUD -> null; +// case MUDDY_MANGROVE_ROOTS -> null; +// case MUD_BRICKS -> null; +// case MUD_BRICK_SLAB -> null; +// case MUD_BRICK_WALL -> null; +// case MUSHROOM_STEM -> null; +// case MYCELIUM -> null; +// case NETHERITE_BLOCK -> null; +// case NETHERRACK -> null; +// case NETHER_BRICKS -> null; +// case NETHER_BRICK_FENCE -> null; +// case NETHER_BRICK_SLAB -> null; +// case NETHER_BRICK_WALL -> null; +// case NETHER_GOLD_ORE -> null; +// case NETHER_PORTAL -> null; +// case NETHER_QUARTZ_ORE -> null; +// case NETHER_SPROUTS -> null; +// case NETHER_WART -> null; +// case NETHER_WART_BLOCK -> null; +// case NOTE_BLOCK -> null; +// case OAK_BUTTON -> null; +// case OAK_DOOR -> null; +// case OAK_FENCE -> null; +// case OAK_FENCE_GATE -> null; +// case OAK_LEAVES -> null; +// case OAK_LOG -> null; +// case OAK_PLANKS -> null; +// case OAK_PRESSURE_PLATE -> null; +// case OAK_SAPLING -> null; +// case OAK_SLAB -> null; +// case OAK_TRAPDOOR -> null; +// case OAK_WOOD -> null; +// case OBSERVER -> null; +// case OBSIDIAN -> null; +// case OCHRE_FROGLIGHT -> null; +// case ORANGE_BANNER -> null; +// case ORANGE_BED -> null; +// case ORANGE_CANDLE -> null; +// case ORANGE_CANDLE_CAKE -> null; +// case ORANGE_CARPET -> null; +// case ORANGE_CONCRETE -> null; +// case ORANGE_CONCRETE_POWDER -> null; +// case ORANGE_GLAZED_TERRACOTTA -> null; +// case ORANGE_SHULKER_BOX -> null; +// case ORANGE_STAINED_GLASS -> null; +// case ORANGE_STAINED_GLASS_PANE -> null; +// case ORANGE_TERRACOTTA -> null; +// case ORANGE_TULIP -> null; +// case ORANGE_WALL_BANNER -> null; +// case ORANGE_WOOL -> null; +// case OXEYE_DAISY -> null; +// case OXIDIZED_CHISELED_COPPER -> null; +// case OXIDIZED_COPPER -> null; +// case OXIDIZED_COPPER_BULB -> null; +// case OXIDIZED_COPPER_DOOR -> null; +// case OXIDIZED_COPPER_GRATE -> null; +// case OXIDIZED_COPPER_TRAPDOOR -> null; +// case OXIDIZED_CUT_COPPER -> null; +// case OXIDIZED_CUT_COPPER_SLAB -> null; +// case PACKED_ICE -> null; +// case PACKED_MUD -> null; +// case PEARLESCENT_FROGLIGHT -> null; +// case PEONY -> null; +// case PETRIFIED_OAK_SLAB -> null; +// case PIGLIN_HEAD -> null; +// case PIGLIN_WALL_HEAD -> null; +// case PINK_BANNER -> null; +// case PINK_BED -> null; +// case PINK_CANDLE -> null; +// case PINK_CANDLE_CAKE -> null; +// case PINK_CARPET -> null; +// case PINK_CONCRETE -> null; +// case PINK_CONCRETE_POWDER -> null; +// case PINK_GLAZED_TERRACOTTA -> null; +// case PINK_PETALS -> null; +// case PINK_SHULKER_BOX -> null; +// case PINK_STAINED_GLASS -> null; +// case PINK_STAINED_GLASS_PANE -> null; +// case PINK_TERRACOTTA -> null; +// case PINK_TULIP -> null; +// case PINK_WALL_BANNER -> null; +// case PINK_WOOL -> null; +// case PISTON -> null; +// case PISTON_HEAD -> null; +// case PITCHER_CROP -> null; +// case PITCHER_PLANT -> null; +// case PLAYER_HEAD -> null; +// case PLAYER_WALL_HEAD -> null; +// case PODZOL -> null; +// case POINTED_DRIPSTONE -> null; +// case POLISHED_ANDESITE -> null; +// case POLISHED_ANDESITE_SLAB -> null; +// case POLISHED_BASALT -> null; +// case POLISHED_BLACKSTONE -> null; +// case POLISHED_BLACKSTONE_BRICKS -> null; +// case POLISHED_BLACKSTONE_BRICK_SLAB -> null; +// case POLISHED_BLACKSTONE_BRICK_WALL -> null; +// case POLISHED_BLACKSTONE_BUTTON -> null; +// case POLISHED_BLACKSTONE_PRESSURE_PLATE -> null; +// case POLISHED_BLACKSTONE_SLAB -> null; +// case POLISHED_BLACKSTONE_WALL -> null; +// case POLISHED_DEEPSLATE -> null; +// case POLISHED_DEEPSLATE_SLAB -> null; +// case POLISHED_DEEPSLATE_WALL -> null; +// case POLISHED_DIORITE -> null; +// case POLISHED_DIORITE_SLAB -> null; +// case POLISHED_GRANITE -> null; +// case POLISHED_GRANITE_SLAB -> null; +// case POLISHED_TUFF -> null; +// case POLISHED_TUFF_SLAB -> null; +// case POLISHED_TUFF_WALL -> null; +// case POPPY -> null; +// case POTATOES -> null; +// case POTTED_ACACIA_SAPLING -> null; +// case POTTED_ALLIUM -> null; +// case POTTED_AZALEA_BUSH -> null; +// case POTTED_AZURE_BLUET -> null; +// case POTTED_BAMBOO -> null; +// case POTTED_BIRCH_SAPLING -> null; +// case POTTED_BLUE_ORCHID -> null; +// case POTTED_BROWN_MUSHROOM -> null; +// case POTTED_CACTUS -> null; +// case POTTED_CHERRY_SAPLING -> null; +// case POTTED_CORNFLOWER -> null; +// case POTTED_CRIMSON_FUNGUS -> null; +// case POTTED_CRIMSON_ROOTS -> null; +// case POTTED_DANDELION -> null; +// case POTTED_DARK_OAK_SAPLING -> null; +// case POTTED_DEAD_BUSH -> null; +// case POTTED_FERN -> null; +// case POTTED_FLOWERING_AZALEA_BUSH -> null; +// case POTTED_JUNGLE_SAPLING -> null; +// case POTTED_LILY_OF_THE_VALLEY -> null; +// case POTTED_MANGROVE_PROPAGULE -> null; +// case POTTED_OAK_SAPLING -> null; +// case POTTED_ORANGE_TULIP -> null; +// case POTTED_OXEYE_DAISY -> null; +// case POTTED_PINK_TULIP -> null; +// case POTTED_POPPY -> null; +// case POTTED_RED_MUSHROOM -> null; +// case POTTED_RED_TULIP -> null; +// case POTTED_SPRUCE_SAPLING -> null; +// case POTTED_TORCHFLOWER -> null; +// case POTTED_WARPED_FUNGUS -> null; +// case POTTED_WARPED_ROOTS -> null; +// case POTTED_WHITE_TULIP -> null; +// case POTTED_WITHER_ROSE -> null; +// case POWDER_SNOW -> null; +// case POWDER_SNOW_CAULDRON -> null; +// case POWERED_RAIL -> null; +// case PRISMARINE -> null; +// case PRISMARINE_BRICKS -> null; +// case PRISMARINE_BRICK_SLAB -> null; +// case PRISMARINE_SLAB -> null; +// case PRISMARINE_WALL -> null; +// case PUMPKIN -> null; +// case PUMPKIN_STEM -> null; +// case PURPLE_BANNER -> null; +// case PURPLE_BED -> null; +// case PURPLE_CANDLE -> null; +// case PURPLE_CANDLE_CAKE -> null; +// case PURPLE_CARPET -> null; +// case PURPLE_CONCRETE -> null; +// case PURPLE_CONCRETE_POWDER -> null; +// case PURPLE_GLAZED_TERRACOTTA -> null; +// case PURPLE_SHULKER_BOX -> null; +// case PURPLE_STAINED_GLASS -> null; +// case PURPLE_STAINED_GLASS_PANE -> null; +// case PURPLE_TERRACOTTA -> null; +// case PURPLE_WALL_BANNER -> null; +// case PURPLE_WOOL -> null; +// case PURPUR_BLOCK -> null; +// case PURPUR_PILLAR -> null; +// case PURPUR_SLAB -> null; +// case QUARTZ_BLOCK -> null; +// case QUARTZ_BRICKS -> null; +// case QUARTZ_PILLAR -> null; +// case QUARTZ_SLAB -> null; +// case RAIL -> null; +// case RAW_COPPER_BLOCK -> null; +// case RAW_GOLD_BLOCK -> null; +// case RAW_IRON_BLOCK -> null; +// case REDSTONE_BLOCK -> null; +// case REDSTONE_LAMP -> null; +// case REDSTONE_ORE -> null; +// case REDSTONE_TORCH -> null; +// case REDSTONE_WALL_TORCH -> null; +// case REDSTONE_WIRE -> null; +// case RED_BANNER -> null; +// case RED_BED -> null; +// case RED_CANDLE -> null; +// case RED_CANDLE_CAKE -> null; +// case RED_CARPET -> null; +// case RED_CONCRETE -> null; +// case RED_CONCRETE_POWDER -> null; +// case RED_GLAZED_TERRACOTTA -> null; +// case RED_MUSHROOM -> null; +// case RED_MUSHROOM_BLOCK -> null; +// case RED_NETHER_BRICKS -> null; +// case RED_NETHER_BRICK_SLAB -> null; +// case RED_NETHER_BRICK_WALL -> null; +// case RED_SAND -> null; +// case RED_SANDSTONE -> null; +// case RED_SANDSTONE_SLAB -> null; +// case RED_SANDSTONE_WALL -> null; +// case RED_SHULKER_BOX -> null; +// case RED_STAINED_GLASS -> null; +// case RED_STAINED_GLASS_PANE -> null; +// case RED_TERRACOTTA -> null; +// case RED_TULIP -> null; +// case RED_WALL_BANNER -> null; +// case RED_WOOL -> null; +// case REINFORCED_DEEPSLATE -> null; +// case REPEATER -> null; +// case REPEATING_COMMAND_BLOCK -> null; +// case RESPAWN_ANCHOR -> null; +// case ROOTED_DIRT -> null; +// case ROSE_BUSH -> null; +// case SAND -> null; +// case SANDSTONE -> null; +// case SANDSTONE_SLAB -> null; +// case SANDSTONE_WALL -> null; +// case SCAFFOLDING -> null; +// case SCULK -> null; +// case SCULK_CATALYST -> null; +// case SCULK_SENSOR -> null; +// case SCULK_SHRIEKER -> null; +// case SCULK_VEIN -> null; +// case SEAGRASS -> null; +// case SEA_LANTERN -> null; +// case SEA_PICKLE -> null; +// case SHROOMLIGHT -> null; +// case SHULKER_BOX -> null; +// case SKELETON_SKULL -> null; +// case SKELETON_WALL_SKULL -> null; +// case SLIME_BLOCK -> null; +// case SMALL_AMETHYST_BUD -> null; +// case SMALL_DRIPLEAF -> null; +// case SMITHING_TABLE -> null; +// case SMOKER -> null; +// case SMOOTH_BASALT -> null; +// case SMOOTH_QUARTZ -> null; +// case SMOOTH_QUARTZ_SLAB -> null; +// case SMOOTH_RED_SANDSTONE -> null; +// case SMOOTH_RED_SANDSTONE_SLAB -> null; +// case SMOOTH_SANDSTONE -> null; +// case SMOOTH_SANDSTONE_SLAB -> null; +// case SMOOTH_STONE -> null; +// case SMOOTH_STONE_SLAB -> null; +// case SNIFFER_EGG -> null; +// case SNOW -> null; +// case SNOW_BLOCK -> null; +// case SOUL_CAMPFIRE -> null; +// case SOUL_FIRE -> null; +// case SOUL_LANTERN -> null; +// case SOUL_SAND -> null; +// case SOUL_SOIL -> null; +// case SOUL_TORCH -> null; +// case SOUL_WALL_TORCH -> null; +// case SPAWNER -> null; +// case SPONGE -> null; +// case SPORE_BLOSSOM -> null; +// case SPRUCE_BUTTON -> null; +// case SPRUCE_DOOR -> null; +// case SPRUCE_FENCE -> null; +// case SPRUCE_FENCE_GATE -> null; +// case SPRUCE_LEAVES -> null; +// case SPRUCE_LOG -> null; +// case SPRUCE_PLANKS -> null; +// case SPRUCE_PRESSURE_PLATE -> null; +// case SPRUCE_SAPLING -> null; +// case SPRUCE_SLAB -> null; +// case SPRUCE_TRAPDOOR -> null; +// case SPRUCE_WOOD -> null; +// case STICKY_PISTON -> null; +// case STONE -> null; +// case STONECUTTER -> null; +// case STONE_BRICKS -> null; +// case STONE_BRICK_SLAB -> null; +// case STONE_BRICK_WALL -> null; +// case STONE_BUTTON -> null; +// case STONE_PRESSURE_PLATE -> null; +// case STONE_SLAB -> null; +// case STRIPPED_ACACIA_LOG -> null; +// case STRIPPED_ACACIA_WOOD -> null; +// case STRIPPED_BAMBOO_BLOCK -> null; +// case STRIPPED_BIRCH_LOG -> null; +// case STRIPPED_BIRCH_WOOD -> null; +// case STRIPPED_CHERRY_LOG -> null; +// case STRIPPED_CHERRY_WOOD -> null; +// case STRIPPED_CRIMSON_HYPHAE -> null; +// case STRIPPED_CRIMSON_STEM -> null; +// case STRIPPED_DARK_OAK_LOG -> null; +// case STRIPPED_DARK_OAK_WOOD -> null; +// case STRIPPED_JUNGLE_LOG -> null; +// case STRIPPED_JUNGLE_WOOD -> null; +// case STRIPPED_MANGROVE_LOG -> null; +// case STRIPPED_MANGROVE_WOOD -> null; +// case STRIPPED_OAK_LOG -> null; +// case STRIPPED_OAK_WOOD -> null; +// case STRIPPED_SPRUCE_LOG -> null; +// case STRIPPED_SPRUCE_WOOD -> null; +// case STRIPPED_WARPED_HYPHAE -> null; +// case STRIPPED_WARPED_STEM -> null; +// case STRUCTURE_BLOCK -> null; +// case STRUCTURE_VOID -> null; +// case SUGAR_CANE -> null; +// case SUNFLOWER -> null; +// case SUSPICIOUS_GRAVEL -> null; +// case SUSPICIOUS_SAND -> null; +// case SWEET_BERRY_BUSH -> null; +// case TALL_GRASS -> null; +// case TALL_SEAGRASS -> null; +// case TARGET -> null; +// case TERRACOTTA -> null; +// case TINTED_GLASS -> null; +// case TNT -> null; +// case TORCH -> null; +// case TORCHFLOWER -> null; +// case TORCHFLOWER_CROP -> null; +// case TRAPPED_CHEST -> null; +// case TRIPWIRE -> null; +// case TRIPWIRE_HOOK -> null; +// case TUBE_CORAL -> null; +// case TUBE_CORAL_BLOCK -> null; +// case TUBE_CORAL_FAN -> null; +// case TUBE_CORAL_WALL_FAN -> null; +// case TUFF -> null; +// case TUFF_BRICKS -> null; +// case TUFF_BRICK_SLAB -> null; +// case TUFF_BRICK_WALL -> null; +// case TUFF_SLAB -> null; +// case TUFF_WALL -> null; +// case TURTLE_EGG -> null; +// case TWISTING_VINES -> null; +// case TWISTING_VINES_PLANT -> null; +// case VERDANT_FROGLIGHT -> null; +// case VINE -> null; +// case VOID_AIR -> null; +// case WALL_TORCH -> null; +// case WARPED_BUTTON -> null; +// case WARPED_DOOR -> null; +// case WARPED_FENCE -> null; +// case WARPED_FENCE_GATE -> null; +// case WARPED_FUNGUS -> null; +// case WARPED_HYPHAE -> null; +// case WARPED_NYLIUM -> null; +// case WARPED_PLANKS -> null; +// case WARPED_PRESSURE_PLATE -> null; +// case WARPED_ROOTS -> null; +// case WARPED_SLAB -> null; +// case WARPED_STEM -> null; +// case WARPED_TRAPDOOR -> null; +// case WARPED_WART_BLOCK -> null; +// case WATER -> null; +// case WATER_CAULDRON -> null; +// case WAXED_CHISELED_COPPER -> null; +// case WAXED_COPPER_BLOCK -> null; +// case WAXED_COPPER_BULB -> null; +// case WAXED_COPPER_DOOR -> null; +// case WAXED_COPPER_GRATE -> null; +// case WAXED_COPPER_TRAPDOOR -> null; +// case WAXED_CUT_COPPER -> null; +// case WAXED_CUT_COPPER_SLAB -> null; +// case WAXED_EXPOSED_CHISELED_COPPER -> null; +// case WAXED_EXPOSED_COPPER -> null; +// case WAXED_EXPOSED_COPPER_BULB -> null; +// case WAXED_EXPOSED_COPPER_DOOR -> null; +// case WAXED_EXPOSED_COPPER_GRATE -> null; +// case WAXED_EXPOSED_COPPER_TRAPDOOR -> null; +// case WAXED_EXPOSED_CUT_COPPER -> null; +// case WAXED_EXPOSED_CUT_COPPER_SLAB -> null; +// case WAXED_OXIDIZED_CHISELED_COPPER -> null; +// case WAXED_OXIDIZED_COPPER -> null; +// case WAXED_OXIDIZED_COPPER_BULB -> null; +// case WAXED_OXIDIZED_COPPER_DOOR -> null; +// case WAXED_OXIDIZED_COPPER_GRATE -> null; +// case WAXED_OXIDIZED_COPPER_TRAPDOOR -> null; +// case WAXED_OXIDIZED_CUT_COPPER -> null; +// case WAXED_OXIDIZED_CUT_COPPER_SLAB -> null; +// case WAXED_WEATHERED_CHISELED_COPPER -> null; +// case WAXED_WEATHERED_COPPER -> null; +// case WAXED_WEATHERED_COPPER_BULB -> null; +// case WAXED_WEATHERED_COPPER_DOOR -> null; +// case WAXED_WEATHERED_COPPER_GRATE -> null; +// case WAXED_WEATHERED_COPPER_TRAPDOOR -> null; +// case WAXED_WEATHERED_CUT_COPPER -> null; +// case WAXED_WEATHERED_CUT_COPPER_SLAB -> null; +// case WEATHERED_CHISELED_COPPER -> null; +// case WEATHERED_COPPER -> null; +// case WEATHERED_COPPER_BULB -> null; +// case WEATHERED_COPPER_DOOR -> null; +// case WEATHERED_COPPER_GRATE -> null; +// case WEATHERED_COPPER_TRAPDOOR -> null; +// case WEATHERED_CUT_COPPER -> null; +// case WEATHERED_CUT_COPPER_SLAB -> null; +// case WEEPING_VINES -> null; +// case WEEPING_VINES_PLANT -> null; +// case WET_SPONGE -> null; +// case WHEAT -> null; +// case WHITE_BANNER -> null; +// case WHITE_BED -> null; +// case WHITE_CANDLE -> null; +// case WHITE_CANDLE_CAKE -> null; +// case WHITE_CARPET -> null; +// case WHITE_CONCRETE -> null; +// case WHITE_CONCRETE_POWDER -> null; +// case WHITE_GLAZED_TERRACOTTA -> null; +// case WHITE_SHULKER_BOX -> null; +// case WHITE_STAINED_GLASS -> null; +// case WHITE_STAINED_GLASS_PANE -> null; +// case WHITE_TERRACOTTA -> null; +// case WHITE_TULIP -> null; +// case WHITE_WALL_BANNER -> null; +// case WHITE_WOOL -> null; +// case WITHER_ROSE -> null; +// case WITHER_SKELETON_SKULL -> null; +// case WITHER_SKELETON_WALL_SKULL -> null; +// case YELLOW_BANNER -> null; +// case YELLOW_BED -> null; +// case YELLOW_CANDLE -> null; +// case YELLOW_CANDLE_CAKE -> null; +// case YELLOW_CARPET -> null; +// case YELLOW_CONCRETE -> null; +// case YELLOW_CONCRETE_POWDER -> null; +// case YELLOW_GLAZED_TERRACOTTA -> null; +// case YELLOW_SHULKER_BOX -> null; +// case YELLOW_STAINED_GLASS -> null; +// case YELLOW_STAINED_GLASS_PANE -> null; +// case YELLOW_TERRACOTTA -> null; +// case YELLOW_WALL_BANNER -> null; +// case YELLOW_WOOL -> null; +// case ZOMBIE_HEAD -> null; +// case ZOMBIE_WALL_HEAD -> null; +// default -> null; +// }; + } + + @Override + public net.ouja.api.world.level.block.Block getBlock() { + return getBlockClass(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/block/DishButtonBlock.java b/patches/release/1.21/net/ouja/dish/world/block/DishButtonBlock.java new file mode 100644 index 0000000..ae9efb6 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/block/DishButtonBlock.java @@ -0,0 +1,30 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.block.Block; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.ButtonBlock; + +public class DishButtonBlock extends DishBlock implements ButtonBlock { + private final net.minecraft.world.level.block.ButtonBlock buttonBlock; + + public DishButtonBlock(BlockPos pos, BlockTypes blockType, Block block) { + super(pos, blockType, block); + this.buttonBlock = (net.minecraft.world.level.block.ButtonBlock) block; + } + + @Override + public BlockPos getBlockPos() { + return super.getBlockPos(); + } + + @Override + public BlockTypes getType() { + return super.getType(); + } + + @Override + public int getSignal() { + return this.buttonBlock.defaultBlockState().getValue(net.minecraft.world.level.block.ButtonBlock.POWERED) ? 15 : 0; + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/block/DishDoorBlock.java b/patches/release/1.21/net/ouja/dish/world/block/DishDoorBlock.java new file mode 100644 index 0000000..f6174a9 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/block/DishDoorBlock.java @@ -0,0 +1,32 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.ouja.api.entity.Entity; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.DoorBlock; + +import javax.annotation.Nullable; + +public class DishDoorBlock extends DishBlock implements DoorBlock { + private final net.minecraft.world.level.block.DoorBlock door; + private final Level level; + + public DishDoorBlock(BlockPos pos, BlockTypes blockType, Block block, Level level) { + super(pos, blockType, block); + this.door = (net.minecraft.world.level.block.DoorBlock) block; + this.level = level; + } + + @Override + public boolean isOpen() { + return this.door.isOpen(this.door.defaultBlockState()); + } + + @Override + public void setOpen(@Nullable Entity entity, boolean open) { + net.minecraft.core.BlockPos blockPos = new net.minecraft.core.BlockPos(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()); + this.door.setOpen(entity != null ? this.level.getEntity(entity.getId()) : null, this.level, this.door.defaultBlockState(), blockPos, open); + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/block/DishSignBlock.java b/patches/release/1.21/net/ouja/dish/world/block/DishSignBlock.java new file mode 100644 index 0000000..04006f4 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/block/DishSignBlock.java @@ -0,0 +1,60 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SignBlock; +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.WaterLoggableBlock; +import net.ouja.api.world.level.block.entity.SignText; +import net.ouja.dish.world.block.entity.DishSignText; + +public class DishSignBlock extends DishBlock implements WaterLoggableBlock, net.ouja.api.world.level.block.SignBlock { + private final SignBlock block; + private final SignBlockEntity signBlockEntity; + private final boolean isWallSign; + private final boolean isHangingSign; + + public DishSignBlock(BlockPos pos, BlockTypes blockType, Block block, SignBlockEntity signBlockEntity) { + super(pos, blockType, block); + this.block = (SignBlock) block; + this.signBlockEntity = signBlockEntity; + this.isWallSign = blockType.getBlockName().contains("_wall_"); + this.isHangingSign = blockType.getBlockName().endsWith("_hanging_sign"); + } + + @Override + public boolean isWaterLogged() { + return !this.block.getFluidState(this.block.defaultBlockState()).isEmpty(); + } + + @Override + public boolean isWallSign() { + return isWallSign; + } + + @Override + public boolean isHangingSign() { + return isHangingSign; + } + + @Override + public boolean isWaxed() { + return signBlockEntity.isWaxed(); + } + + @Override + public void setWaxed(boolean waxed) { + signBlockEntity.setWaxed(waxed); + } + + @Override + public SignText getFrontText() { + return new DishSignText(signBlockEntity,true); + } + + @Override + public SignText getBackText() { + return new DishSignText(signBlockEntity,false); + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/block/DishStairBlock.java b/patches/release/1.21/net/ouja/dish/world/block/DishStairBlock.java new file mode 100644 index 0000000..ae09207 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/block/DishStairBlock.java @@ -0,0 +1,26 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.StairBlock; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.WaterLoggableBlock; + +public class DishStairBlock extends DishBlock implements WaterLoggableBlock, net.ouja.api.world.level.block.StairBlock { + private final StairBlock block; + + public DishStairBlock(BlockPos pos, BlockTypes blockType, Block block) { + super(pos, blockType, block); + this.block = (StairBlock) block; + } + + @Override + public boolean isWaterLogged() { + return !this.block.getFluidState(this.block.defaultBlockState()).isEmpty(); + } + + @Override + public String direction() { + return this.block.defaultBlockState().getValue(StairBlock.FACING).getName(); + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/block/DishTrapdoorBlock.java b/patches/release/1.21/net/ouja/dish/world/block/DishTrapdoorBlock.java new file mode 100644 index 0000000..1c3e669 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/block/DishTrapdoorBlock.java @@ -0,0 +1,38 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.TrapDoorBlock; +import net.ouja.api.entity.Player; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.TrapdoorBlock; + +import javax.annotation.Nullable; + +public class DishTrapdoorBlock extends DishBlock implements TrapdoorBlock { + private final TrapDoorBlock trapdoor; + private final Level level; + + public DishTrapdoorBlock(BlockPos pos, BlockTypes blockType, Block block, Level level) { + super(pos, blockType, block); + this.trapdoor = (TrapDoorBlock) block; + this.level = level; + } + + @Override + public boolean isOpen() { + return this.trapdoor.defaultBlockState().getValue(TrapDoorBlock.OPEN); + } + + @Override + public void setOpen(@Nullable Player player, boolean open) { + net.minecraft.core.BlockPos blockPos = new net.minecraft.core.BlockPos(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()); + this.trapdoor.setOpen(player != null ? this.level.getPlayerByUUID(player.getUUID()) : null, this.level, this.trapdoor.defaultBlockState(), blockPos, open); + } + + @Override + public boolean isWaterLogged() { + return this.trapdoor.defaultBlockState().getValue(TrapDoorBlock.WATERLOGGED); + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/block/entity/DishSignText.java b/patches/release/1.21/net/ouja/dish/world/block/entity/DishSignText.java new file mode 100644 index 0000000..3e94690 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/block/entity/DishSignText.java @@ -0,0 +1,54 @@ +package net.ouja.dish.world.block.entity; + +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.ouja.api.network.chat.Component; +import net.ouja.api.world.level.block.entity.SignText; +import net.ouja.dish.network.chat.DishComponent; + +public class DishSignText implements SignText { + private final SignBlockEntity signBlockEntity; + private final boolean isFront; + + public DishSignText(SignBlockEntity signBlockEntity, boolean front) { + this.signBlockEntity = signBlockEntity; + this.isFront = front; + } + + @Override + public Component[] getText(boolean filtered) { + if (signBlockEntity == null) return new Component[0]; + return isFront ? DishComponent.fromComponent(signBlockEntity.getFrontText().getMessages(filtered)) : DishComponent.fromComponent(signBlockEntity.getBackText().getMessages(filtered)); + } + + @Override + public boolean isGlowing() { + return isFront ? signBlockEntity.getFrontText().hasGlowingText() : signBlockEntity.getBackText().hasGlowingText(); + } + + @Override + public void setGlowing(boolean b) { + net.minecraft.world.level.block.entity.SignText text = isFront ? + signBlockEntity.getFrontText().setHasGlowingText(b) : + signBlockEntity.getBackText().setHasGlowingText(b); + + setText(text); + } + + @Override + public void setMessage(int i, Component component) { + this.setMessage(i, component, component); + } + + @Override + public void setMessage(int i, Component message, Component filtered) { + net.minecraft.world.level.block.entity.SignText text = isFront ? + signBlockEntity.getFrontText().setMessage(i, DishComponent.toComponent(message), DishComponent.toComponent(filtered)) : + signBlockEntity.getBackText().setMessage(i, DishComponent.toComponent(message), DishComponent.toComponent(filtered)); + + setText(text); + } + + private void setText(net.minecraft.world.level.block.entity.SignText text) { + signBlockEntity.updateText((signText) -> text, isFront); + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/item/DishItemStack.java b/patches/release/1.21/net/ouja/dish/world/item/DishItemStack.java new file mode 100644 index 0000000..72ff493 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/item/DishItemStack.java @@ -0,0 +1,140 @@ +package net.ouja.dish.world.item; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.PatchedDataComponentMap; +import net.ouja.api.network.chat.Component; +import net.ouja.api.world.item.Item; +import net.ouja.api.world.item.ItemStack; +import net.ouja.dish.network.chat.DishComponent; + +public class DishItemStack implements ItemStack { + private final net.minecraft.world.item.ItemStack itemStack; + + public DishItemStack(net.minecraft.world.item.ItemStack itemStack) { + this.itemStack = itemStack; + } + + /** + * Converts vanilla's ObjectArrayList to Dishes version of it + * @param items vanilla items + * @return Dishes variant of the ItemStacks. + */ + public static ObjectArrayList convertFromVanilla(ObjectArrayList items) { + ObjectArrayList dishItems = new ObjectArrayList<>(); + + for (net.minecraft.world.item.ItemStack vanillaItem : items) { + dishItems.add(new DishItemStack(vanillaItem)); + } + + return dishItems; + } + + // TODO: 11/15/2023 Make Item classes + @Override + public Item getItem() { + return null; + } + + @Override + public boolean is(Item item) { + return false; + } + + @Override + public int getMaxStackSize() { + return this.itemStack.getMaxStackSize(); + } + + @Override + public boolean isDamageableItem() { + return this.itemStack.isDamageableItem(); + } + + @Override + public boolean isDamaged() { + return this.itemStack.isDamageableItem(); + } + + @Override + public int getDamageValue() { + return this.itemStack.getDamageValue(); + } + + @Override + public void setDamageValue(int i) { + this.itemStack.setDamageValue(i); + } + + @Override + public int getMaxDamage() { + return this.itemStack.getMaxDamage(); + } + + @Override + public ItemStack copy() { + if (this.itemStack.isEmpty()) { + return new DishItemStack(net.minecraft.world.item.ItemStack.EMPTY); + } + + net.minecraft.world.item.ItemStack itemstack = new net.minecraft.world.item.ItemStack((Holder)this.itemStack.getItem(), this.itemStack.getCount(), this.itemStack.getComponentsPatch()); + itemstack.setPopTime(this.itemStack.getPopTime()); + + return new DishItemStack(itemstack); + } + + @Override + public ItemStack copyWithCount(int i) { + if (this.itemStack.isEmpty()) { + return new DishItemStack(net.minecraft.world.item.ItemStack.EMPTY); + } + + net.minecraft.world.item.ItemStack itemstack = new net.minecraft.world.item.ItemStack((Holder)this.itemStack.getItem(), this.itemStack.getCount(), this.itemStack.getComponentsPatch()); + itemstack.setPopTime(this.itemStack.getPopTime()); + + itemstack.setCount(i); + return new DishItemStack(itemstack); + } + + @Override + public Component getHoverName() { + return DishComponent.fromComponent(this.itemStack.getHoverName()); + } + + @Override + public void setHoverName(Component component) { + DataComponentMap.Builder builder = DataComponentMap.builder().addAll(this.itemStack.getComponents()); + builder.set(DataComponents.CUSTOM_NAME, DishComponent.toComponent(component)); + this.itemStack.applyComponents(builder.build()); + } + + @Override + public void resetHoverName() { + DataComponentMap.Builder builder = DataComponentMap.builder().addAll(this.itemStack.getComponents()); + builder.set(DataComponents.CUSTOM_NAME, this.itemStack.getItem().getName(this.itemStack)); + this.itemStack.applyComponents(builder.build()); + } + + @Override + public boolean hasCustomHoverName() { + return this.itemStack.getComponents().has(DataComponents.CUSTOM_NAME); + } + + @Override + public Component getDisplayName() { + return DishComponent.fromComponent(this.itemStack.getDisplayName()); + } + + @Override + public int getCount() { + return this.itemStack.getCount(); + } + + @Override + public void setCount(int i) { + this.itemStack.setCount(i); + } +} diff --git a/patches/release/1.21/net/ouja/dish/world/level/chunk/DishStructure.java b/patches/release/1.21/net/ouja/dish/world/level/chunk/DishStructure.java new file mode 100644 index 0000000..4639ddc --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/world/level/chunk/DishStructure.java @@ -0,0 +1,52 @@ +package net.ouja.dish.world.level.chunk; + +import net.ouja.api.world.level.chunk.Structure; +import net.ouja.api.world.level.chunk.StructureTypes; + +public class DishStructure implements Structure { + private final net.minecraft.world.level.levelgen.structure.Structure structure; + + public DishStructure(net.minecraft.world.level.levelgen.structure.Structure structure) { + this.structure = structure; + } + + @Override + public StructureTypes getType() { + if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.BURIED_TREASURE) { + return StructureTypes.BURIED_TREASURE; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.DESERT_PYRAMID) { + return StructureTypes.DESERT_PYRAMID; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.END_CITY) { + return StructureTypes.END_CITY; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.FORTRESS) { + return StructureTypes.FORTRESS; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.IGLOO) { + return StructureTypes.IGLOO; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.JIGSAW) { + return StructureTypes.JIGSAW; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.JUNGLE_TEMPLE) { + return StructureTypes.JUNGLE_TEMPLE; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.MINESHAFT) { + return StructureTypes.MINESHAFT; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.NETHER_FOSSIL) { + return StructureTypes.NETHER_FOSSIL; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.OCEAN_MONUMENT) { + return StructureTypes.OCEAN_MONUMENT; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.OCEAN_RUIN) { + return StructureTypes.OCEAN_RUIN; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.RUINED_PORTAL) { + return StructureTypes.RUINED_PORTAL; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.SHIPWRECK) { + return StructureTypes.SHIPWRECK; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.STRONGHOLD) { + return StructureTypes.STRONGHOLD; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.SWAMP_HUT) { + return StructureTypes.SWAMP_HUT; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.WOODLAND_MANSION) { + return StructureTypes.WOODLAND_MANSION; + } else { + return null; + } + + } +} From be233081500fb222ba177462486c601118b9879d Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 00:17:28 -0500 Subject: [PATCH 04/15] start working on 1.21 - 2 --- config.js | 2 +- dish/index.js | 58 ++++++++++++++++++++--- dish/libraries/{1.20.6.json => 1.21.json} | 2 +- mache | 2 +- 4 files changed, 54 insertions(+), 10 deletions(-) rename dish/libraries/{1.20.6.json => 1.21.json} (96%) diff --git a/config.js b/config.js index 6e0c854..9e020e5 100644 --- a/config.js +++ b/config.js @@ -8,7 +8,7 @@ const fs = require('fs'); const colors = require('./libs/colors'); -const DEFAULT_MINECRAFT_VERSION = "snapshot/23w51b"; +const DEFAULT_MINECRAFT_VERSION = 'release/1.21'; function log(msg) { console.log(`[Info]${colors.reset} ${msg}`); diff --git a/dish/index.js b/dish/index.js index db9fee8..cb4c2da 100644 --- a/dish/index.js +++ b/dish/index.js @@ -5,9 +5,10 @@ const args = process.argv.slice(2); const fs = require('fs'); +const calculateFileHash = require('../utils/checkFileHash'); +const https = require('https'); const { error, DEFAULT_MINECRAFT_VERSION, log, warn } = require('../config'); const { execSync } = require('child_process'); -const calculateFileHash = require('../utils/checkFileHash'); const stdio = [process.stdin, process.stdout, process.stderr]; const DECOMPILE_VERSION = args[0] ?? DEFAULT_MINECRAFT_VERSION; @@ -31,6 +32,16 @@ function parseLibraries(libraries) { (async function () { if (!fs.existsSync('init.js')) return error('Run this file in the parent directory'); + if (!fs.existsSync(`cache/${DECOMPILE_VERSION.split('/')[1]}/META-INF/libraries.list`)) { + warn(`Could not find file: cache/${DECOMPILE_VERSION.split('/')[1]}/META-INF/libraries.list, installing...`); + await cacheServer(); + // final check + if (!fs.existsSync(`cache/${DECOMPILE_VERSION.split('/')[1]}/META-INF/libraries.list`)) { + error(`Could not find file: cache/${DECOMPILE_VERSION.split('/')[1]}/META-INF/libraries.list`); + return process.exit(1); + } + } + log(`Creating workspace for version '${DECOMPILE_VERSION}'`); if (!fs.existsSync(`workspaces/${DECOMPILE_VERSION.split('/')[1]}`)) { // If workspace does not exist, try to create it. @@ -53,11 +64,6 @@ function parseLibraries(libraries) { return process.exit(1); } - if (!fs.existsSync(`cache/${DECOMPILE_VERSION.split('/')[1]}/META-INF/libraries.list`)) { - error(`Could not find file: cache/${DECOMPILE_VERSION.split('/')[1]}/META-INF/libraries.list`); - return process.exit(1); - } - if (fs.existsSync('dish/workspace')) { console.time('Moved directories'); warn('Dish workspace already exists. Moving it, this may take a while...'); @@ -88,4 +94,42 @@ function parseLibraries(libraries) { execSync('cd dish/workspace && git add .', { stdio }); execSync('cd dish/workspace && git commit -m "applied patches"', { stdio }); process.exit(0); -})(); \ No newline at end of file +})(); + +async function cacheServer(version = DECOMPILE_VERSION.split('/')[1]) { + const manifestReq = await fetch('https://launchermeta.mojang.com/mc/game/version_manifest_v2.json'); + if (manifestReq.status !== 200) { + error('https://launchermeta.mojang.com/mc/game/version_manifest_v2.json returned ' + manifestReq.status); + return process.exit(1); + } + + const manifest = await manifestReq.json(); + const versionJson = manifest.versions.filter(v => v.id === version)[0]; + if (!versionJson) { + error(`Could not find version '${version}'`); + return process.exit(1); + } + + const packageReq = await fetch(versionJson.url); + if (manifestReq.status !== 200) { + error(versionJson.url + ' returned ' + packageReq.status); + return process.exit(1); + } + + const package = await packageReq.json(); + await fs.promises.mkdir(`cache/${version}`, { recursive: true }); + await fs.promises.writeFile(`cache/${version}/${version}.json`, JSON.stringify(package)); + + log('Downloading server jar...'); + const file = fs.createWriteStream(`cache/${version}/server.jar`); + await downloadServerJar(package.downloads.server.url, file); + log('Server jar finished downloading'); + execSync(`cd cache/${version} && jar xf server.jar META-INF`, { stdio }); +} + +async function downloadServerJar(url, file) { + return new Promise((res, rej) => { + const request = https.get(url, (res) => res.pipe(file)); + request.on('error', (e) => rej(e)); + }); +} diff --git a/dish/libraries/1.20.6.json b/dish/libraries/1.21.json similarity index 96% rename from dish/libraries/1.20.6.json rename to dish/libraries/1.21.json index 7c3e14d..16e4b8d 100644 --- a/dish/libraries/1.20.6.json +++ b/dish/libraries/1.21.json @@ -1,5 +1,5 @@ { - "version": "1.20.6", + "version": "1.21", "api_version": "R0.1-SNAPSHOT", "libraries": [ { diff --git a/mache b/mache index 5e88a90..6c25200 160000 --- a/mache +++ b/mache @@ -1 +1 @@ -Subproject commit 5e88a906c3763b10a30bb4dcab04e722d56425b5 +Subproject commit 6c2520009970e76eab705eaf48d01c7b851eb284 From 94ee8fa6cecd8abff19b20d7edd6b1530b978d0f Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 17:45:59 -0500 Subject: [PATCH 05/15] finish initial port to 1.21 --- README.md | 4 +-- dish/libraries/1.21.json | 6 ++-- .../level/levelgen/BitRandomSource.patch | 13 --------- .../1.21/net/minecraft/ChatFormatting.patch | 4 +-- .../1.21/net/minecraft/CrashReport.patch | 4 +-- .../net/minecraft/commands/Commands.patch | 6 ++-- .../1.21/net/minecraft/server/Main.patch | 2 +- .../minecraft/server/MinecraftServer.patch | 4 +-- .../server/dedicated/DedicatedServer.patch | 10 +++---- .../net/minecraft/server/level/ChunkMap.patch | 6 ++-- .../minecraft/server/level/ServerEntity.patch | 29 +++++++++---------- .../minecraft/server/level/ServerPlayer.patch | 10 +++---- .../server/level/ServerPlayerGameMode.patch | 4 +-- .../ServerGamePacketListenerImpl.patch | 4 +-- .../ServerLoginPacketListenerImpl.patch | 4 +-- .../minecraft/server/players/PlayerList.patch | 8 +++-- .../world/damagesource/DamageSource.patch | 4 +-- .../minecraft/world/entity/LivingEntity.patch | 11 ++++--- .../minecraft/world/entity/animal/Squid.patch | 4 +-- .../world/entity/animal/sniffer/Sniffer.patch | 2 +- .../world/entity/item/ItemEntity.patch | 4 +-- .../world/entity/monster/Shulker.patch | 2 +- .../world/entity/monster/Vindicator.patch | 4 +-- .../world/entity/monster/hoglin/Hoglin.patch | 2 +- .../world/entity/monster/piglin/Piglin.patch | 2 +- .../world/entity/player/Player.patch | 6 ++-- .../net/minecraft/world/item/ItemStack.patch | 4 +-- .../net/minecraft/world/level/ChunkPos.patch | 2 +- .../minecraft/world/level/block/Block.patch | 4 +-- .../world/level/block/SignBlock.patch | 4 +-- .../world/level/block/StairBlock.patch | 2 +- .../world/level/block/TrapDoorBlock.patch | 4 +-- .../world/level/chunk/ChunkGenerator.patch | 10 +++---- .../world/level/chunk/ChunkStatus.patch | 13 --------- .../level/chunk/status/ChunkStatusTasks.patch | 12 ++++---- .../world/level/storage/loot/LootTable.patch | 4 +-- .../net/ouja/dish/entity/passive/DishPig.java | 2 +- .../ouja/dish/entity/passive/DishStrider.java | 2 +- 38 files changed, 98 insertions(+), 124 deletions(-) delete mode 100644 patches/release/1.20.6/net/minecraft/world/level/levelgen/BitRandomSource.patch delete mode 100644 patches/release/1.21/net/minecraft/world/level/chunk/ChunkStatus.patch diff --git a/README.md b/README.md index 8b18037..65baef1 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ repositories { } dependencies { - compileOnly("net.ouja:api:1.20.6-R0.1-SNAPSHOT") + compileOnly("net.ouja:api:1.21-R0.1-SNAPSHOT") implementation 'it.unimi.dsi:fastutil:8.5.12' } ``` @@ -41,7 +41,7 @@ Maven net.ouja api - 1.20.6-R0.1-SNAPSHOT + 1.21-R0.1-SNAPSHOT provided diff --git a/dish/libraries/1.21.json b/dish/libraries/1.21.json index 16e4b8d..24d0f37 100644 --- a/dish/libraries/1.21.json +++ b/dish/libraries/1.21.json @@ -11,10 +11,10 @@ }, { "downloads": { - "url": "https://maven.ouja.net/net/ouja/api/1.20.6-R0.1-SNAPSHOT/api-1.20.6-R0.1-20240523.231723-1.jar", - "path": "net/ouja/api/1.20.6/1.20.6-R0.1-SNAPSHOT.jar" + "url": "https://maven.ouja.net/net/ouja/api/1.21-R0.1-SNAPSHOT/api-1.21-R0.1-20240707.170948-1.jar", + "path": "net/ouja/api/1.21/1.21-R0.1-SNAPSHOT.jar" }, - "name": "net.ouja:api:1.20.6-R0.1-SNAPSHOT" + "name": "net.ouja:api:1.21-R0.1-SNAPSHOT" } ] } \ No newline at end of file diff --git a/patches/release/1.20.6/net/minecraft/world/level/levelgen/BitRandomSource.patch b/patches/release/1.20.6/net/minecraft/world/level/levelgen/BitRandomSource.patch deleted file mode 100644 index 6fb5e71..0000000 --- a/patches/release/1.20.6/net/minecraft/world/level/levelgen/BitRandomSource.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java b/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java -index e2e46f4..a7f7f74 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java -@@ -18,7 +18,7 @@ public interface BitRandomSource extends RandomSource { - if (bound <= 0) { - throw new IllegalArgumentException("Bound must be positive"); - } else if ((bound & bound - 1) == 0) { -- return (int)(bound * this.next(31) >> 31); -+ return (int)((long)bound * (long)this.next(31) >> 31); // fix decompiler error - } else { - int i; - int i1; diff --git a/patches/release/1.21/net/minecraft/ChatFormatting.patch b/patches/release/1.21/net/minecraft/ChatFormatting.patch index 474caf2..8f0b980 100644 --- a/patches/release/1.21/net/minecraft/ChatFormatting.patch +++ b/patches/release/1.21/net/minecraft/ChatFormatting.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net/minecraft/ChatFormatting.java -index cd1fc70..d8eba59 100644 +index 12c6b47..2077793 100644 --- a/src/main/java/net/minecraft/ChatFormatting.java +++ b/src/main/java/net/minecraft/ChatFormatting.java -@@ -37,7 +37,7 @@ public enum ChatFormatting implements StringRepresentable { +@@ -38,7 +38,7 @@ public enum ChatFormatting implements StringRepresentable { RESET("RESET", 'r', -1, null); public static final Codec CODEC = StringRepresentable.fromEnum(ChatFormatting::values); diff --git a/patches/release/1.21/net/minecraft/CrashReport.patch b/patches/release/1.21/net/minecraft/CrashReport.patch index 28900ee..a87eeb2 100644 --- a/patches/release/1.21/net/minecraft/CrashReport.patch +++ b/patches/release/1.21/net/minecraft/CrashReport.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java -index 990d8c0..73758fc 100644 +index 706b64e..1bdfec4 100644 --- a/src/main/java/net/minecraft/CrashReport.java +++ b/src/main/java/net/minecraft/CrashReport.java -@@ -35,6 +35,7 @@ public class CrashReport { +@@ -34,6 +34,7 @@ public class CrashReport { public CrashReport(String title, Throwable exception) { this.title = title; this.exception = exception; diff --git a/patches/release/1.21/net/minecraft/commands/Commands.patch b/patches/release/1.21/net/minecraft/commands/Commands.patch index f7cc015..896bcee 100644 --- a/patches/release/1.21/net/minecraft/commands/Commands.patch +++ b/patches/release/1.21/net/minecraft/commands/Commands.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index b958c90..0e23552 100644 +index 587b873..093661e 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -144,7 +144,7 @@ public class Commands { +@@ -143,7 +143,7 @@ public class Commands { public static final int LEVEL_GAMEMASTERS = 2; public static final int LEVEL_ADMINS = 3; public static final int LEVEL_OWNERS = 4; @@ -11,7 +11,7 @@ index b958c90..0e23552 100644 public Commands(Commands.CommandSelection selection, CommandBuildContext context) { AdvancementCommands.register(this.dispatcher); -@@ -418,8 +418,8 @@ public class Commands { +@@ -416,8 +416,8 @@ public class Commands { }; } diff --git a/patches/release/1.21/net/minecraft/server/Main.patch b/patches/release/1.21/net/minecraft/server/Main.patch index c7ebbdf..3df466a 100644 --- a/patches/release/1.21/net/minecraft/server/Main.patch +++ b/patches/release/1.21/net/minecraft/server/Main.patch @@ -1,5 +1,5 @@ diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 30ed4b8..26bd788 100644 +index 3cde004..a5b4913 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -114,6 +114,12 @@ public class Main { diff --git a/patches/release/1.21/net/minecraft/server/MinecraftServer.patch b/patches/release/1.21/net/minecraft/server/MinecraftServer.patch index e280e0c..1454230 100644 --- a/patches/release/1.21/net/minecraft/server/MinecraftServer.patch +++ b/patches/release/1.21/net/minecraft/server/MinecraftServer.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 162e5a8..1a97ce4 100644 +index a049964..06a356b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1096,7 +1096,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop seenBy = Sets.newIdentityHashSet(); public TrackedEntity(final Entity entity, final int range, final int updateInterval, final boolean trackDelta) { diff --git a/patches/release/1.21/net/minecraft/server/level/ServerEntity.patch b/patches/release/1.21/net/minecraft/server/level/ServerEntity.patch index 91a7900..de2692d 100644 --- a/patches/release/1.21/net/minecraft/server/level/ServerEntity.patch +++ b/patches/release/1.21/net/minecraft/server/level/ServerEntity.patch @@ -1,16 +1,16 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index f779c6e..1dfdd4a 100644 +index 26d9a03..c65e60d 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -56,19 +56,20 @@ public class ServerEntity { +@@ -56,25 +56,27 @@ public class ServerEntity { private final boolean trackDelta; private final Consumer> broadcast; private final VecDeltaCodec positionCodec = new VecDeltaCodec(); + private final Set seenBy; // dish - private int yRotp; - private int xRotp; - private int yHeadRotp; - private Vec3 ap = Vec3.ZERO; + private int lastSentYRot; + private int lastSentXRot; + private int lastSentYHeadRot; + private Vec3 lastSentMovement; private int tickCount; private int teleportDelay; - private List lastPassengers = Collections.emptyList(); @@ -21,19 +21,18 @@ index f779c6e..1dfdd4a 100644 private List> trackedDataValues; - public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast) { -+ public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast, Set seenBy) { ++ public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast, Set seenBy) { // dish this.level = level; this.broadcast = broadcast; this.entity = entity; -@@ -80,6 +81,7 @@ public class ServerEntity { - this.yHeadRotp = Mth.floor(entity.getYHeadRot() * 256.0F / 360.0F); - this.wasOnGround = entity.onGround(); - this.trackedDataValues = entity.getEntityData().getNonDefaultValues(); + this.updateInterval = updateInterval; + this.trackDelta = trackDelta; + this.positionCodec.setBase(entity.trackingPosition()); + this.seenBy = seenBy; // dish - } - - public void sendChanges() { -@@ -98,7 +100,7 @@ public class ServerEntity { + this.lastSentMovement = entity.getDeltaMovement(); + this.lastSentYRot = Mth.floor(entity.getYRot() * 256.0F / 360.0F); + this.lastSentXRot = Mth.floor(entity.getXRot() * 256.0F / 360.0F); +@@ -99,7 +101,7 @@ public class ServerEntity { this.lastPassengers = passengers; } diff --git a/patches/release/1.21/net/minecraft/server/level/ServerPlayer.patch b/patches/release/1.21/net/minecraft/server/level/ServerPlayer.patch index 70ac6e9..dd38908 100644 --- a/patches/release/1.21/net/minecraft/server/level/ServerPlayer.patch +++ b/patches/release/1.21/net/minecraft/server/level/ServerPlayer.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index de86986..5efcffb 100644 +index 1a5123c..fa5d35d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -650,10 +650,25 @@ public class ServerPlayer extends Player { +@@ -655,10 +655,25 @@ public class ServerPlayer extends Player { @Override public void die(DamageSource cause) { @@ -29,7 +29,7 @@ index de86986..5efcffb 100644 this.connection .send( new ClientboundPlayerCombatKillPacket(this.getId(), deathMessage), -@@ -916,6 +931,11 @@ public class ServerPlayer extends Player { +@@ -945,6 +960,11 @@ public class ServerPlayer extends Player { } else if (this.bedBlocked(at, direction)) { return Either.left(Player.BedSleepingProblem.OBSTRUCTED); } else { @@ -41,7 +41,7 @@ index de86986..5efcffb 100644 this.setRespawnPosition(this.level().dimension(), at, this.getYRot(), false, true); if (this.level().isDay()) { return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); -@@ -930,7 +950,7 @@ public class ServerPlayer extends Player { +@@ -959,7 +979,7 @@ public class ServerPlayer extends Player { new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0), monster -> monster.isPreventingPlayerRest(this) ); @@ -50,7 +50,7 @@ index de86986..5efcffb 100644 return Either.left(Player.BedSleepingProblem.NOT_SAFE); } } -@@ -1599,6 +1619,11 @@ public class ServerPlayer extends Player { +@@ -1641,6 +1661,11 @@ public class ServerPlayer extends Player { if (this.gameMode.getGameModeForPlayer() == GameType.SPECTATOR) { this.setCamera(targetEntity); } else { diff --git a/patches/release/1.21/net/minecraft/server/level/ServerPlayerGameMode.patch b/patches/release/1.21/net/minecraft/server/level/ServerPlayerGameMode.patch index 3730b97..aa05a6f 100644 --- a/patches/release/1.21/net/minecraft/server/level/ServerPlayerGameMode.patch +++ b/patches/release/1.21/net/minecraft/server/level/ServerPlayerGameMode.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index e0a8638..1334d42 100644 +index 043f44a..97eb976 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -229,6 +229,20 @@ public class ServerPlayerGameMode { +@@ -242,6 +242,20 @@ public class ServerPlayerGameMode { } else { BlockEntity blockEntity = this.level.getBlockEntity(pos); Block block = blockState.getBlock(); diff --git a/patches/release/1.21/net/minecraft/server/network/ServerGamePacketListenerImpl.patch b/patches/release/1.21/net/minecraft/server/network/ServerGamePacketListenerImpl.patch index 8c9fce8..e3dc31d 100644 --- a/patches/release/1.21/net/minecraft/server/network/ServerGamePacketListenerImpl.patch +++ b/patches/release/1.21/net/minecraft/server/network/ServerGamePacketListenerImpl.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ec2aed1..fff8085 100644 +index 45fca81..9550e4d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -400,6 +400,23 @@ public class ServerGamePacketListenerImpl +@@ -401,6 +401,23 @@ public class ServerGamePacketListenerImpl double d2 = clampHorizontal(packet.getZ()); float f = Mth.wrapDegrees(packet.getYRot()); float f1 = Mth.wrapDegrees(packet.getXRot()); diff --git a/patches/release/1.21/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch b/patches/release/1.21/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch index 15f1ea6..3a39f91 100644 --- a/patches/release/1.21/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch +++ b/patches/release/1.21/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 1638819..19ffca9 100644 +index 4efac29..7c51e09 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -136,6 +136,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -138,6 +138,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, private void verifyLoginAndFinishConnectionSetup(GameProfile profile) { PlayerList playerList = this.server.getPlayerList(); Component component = playerList.canPlayerLogin(this.connection.getRemoteAddress(), profile); diff --git a/patches/release/1.21/net/minecraft/server/players/PlayerList.patch b/patches/release/1.21/net/minecraft/server/players/PlayerList.patch index 14eabfc..0222ad1 100644 --- a/patches/release/1.21/net/minecraft/server/players/PlayerList.patch +++ b/patches/release/1.21/net/minecraft/server/players/PlayerList.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 6021c1b..772f82a 100644 +index 47f61db..ccbd5ec 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -214,7 +214,13 @@ public abstract class PlayerList { +@@ -214,7 +214,15 @@ public abstract class PlayerList { mutableComponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), string); } @@ -12,12 +12,14 @@ index 6021c1b..772f82a 100644 + net.ouja.dish.plugins.RegisteredEvents.callEvent(event); + if (event.getJoinMessage() != null) { + mutableComponent = net.ouja.dish.network.chat.DishComponent.toComponent(event.getJoinMessage()); ++ } else { ++ mutableComponent = mutableComponent.withStyle(ChatFormatting.YELLOW); + } + // dish end serverGamePacketListenerImpl.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); ServerStatus status = this.server.getStatus(); if (status != null && !cookie.transferred()) { -@@ -224,6 +230,7 @@ public abstract class PlayerList { +@@ -224,6 +232,7 @@ public abstract class PlayerList { player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); this.players.add(player); this.playersByUUID.put(player.getUUID(), player); diff --git a/patches/release/1.21/net/minecraft/world/damagesource/DamageSource.patch b/patches/release/1.21/net/minecraft/world/damagesource/DamageSource.patch index 2422f25..e472f0b 100644 --- a/patches/release/1.21/net/minecraft/world/damagesource/DamageSource.patch +++ b/patches/release/1.21/net/minecraft/world/damagesource/DamageSource.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java -index 7fd78c4..b0be3cf 100644 +index f70a6e9..709f53e 100644 --- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java +++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java -@@ -133,4 +133,6 @@ public class DamageSource { +@@ -138,4 +138,6 @@ public class DamageSource { public Holder typeHolder() { return this.type; } diff --git a/patches/release/1.21/net/minecraft/world/entity/LivingEntity.patch b/patches/release/1.21/net/minecraft/world/entity/LivingEntity.patch index 6a23cf9..9ce0b29 100644 --- a/patches/release/1.21/net/minecraft/world/entity/LivingEntity.patch +++ b/patches/release/1.21/net/minecraft/world/entity/LivingEntity.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4e371f1..542ad21 100644 +index 3667e1d..667b504 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1229,6 +1229,10 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1196,6 +1196,10 @@ public abstract class LivingEntity extends Entity implements Attackable { } if (this.isDeadOrDying()) { @@ -13,7 +13,7 @@ index 4e371f1..542ad21 100644 if (!this.checkTotemDeathProtection(source)) { if (flag1) { this.makeSound(this.getDeathSound()); -@@ -2893,6 +2897,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2890,6 +2894,11 @@ public abstract class LivingEntity extends Entity implements Attackable { public void onItemPickup(ItemEntity itemEntity) { Entity owner = itemEntity.getOwner(); if (owner instanceof ServerPlayer) { @@ -25,12 +25,11 @@ index 4e371f1..542ad21 100644 CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer)owner, itemEntity.getItem(), this); } } -@@ -3531,6 +3540,8 @@ public abstract class LivingEntity extends Entity implements Attackable { - return false; +@@ -3554,6 +3563,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + } } + public net.ouja.dish.entity.DishEntity toDish() { return new net.ouja.dish.entity.DishEntity(this); } // dish -+ public static record Fallsounds(SoundEvent small, SoundEvent big) { } } diff --git a/patches/release/1.21/net/minecraft/world/entity/animal/Squid.patch b/patches/release/1.21/net/minecraft/world/entity/animal/Squid.patch index 844c9fc..c998e3f 100644 --- a/patches/release/1.21/net/minecraft/world/entity/animal/Squid.patch +++ b/patches/release/1.21/net/minecraft/world/entity/animal/Squid.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java -index 8fc9ae8..2a287b6 100644 +index 120889e..e22c9fc 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java -@@ -177,7 +177,7 @@ public class Squid extends WaterAnimal { +@@ -176,7 +176,7 @@ public class Squid extends WaterAnimal { return vec3.yRot(-this.yBodyRotO * (float) (Math.PI / 180.0)); } diff --git a/patches/release/1.21/net/minecraft/world/entity/animal/sniffer/Sniffer.patch b/patches/release/1.21/net/minecraft/world/entity/animal/sniffer/Sniffer.patch index 47a02b3..9b15a00 100644 --- a/patches/release/1.21/net/minecraft/world/entity/animal/sniffer/Sniffer.patch +++ b/patches/release/1.21/net/minecraft/world/entity/animal/sniffer/Sniffer.patch @@ -1,5 +1,5 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index 2775bcc..f53e832 100644 +index 834f3ae..95691f3 100644 --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -141,7 +141,7 @@ public class Sniffer extends Animal { diff --git a/patches/release/1.21/net/minecraft/world/entity/item/ItemEntity.patch b/patches/release/1.21/net/minecraft/world/entity/item/ItemEntity.patch index cac714a..9bd4977 100644 --- a/patches/release/1.21/net/minecraft/world/entity/item/ItemEntity.patch +++ b/patches/release/1.21/net/minecraft/world/entity/item/ItemEntity.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 8cadd05..9bb4f42 100644 +index d3286a1..db9022b 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -341,6 +341,20 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -342,6 +342,20 @@ public class ItemEntity extends Entity implements TraceableEntity { ItemStack item = this.getItem(); Item item1 = item.getItem(); int count = item.getCount(); diff --git a/patches/release/1.21/net/minecraft/world/entity/monster/Shulker.patch b/patches/release/1.21/net/minecraft/world/entity/monster/Shulker.patch index f20fe5a..9de144f 100644 --- a/patches/release/1.21/net/minecraft/world/entity/monster/Shulker.patch +++ b/patches/release/1.21/net/minecraft/world/entity/monster/Shulker.patch @@ -1,5 +1,5 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java -index c25ce1d..7ebb66b 100644 +index f7e3554..52d550f 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java +++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java @@ -437,7 +437,7 @@ public class Shulker extends AbstractGolem implements VariantHolder { -@@ -492,6 +497,12 @@ public abstract class ChunkGenerator { +@@ -489,6 +494,12 @@ public abstract class ChunkGenerator { if (structurePlacement.isStructureChunk(structureState, pos.x, pos.z)) { if (list.size() == 1) { @@ -33,7 +33,7 @@ index 0fd3773..5802b9d 100644 this.tryGenerateStructure( list.get(0), structureManager, -@@ -528,6 +539,17 @@ public abstract class ChunkGenerator { +@@ -525,6 +536,17 @@ public abstract class ChunkGenerator { } StructureSet.StructureSelectionEntry structureSelectionEntry3 = list1.get(i1); diff --git a/patches/release/1.21/net/minecraft/world/level/chunk/ChunkStatus.patch b/patches/release/1.21/net/minecraft/world/level/chunk/ChunkStatus.patch deleted file mode 100644 index d0b8370..0000000 --- a/patches/release/1.21/net/minecraft/world/level/chunk/ChunkStatus.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -index 397d4ca..7ab7c58 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -@@ -40,7 +40,7 @@ public class ChunkStatus { - }); - public static final ChunkStatus STRUCTURE_STARTS = register("structure_starts", ChunkStatus.EMPTY, 0, false, ChunkStatus.PRE_FEATURES, ChunkStatus.ChunkType.PROTOCHUNK, (chunkstatus, executor, serverlevel, chunkgenerator, structuretemplatemanager, threadedlevellightengine, function, list, chunkaccess) -> { - if (serverlevel.getServer().getWorldData().worldGenOptions().generateStructures()) { -- chunkgenerator.createStructures(serverlevel.registryAccess(), serverlevel.getChunkSource().getGeneratorState(), serverlevel.structureManager(), chunkaccess, structuretemplatemanager); -+ chunkgenerator.createStructures(serverlevel.registryAccess(), serverlevel.getChunkSource().getGeneratorState(), serverlevel.structureManager(), chunkaccess, structuretemplatemanager, serverlevel); // dish -- add serverlevel - } - - serverlevel.onStructureStartsAvailable(chunkaccess); diff --git a/patches/release/1.21/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch b/patches/release/1.21/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch index 67fa613..90d34fa 100644 --- a/patches/release/1.21/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch +++ b/patches/release/1.21/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch @@ -1,14 +1,14 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java -index d457c3e..5185061 100644 +index a76abac..c688efb 100644 --- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java -@@ -40,7 +40,8 @@ public class ChunkStatusTasks { +@@ -43,7 +43,8 @@ public class ChunkStatusTasks { serverLevel.getChunkSource().getGeneratorState(), serverLevel.structureManager(), - loadingChunk, -- context.structureManager() -+ context.structureManager(), -+ serverLevel // dish -- add serverlevel + chunkAccess, +- worldGenContext.structureManager() ++ worldGenContext.structureManager(), ++ serverLevel // dish -- add serverLevel ); } diff --git a/patches/release/1.21/net/minecraft/world/level/storage/loot/LootTable.patch b/patches/release/1.21/net/minecraft/world/level/storage/loot/LootTable.patch index 746d597..db2466a 100644 --- a/patches/release/1.21/net/minecraft/world/level/storage/loot/LootTable.patch +++ b/patches/release/1.21/net/minecraft/world/level/storage/loot/LootTable.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -index 68eedb4..de3762f 100644 +index b806cc8..83157b6 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -@@ -142,6 +142,12 @@ public class LootTable { +@@ -146,6 +146,12 @@ public class LootTable { RandomSource random = lootContext.getRandom(); List availableSlots = this.getAvailableSlots(container, random); this.shuffleAndSplitItems(randomItems, availableSlots.size(), random); diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishPig.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishPig.java index 1751144..6966440 100644 --- a/patches/release/1.21/net/ouja/dish/entity/passive/DishPig.java +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishPig.java @@ -25,6 +25,6 @@ public boolean isSaddled() { @Override public void equipSaddle() { - this.pig.equipSaddle(SoundSource.BLOCKS); + this.pig.equipSaddle(null, SoundSource.BLOCKS); } } diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishStrider.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishStrider.java index 57f1679..918984d 100644 --- a/patches/release/1.21/net/ouja/dish/entity/passive/DishStrider.java +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishStrider.java @@ -25,6 +25,6 @@ public boolean isSaddled() { @Override public void equipSaddle() { - this.strider.equipSaddle(SoundSource.BLOCKS); + this.strider.equipSaddle(null, SoundSource.BLOCKS); } } From cde44c6ef283b023e229723236ccd9ab049e078a Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:12:44 -0500 Subject: [PATCH 06/15] update to 1.21 --- Dish-API | 2 +- README.md | 4 ++-- dish/libraries/1.21.json | 8 +++---- patches/release/1.21/net/ouja/dish/Dish.java | 14 +++++++++++ .../1.21/net/ouja/dish/entity/DishEntity.java | 9 +++++-- .../ouja/dish/entity/monster/DishBogged.java | 24 +++++++++++++++++++ .../ouja/dish/entity/passive/DishSheep.java | 7 +++++- .../ouja/dish/network/chat/DishComponent.java | 1 - 8 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 patches/release/1.21/net/ouja/dish/entity/monster/DishBogged.java diff --git a/Dish-API b/Dish-API index 94abec5..37c42e2 160000 --- a/Dish-API +++ b/Dish-API @@ -1 +1 @@ -Subproject commit 94abec58656e6c801a67a2a9b3c47ea0a9bc88a0 +Subproject commit 37c42e22ba3f5f7e54f5bf30f4b17cc8d6821d10 diff --git a/README.md b/README.md index 65baef1..6a3d917 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ repositories { } dependencies { - compileOnly("net.ouja:api:1.21-R0.1-SNAPSHOT") + compileOnly("net.ouja:api:1.21-R0.2-SNAPSHOT") implementation 'it.unimi.dsi:fastutil:8.5.12' } ``` @@ -41,7 +41,7 @@ Maven net.ouja api - 1.21-R0.1-SNAPSHOT + 1.21-R0.2-SNAPSHOT provided diff --git a/dish/libraries/1.21.json b/dish/libraries/1.21.json index 24d0f37..73fc523 100644 --- a/dish/libraries/1.21.json +++ b/dish/libraries/1.21.json @@ -1,6 +1,6 @@ { "version": "1.21", - "api_version": "R0.1-SNAPSHOT", + "api_version": "R0.2-SNAPSHOT", "libraries": [ { "downloads": { @@ -11,10 +11,10 @@ }, { "downloads": { - "url": "https://maven.ouja.net/net/ouja/api/1.21-R0.1-SNAPSHOT/api-1.21-R0.1-20240707.170948-1.jar", - "path": "net/ouja/api/1.21/1.21-R0.1-SNAPSHOT.jar" + "url": "https://maven.ouja.net/net/ouja/api/1.21-R0.2-SNAPSHOT/api-1.21-R0.2-20240707.232548-2.jar", + "path": "net/ouja/api/1.21/1.21-R0.2-SNAPSHOT.jar" }, - "name": "net.ouja:api:1.21-R0.1-SNAPSHOT" + "name": "net.ouja:api:1.21-R0.2-SNAPSHOT" } ] } \ No newline at end of file diff --git a/patches/release/1.21/net/ouja/dish/Dish.java b/patches/release/1.21/net/ouja/dish/Dish.java index 1f4ddca..a34d25f 100644 --- a/patches/release/1.21/net/ouja/dish/Dish.java +++ b/patches/release/1.21/net/ouja/dish/Dish.java @@ -1,6 +1,7 @@ package net.ouja.dish; import com.mojang.logging.LogUtils; +import net.minecraft.server.ServerLinks; import net.minecraft.server.dedicated.DedicatedServer; import net.minecraft.server.players.UserBanListEntry; import net.ouja.api.DishAPI; @@ -13,10 +14,12 @@ import net.ouja.api.event.EventHandler; import net.ouja.api.event.EventListener; import net.ouja.api.network.chat.Component; +import net.ouja.api.server.ServerLink; import net.ouja.api.server.players.BanEntry; import net.ouja.dish.commands.RegisteredCommands; import net.ouja.dish.commands.VersionCommand; import net.ouja.dish.entity.DishPlayer; +import net.ouja.dish.network.chat.DishComponent; import net.ouja.dish.plugins.PluginManager; import net.ouja.dish.plugins.RegisteredEvents; import org.jetbrains.annotations.NotNull; @@ -143,4 +146,15 @@ public BanEntry getBanEntry(GameProfile profile) { if (entry == null) return null; return new BanEntry(entry.getCreated(), entry.getSource(), entry.getExpires(), entry.getReason()); } + + @Override + public ArrayList getServerLinks() { + var list = new ArrayList(); + + for (ServerLinks.Entry entry : this.server.serverLinks().entries()) { + list.add(new ServerLink(DishComponent.fromComponent(entry.displayName()), entry.link())); + } + + return list; + } } diff --git a/patches/release/1.21/net/ouja/dish/entity/DishEntity.java b/patches/release/1.21/net/ouja/dish/entity/DishEntity.java index a33c502..80070cf 100644 --- a/patches/release/1.21/net/ouja/dish/entity/DishEntity.java +++ b/patches/release/1.21/net/ouja/dish/entity/DishEntity.java @@ -2,6 +2,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; import net.ouja.api.entity.Entity; import net.ouja.api.entity.EntityTypes; import net.ouja.dish.entity.monster.*; @@ -12,9 +13,9 @@ import java.util.UUID; public class DishEntity implements Entity { - private net.minecraft.world.entity.LivingEntity entity; + private final LivingEntity entity; - public DishEntity(net.minecraft.world.entity.LivingEntity entity) { + public DishEntity(LivingEntity entity) { this.entity = entity; } @@ -23,6 +24,7 @@ public int getId() { return entity.getId(); } + @Nullable @Override // todo: finish adding other entity types i.e. ChestBoat, Llama_spit, etc... public Entity getEntity() { @@ -174,6 +176,9 @@ else if (entityType == EntityType.ZOMBIFIED_PIGLIN) { else if (entityType == EntityType.BLAZE) { return new DishBlaze(this.entity); } + else if (entityType == EntityType.BOGGED) { + return new DishBogged(this.entity); + } else if (entityType == EntityType.CREEPER) { return new DishCreeper(this.entity); } diff --git a/patches/release/1.21/net/ouja/dish/entity/monster/DishBogged.java b/patches/release/1.21/net/ouja/dish/entity/monster/DishBogged.java new file mode 100644 index 0000000..f36b1c3 --- /dev/null +++ b/patches/release/1.21/net/ouja/dish/entity/monster/DishBogged.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Bogged; +import net.ouja.dish.entity.DishEntity; + +public class DishBogged extends DishEntity implements net.ouja.api.entity.monster.Bogged { + private final Bogged bogged; + + public DishBogged(LivingEntity bogged) { + super(bogged); + this.bogged = (Bogged)bogged; + } + + @Override + public boolean isSheared() { + return this.bogged.isSheared(); + } + + @Override + public void setSheared(boolean b) { + this.bogged.setSheared(b); + } +} diff --git a/patches/release/1.21/net/ouja/dish/entity/passive/DishSheep.java b/patches/release/1.21/net/ouja/dish/entity/passive/DishSheep.java index 81a50f0..689f72b 100644 --- a/patches/release/1.21/net/ouja/dish/entity/passive/DishSheep.java +++ b/patches/release/1.21/net/ouja/dish/entity/passive/DishSheep.java @@ -5,7 +5,7 @@ import net.ouja.dish.entity.DishEntity; public class DishSheep extends DishEntity implements net.ouja.api.entity.passive.Sheep { - private Sheep sheep; + private final Sheep sheep; public DishSheep(LivingEntity entity) { super(entity); @@ -16,4 +16,9 @@ public DishSheep(LivingEntity entity) { public boolean isSheared() { return this.sheep.isSheared(); } + + @Override + public void setSheared(boolean b) { + this.sheep.setSheared(b); + } } diff --git a/patches/release/1.21/net/ouja/dish/network/chat/DishComponent.java b/patches/release/1.21/net/ouja/dish/network/chat/DishComponent.java index 22a2e1e..7482fd5 100644 --- a/patches/release/1.21/net/ouja/dish/network/chat/DishComponent.java +++ b/patches/release/1.21/net/ouja/dish/network/chat/DishComponent.java @@ -1,6 +1,5 @@ package net.ouja.dish.network.chat; -import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; From 1a9729405e00070b729b55d996141097e678f3dc Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:15:31 -0500 Subject: [PATCH 07/15] update github worker --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aae81ae..6cd524d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,10 +16,10 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' cache: gradle - name: Setup Gradle @@ -29,6 +29,7 @@ jobs: run: | git config --global user.email "60985521+KaiAF@users.noreply.github.com" git config --global user.name "iris" + git submodule update --init --recursive - name: Run Init run: node init.js - name: Create dish workspace & patch From 6962133bfb7880facf17893b8c3eba1c0aa02306 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:15:31 -0500 Subject: [PATCH 08/15] update github worker --- .github/workflows/main.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aae81ae..a6254dc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,10 +16,10 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'npm' - - name: Set up JDK 17 + - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '21' distribution: 'temurin' cache: gradle - name: Setup Gradle @@ -29,8 +29,7 @@ jobs: run: | git config --global user.email "60985521+KaiAF@users.noreply.github.com" git config --global user.name "iris" - - name: Run Init - run: node init.js + git submodule update --init --recursive - name: Create dish workspace & patch run: node ./dish/index.js - name: "Clone Bundler" From d8af385a4125aea3cc5a1bfb6f8a40868ca005f9 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:21:41 -0500 Subject: [PATCH 09/15] only call node dish --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6cd524d..a6254dc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,8 +30,6 @@ jobs: git config --global user.email "60985521+KaiAF@users.noreply.github.com" git config --global user.name "iris" git submodule update --init --recursive - - name: Run Init - run: node init.js - name: Create dish workspace & patch run: node ./dish/index.js - name: "Clone Bundler" From fdf18dcf43a42d99ab8ad5ff2e32fd2497fa36b6 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:24:06 -0500 Subject: [PATCH 10/15] fix github worker again --- .github/workflows/main.yml | 7 ------- dish/index.js | 19 +++++++++---------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a6254dc..21a27cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,12 +32,5 @@ jobs: git submodule update --init --recursive - name: Create dish workspace & patch run: node ./dish/index.js - - name: "Clone Bundler" - uses: actions/checkout@v3 - with: - token: ${{ secrets.PAT }} - repository: KaiAF/Dish-Bundler - path: Dish-Bundler - ref: main - name: Compile dish run: node ./dish/compile.js \ No newline at end of file diff --git a/dish/index.js b/dish/index.js index cb4c2da..e68a448 100644 --- a/dish/index.js +++ b/dish/index.js @@ -47,16 +47,7 @@ function parseLibraries(libraries) { // If workspace does not exist, try to create it. // If it fails, error out warn(`Workspace for version '${DECOMPILE_VERSION.split('/')[1]}' wasn't found. Running init.js in 5 seconds...`); - setTimeout(() => { - try { - execSync(`node init.js --MC="${DECOMPILE_VERSION}" --OLD_MC="${args[1] || ''}" --IGNORE-CACHE="${args[2] ? 'true' : 'false'}"`, { stdio }); - execSync(`node dish/index.js ${DECOMPILE_VERSION}${args[1] ? ' ' + args[1] : ''}`, { stdio }); - } catch (e) { - error(e); - return process.exit(1); - } - }, 1000 * 5); - return; + await generateWorkspace(); } if (!fs.existsSync(`dish/libraries/${DECOMPILE_VERSION.split('/')[1]}.json`)) { @@ -96,6 +87,14 @@ function parseLibraries(libraries) { process.exit(0); })(); +async function generateWorkspace() { + return new Promise((res, rej) => { + execSync(`node init.js --MC="${DECOMPILE_VERSION}" --OLD_MC="${args[1] || ''}" --IGNORE-CACHE="${args[2] ? 'true' : 'false'}"`, { stdio }); + execSync(`node dish/index.js ${DECOMPILE_VERSION}${args[1] ? ' ' + args[1] : ''}`, { stdio }); + res(); + }); +} + async function cacheServer(version = DECOMPILE_VERSION.split('/')[1]) { const manifestReq = await fetch('https://launchermeta.mojang.com/mc/game/version_manifest_v2.json'); if (manifestReq.status !== 200) { From d14ba2e327f09c3c33901cdfe0a30afcf1954bfa Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Sun, 7 Jul 2024 19:31:24 -0500 Subject: [PATCH 11/15] fix github worker for real this time --- dish/index.js | 3 ++- utils/checkFileHash.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dish/index.js b/dish/index.js index e68a448..c7bc31d 100644 --- a/dish/index.js +++ b/dish/index.js @@ -46,7 +46,7 @@ function parseLibraries(libraries) { if (!fs.existsSync(`workspaces/${DECOMPILE_VERSION.split('/')[1]}`)) { // If workspace does not exist, try to create it. // If it fails, error out - warn(`Workspace for version '${DECOMPILE_VERSION.split('/')[1]}' wasn't found. Running init.js in 5 seconds...`); + warn(`Workspace for version '${DECOMPILE_VERSION.split('/')[1]}' wasn't found. Running init.js`); await generateWorkspace(); } @@ -130,5 +130,6 @@ async function downloadServerJar(url, file) { return new Promise((res, rej) => { const request = https.get(url, (res) => res.pipe(file)); request.on('error', (e) => rej(e)); + request.on('close', () => res()); }); } diff --git a/utils/checkFileHash.js b/utils/checkFileHash.js index 47ed508..3a8e2d2 100644 --- a/utils/checkFileHash.js +++ b/utils/checkFileHash.js @@ -11,7 +11,7 @@ const crypto = require('crypto'); * @returns a sha1 hex hash of the file */ function calculateFileHash(pathToFile) { - return crypto.createHash('sha1').update(fs.readFileSync(pathToFile)).digest("hex"); + return crypto.createHash('sha1').update(fs.readFileSync(pathToFile).toString().replace(/\n/g, '')).digest("hex"); } module.exports = calculateFileHash; \ No newline at end of file From 7c2341e194375b83608c2cb0fe58d2869f82b139 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Tue, 23 Sep 2025 19:10:42 -0500 Subject: [PATCH 12/15] clean init process --- dish/index.js | 7 ++-- docs/CONTRIBUTING.md | 4 +-- init.js | 54 ---------------------------- create-workspace.js => utils/init.js | 52 +++++++++++++++++++++++---- 4 files changed, 51 insertions(+), 66 deletions(-) delete mode 100644 init.js rename create-workspace.js => utils/init.js (62%) diff --git a/dish/index.js b/dish/index.js index c7bc31d..5c1b9b3 100644 --- a/dish/index.js +++ b/dish/index.js @@ -9,6 +9,7 @@ const calculateFileHash = require('../utils/checkFileHash'); const https = require('https'); const { error, DEFAULT_MINECRAFT_VERSION, log, warn } = require('../config'); const { execSync } = require('child_process'); +const init = require('../utils/init'); const stdio = [process.stdin, process.stdout, process.stderr]; const DECOMPILE_VERSION = args[0] ?? DEFAULT_MINECRAFT_VERSION; @@ -31,7 +32,7 @@ function parseLibraries(libraries) { } (async function () { - if (!fs.existsSync('init.js')) return error('Run this file in the parent directory'); + if (!fs.existsSync('./utils/init.js')) return error('Run this file in the parent directory'); if (!fs.existsSync(`cache/${DECOMPILE_VERSION.split('/')[1]}/META-INF/libraries.list`)) { warn(`Could not find file: cache/${DECOMPILE_VERSION.split('/')[1]}/META-INF/libraries.list, installing...`); await cacheServer(); @@ -88,8 +89,8 @@ function parseLibraries(libraries) { })(); async function generateWorkspace() { - return new Promise((res, rej) => { - execSync(`node init.js --MC="${DECOMPILE_VERSION}" --OLD_MC="${args[1] || ''}" --IGNORE-CACHE="${args[2] ? 'true' : 'false'}"`, { stdio }); + return new Promise(async (res, rej) => { + await init(DECOMPILE_VERSION, args[1] || null); execSync(`node dish/index.js ${DECOMPILE_VERSION}${args[1] ? ' ' + args[1] : ''}`, { stdio }); res(); }); diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 9940105..9e3857d 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -12,7 +12,7 @@ What you will need to contribute: Now that you have the required stuff installed, what you will need to do is clone Dish and run the following command `npm install`. Once the npm packages are installed, run the command `git submodule update --init --recursive`. -Once everything is ready, run the command `node init.js`. Then, hopefully, no patches get rejected, then you can run the command `node dish`. After everything is set up, you can go to the directory `~/dish/workspace` and modify the Minecraft or Dish code. +Once everything is ready, run the command `node dish`. After everything is set up, you can go to the directory `~/dish/workspace` and modify the Minecraft or Dish code. ### Patches @@ -26,7 +26,7 @@ When you are finished making the changes, run the command in the home directory #### Updating to a new version -If you wish to update Dish to a new version that has been recently released, run the command `node dish/index.js / / <(true | false) -- If true, it will ignore the cache>`. This will very likely cause an error, which means you will need to fix the rejected patches or new files that have new decompile errors. This can be done by going to the workspaces directory and the new version's sub directory. Opening it in the IDE of your choice, then, fix the errors and run `node patches/generatePatches /`. +If you wish to update Dish to a new version that has been recently released, run the command `node dish / / <(true | false) -- If true, it will ignore the cache>`. This will very likely cause an error, which means you will need to fix the rejected patches or new files that have new decompile errors. This can be done by going to the workspaces directory and the new version's sub directory. Opening it in the IDE of your choice, then, fix the errors and run `node patches/generatePatches /`. ##### Publishing diff --git a/init.js b/init.js deleted file mode 100644 index 2e70d57..0000000 --- a/init.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) Ouja and contributors - * LGPL-3.0-or-later - */ - -const fs = require('fs'); -const { execSync } = require('child_process'); -const { error, checkMinecraftVersion, DEFAULT_MINECRAFT_VERSION, stdio } = require('./config'); -const parseArg = require('./utils/parseArguments'); - -const DECOMPILE_VERSION = parseArg('MC', DEFAULT_MINECRAFT_VERSION); -const OLD_VERSION = parseArg('OLD_MC', null); - -let MINECRAFT_VERSION = 'UNKNOWN'; - -(async function () { - try { - if (!checkMinecraftVersion(DECOMPILE_VERSION)) { - error(`Using invalid Minecraft version '${DECOMPILE_VERSION}'`); - return process.exit(1); - } - - if (OLD_VERSION && !checkMinecraftVersion(OLD_VERSION)) { - error(`Using invalid Minecraft version '${OLD_VERSION}'`); - return process.exit(1); - } - - if (!fs.existsSync('mache/gradlew')) { - error('Run git submodule update --init --recursive'); - return process.exit(1); - } - - MINECRAFT_VERSION = DECOMPILE_VERSION.split('/').pop(); - - if (process.platform !== 'win32') { - execSync(`cd mache && chmod +x gradlew`, { stdio }); // for linux, you will need to make gradlew executable - execSync(`cd mache && ./gradlew :versions:v${MINECRAFT_VERSION.replace(/\./g, '_')}:setup`, { stdio }); - } else { - execSync(`cd mache && gradlew :versions:v${MINECRAFT_VERSION.replace(/\./g, '_')}:setup`, { stdio }); - } - - fs.cpSync(`mache/versions/${MINECRAFT_VERSION}/src/main/resources/assets`, `cache/${MINECRAFT_VERSION}/assets`, { recursive: true }); - fs.cpSync(`mache/versions/${MINECRAFT_VERSION}/src/main/resources/data`, `cache/${MINECRAFT_VERSION}/data`, { recursive: true }); - fs.cpSync(`mache/versions/${MINECRAFT_VERSION}/src`, 'decompiled/src', { recursive: true, force: true }); - execSync(`node create-workspace.js ${DECOMPILE_VERSION}`, { stdio }); // automatically create a workspace - // delete decompiled source as it's taking space - fs.rmSync('decompiled', { recursive: true }); - } catch (e) { - console.error(e); - return process.exit(1); - } - - process.exit(0); -})(); diff --git a/create-workspace.js b/utils/init.js similarity index 62% rename from create-workspace.js rename to utils/init.js index e48fcfd..2e99934 100644 --- a/create-workspace.js +++ b/utils/init.js @@ -5,13 +5,50 @@ const fs = require('fs'); const { execSync } = require('child_process'); +const { error, warn, copyDir, checkMinecraftVersion, DEFAULT_MINECRAFT_VERSION, stdio } = require('../config'); -const { log, DEFAULT_MINECRAFT_VERSION, error, warn, copyDir } = require("./config"); -const args = process.argv.slice(2); +async function init(DECOMPILE_VERSION = DEFAULT_MINECRAFT_VERSION, OLD_VERSION = null) { + let MINECRAFT_VERSION = 'UNKNOWN'; -const stdio = [process.stdin, process.stdout, process.stderr]; -const DECOMPILE_VERSION = args[0] ?? DEFAULT_MINECRAFT_VERSION; + try { + if (!checkMinecraftVersion(DECOMPILE_VERSION)) { + error(`Using invalid Minecraft version '${DECOMPILE_VERSION}'`); + return false; + } + if (OLD_VERSION && !checkMinecraftVersion(OLD_VERSION)) { + error(`Using invalid Minecraft version '${OLD_VERSION}'`); + return false; + } + + if (!fs.existsSync('mache/gradlew')) { + error('Run git submodule update --init --recursive'); + return false; + } + + MINECRAFT_VERSION = DECOMPILE_VERSION.split('/').pop(); + + if (process.platform !== 'win32') { + execSync(`cd mache && chmod +x gradlew`, { stdio }); // for linux, you will need to make gradlew executable + execSync(`cd mache && ./gradlew :versions:v${MINECRAFT_VERSION.replace(/\./g, '_')}:setup`, { stdio }); + } else { + execSync(`cd mache && gradlew :versions:v${MINECRAFT_VERSION.replace(/\./g, '_')}:setup`, { stdio }); + } + + fs.cpSync(`mache/versions/${MINECRAFT_VERSION}/src/main/resources/assets`, `cache/${MINECRAFT_VERSION}/assets`, { recursive: true }); + fs.cpSync(`mache/versions/${MINECRAFT_VERSION}/src/main/resources/data`, `cache/${MINECRAFT_VERSION}/data`, { recursive: true }); + fs.cpSync(`mache/versions/${MINECRAFT_VERSION}/src`, 'decompiled/src', { recursive: true, force: true }); + await createWorkspace(DECOMPILE_VERSION); // automatically create a workspace + // delete decompiled source as it's taking space + fs.rmSync('decompiled', { recursive: true }); + return true; + } catch (e) { + console.error(e); + return false; + } +} + +// create-workspace function parseLibraries(libraries) { libraries = libraries.split('\n'); libraries = libraries.map(l => l.split(' ')[1]); @@ -20,7 +57,7 @@ function parseLibraries(libraries) { return libraries; } -(async function () { +async function createWorkspace(DECOMPILE_VERSION = DEFAULT_MINECRAFT_VERSION) { if (!DECOMPILE_VERSION || !DECOMPILE_VERSION.includes('/')) return error(`Using invalid Minecraft version '${DECOMPILE_VERSION}'`); const MC_VER = DECOMPILE_VERSION.split('/')[1]; if (!fs.existsSync(`cache/${MC_VER}`)) return error(`Could not find cache version '${MC_VER}'!`); @@ -53,5 +90,6 @@ function parseLibraries(libraries) { } else { execSync(`cd workspaces/${MC_VER} && gradlew build`, { stdio }); // build to make sure it works. Will error if there are decompile errors } - process.exit(0); -})(); \ No newline at end of file +} + +module.exports = init; From c0c6317b23d3de6c184d8ac7a31752e64c9daf32 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Tue, 23 Sep 2025 19:59:13 -0500 Subject: [PATCH 13/15] start patches for 1.21.8 --- config.js | 2 +- dish/libraries/1.21.8.json | 20 + libs/static/build.gradle.dish.txt | 10 +- mache | 2 +- .../1.21.8/net/minecraft/ChatFormatting.patch | 13 + .../1.21.8/net/minecraft/CrashReport.patch | 12 + .../net/minecraft/commands/Commands.patch | 24 + .../1.21.8/net/minecraft/server/Main.patch | 17 + .../minecraft/server/MinecraftServer.patch | 13 + .../server/dedicated/DedicatedServer.patch | 20 + .../net/minecraft/server/level/ChunkMap.patch | 22 + .../minecraft/server/level/ServerEntity.patch | 43 + .../minecraft/server/level/ServerPlayer.patch | 64 ++ .../server/level/ServerPlayerGameMode.patch | 25 + .../ServerGamePacketListenerImpl.patch | 28 + .../ServerLoginPacketListenerImpl.patch | 18 + .../minecraft/server/players/PlayerList.patch | 29 + .../world/damagesource/DamageSource.patch | 11 + .../minecraft/world/entity/LivingEntity.patch | 35 + .../minecraft/world/entity/animal/Squid.patch | 13 + .../world/entity/animal/sniffer/Sniffer.patch | 13 + .../world/entity/item/ItemEntity.patch | 25 + .../world/entity/monster/Shulker.patch | 13 + .../world/entity/monster/Vindicator.patch | 13 + .../world/entity/monster/hoglin/Hoglin.patch | 13 + .../world/entity/monster/piglin/Piglin.patch | 19 + .../world/entity/player/Player.patch | 25 + .../net/minecraft/world/item/BlockItem.patch | 35 + .../net/minecraft/world/item/ItemStack.patch | 11 + .../minecraft/world/level/BaseSpawner.patch | 21 + .../net/minecraft/world/level/ChunkPos.patch | 45 + .../minecraft/world/level/LevelReader.patch | 18 + .../minecraft/world/level/block/Block.patch | 13 + .../world/level/block/SignBlock.patch | 13 + .../world/level/block/StairBlock.patch | 13 + .../world/level/block/TrapDoorBlock.patch | 22 + .../world/level/chunk/ChunkGenerator.patch | 53 + .../level/chunk/status/ChunkStatusTasks.patch | 14 + .../level/levelgen/BitRandomSource.patch | 13 + .../world/level/material/FlowingFluid.patch | 91 ++ .../world/level/storage/loot/LootTable.patch | 17 + .../release/1.21.8/net/ouja/dish/Dish.java | 160 +++ .../1.21.8/net/ouja/dish/DishCrashReport.java | 39 + .../1.21.8/net/ouja/dish/DishProperties.java | 99 ++ .../dish/commands/RegisteredCommands.java | 61 + .../ouja/dish/commands/VersionCommand.java | 18 + .../net/ouja/dish/entity/DishEntity.java | 308 +++++ .../net/ouja/dish/entity/DishPlayer.java | 96 ++ .../ouja/dish/entity/monster/DishBlaze.java | 19 + .../ouja/dish/entity/monster/DishBogged.java | 24 + .../ouja/dish/entity/monster/DishCreeper.java | 29 + .../ouja/dish/entity/monster/DishDrowned.java | 19 + .../entity/monster/DishElderGuardian.java | 14 + .../dish/entity/monster/DishEndermite.java | 14 + .../ouja/dish/entity/monster/DishEvoker.java | 19 + .../ouja/dish/entity/monster/DishGhast.java | 24 + .../dish/entity/monster/DishGuardian.java | 14 + .../ouja/dish/entity/monster/DishHoglin.java | 29 + .../ouja/dish/entity/monster/DishHusk.java | 14 + .../dish/entity/monster/DishMagmaCube.java | 14 + .../ouja/dish/entity/monster/DishPhantom.java | 14 + .../dish/entity/monster/DishPiglinBrute.java | 14 + .../dish/entity/monster/DishPillager.java | 19 + .../ouja/dish/entity/monster/DishRavager.java | 14 + .../ouja/dish/entity/monster/DishShulker.java | 19 + .../dish/entity/monster/DishSilverfish.java | 14 + .../dish/entity/monster/DishSkeleton.java | 24 + .../ouja/dish/entity/monster/DishSlime.java | 19 + .../ouja/dish/entity/monster/DishStray.java | 14 + .../net/ouja/dish/entity/monster/DishVex.java | 22 + .../dish/entity/monster/DishVindicator.java | 19 + .../ouja/dish/entity/monster/DishWarden.java | 14 + .../ouja/dish/entity/monster/DishWitch.java | 14 + .../entity/monster/DishWitherSkeleton.java | 14 + .../ouja/dish/entity/monster/DishZoglin.java | 14 + .../ouja/dish/entity/monster/DishZombie.java | 29 + .../dish/entity/monster/DishZombieHorse.java | 14 + .../entity/monster/DishZombieVillager.java | 13 + .../net/ouja/dish/entity/neutral/DishBee.java | 29 + .../dish/entity/neutral/DishCaveSpider.java | 14 + .../ouja/dish/entity/neutral/DishDolphin.java | 14 + .../dish/entity/neutral/DishEnderman.java | 14 + .../ouja/dish/entity/neutral/DishGoat.java | 39 + .../dish/entity/neutral/DishIronGolem.java | 24 + .../ouja/dish/entity/neutral/DishLlama.java | 20 + .../ouja/dish/entity/neutral/DishPanda.java | 44 + .../ouja/dish/entity/neutral/DishPiglin.java | 34 + .../dish/entity/neutral/DishPolarBear.java | 24 + .../ouja/dish/entity/neutral/DishSpider.java | 19 + .../dish/entity/neutral/DishTraderLlama.java | 14 + .../ouja/dish/entity/neutral/DishWolf.java | 29 + .../entity/neutral/DishZombifiedPiglin.java | 14 + .../ouja/dish/entity/passive/DishAllay.java | 14 + .../dish/entity/passive/DishArmadillo.java | 34 + .../ouja/dish/entity/passive/DishAxolotl.java | 24 + .../net/ouja/dish/entity/passive/DishBat.java | 24 + .../ouja/dish/entity/passive/DishCamel.java | 39 + .../net/ouja/dish/entity/passive/DishCat.java | 34 + .../ouja/dish/entity/passive/DishChicken.java | 14 + .../net/ouja/dish/entity/passive/DishCod.java | 14 + .../net/ouja/dish/entity/passive/DishCow.java | 14 + .../ouja/dish/entity/passive/DishDonkey.java | 14 + .../net/ouja/dish/entity/passive/DishFox.java | 19 + .../ouja/dish/entity/passive/DishFrog.java | 19 + .../dish/entity/passive/DishGlowSquid.java | 13 + .../ouja/dish/entity/passive/DishHorse.java | 26 + .../ouja/dish/entity/passive/DishMule.java | 14 + .../dish/entity/passive/DishMushroomCow.java | 22 + .../ouja/dish/entity/passive/DishOcelot.java | 14 + .../ouja/dish/entity/passive/DishParrot.java | 20 + .../net/ouja/dish/entity/passive/DishPig.java | 30 + .../dish/entity/passive/DishPufferfish.java | 19 + .../ouja/dish/entity/passive/DishRabbit.java | 20 + .../ouja/dish/entity/passive/DishSalmon.java | 14 + .../ouja/dish/entity/passive/DishSheep.java | 24 + .../entity/passive/DishSkeletonHorse.java | 19 + .../ouja/dish/entity/passive/DishSniffer.java | 35 + .../dish/entity/passive/DishSnowGolem.java | 24 + .../ouja/dish/entity/passive/DishSquid.java | 19 + .../ouja/dish/entity/passive/DishStrider.java | 30 + .../ouja/dish/entity/passive/DishTadpole.java | 14 + .../dish/entity/passive/DishTropicalFish.java | 19 + .../ouja/dish/entity/passive/DishTurtle.java | 24 + .../dish/entity/passive/DishVillager.java | 14 + .../entity/passive/DishWanderingTrader.java | 14 + .../ouja/dish/network/chat/DishComponent.java | 82 ++ .../net/ouja/dish/plugins/PluginManager.java | 97 ++ .../ouja/dish/plugins/RegisteredEvents.java | 32 + .../server/level/DishClientInformation.java | 81 ++ .../net/ouja/dish/world/DishDamageSource.java | 22 + .../1.21.8/net/ouja/dish/world/DishLevel.java | 64 ++ .../net/ouja/dish/world/block/DishBlock.java | 27 + .../ouja/dish/world/block/DishBlockInfo.java | 1010 +++++++++++++++++ .../dish/world/block/DishButtonBlock.java | 30 + .../ouja/dish/world/block/DishDoorBlock.java | 32 + .../ouja/dish/world/block/DishSignBlock.java | 60 + .../ouja/dish/world/block/DishStairBlock.java | 26 + .../dish/world/block/DishTrapdoorBlock.java | 38 + .../dish/world/block/entity/DishSignText.java | 54 + .../ouja/dish/world/item/DishItemStack.java | 140 +++ .../dish/world/level/chunk/DishStructure.java | 52 + 141 files changed, 5106 insertions(+), 3 deletions(-) create mode 100644 dish/libraries/1.21.8.json create mode 100644 patches/release/1.21.8/net/minecraft/ChatFormatting.patch create mode 100644 patches/release/1.21.8/net/minecraft/CrashReport.patch create mode 100644 patches/release/1.21.8/net/minecraft/commands/Commands.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/Main.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/MinecraftServer.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/dedicated/DedicatedServer.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/level/ChunkMap.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/level/ServerEntity.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/level/ServerPlayer.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/level/ServerPlayerGameMode.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/network/ServerGamePacketListenerImpl.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch create mode 100644 patches/release/1.21.8/net/minecraft/server/players/PlayerList.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/damagesource/DamageSource.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/LivingEntity.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/animal/Squid.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/animal/sniffer/Sniffer.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/item/ItemEntity.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/monster/Shulker.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/monster/Vindicator.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/monster/hoglin/Hoglin.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/monster/piglin/Piglin.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/player/Player.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/item/BlockItem.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/item/ItemStack.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/BaseSpawner.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/ChunkPos.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/LevelReader.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/block/Block.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/block/SignBlock.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/block/StairBlock.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/block/TrapDoorBlock.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/chunk/ChunkGenerator.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/levelgen/BitRandomSource.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/material/FlowingFluid.patch create mode 100644 patches/release/1.21.8/net/minecraft/world/level/storage/loot/LootTable.patch create mode 100644 patches/release/1.21.8/net/ouja/dish/Dish.java create mode 100644 patches/release/1.21.8/net/ouja/dish/DishCrashReport.java create mode 100644 patches/release/1.21.8/net/ouja/dish/DishProperties.java create mode 100644 patches/release/1.21.8/net/ouja/dish/commands/RegisteredCommands.java create mode 100644 patches/release/1.21.8/net/ouja/dish/commands/VersionCommand.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/DishEntity.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/DishPlayer.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishBlaze.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishBogged.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishCreeper.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishDrowned.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishElderGuardian.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishEndermite.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishEvoker.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishGhast.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishGuardian.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishHoglin.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishHusk.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishMagmaCube.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishPhantom.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishPiglinBrute.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishPillager.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishRavager.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishShulker.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishSilverfish.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishSkeleton.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishSlime.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishStray.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishVex.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishVindicator.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishWarden.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishWitch.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishWitherSkeleton.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishZoglin.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombie.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombieHorse.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombieVillager.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishBee.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishCaveSpider.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishDolphin.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishEnderman.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishGoat.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishIronGolem.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishLlama.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPanda.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPiglin.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPolarBear.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishSpider.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishTraderLlama.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishWolf.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/neutral/DishZombifiedPiglin.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishAllay.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishArmadillo.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishAxolotl.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishBat.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishCamel.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishCat.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishChicken.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishCod.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishCow.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishDonkey.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishFox.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishFrog.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishGlowSquid.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishHorse.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishMule.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishMushroomCow.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishOcelot.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishParrot.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishPig.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishPufferfish.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishRabbit.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishSalmon.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishSheep.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishSkeletonHorse.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishSniffer.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishSnowGolem.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishSquid.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishStrider.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishTadpole.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishTropicalFish.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishTurtle.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishVillager.java create mode 100644 patches/release/1.21.8/net/ouja/dish/entity/passive/DishWanderingTrader.java create mode 100644 patches/release/1.21.8/net/ouja/dish/network/chat/DishComponent.java create mode 100644 patches/release/1.21.8/net/ouja/dish/plugins/PluginManager.java create mode 100644 patches/release/1.21.8/net/ouja/dish/plugins/RegisteredEvents.java create mode 100644 patches/release/1.21.8/net/ouja/dish/server/level/DishClientInformation.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/DishDamageSource.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/DishLevel.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/block/DishBlock.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/block/DishBlockInfo.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/block/DishButtonBlock.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/block/DishDoorBlock.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/block/DishSignBlock.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/block/DishStairBlock.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/block/DishTrapdoorBlock.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/block/entity/DishSignText.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/item/DishItemStack.java create mode 100644 patches/release/1.21.8/net/ouja/dish/world/level/chunk/DishStructure.java diff --git a/config.js b/config.js index 9e020e5..f84978f 100644 --- a/config.js +++ b/config.js @@ -8,7 +8,7 @@ const fs = require('fs'); const colors = require('./libs/colors'); -const DEFAULT_MINECRAFT_VERSION = 'release/1.21'; +const DEFAULT_MINECRAFT_VERSION = 'release/1.21.8'; function log(msg) { console.log(`[Info]${colors.reset} ${msg}`); diff --git a/dish/libraries/1.21.8.json b/dish/libraries/1.21.8.json new file mode 100644 index 0000000..88e0038 --- /dev/null +++ b/dish/libraries/1.21.8.json @@ -0,0 +1,20 @@ +{ + "version": "1.21.8", + "api_version": "R0.1-SNAPSHOT", + "libraries": [ + { + "downloads": { + "url": "https://repo1.maven.org/maven2/org/yaml/snakeyaml/2.0/snakeyaml-2.0.jar", + "path": "org/yaml/snakeyaml/2.0/snakeyaml-2.0.jar" + }, + "name": "org.yaml:snakeyaml:2.0" + }, + { + "downloads": { + "url": "https://maven.ouja.net/net/ouja/api/1.21.8-R0.1-SNAPSHOT/api-1.21.8-R0.1-20250924.003335-1.jar", + "path": "net/ouja/api/1.21.8/1.21.8-R0.1-SNAPSHOT.jar" + }, + "name": "net.ouja:api:1.21.8-R0.1-SNAPSHOT" + } + ] +} \ No newline at end of file diff --git a/libs/static/build.gradle.dish.txt b/libs/static/build.gradle.dish.txt index 6d359c0..3464fbb 100644 --- a/libs/static/build.gradle.dish.txt +++ b/libs/static/build.gradle.dish.txt @@ -1,11 +1,19 @@ plugins { id 'java' - id 'org.ajoberstar.grgit' version '4.1.0' + id 'org.ajoberstar.grgit' version '5.3.3' } group 'net.minecraft' version '{VERSION}' +java { + withJavadocJar() + withSourcesJar() + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + ext { api_version = version + '-{API_VERSION}' } diff --git a/mache b/mache index 6c25200..b856945 160000 --- a/mache +++ b/mache @@ -1 +1 @@ -Subproject commit 6c2520009970e76eab705eaf48d01c7b851eb284 +Subproject commit b8569458bb74c0c66c98a85a85a28cdec737225e diff --git a/patches/release/1.21.8/net/minecraft/ChatFormatting.patch b/patches/release/1.21.8/net/minecraft/ChatFormatting.patch new file mode 100644 index 0000000..8f0b980 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/ChatFormatting.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net/minecraft/ChatFormatting.java +index 12c6b47..2077793 100644 +--- a/src/main/java/net/minecraft/ChatFormatting.java ++++ b/src/main/java/net/minecraft/ChatFormatting.java +@@ -38,7 +38,7 @@ public enum ChatFormatting implements StringRepresentable { + RESET("RESET", 'r', -1, null); + + public static final Codec CODEC = StringRepresentable.fromEnum(ChatFormatting::values); +- public static final char PREFIX_CODE = '§'; ++ public static final char PREFIX_CODE = '\u00a7'; // decompiler error + private static final Map FORMATTING_BY_NAME = Arrays.stream(values()) + .collect(Collectors.toMap(formatting -> cleanName(formatting.name), chatFormatter -> (ChatFormatting)chatFormatter)); + private static final Pattern STRIP_FORMATTING_PATTERN = Pattern.compile("(?i)§[0-9A-FK-OR]"); diff --git a/patches/release/1.21.8/net/minecraft/CrashReport.patch b/patches/release/1.21.8/net/minecraft/CrashReport.patch new file mode 100644 index 0000000..a87eeb2 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/CrashReport.patch @@ -0,0 +1,12 @@ +diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java +index 706b64e..1bdfec4 100644 +--- a/src/main/java/net/minecraft/CrashReport.java ++++ b/src/main/java/net/minecraft/CrashReport.java +@@ -34,6 +34,7 @@ public class CrashReport { + public CrashReport(String title, Throwable exception) { + this.title = title; + this.exception = exception; ++ this.systemReport.setDetail("DishServer", new net.ouja.dish.DishCrashReport()); + } + + public String getTitle() { diff --git a/patches/release/1.21.8/net/minecraft/commands/Commands.patch b/patches/release/1.21.8/net/minecraft/commands/Commands.patch new file mode 100644 index 0000000..896bcee --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/commands/Commands.patch @@ -0,0 +1,24 @@ +diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java +index 587b873..093661e 100644 +--- a/src/main/java/net/minecraft/commands/Commands.java ++++ b/src/main/java/net/minecraft/commands/Commands.java +@@ -143,7 +143,7 @@ public class Commands { + public static final int LEVEL_GAMEMASTERS = 2; + public static final int LEVEL_ADMINS = 3; + public static final int LEVEL_OWNERS = 4; +- private final CommandDispatcher dispatcher = new CommandDispatcher<>(); ++ private static final CommandDispatcher dispatcher = new CommandDispatcher(); // dish -- make this static + + public Commands(Commands.CommandSelection selection, CommandBuildContext context) { + AdvancementCommands.register(this.dispatcher); +@@ -416,8 +416,8 @@ public class Commands { + }; + } + +- public CommandDispatcher getDispatcher() { +- return this.dispatcher; ++ public static CommandDispatcher getDispatcher() { // dish -- make this static so that plugins can use commands ++ return dispatcher; + } + + public static void validateParseResults(ParseResults parseResults) throws CommandSyntaxException { diff --git a/patches/release/1.21.8/net/minecraft/server/Main.patch b/patches/release/1.21.8/net/minecraft/server/Main.patch new file mode 100644 index 0000000..3df466a --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/server/Main.patch @@ -0,0 +1,17 @@ +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index 3cde004..a5b4913 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -114,6 +114,12 @@ public class Main { + return; + } + ++ // dish -- create a plugins directory ++ if (!new File("plugins").exists()) { ++ Files.createDirectories(Path.of("plugins")); ++ } ++ // dish end ++ + if (!eula.hasAgreedToEULA()) { + LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); + return; diff --git a/patches/release/1.21.8/net/minecraft/server/MinecraftServer.patch b/patches/release/1.21.8/net/minecraft/server/MinecraftServer.patch new file mode 100644 index 0000000..1454230 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/server/MinecraftServer.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index a049964..06a356b 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1119,7 +1119,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop seenBy = Sets.newIdentityHashSet(); + + public TrackedEntity(final Entity entity, final int range, final int updateInterval, final boolean trackDelta) { +- this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, updateInterval, trackDelta, this::broadcast); ++ this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, updateInterval, trackDelta, this::broadcast, this.seenBy); // dish -- pass the seenBy field into ServerEntity + this.entity = entity; + this.range = range; + this.lastSectionPos = SectionPos.of(entity); diff --git a/patches/release/1.21.8/net/minecraft/server/level/ServerEntity.patch b/patches/release/1.21.8/net/minecraft/server/level/ServerEntity.patch new file mode 100644 index 0000000..de2692d --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/server/level/ServerEntity.patch @@ -0,0 +1,43 @@ +diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java +index 26d9a03..c65e60d 100644 +--- a/src/main/java/net/minecraft/server/level/ServerEntity.java ++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +@@ -56,25 +56,27 @@ public class ServerEntity { + private final boolean trackDelta; + private final Consumer> broadcast; + private final VecDeltaCodec positionCodec = new VecDeltaCodec(); ++ private final Set seenBy; // dish + private int lastSentYRot; + private int lastSentXRot; + private int lastSentYHeadRot; + private Vec3 lastSentMovement; + private int tickCount; + private int teleportDelay; +- private List lastPassengers = Collections.emptyList(); ++ private List lastPassengers = com.google.common.collect.ImmutableList.of(); // dish -- use ImmutableList + private boolean wasRiding; + private boolean wasOnGround; + @Nullable + private List> trackedDataValues; + +- public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast) { ++ public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast, Set seenBy) { // dish + this.level = level; + this.broadcast = broadcast; + this.entity = entity; + this.updateInterval = updateInterval; + this.trackDelta = trackDelta; + this.positionCodec.setBase(entity.trackingPosition()); ++ this.seenBy = seenBy; // dish + this.lastSentMovement = entity.getDeltaMovement(); + this.lastSentYRot = Mth.floor(entity.getYRot() * 256.0F / 360.0F); + this.lastSentXRot = Mth.floor(entity.getXRot() * 256.0F / 360.0F); +@@ -99,7 +101,7 @@ public class ServerEntity { + this.lastPassengers = passengers; + } + +- if (this.entity instanceof ItemFrame itemFrame && this.tickCount % 10 == 0) { ++ if (!this.seenBy.isEmpty() && this.entity instanceof ItemFrame itemFrame && this.tickCount % 10 == 0) { // dish -- only update item frames if players can see them + ItemStack item = itemFrame.getItem(); + if (item.getItem() instanceof MapItem) { + MapId mapId = item.get(DataComponents.MAP_ID); diff --git a/patches/release/1.21.8/net/minecraft/server/level/ServerPlayer.patch b/patches/release/1.21.8/net/minecraft/server/level/ServerPlayer.patch new file mode 100644 index 0000000..dd38908 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/server/level/ServerPlayer.patch @@ -0,0 +1,64 @@ +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index 1a5123c..fa5d35d 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -655,10 +655,25 @@ public class ServerPlayer extends Player { + + @Override + public void die(DamageSource cause) { ++ // dish ++ net.ouja.api.event.player.PlayerDeathEvent event = new net.ouja.api.event.player.PlayerDeathEvent( ++ new net.ouja.dish.entity.DishPlayer(this), ++ new net.ouja.api.world.level.block.BlockPos( ++ this.blockPosition().getX(), ++ this.blockPosition().getY(), ++ this.blockPosition().getZ(), ++ new net.ouja.dish.world.DishLevel((ServerLevel)this.level()) ++ ), ++ cause.toDish(), ++ net.ouja.dish.network.chat.DishComponent.fromComponent(this.getCombatTracker().getDeathMessage()) ++ ); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + this.gameEvent(GameEvent.ENTITY_DIE); + boolean _boolean = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); + if (_boolean) { +- Component deathMessage = this.getCombatTracker().getDeathMessage(); ++ Component deathMessage = net.ouja.dish.network.chat.DishComponent.toComponent(event.getDeathMessage()); // dish -- allow plugins to modify the death message + this.connection + .send( + new ClientboundPlayerCombatKillPacket(this.getId(), deathMessage), +@@ -945,6 +960,11 @@ public class ServerPlayer extends Player { + } else if (this.bedBlocked(at, direction)) { + return Either.left(Player.BedSleepingProblem.OBSTRUCTED); + } else { ++ // dish ++ net.ouja.api.event.player.PlayerSleepEvent event = new net.ouja.api.event.player.PlayerSleepEvent(new net.ouja.dish.entity.DishPlayer(this), new net.ouja.api.world.level.block.BlockPos(at.getX(), at.getY(), at.getZ(), new net.ouja.dish.world.DishLevel((ServerLevel)this.level()))); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_HERE); ++ // dish end + this.setRespawnPosition(this.level().dimension(), at, this.getYRot(), false, true); + if (this.level().isDay()) { + return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); +@@ -959,7 +979,7 @@ public class ServerPlayer extends Player { + new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0), + monster -> monster.isPreventingPlayerRest(this) + ); +- if (!entitiesOfClass.isEmpty()) { ++ if (!event.canSleepWhileMonstersAreNear() && !entitiesOfClass.isEmpty()) { // dish -- PlayerSleepEvent modifies if the player can sleep while monsters are near. + return Either.left(Player.BedSleepingProblem.NOT_SAFE); + } + } +@@ -1641,6 +1661,11 @@ public class ServerPlayer extends Player { + if (this.gameMode.getGameModeForPlayer() == GameType.SPECTATOR) { + this.setCamera(targetEntity); + } else { ++ // dish start ++ net.ouja.api.event.player.PlayerAttackEvent event = new net.ouja.api.event.player.PlayerAttackEvent(new net.ouja.dish.entity.DishPlayer(this), new net.ouja.dish.entity.DishEntity((LivingEntity)targetEntity)); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + super.attack(targetEntity); + } + } diff --git a/patches/release/1.21.8/net/minecraft/server/level/ServerPlayerGameMode.patch b/patches/release/1.21.8/net/minecraft/server/level/ServerPlayerGameMode.patch new file mode 100644 index 0000000..aa05a6f --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/server/level/ServerPlayerGameMode.patch @@ -0,0 +1,25 @@ +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +index 043f44a..97eb976 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +@@ -242,6 +242,20 @@ public class ServerPlayerGameMode { + } else { + BlockEntity blockEntity = this.level.getBlockEntity(pos); + Block block = blockState.getBlock(); ++ // dish ++ try { ++ net.ouja.dish.world.block.DishBlockInfo dishBlockInfo = new net.ouja.dish.world.block.DishBlockInfo(block, pos, this.level); ++ if (dishBlockInfo.getBlock() != null) { ++ net.ouja.dish.entity.DishPlayer dishPlayer = new net.ouja.dish.entity.DishPlayer(this.player); ++ net.ouja.api.event.player.PlayerBreakBlockEvent event = new net.ouja.api.event.player.PlayerBreakBlockEvent(dishPlayer, dishBlockInfo.getBlock()); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return false; ++ } ++ } catch (Exception e) { ++ // TODO: 10/31/2023 make proper error logging ++ e.printStackTrace(); ++ } ++ // dish end + if (block instanceof GameMasterBlock && !this.player.canUseGameMasterBlocks()) { + this.level.sendBlockUpdated(pos, blockState, blockState, 3); + return false; diff --git a/patches/release/1.21.8/net/minecraft/server/network/ServerGamePacketListenerImpl.patch b/patches/release/1.21.8/net/minecraft/server/network/ServerGamePacketListenerImpl.patch new file mode 100644 index 0000000..e3dc31d --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/server/network/ServerGamePacketListenerImpl.patch @@ -0,0 +1,28 @@ +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 45fca81..9550e4d 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -401,6 +401,23 @@ public class ServerGamePacketListenerImpl + double d2 = clampHorizontal(packet.getZ()); + float f = Mth.wrapDegrees(packet.getYRot()); + float f1 = Mth.wrapDegrees(packet.getXRot()); ++ // dish ++ // Not sure if converting the passangers to a stream, then filtering out non players then converting it back to an ArrayList is good for performance. ++ java.util.ArrayList players = rootVehicle.getPassengers().stream().map((e) -> { ++ if (e instanceof Player) return new net.ouja.dish.entity.DishPlayer(((ServerPlayer) e)); ++ return null; ++ }).filter(Objects::nonNull).collect(Collectors.toCollection(java.util.ArrayList::new)); ++ double xOld = clampHorizontal(this.vehicleLastGoodX); ++ double yOld = clampHorizontal(this.vehicleLastGoodY); ++ double zOld = clampHorizontal(this.vehicleLastGoodZ); ++ net.ouja.api.event.vehicle.VehicleMoveEvent event = new net.ouja.api.event.vehicle.VehicleMoveEvent(players, d, d1, d2, xOld, yOld, zOld); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) { ++ rootVehicle.absMoveTo(xOld, yOld, zOld, f, f1); ++ this.send(new ClientboundMoveVehiclePacket(rootVehicle)); ++ return; ++ } ++ // dish end + double d3 = d - this.vehicleFirstGoodX; + double d4 = d1 - this.vehicleFirstGoodY; + double d5 = d2 - this.vehicleFirstGoodZ; diff --git a/patches/release/1.21.8/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch b/patches/release/1.21.8/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch new file mode 100644 index 0000000..3a39f91 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch @@ -0,0 +1,18 @@ +diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +index 4efac29..7c51e09 100644 +--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -138,6 +138,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + private void verifyLoginAndFinishConnectionSetup(GameProfile profile) { + PlayerList playerList = this.server.getPlayerList(); + Component component = playerList.canPlayerLogin(this.connection.getRemoteAddress(), profile); ++ // dish ++ net.ouja.api.event.player.PlayerLoginEvent event = new net.ouja.api.event.player.PlayerLoginEvent(new net.ouja.api.auth.GameProfile(profile.getName(), profile.getId()), component != null ? net.ouja.dish.network.chat.DishComponent.fromComponent(component) : null); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.getErrorMessage() != null) { ++ component = net.ouja.dish.network.chat.DishComponent.toComponent(event.getErrorMessage()); // dish -- return custom error message ++ } ++ // dish end + if (component != null) { + this.disconnect(component); + } else { diff --git a/patches/release/1.21.8/net/minecraft/server/players/PlayerList.patch b/patches/release/1.21.8/net/minecraft/server/players/PlayerList.patch new file mode 100644 index 0000000..0222ad1 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/server/players/PlayerList.patch @@ -0,0 +1,29 @@ +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 47f61db..ccbd5ec 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -214,7 +214,15 @@ public abstract class PlayerList { + mutableComponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), string); + } + +- this.broadcastSystemMessage(mutableComponent.withStyle(ChatFormatting.YELLOW), false); ++ // dish start -- add event listener for players joining ++ net.ouja.api.event.player.PlayerJoinEvent event = new net.ouja.api.event.player.PlayerJoinEvent(new net.ouja.dish.entity.DishPlayer(player), net.ouja.dish.network.chat.DishComponent.fromComponent(mutableComponent)); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.getJoinMessage() != null) { ++ mutableComponent = net.ouja.dish.network.chat.DishComponent.toComponent(event.getJoinMessage()); ++ } else { ++ mutableComponent = mutableComponent.withStyle(ChatFormatting.YELLOW); ++ } ++ // dish end + serverGamePacketListenerImpl.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); + ServerStatus status = this.server.getStatus(); + if (status != null && !cookie.transferred()) { +@@ -224,6 +232,7 @@ public abstract class PlayerList { + player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); + this.players.add(player); + this.playersByUUID.put(player.getUUID(), player); ++ this.broadcastSystemMessage(mutableComponent, false); // dish -- remove ".withStyle()" and move this here so that when players join, they can see their own join message. + this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); + this.sendLevelInfo(player, serverLevel); + serverLevel.addNewPlayer(player); diff --git a/patches/release/1.21.8/net/minecraft/world/damagesource/DamageSource.patch b/patches/release/1.21.8/net/minecraft/world/damagesource/DamageSource.patch new file mode 100644 index 0000000..e472f0b --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/damagesource/DamageSource.patch @@ -0,0 +1,11 @@ +diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java +index f70a6e9..709f53e 100644 +--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java ++++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java +@@ -138,4 +138,6 @@ public class DamageSource { + public Holder typeHolder() { + return this.type; + } ++ ++ public net.ouja.dish.world.DishDamageSource toDish() { return new net.ouja.dish.world.DishDamageSource(this); } // dish + } diff --git a/patches/release/1.21.8/net/minecraft/world/entity/LivingEntity.patch b/patches/release/1.21.8/net/minecraft/world/entity/LivingEntity.patch new file mode 100644 index 0000000..9ce0b29 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/entity/LivingEntity.patch @@ -0,0 +1,35 @@ +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 3667e1d..667b504 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -1196,6 +1196,10 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + + if (this.isDeadOrDying()) { ++ if (!(this instanceof Player)) { // dish -- make sure the entity that died is not a player, then call the EntityDeathEvent. ++ net.ouja.api.event.entity.EntityDeathEvent event = new net.ouja.api.event.entity.EntityDeathEvent(this.toDish(), new net.ouja.api.world.level.block.BlockPos(this.blockPosition().getX(), this.blockPosition().getY(), this.blockPosition().getZ(), new net.ouja.dish.world.DishLevel((ServerLevel)this.level())), source.toDish(), net.ouja.dish.network.chat.DishComponent.fromComponent(this.getCombatTracker().getDeathMessage())); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ } // dish end + if (!this.checkTotemDeathProtection(source)) { + if (flag1) { + this.makeSound(this.getDeathSound()); +@@ -2890,6 +2894,11 @@ public abstract class LivingEntity extends Entity implements Attackable { + public void onItemPickup(ItemEntity itemEntity) { + Entity owner = itemEntity.getOwner(); + if (owner instanceof ServerPlayer) { ++ // dish ++ net.ouja.api.event.player.PlayerPickUpItemEvent event = new net.ouja.api.event.player.PlayerPickUpItemEvent(new net.ouja.dish.entity.DishPlayer((ServerPlayer)this), itemEntity.getItem().toDish()); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer)owner, itemEntity.getItem(), this); + } + } +@@ -3554,6 +3563,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + } + } + ++ public net.ouja.dish.entity.DishEntity toDish() { return new net.ouja.dish.entity.DishEntity(this); } // dish + public static record Fallsounds(SoundEvent small, SoundEvent big) { + } + } diff --git a/patches/release/1.21.8/net/minecraft/world/entity/animal/Squid.patch b/patches/release/1.21.8/net/minecraft/world/entity/animal/Squid.patch new file mode 100644 index 0000000..c998e3f --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/entity/animal/Squid.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java +index 120889e..e22c9fc 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java +@@ -176,7 +176,7 @@ public class Squid extends WaterAnimal { + return vec3.yRot(-this.yBodyRotO * (float) (Math.PI / 180.0)); + } + +- private void spawnInk() { ++ public void spawnInk() { // dish -- make this public + this.makeSound(this.getSquirtSound()); + Vec3 vec3 = this.rotateVector(new Vec3(0.0, -1.0, 0.0)).add(this.getX(), this.getY(), this.getZ()); + diff --git a/patches/release/1.21.8/net/minecraft/world/entity/animal/sniffer/Sniffer.patch b/patches/release/1.21.8/net/minecraft/world/entity/animal/sniffer/Sniffer.patch new file mode 100644 index 0000000..9b15a00 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/entity/animal/sniffer/Sniffer.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +index 834f3ae..95691f3 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java ++++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +@@ -141,7 +141,7 @@ public class Sniffer extends Animal { + return this.position().add(this.getForward().scale(2.25)); + } + +- private Sniffer.State getState() { ++ public Sniffer.State getState() { // dish -- make this public + return this.entityData.get(DATA_STATE); + } + diff --git a/patches/release/1.21.8/net/minecraft/world/entity/item/ItemEntity.patch b/patches/release/1.21.8/net/minecraft/world/entity/item/ItemEntity.patch new file mode 100644 index 0000000..9bd4977 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/entity/item/ItemEntity.patch @@ -0,0 +1,25 @@ +diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +index d3286a1..db9022b 100644 +--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +@@ -342,6 +342,20 @@ public class ItemEntity extends Entity implements TraceableEntity { + ItemStack item = this.getItem(); + Item item1 = item.getItem(); + int count = item.getCount(); ++ // dish ++ // TODO: 12/11/2023 Check performance ++ net.ouja.dish.entity.DishEntity cachedThrower = new net.ouja.dish.entity.DishEntity((net.minecraft.world.entity.LivingEntity)this.cachedThrower); ++ net.ouja.api.entity.ItemEntity itemEntity = new net.ouja.api.entity.ItemEntity( ++ item.toDish(), ++ this.pickupDelay, ++ this.age, ++ cachedThrower, ++ this.thrower ++ ); ++ net.ouja.api.event.player.PlayerAttemptPickUpItem event = new net.ouja.api.event.player.PlayerAttemptPickUpItem(new net.ouja.dish.entity.DishPlayer((net.minecraft.server.level.ServerPlayer)entity), itemEntity); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ // dish end ++ + if (this.pickupDelay == 0 && (this.target == null || this.target.equals(entity.getUUID())) && entity.getInventory().add(item)) { + entity.take(this, count); + if (item.isEmpty()) { diff --git a/patches/release/1.21.8/net/minecraft/world/entity/monster/Shulker.patch b/patches/release/1.21.8/net/minecraft/world/entity/monster/Shulker.patch new file mode 100644 index 0000000..9de144f --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/entity/monster/Shulker.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java +index f7e3554..52d550f 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java +@@ -437,7 +437,7 @@ public class Shulker extends AbstractGolem implements VariantHolder> 32); ++ this.toLongKey = asLong(this.x, this.z); // dish + } + + public static ChunkPos minFromRegion(int chunkX, int chunkZ) { +@@ -48,10 +52,10 @@ public class ChunkPos { + } + + public long toLong() { +- return asLong(this.x, this.z); ++ return this.toLongKey; // dish + } + +- public static long asLong(int x, int z) { ++ public static long asLong(int x, int z) { // dish -- this should not change + return x & 4294967295L | (z & 4294967295L) << 32; + } + diff --git a/patches/release/1.21.8/net/minecraft/world/level/LevelReader.patch b/patches/release/1.21.8/net/minecraft/world/level/LevelReader.patch new file mode 100644 index 0000000..bd35266 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/LevelReader.patch @@ -0,0 +1,18 @@ +diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java +index 9b242cc..bb9fa38 100644 +--- a/src/main/java/net/minecraft/world/level/LevelReader.java ++++ b/src/main/java/net/minecraft/world/level/LevelReader.java +@@ -39,6 +39,13 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal + return this.getBiomeManager().getBiome(pos); + } + ++ // dish ++ public default BlockState getBlockStateIfLoaded(BlockPos blockpos) { ++ ChunkAccess chunk = this.getChunk(blockpos.getX() >> 4, blockpos.getZ() >> 4, ChunkStatus.FULL, false); ++ return chunk == null ? null : chunk.getBlockState(blockpos); ++ } ++ // dish end ++ + default Stream getBlockStatesIfLoaded(AABB aabb) { + int floor = Mth.floor(aabb.minX); + int floor1 = Mth.floor(aabb.maxX); diff --git a/patches/release/1.21.8/net/minecraft/world/level/block/Block.patch b/patches/release/1.21.8/net/minecraft/world/level/block/Block.patch new file mode 100644 index 0000000..e7bfe9a --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/block/Block.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 7e705ef..87c40cb 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -489,6 +489,8 @@ public class Block extends BlockBehaviour implements ItemLike { + } + } + ++ public net.ouja.api.world.level.block.Block toDish(BlockPos blockPos, Level level) { return new net.ouja.dish.world.block.DishBlockInfo(this, blockPos, level).getBlock(); } // dish ++ + public static final class BlockStatePairKey { + private final BlockState first; + private final BlockState second; diff --git a/patches/release/1.21.8/net/minecraft/world/level/block/SignBlock.patch b/patches/release/1.21.8/net/minecraft/world/level/block/SignBlock.patch new file mode 100644 index 0000000..5b60934 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/block/SignBlock.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java +index c917e90..5468d52 100644 +--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java +@@ -147,7 +147,7 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo + } + + @Override +- protected FluidState getFluidState(BlockState state) { ++ public FluidState getFluidState(BlockState state) { // dish -- make this public + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + diff --git a/patches/release/1.21.8/net/minecraft/world/level/block/StairBlock.patch b/patches/release/1.21.8/net/minecraft/world/level/block/StairBlock.patch new file mode 100644 index 0000000..f52b7c9 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/block/StairBlock.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/block/StairBlock.java b/src/main/java/net/minecraft/world/level/block/StairBlock.java +index 105d694..beaa90a 100644 +--- a/src/main/java/net/minecraft/world/level/block/StairBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/StairBlock.java +@@ -232,7 +232,7 @@ public class StairBlock extends Block implements SimpleWaterloggedBlock { + } + + @Override +- protected FluidState getFluidState(BlockState state) { ++ public FluidState getFluidState(BlockState state) { // dish -- make this public + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + diff --git a/patches/release/1.21.8/net/minecraft/world/level/block/TrapDoorBlock.patch b/patches/release/1.21.8/net/minecraft/world/level/block/TrapDoorBlock.patch new file mode 100644 index 0000000..f6cfe30 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/block/TrapDoorBlock.patch @@ -0,0 +1,22 @@ +diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java +index daf1f67..293f7b9 100644 +--- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java +@@ -197,4 +197,17 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW + protected BlockSetType getType() { + return this.type; + } ++ ++ // dish -- add a new method for plugins to open trapdoors. It's easier to do this than the use method ++ public void setOpen(@Nullable Player player, Level level, BlockState blockstate, BlockPos blockpos, boolean flag) { ++ if (blockstate.is(this) && blockstate.getValue(TrapDoorBlock.OPEN) != flag) { ++ level.setBlock(blockpos, blockstate.setValue(TrapDoorBlock.OPEN, flag), 2); ++ if (blockstate.getValue(TrapDoorBlock.WATERLOGGED)) { ++ level.scheduleTick(blockpos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); ++ } ++ ++ this.playSound(player, level, blockpos, flag); ++ } ++ } ++ // dish end + } diff --git a/patches/release/1.21.8/net/minecraft/world/level/chunk/ChunkGenerator.patch b/patches/release/1.21.8/net/minecraft/world/level/chunk/ChunkGenerator.patch new file mode 100644 index 0000000..0ec08b7 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/chunk/ChunkGenerator.patch @@ -0,0 +1,53 @@ +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +index d9f1aaf..0c9da6d 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +@@ -469,11 +469,16 @@ public abstract class ChunkGenerator { + ChunkGeneratorStructureState structureState, + StructureManager structureManager, + ChunkAccess chunk, +- StructureTemplateManager structureTemplateManager ++ StructureTemplateManager structureTemplateManager, ++ ServerLevel serverlevel // dish -- add serverlevel to parameters for plugins to cancel structure generation todo: remove this maybe + ) { + ChunkPos pos = chunk.getPos(); + SectionPos sectionPos = SectionPos.bottomOf(chunk); + RandomState randomState = structureState.randomState(); ++ // dish ++ net.ouja.dish.world.DishLevel dishLevel = new net.ouja.dish.world.DishLevel(serverlevel); ++ net.ouja.api.world.level.chunk.ChunkPos dishChunkPos = new net.ouja.api.world.level.chunk.ChunkPos(pos.x, pos.z, dishLevel); ++ // dish end + structureState.possibleStructureSets() + .forEach( + structureSet -> { +@@ -489,6 +494,12 @@ public abstract class ChunkGenerator { + + if (structurePlacement.isStructureChunk(structureState, pos.x, pos.z)) { + if (list.size() == 1) { ++ // dish ++ net.ouja.dish.world.level.chunk.DishStructure dishStructure = new net.ouja.dish.world.level.chunk.DishStructure(list.get(0).structure().value()); ++ net.ouja.api.event.world.level.chunk.StructureGenerateEvent event = new net.ouja.api.event.world.level.chunk.StructureGenerateEvent(dishStructure, dishChunkPos); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + this.tryGenerateStructure( + list.get(0), + structureManager, +@@ -525,6 +536,17 @@ public abstract class ChunkGenerator { + } + + StructureSet.StructureSelectionEntry structureSelectionEntry3 = list1.get(i1); ++ // dish ++ net.ouja.dish.world.level.chunk.DishStructure dishStructure = new net.ouja.dish.world.level.chunk.DishStructure(structureSelectionEntry3.structure().value()); ++ net.ouja.api.event.world.level.chunk.StructureGenerateEvent event = new net.ouja.api.event.world.level.chunk.StructureGenerateEvent(dishStructure, dishChunkPos); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) { ++ list1.remove(i1); ++ i -= structureSelectionEntry3.weight(); ++ break; ++ } ++ // dish end ++ + if (this.tryGenerateStructure( + structureSelectionEntry3, + structureManager, diff --git a/patches/release/1.21.8/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch b/patches/release/1.21.8/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch new file mode 100644 index 0000000..90d34fa --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch @@ -0,0 +1,14 @@ +diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +index a76abac..c688efb 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java ++++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +@@ -43,7 +43,8 @@ public class ChunkStatusTasks { + serverLevel.getChunkSource().getGeneratorState(), + serverLevel.structureManager(), + chunkAccess, +- worldGenContext.structureManager() ++ worldGenContext.structureManager(), ++ serverLevel // dish -- add serverLevel + ); + } + diff --git a/patches/release/1.21.8/net/minecraft/world/level/levelgen/BitRandomSource.patch b/patches/release/1.21.8/net/minecraft/world/level/levelgen/BitRandomSource.patch new file mode 100644 index 0000000..6fb5e71 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/levelgen/BitRandomSource.patch @@ -0,0 +1,13 @@ +diff --git a/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java b/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java +index e2e46f4..a7f7f74 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/BitRandomSource.java +@@ -18,7 +18,7 @@ public interface BitRandomSource extends RandomSource { + if (bound <= 0) { + throw new IllegalArgumentException("Bound must be positive"); + } else if ((bound & bound - 1) == 0) { +- return (int)(bound * this.next(31) >> 31); ++ return (int)((long)bound * (long)this.next(31) >> 31); // fix decompiler error + } else { + int i; + int i1; diff --git a/patches/release/1.21.8/net/minecraft/world/level/material/FlowingFluid.patch b/patches/release/1.21.8/net/minecraft/world/level/material/FlowingFluid.patch new file mode 100644 index 0000000..0103fc8 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/material/FlowingFluid.patch @@ -0,0 +1,91 @@ +diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +index 03bc74e..14c9081 100644 +--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java ++++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +@@ -30,6 +30,10 @@ import net.minecraft.world.phys.Vec3; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; + ++/** ++ * Modifications: ++ * - Prevent chunk loading by flowing liquids ++ */ + public abstract class FlowingFluid extends Fluid { + public static final BooleanProperty FALLING = BlockStateProperties.FALLING; + public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_FLOWING; +@@ -113,7 +117,8 @@ public abstract class FlowingFluid extends Fluid { + if (!state.isEmpty()) { + BlockState blockState = level.getBlockState(pos); + BlockPos blockPos = pos.below(); +- BlockState blockState1 = level.getBlockState(blockPos); ++ BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish ++ if (blockState1 == null) return; // dish + FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState1); + if (this.canSpreadTo(level, pos, blockState, Direction.DOWN, blockPos, blockState1, level.getFluidState(blockPos), newLiquid.getType())) { + this.spreadTo(level, blockPos, blockState1, Direction.DOWN, newLiquid); +@@ -139,7 +144,8 @@ public abstract class FlowingFluid extends Fluid { + Direction direction = entry.getKey(); + FluidState fluidState1 = entry.getValue(); + BlockPos blockPos = pos.relative(direction); +- BlockState blockState1 = level.getBlockState(blockPos); ++ BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish ++ if (blockState1 == null) continue; // dish + if (this.canSpreadTo(level, pos, blockState, direction, blockPos, blockState1, level.getFluidState(blockPos), fluidState1.getType())) { + this.spreadTo(level, blockPos, blockState1, direction, fluidState1); + } +@@ -153,7 +159,8 @@ public abstract class FlowingFluid extends Fluid { + + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockPos blockPos = pos.relative(direction); +- BlockState blockState1 = level.getBlockState(blockPos); ++ BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish ++ if (blockState1 == null) continue; + FluidState fluidState = blockState1.getFluidState(); + if (fluidState.getType().isSame(this) && this.canPassThroughWall(direction, level, pos, blockState, blockPos, blockState1)) { + if (fluidState.isSource()) { +@@ -268,10 +275,22 @@ public abstract class FlowingFluid extends Fluid { + if (direction1 != direction) { + BlockPos blockPos = spreadPos.relative(direction1); + short cacheKey = getCacheKey(sourcePos, blockPos); ++ /* + Pair pair = stateCache.computeIfAbsent(cacheKey, key -> { + BlockState blockState1 = level.getBlockState(blockPos); + return Pair.of(blockState1, blockState1.getFluidState()); + }); ++ */ ++ // dish ++ Pair pair = stateCache.get(cacheKey); ++ if (pair == null) { ++ BlockState blockStateD = level.getBlockStateIfLoaded(blockPos); ++ if (blockStateD == null) continue; ++ ++ pair = Pair.of(blockStateD, blockStateD.getFluidState()); ++ stateCache.put(cacheKey, pair); ++ } ++ // dish end + BlockState blockState = pair.getFirst(); + FluidState fluidState = pair.getSecond(); + if (this.canPassThrough(level, this.getFlowing(), spreadPos, currentSpreadState, direction1, blockPos, blockState, fluidState)) { +@@ -341,10 +360,22 @@ public abstract class FlowingFluid extends Fluid { + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockPos blockPos = pos.relative(direction); + short cacheKey = getCacheKey(pos, blockPos); ++ /* + Pair pair = map1.computeIfAbsent(cacheKey, key -> { + BlockState blockState1 = level.getBlockState(blockPos); + return Pair.of(blockState1, blockState1.getFluidState()); + }); ++ */ ++ // dish ++ Pair pair = map1.get(cacheKey); ++ if (pair == null) { ++ BlockState blockStateD = level.getBlockStateIfLoaded(blockPos); ++ if (blockStateD == null) continue; ++ ++ pair = Pair.of(blockStateD, blockStateD.getFluidState()); ++ map1.put(cacheKey, pair); ++ } ++ // dish end + BlockState blockState = pair.getFirst(); + FluidState fluidState = pair.getSecond(); + FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState); diff --git a/patches/release/1.21.8/net/minecraft/world/level/storage/loot/LootTable.patch b/patches/release/1.21.8/net/minecraft/world/level/storage/loot/LootTable.patch new file mode 100644 index 0000000..db2466a --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/level/storage/loot/LootTable.patch @@ -0,0 +1,17 @@ +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +index b806cc8..83157b6 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +@@ -146,6 +146,12 @@ public class LootTable { + RandomSource random = lootContext.getRandom(); + List availableSlots = this.getAvailableSlots(container, random); + this.shuffleAndSplitItems(randomItems, availableSlots.size(), random); ++ // dish ++ // TODO: 11/15/2023 Make container class and allow the plugin to modify the items in the container ++ net.ouja.api.event.world.level.LootGenerateEvent event = new net.ouja.api.event.world.level.LootGenerateEvent(net.ouja.dish.world.item.DishItemStack.convertFromVanilla(randomItems)); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return; ++ // dish end + + for (ItemStack itemStack : randomItems) { + if (availableSlots.isEmpty()) { diff --git a/patches/release/1.21.8/net/ouja/dish/Dish.java b/patches/release/1.21.8/net/ouja/dish/Dish.java new file mode 100644 index 0000000..a34d25f --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/Dish.java @@ -0,0 +1,160 @@ +package net.ouja.dish; + +import com.mojang.logging.LogUtils; +import net.minecraft.server.ServerLinks; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.players.UserBanListEntry; +import net.ouja.api.DishAPI; +import net.ouja.api.entity.Player; +import net.ouja.api.Server; +import net.ouja.api.auth.GameProfile; +import net.ouja.api.commands.Command; +import net.ouja.api.commands.CommandListener; +import net.ouja.api.dedicated.ServerProperties; +import net.ouja.api.event.EventHandler; +import net.ouja.api.event.EventListener; +import net.ouja.api.network.chat.Component; +import net.ouja.api.server.ServerLink; +import net.ouja.api.server.players.BanEntry; +import net.ouja.dish.commands.RegisteredCommands; +import net.ouja.dish.commands.VersionCommand; +import net.ouja.dish.entity.DishPlayer; +import net.ouja.dish.network.chat.DishComponent; +import net.ouja.dish.plugins.PluginManager; +import net.ouja.dish.plugins.RegisteredEvents; +import org.jetbrains.annotations.NotNull; +import org.slf4j.Logger; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +public class Dish implements Server { + private final DedicatedServer server; + private final String dishVersion = getBuild(); + public static final Logger logger = LogUtils.getLogger(); + + public Dish(DedicatedServer server) { + this.server = server; + DishAPI.setServer(this); + logger.info(String.format("Launching Dish server with the version %s (API Version: %s)", dishVersion, DishAPI.getApiVersion())); + initializeDishCommands(); + } + + public static String getBuild() { + try { + InputStream in = Dish.class.getResourceAsStream("/build.txt"); + if (in == null) return "UNKNOWN"; + + return readLines(in)[0]; + } catch (Exception e) { + e.printStackTrace(); + } + + return "UNKNOWN"; + } + + public static String[] readLines(InputStream is) throws IOException { + List list = new ArrayList<>(); + InputStreamReader isr = new InputStreamReader(is, StandardCharsets.US_ASCII); + BufferedReader br = new BufferedReader(isr); + + while(true) { + String line = br.readLine(); + if (line == null) { + return list.toArray(new String[0]); + } + + list.add(line); + } + } + + public void initializePlugins() { + try { + new PluginManager(new File("plugins")); + } catch (IOException e) { + e.printStackTrace(); // todo make an error handler + } + } + + public void initializeDishCommands() { + VersionCommand.register(); + } + + @Override + public @NotNull String getVersion() { + return this.server.getServerVersion(); + } + + @Override + public @NotNull ServerProperties getProperties() { + return new DishProperties(this.server.getProperties()); + } + + @Override + public @NotNull String getDishVersion() { + return this.dishVersion; + } + + @Override + public @NotNull ArrayList getOnlinePlayers() { + return new ArrayList<>(DishPlayer.CACHED_PLAYERS.values()); + } + + @Override + public void registerEvent(EventListener eventListener, Class aClass) { + for (Method method : eventListener.getClass().getMethods()) { + if (method.isAnnotationPresent(EventHandler.class)) { + new RegisteredEvents(method, aClass); + } + } + } + + @Override + public void registerCommand(Command command) { + for (Method method : command.getClass().getMethods()) { + if (method.isAnnotationPresent(CommandListener.class)) { + CommandListener commandListener = method.getAnnotation(CommandListener.class); + if (commandListener != null && commandListener.name() != "") { + new RegisteredCommands(commandListener, method, command.getClass()); + } + } + } + } + + @Override + public void broadcast(Component component) { + for (Player player : DishPlayer.CACHED_PLAYERS.values()) { + player.sendMessage(component); + } + } + + @Override + public boolean isPlayerBanned(GameProfile profile) { + return this.server.getPlayerList().getBans().isBanned(new com.mojang.authlib.GameProfile(profile.getPlayerUUID(), profile.getPlayerName())); + } + + @Override + public BanEntry getBanEntry(GameProfile profile) { + UserBanListEntry entry = this.server.getPlayerList().getBans().get(new com.mojang.authlib.GameProfile(profile.getPlayerUUID(), profile.getPlayerName())); + if (entry == null) return null; + return new BanEntry(entry.getCreated(), entry.getSource(), entry.getExpires(), entry.getReason()); + } + + @Override + public ArrayList getServerLinks() { + var list = new ArrayList(); + + for (ServerLinks.Entry entry : this.server.serverLinks().entries()) { + list.add(new ServerLink(DishComponent.fromComponent(entry.displayName()), entry.link())); + } + + return list; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/DishCrashReport.java b/patches/release/1.21.8/net/ouja/dish/DishCrashReport.java new file mode 100644 index 0000000..02e46c6 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/DishCrashReport.java @@ -0,0 +1,39 @@ +package net.ouja.dish; + +import net.ouja.api.DishAPI; +import net.ouja.dish.plugins.PluginManager; +import net.ouja.dish.plugins.RegisteredEvents; + +import java.util.function.Supplier; + +public class DishCrashReport implements Supplier { + @Override + public String get() { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("\n\t\tVersion: " + Dish.getBuild()); + stringBuilder.append("\n\t\tAPI Version: " + DishAPI.getApiVersion()); + stringBuilder.append("\n\t\tLoaded Plugins: " + PluginManager.plugins.size()); + if (!PluginManager.plugins.isEmpty()) { + stringBuilder.append("\n\t\tPlugins:"); + for (String pluginName : PluginManager.plugins) { + stringBuilder.append("\n\t\t\t" + pluginName); + } + } + stringBuilder.append("\n\t\tLoaded Events: " + RegisteredEvents.listeners.size()); + if (!RegisteredEvents.listeners.isEmpty()) { + stringBuilder.append("\n\t\tEvents:"); + // EventType; pluginName.jar + for (int i = 0; i < RegisteredEvents.listeners.size(); i++) { + if (i < 99) { + String fileName = RegisteredEvents.classes.get(i).getProtectionDomain().getCodeSource().getLocation().getFile().split("/plugins/")[1]; + stringBuilder.append("\n\t\t\t" + RegisteredEvents.listeners.get(i).getName() + "; " + fileName); + } else { + stringBuilder.append("\n\t\t\tTruncated loaded events."); + break; + } + } + } + + return stringBuilder.toString(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/DishProperties.java b/patches/release/1.21.8/net/ouja/dish/DishProperties.java new file mode 100644 index 0000000..c116153 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/DishProperties.java @@ -0,0 +1,99 @@ +package net.ouja.dish; + +import net.minecraft.server.dedicated.DedicatedServerProperties; +import net.ouja.api.dedicated.ServerProperties; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class DishProperties implements ServerProperties { + private final DedicatedServerProperties properties; + + public DishProperties(DedicatedServerProperties properties) { + this.properties = properties; + } + + @Override + public boolean isOnline() { + return this.properties.onlineMode; + } + + @Override + public boolean isHardcore() { + return this.properties.hardcore; + } + + @Override + public @NotNull String getMotd() { + return this.properties.motd; + } + + @Override + public boolean canSpawnAnimals() { + return this.properties.spawnAnimals; + } + + @Override + public boolean canSpawnNpcs() { + return this.properties.spawnNpcs; + } + + @Override + public boolean isPvPEnabled() { + return this.properties.pvp; + } + + @Override + public boolean isFlightEnabled() { + return this.properties.allowFlight; + } + + @Override + public @Nullable Boolean isAnnouncePlayerAchievementsEnabled() { + return this.properties.announcePlayerAchievements; + } + + @Override + public boolean isNetherAllowed() { + return this.properties.allowNether; + } + + @Override + public boolean canSpawnMonsters() { + return this.properties.spawnMonsters; + } + + @Override + public int getSpawnProtection() { + return this.properties.spawnProtection; + } + + @Override + public int getViewDistance() { + return this.properties.viewDistance; + } + + @Override + public int getSimulationDistance() { + return this.properties.simulationDistance; + } + + @Override + public int getMaxPlayers() { + return this.properties.maxPlayers; + } + + @Override + public boolean hideOnlinePlayers() { + return this.properties.hideOnlinePlayers; + } + + @Override + public boolean isWhitelistEnabled() { + return this.properties.enforceWhitelist; + } + + @Override + public boolean acceptsServerTransfers() { + return this.properties.acceptsTransfers; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/commands/RegisteredCommands.java b/patches/release/1.21.8/net/ouja/dish/commands/RegisteredCommands.java new file mode 100644 index 0000000..f913d18 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/commands/RegisteredCommands.java @@ -0,0 +1,61 @@ +package net.ouja.dish.commands; + +import com.mojang.brigadier.builder.ArgumentBuilder; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import net.minecraft.ChatFormatting; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.network.chat.Component; +import net.ouja.api.commands.CommandListener; +import net.ouja.dish.Dish; +import net.ouja.dish.entity.DishPlayer; +import net.ouja.dish.network.chat.DishComponent; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; + +public class RegisteredCommands { + private static final HashMap names = new HashMap<>(); + private static final HashMap> classes = new HashMap<>(); + + public RegisteredCommands(CommandListener commandListener, Method method, Class commandClass) { + String name = commandListener.name(); + if (names.get(name) != null) { + Dish.logger.warn(String.format("[Warning] Command name '%s' already exists. Changing name to '%s%s'%n", name, name, names.size() + 1)); + name = name + (names.size() + 1); + } + + names.put(name, method); + classes.put(name, commandClass); + + LiteralArgumentBuilder command = Commands.literal(name); + String finalName = name; + Commands.getDispatcher().register( + command.executes((cmd) -> { + DishPlayer player = new DishPlayer(cmd.getSource().getPlayer()); + try { + return runCommand(finalName, player, commandListener) ? 1 : 0; + } catch (Exception e) { + Component component = Component.literal("An error occurred when running this command").withStyle(ChatFormatting.RED); + player.sendMessage(DishComponent.fromComponent(component).setColor(String.valueOf(ChatFormatting.RED.getColor().intValue()))); + return 0; + } + }) + ); + } + + public static boolean runCommand(String commandName, DishPlayer player, CommandListener commandListener) throws InstantiationException, IllegalAccessException, InvocationTargetException { + Method method = names.get(commandName); + Class clazz = classes.get(commandName); + if (method == null || clazz == null) return false; + + if (player.isConsole() && !commandListener.allowConsole()) { + System.out.println("Command can't be ran from the console."); + return false; + } + + method.setAccessible(true); + return (boolean)method.invoke(clazz.newInstance(), player); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/commands/VersionCommand.java b/patches/release/1.21.8/net/ouja/dish/commands/VersionCommand.java new file mode 100644 index 0000000..1f1450a --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/commands/VersionCommand.java @@ -0,0 +1,18 @@ +package net.ouja.dish.commands; + +import net.minecraft.commands.Commands; +import net.minecraft.network.chat.Component; +import net.ouja.api.DishAPI; +import net.ouja.dish.Dish; + +public class VersionCommand { + public static void register() { + Commands.getDispatcher().register(Commands.literal("version").executes((commandcontext) -> { + commandcontext.getSource().sendSuccess(() -> { + return Component.literal(String.format("DishServer version is '%s' implementing API '%s'", Dish.getBuild(), DishAPI.getApiVersion())); + }, false); + + return 1; + })); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/DishEntity.java b/patches/release/1.21.8/net/ouja/dish/entity/DishEntity.java new file mode 100644 index 0000000..80070cf --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/DishEntity.java @@ -0,0 +1,308 @@ +package net.ouja.dish.entity; + +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.ouja.api.entity.Entity; +import net.ouja.api.entity.EntityTypes; +import net.ouja.dish.entity.monster.*; +import net.ouja.dish.entity.neutral.*; +import net.ouja.dish.entity.passive.*; +import org.jetbrains.annotations.Nullable; + +import java.util.UUID; + +public class DishEntity implements Entity { + private final LivingEntity entity; + + public DishEntity(LivingEntity entity) { + this.entity = entity; + } + + @Override + public int getId() { + return entity.getId(); + } + + @Nullable + @Override + // todo: finish adding other entity types i.e. ChestBoat, Llama_spit, etc... + public Entity getEntity() { + EntityType entityType = this.entity.getType(); + // Passive mobs + if (entityType == EntityType.ALLAY) { + return new DishAllay(this.entity); + } + else if (entityType == EntityType.ARMADILLO) { + return new DishArmadillo(this.entity); + } + else if (entityType == EntityType.AXOLOTL) { + return new DishAxolotl(this.entity); + } + else if (entityType == EntityType.BAT) { + return new DishBat(this.entity); + } + else if (entityType == EntityType.CAMEL) { + return new DishCamel(this.entity); + } + else if (entityType == EntityType.CAT) { + return new DishCat(this.entity); + } + else if (entityType == EntityType.CHICKEN) { + return new DishChicken(this.entity); + } + else if (entityType == EntityType.COD) { + return new DishCod(this.entity); + } + else if (entityType == EntityType.COW) { + return new DishCow(this.entity); + } + else if (entityType == EntityType.DONKEY) { + return new DishDonkey(this.entity); + } + else if (entityType == EntityType.FOX) { + return new DishFox(this.entity); + } + else if (entityType == EntityType.FROG) { + return new DishFrog(this.entity); + } + else if (entityType == EntityType.GLOW_SQUID) { + return new DishGlowSquid(this.entity); + } + else if (entityType == EntityType.HORSE) { + return new DishHorse(this.entity); + } + else if (entityType == EntityType.MOOSHROOM) { + return new DishMushroomCow(this.entity); + } + else if (entityType == EntityType.MULE) { + return new DishMule(this.entity); + } + else if (entityType == EntityType.OCELOT) { + return new DishOcelot(this.entity); + } + else if (entityType == EntityType.PARROT) { + return new DishParrot(this.entity); + } + else if (entityType == EntityType.PIG) { + return new DishPig(this.entity); + } + else if (entityType == EntityType.PUFFERFISH) { + return new DishPufferfish(this.entity); + } + else if (entityType == EntityType.RABBIT) { + return new DishRabbit(this.entity); + } + else if (entityType == EntityType.SALMON) { + return new DishSalmon(this.entity); + } + else if (entityType == EntityType.SHEEP) { + return new DishSheep(this.entity); + } + else if (entityType == EntityType.SKELETON_HORSE) { + return new DishSkeletonHorse(this.entity); + } + else if (entityType == EntityType.SNIFFER) { + return new DishSniffer(this.entity); + } + else if (entityType == EntityType.SNOW_GOLEM) { + return new DishSnowGolem(this.entity); + } + else if (entityType == EntityType.SQUID) { + return new DishSquid(this.entity); + } + else if (entityType == EntityType.STRIDER) { + return new DishStrider(this.entity); + } + else if (entityType == EntityType.TADPOLE) { + return new DishTadpole(this.entity); + } + else if (entityType == EntityType.TROPICAL_FISH) { + return new DishTropicalFish(this.entity); + } + else if (entityType == EntityType.TURTLE) { + return new DishTurtle(this.entity); + } + else if (entityType == EntityType.VILLAGER) { + return new DishVillager(this.entity); + } + else if (entityType == EntityType.WANDERING_TRADER) { + return new DishWanderingTrader(this.entity); + } + // Neutral mobs + else if (entityType == EntityType.BEE) { + return new DishBee(this.entity); + } + else if (entityType == EntityType.CAVE_SPIDER) { + return new DishCaveSpider(this.entity); + } + else if (entityType == EntityType.DOLPHIN) { + return new DishDolphin(this.entity); + } + else if (entityType == EntityType.ENDERMAN) { + return new DishEnderman(this.entity); + } + else if (entityType == EntityType.GOAT) { + return new DishGoat(this.entity); + } + else if (entityType == EntityType.IRON_GOLEM) { + return new DishIronGolem(this.entity); + } + else if (entityType == EntityType.LLAMA) { + return new DishLlama(this.entity); + } + else if (entityType == EntityType.PANDA) { + return new DishPanda(this.entity); + } + else if (entityType == EntityType.PIGLIN) { + return new DishPiglin(this.entity); + } + else if (entityType == EntityType.POLAR_BEAR) { + return new DishPolarBear(this.entity); + } + else if (entityType == EntityType.SPIDER) { + return new DishSpider(this.entity); + } + else if (entityType == EntityType.TRADER_LLAMA) { + return new DishTraderLlama(this.entity); + } + else if (entityType == EntityType.WOLF) { + return new DishWolf(this.entity); + } + else if (entityType == EntityType.ZOMBIFIED_PIGLIN) { + return new DishZombifiedPiglin(this.entity); + } + // Monster mobs + else if (entityType == EntityType.BLAZE) { + return new DishBlaze(this.entity); + } + else if (entityType == EntityType.BOGGED) { + return new DishBogged(this.entity); + } + else if (entityType == EntityType.CREEPER) { + return new DishCreeper(this.entity); + } + else if (entityType == EntityType.DROWNED) { + return new DishDrowned(this.entity); + } + else if (entityType == EntityType.ELDER_GUARDIAN) { + return new DishElderGuardian(this.entity); + } + else if (entityType == EntityType.ENDERMITE) { + return new DishEndermite(this.entity); + } + else if (entityType == EntityType.EVOKER) { + return new DishEvoker(this.entity); + } + else if (entityType == EntityType.GHAST) { + return new DishGhast(this.entity); + } + else if (entityType == EntityType.GUARDIAN) { + return new DishGuardian(this.entity); + } + else if (entityType == EntityType.HOGLIN) { + return new DishHoglin(this.entity); + } + else if (entityType == EntityType.HUSK) { + return new DishHusk(this.entity); + } + else if (entityType == EntityType.MAGMA_CUBE) { + return new DishMagmaCube(this.entity); + } + else if (entityType == EntityType.PHANTOM) { + return new DishPhantom(this.entity); + } + else if (entityType == EntityType.PIGLIN_BRUTE) { + return new DishPiglinBrute(this.entity); + } + else if (entityType == EntityType.PILLAGER) { + return new DishPillager(this.entity); + } + else if (entityType == EntityType.RAVAGER) { + return new DishRavager(this.entity); + } + else if (entityType == EntityType.SHULKER) { + return new DishShulker(this.entity); + } + else if (entityType == EntityType.SILVERFISH) { + return new DishSilverfish(this.entity); + } + else if (entityType == EntityType.SKELETON) { + return new DishSkeleton(this.entity); + } + else if (entityType == EntityType.SLIME) { + return new DishSlime(this.entity); + } + else if (entityType == EntityType.STRAY) { + return new DishStray(this.entity); + } + else if (entityType == EntityType.VEX) { + return new DishVex(this.entity); + } + else if (entityType == EntityType.VINDICATOR) { + return new DishVindicator(this.entity); + } + else if (entityType == EntityType.WARDEN) { + return new DishWarden(this.entity); + } + else if (entityType == EntityType.WITCH) { + return new DishWitch(this.entity); + } + else if (entityType == EntityType.WITHER_SKELETON) { + return new DishWitherSkeleton(this.entity); + } + else if (entityType == EntityType.ZOGLIN) { + return new DishZoglin(this.entity); + } + else if (entityType == EntityType.ZOMBIE) { + return new DishZombie(this.entity); + } + else if (entityType == EntityType.ZOMBIE_HORSE) { + return new DishZombieHorse(this.entity); + } + else if (entityType == EntityType.ZOMBIE_VILLAGER) { + return new DishZombieVillager(this.entity); + } + else if (entityType == EntityType.PLAYER) { + return new DishPlayer((ServerPlayer)this.entity); + } + else if (entityType == EntityType.ENDER_DRAGON || entityType == EntityType.WITHER || entityType == EntityType.BREEZE) { + return this; + } + else { + return null; + } + } + + @Override + @Nullable + public EntityTypes getType() { + if (this.entity == null) return null; + return EntityTypes.valueOf(this.entity.getType().getDescription().getString().toUpperCase().replace(" ", "_")); + } + + @Override + public boolean isSilent() { + return this.entity.isSilent(); + } + + @Override + public void setSilent(boolean b) { + this.entity.setSilent(b); + } + + @Override + public UUID getUUID() { + return this.entity.getUUID(); + } + + @Override + public float getHealth() { + return this.entity.getHealth(); + } + + @Override + public void setHealth(float health) { + this.entity.setHealth(health); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/DishPlayer.java b/patches/release/1.21.8/net/ouja/dish/entity/DishPlayer.java new file mode 100644 index 0000000..6c1e212 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/DishPlayer.java @@ -0,0 +1,96 @@ +package net.ouja.dish.entity; + +import net.minecraft.core.GlobalPos; +import net.minecraft.server.level.ClientInformation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.ouja.api.entity.Player; +import net.ouja.api.world.Level; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.dish.network.chat.DishComponent; +import net.ouja.dish.server.level.DishClientInformation; +import net.ouja.dish.world.DishLevel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.HashMap; +import java.util.UUID; + +public class DishPlayer extends DishEntity implements Player { + private net.minecraft.server.level.ServerPlayer player; + public static HashMap CACHED_PLAYERS = new HashMap<>(); + + public DishPlayer(ServerPlayer player) { + super(player); + this.player = player; + if (player != null) { + CACHED_PLAYERS.putIfAbsent(player.getUUID(), this); + } + } + + @Override + public @NotNull String getName() { + return player.getName().getString(); + } + + @Override + public @NotNull UUID getUUID() { + return player.getUUID(); + } + + @Override + public Level getLevel() { + if (isConsole()) return null; + return new DishLevel(player.getServer().getLevel(player.getCommandSenderWorld().dimension())); + } + + @Override + public boolean isConsole() { + return this.player == null; + } + + @Override + public void sendMessage(net.ouja.api.network.chat.Component component) { + this.player.sendSystemMessage(new DishComponent(component)); + } + + @Nullable + @Override + public BlockPos lastDeathLocation() { + GlobalPos globalPos = this.player.getLastDeathLocation().get(); + if (globalPos == null) return null; + return new BlockPos(globalPos.pos().getX(), globalPos.pos().getX(), globalPos.pos().getX(), new DishLevel((ServerLevel)this.player.level())); + } + + @Override + public double getReach() { + return this.player.blockInteractionRange(); + } + + @Override + public float getScale() { + return this.player.getScale(); + } + + @Override + public void setReach(double reach) { + if (reach >= 0) { + this.player.getAttribute(Attributes.BLOCK_INTERACTION_RANGE).setBaseValue(reach); + } + } + + @Override + public void setScale(float scale) { + if (scale >= 0) { + this.player.getAttribute(Attributes.SCALE).setBaseValue(scale); + } + } + + @NotNull + @Override + public DishClientInformation getClientInformation() { + ClientInformation info = this.player.clientInformation(); + return new DishClientInformation(info); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishBlaze.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishBlaze.java new file mode 100644 index 0000000..96e1e7c --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishBlaze.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Blaze; +import net.ouja.dish.entity.DishEntity; + +public class DishBlaze extends DishEntity implements net.ouja.api.entity.monster.Blaze { + private Blaze blaze; + + public DishBlaze(LivingEntity entity) { + super(entity); + this.blaze = (Blaze)entity; + } + + @Override + public boolean isOnFire() { + return this.blaze.isOnFire(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishBogged.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishBogged.java new file mode 100644 index 0000000..f36b1c3 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishBogged.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Bogged; +import net.ouja.dish.entity.DishEntity; + +public class DishBogged extends DishEntity implements net.ouja.api.entity.monster.Bogged { + private final Bogged bogged; + + public DishBogged(LivingEntity bogged) { + super(bogged); + this.bogged = (Bogged)bogged; + } + + @Override + public boolean isSheared() { + return this.bogged.isSheared(); + } + + @Override + public void setSheared(boolean b) { + this.bogged.setSheared(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishCreeper.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishCreeper.java new file mode 100644 index 0000000..a086963 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishCreeper.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Creeper; +import net.ouja.dish.entity.DishEntity; + +public class DishCreeper extends DishEntity implements net.ouja.api.entity.monster.Creeper { + private Creeper creeper; + + public DishCreeper(LivingEntity entity) { + super(entity); + this.creeper = (Creeper)entity; + } + + @Override + public boolean isCharged() { + return this.creeper.isPowered(); + } + + @Override + public boolean isIgnited() { + return this.creeper.isIgnited(); + } + + @Override + public void ignite() { + this.creeper.ignite(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishDrowned.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishDrowned.java new file mode 100644 index 0000000..67cde95 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishDrowned.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Drowned; +import net.ouja.dish.entity.DishEntity; + +public class DishDrowned extends DishEntity implements net.ouja.api.entity.monster.Drowned { + private Drowned drowned; + + public DishDrowned(LivingEntity entity) { + super(entity); + this.drowned = (Drowned)entity; + } + + @Override + public boolean isSwimming() { + return this.drowned.isVisuallySwimming(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishElderGuardian.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishElderGuardian.java new file mode 100644 index 0000000..c766ac0 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishElderGuardian.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.ElderGuardian; +import net.ouja.dish.entity.DishEntity; + +public class DishElderGuardian extends DishEntity implements net.ouja.api.entity.monster.ElderGuardian { + private ElderGuardian elderGuardian; + + public DishElderGuardian(LivingEntity entity) { + super(entity); + this.elderGuardian = (ElderGuardian)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishEndermite.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishEndermite.java new file mode 100644 index 0000000..9d310e3 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishEndermite.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Endermite; +import net.ouja.dish.entity.DishEntity; + +public class DishEndermite extends DishEntity implements net.ouja.api.entity.monster.Endermite { + private Endermite endermite; + + public DishEndermite(LivingEntity entity) { + super(entity); + this.endermite = (Endermite)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishEvoker.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishEvoker.java new file mode 100644 index 0000000..898865d --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishEvoker.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Evoker; +import net.ouja.dish.entity.DishEntity; + +public class DishEvoker extends DishEntity implements net.ouja.api.entity.monster.Evoker { + private Evoker evoker; + + public DishEvoker(LivingEntity entity) { + super(entity); + this.evoker = (Evoker)entity; + } + + @Override + public boolean isCastingSpell() { + return this.evoker.isCastingSpell(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishGhast.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishGhast.java new file mode 100644 index 0000000..8190814 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishGhast.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Ghast; +import net.ouja.dish.entity.DishEntity; + +public class DishGhast extends DishEntity implements net.ouja.api.entity.monster.Ghast { + private Ghast ghast; + + public DishGhast(LivingEntity entity) { + super(entity); + this.ghast = (Ghast)entity; + } + + @Override + public boolean isCharged() { + return this.ghast.isCharging(); + } + + @Override + public void setCharged(boolean b) { + this.ghast.setCharging(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishGuardian.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishGuardian.java new file mode 100644 index 0000000..6381401 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishGuardian.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Guardian; +import net.ouja.dish.entity.DishEntity; + +public class DishGuardian extends DishEntity implements net.ouja.api.entity.monster.Guardian { + private Guardian guardian; + + public DishGuardian(LivingEntity entity) { + super(entity); + this.guardian = (Guardian)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishHoglin.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishHoglin.java new file mode 100644 index 0000000..26efdb5 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishHoglin.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.hoglin.Hoglin; +import net.ouja.dish.entity.DishEntity; + +public class DishHoglin extends DishEntity implements net.ouja.api.entity.monster.Hoglin { + private Hoglin hoglin; + + public DishHoglin(LivingEntity entity) { + super(entity); + this.hoglin = (Hoglin)entity; + } + + @Override + public void setImmuneToZombification(boolean b) { + this.hoglin.setImmuneToZombification(b); + } + + @Override + public boolean isImmuneToZombification() { + return this.hoglin.isImmuneToZombification(); + } + + @Override + public boolean isConverting() { + return this.hoglin.isConverting(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishHusk.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishHusk.java new file mode 100644 index 0000000..cc1fb8a --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishHusk.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Husk; +import net.ouja.dish.entity.DishEntity; + +public class DishHusk extends DishEntity implements net.ouja.api.entity.monster.Husk { + private Husk husk; + + public DishHusk(LivingEntity entity) { + super(entity); + this.husk = (Husk)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishMagmaCube.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishMagmaCube.java new file mode 100644 index 0000000..026db1a --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishMagmaCube.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.MagmaCube; +import net.ouja.dish.entity.DishEntity; + +public class DishMagmaCube extends DishEntity implements net.ouja.api.entity.monster.MagmaCube { + private MagmaCube magmaCube; + + public DishMagmaCube(LivingEntity entity) { + super(entity); + this.magmaCube = (MagmaCube)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPhantom.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPhantom.java new file mode 100644 index 0000000..4a0d826 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPhantom.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Phantom; +import net.ouja.dish.entity.DishEntity; + +public class DishPhantom extends DishEntity implements net.ouja.api.entity.monster.Phantom { + private Phantom phantom; + + public DishPhantom(LivingEntity entity) { + super(entity); + this.phantom = (Phantom)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPiglinBrute.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPiglinBrute.java new file mode 100644 index 0000000..75ec5a9 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPiglinBrute.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.piglin.PiglinBrute; +import net.ouja.dish.entity.DishEntity; + +public class DishPiglinBrute extends DishEntity implements net.ouja.api.entity.monster.PiglinBrute { + private PiglinBrute piglinBrute; + + public DishPiglinBrute(LivingEntity entity) { + super(entity); + this.piglinBrute = (PiglinBrute)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPillager.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPillager.java new file mode 100644 index 0000000..fc99dae --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishPillager.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Pillager; +import net.ouja.dish.entity.DishEntity; + +public class DishPillager extends DishEntity implements net.ouja.api.entity.monster.Pillager { + private Pillager pillager; + + public DishPillager(LivingEntity entity) { + super(entity); + this.pillager = (Pillager)entity; + } + + @Override + public boolean isChargingCrossbow() { + return this.pillager.isChargingCrossbow(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishRavager.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishRavager.java new file mode 100644 index 0000000..b570063 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishRavager.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Ravager; +import net.ouja.dish.entity.DishEntity; + +public class DishRavager extends DishEntity implements net.ouja.api.entity.monster.Ravager { + private Ravager ravager; + + public DishRavager(LivingEntity entity) { + super(entity); + this.ravager = (Ravager)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishShulker.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishShulker.java new file mode 100644 index 0000000..59469c6 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishShulker.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Shulker; +import net.ouja.dish.entity.DishEntity; + +public class DishShulker extends DishEntity implements net.ouja.api.entity.monster.Shulker { + private Shulker shulker; + + public DishShulker(LivingEntity entity) { + super(entity); + this.shulker = (Shulker)entity; + } + + @Override + public boolean isClosed() { + return this.shulker.isClosed(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSilverfish.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSilverfish.java new file mode 100644 index 0000000..1fe67c2 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSilverfish.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Silverfish; +import net.ouja.dish.entity.DishEntity; + +public class DishSilverfish extends DishEntity implements net.ouja.api.entity.monster.Silverfish { + private Silverfish silverfish; + + public DishSilverfish(LivingEntity entity) { + super(entity); + this.silverfish = (Silverfish)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSkeleton.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSkeleton.java new file mode 100644 index 0000000..2a03add --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSkeleton.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Skeleton; +import net.ouja.dish.entity.DishEntity; + +public class DishSkeleton extends DishEntity implements net.ouja.api.entity.monster.Skeleton { + private Skeleton skeleton; + + public DishSkeleton(LivingEntity entity) { + super(entity); + this.skeleton = (Skeleton)entity; + } + + @Override + public boolean isShaking() { + return this.skeleton.isShaking(); + } + + @Override + public void setShaking(boolean b) { + this.skeleton.setFreezeConverting(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSlime.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSlime.java new file mode 100644 index 0000000..064cca1 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishSlime.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Slime; +import net.ouja.dish.entity.DishEntity; + +public class DishSlime extends DishEntity implements net.ouja.api.entity.monster.Slime { + private Slime slime; + + public DishSlime(LivingEntity entity) { + super(entity); + this.slime = (Slime)entity; + } + + @Override + public int getSize() { + return this.slime.getSize(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishStray.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishStray.java new file mode 100644 index 0000000..e69df7f --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishStray.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Stray; +import net.ouja.dish.entity.DishEntity; + +public class DishStray extends DishEntity implements net.ouja.api.entity.monster.Stray { + private Stray stray; + + public DishStray(LivingEntity entity) { + super(entity); + this.stray = (Stray)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishVex.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishVex.java new file mode 100644 index 0000000..1369b65 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishVex.java @@ -0,0 +1,22 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Vex; +import net.ouja.dish.entity.DishEntity; +import org.jetbrains.annotations.Nullable; + +public class DishVex extends DishEntity implements net.ouja.api.entity.monster.Vex { + private Vex vex; + + public DishVex(LivingEntity entity) { + super(entity); + this.vex = (Vex)entity; + } + + @Override + @Nullable + public net.ouja.api.entity.Entity getOwner() { + if (this.vex.getOwner() == null) return null; + return new DishEntity(this.vex.getOwner()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishVindicator.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishVindicator.java new file mode 100644 index 0000000..68b2e98 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishVindicator.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Vindicator; +import net.ouja.dish.entity.DishEntity; + +public class DishVindicator extends DishEntity implements net.ouja.api.entity.monster.Vindicator { + private Vindicator vindicator; + + public DishVindicator(LivingEntity entity) { + super(entity); + this.vindicator = (Vindicator)entity; + } + + @Override + public boolean isJohnny() { + return this.vindicator.isJohnny(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWarden.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWarden.java new file mode 100644 index 0000000..aa71aba --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWarden.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.warden.Warden; +import net.ouja.dish.entity.DishEntity; + +public class DishWarden extends DishEntity implements net.ouja.api.entity.monster.Warden { + private Warden warden; + + public DishWarden(LivingEntity entity) { + super(entity); + this.warden = (Warden)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWitch.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWitch.java new file mode 100644 index 0000000..06111f9 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWitch.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Witch; +import net.ouja.dish.entity.DishEntity; + +public class DishWitch extends DishEntity implements net.ouja.api.entity.monster.Witch { + private Witch witch; + + public DishWitch(LivingEntity entity) { + super(entity); + this.witch = (Witch)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWitherSkeleton.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWitherSkeleton.java new file mode 100644 index 0000000..f35dfee --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishWitherSkeleton.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.WitherSkeleton; +import net.ouja.dish.entity.DishEntity; + +public class DishWitherSkeleton extends DishEntity implements net.ouja.api.entity.monster.WitherSkeleton { + private WitherSkeleton witherSkeleton; + + public DishWitherSkeleton(LivingEntity entity) { + super(entity); + this.witherSkeleton = (WitherSkeleton)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZoglin.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZoglin.java new file mode 100644 index 0000000..03b39f7 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZoglin.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Zoglin; +import net.ouja.dish.entity.DishEntity; + +public class DishZoglin extends DishEntity implements net.ouja.api.entity.monster.Zoglin { + private Zoglin zoglin; + + public DishZoglin(LivingEntity entity) { + super(entity); + this.zoglin = (Zoglin)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombie.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombie.java new file mode 100644 index 0000000..ae8b412 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombie.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Zombie; +import net.ouja.dish.entity.DishEntity; + +public class DishZombie extends DishEntity implements net.ouja.api.entity.monster.Zombie { + private Zombie zombie; + + public DishZombie(LivingEntity entity) { + super(entity); + this.zombie = (Zombie)entity; + } + + @Override + public boolean isConverting() { + return this.zombie.isUnderWaterConverting(); + } + + @Override + public boolean canBreakDoors() { + return this.zombie.canBreakDoors(); + } + + @Override + public void setCanBreakDoors(boolean b) { + this.zombie.setCanBreakDoors(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombieHorse.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombieHorse.java new file mode 100644 index 0000000..865cb3d --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombieHorse.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.ZombieHorse; +import net.ouja.dish.entity.DishEntity; + +public class DishZombieHorse extends DishEntity implements net.ouja.api.entity.monster.ZombieHorse { + private ZombieHorse zombieHorse; + + public DishZombieHorse(LivingEntity entity) { + super(entity); + this.zombieHorse = (ZombieHorse)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombieVillager.java b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombieVillager.java new file mode 100644 index 0000000..8b743f4 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/monster/DishZombieVillager.java @@ -0,0 +1,13 @@ +package net.ouja.dish.entity.monster; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.ZombieVillager; + +public class DishZombieVillager extends DishZombie implements net.ouja.api.entity.monster.ZombieVillager { + private ZombieVillager zombieVillager; + + public DishZombieVillager(LivingEntity entity) { + super(entity); + this.zombieVillager = (ZombieVillager)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishBee.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishBee.java new file mode 100644 index 0000000..1f34df6 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishBee.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Bee; +import net.ouja.dish.entity.DishEntity; + +public class DishBee extends DishEntity implements net.ouja.api.entity.neutral.Bee { + private Bee bee; + + public DishBee(LivingEntity entity) { + super(entity); + this.bee = (Bee)entity; + } + + @Override + public boolean hasNectar() { + return this.bee.hasNectar(); + } + + @Override + public boolean hasStung() { + return this.bee.hasStung(); + } + + @Override + public boolean isAngry() { + return this.bee.isAngry(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishCaveSpider.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishCaveSpider.java new file mode 100644 index 0000000..1c58fea --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishCaveSpider.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.CaveSpider; +import net.ouja.dish.entity.DishEntity; + +public class DishCaveSpider extends DishEntity implements net.ouja.api.entity.neutral.CaveSpider { + private CaveSpider caveSpider; + + public DishCaveSpider(LivingEntity entity) { + super(entity); + this.caveSpider = (CaveSpider)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishDolphin.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishDolphin.java new file mode 100644 index 0000000..62e4360 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishDolphin.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Dolphin; +import net.ouja.dish.entity.DishEntity; + +public class DishDolphin extends DishEntity { + private Dolphin dolphin; + + public DishDolphin(LivingEntity entity) { + super(entity); + this.dolphin = (Dolphin)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishEnderman.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishEnderman.java new file mode 100644 index 0000000..c71a750 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishEnderman.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.EnderMan; +import net.ouja.dish.entity.DishEntity; + +public class DishEnderman extends DishEntity { + private EnderMan enderMan; + + public DishEnderman(LivingEntity entity) { + super(entity); + this.enderMan = (EnderMan)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishGoat.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishGoat.java new file mode 100644 index 0000000..2002f3e --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishGoat.java @@ -0,0 +1,39 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.goat.Goat; +import net.ouja.dish.entity.DishEntity; + +public class DishGoat extends DishEntity implements net.ouja.api.entity.neutral.Goat { + private Goat goat; + + public DishGoat(LivingEntity entity) { + super(entity); + this.goat = (Goat)entity; + } + + @Override + public boolean hasLeftHorn() { + return this.goat.hasLeftHorn(); + } + + @Override + public boolean hasRightHorn() { + return this.goat.hasRightHorn(); + } + + @Override + public void addHorns() { + this.goat.addHorns(); + } + + @Override + public void removeHorns() { + this.goat.removeHorns(); + } + + @Override + public boolean isScreamingGoat() { + return this.goat.isScreamingGoat(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishIronGolem.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishIronGolem.java new file mode 100644 index 0000000..0067562 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishIronGolem.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.IronGolem; +import net.ouja.dish.entity.DishEntity; + +public class DishIronGolem extends DishEntity implements net.ouja.api.entity.neutral.IronGolem { + private IronGolem ironGolem; + + public DishIronGolem(LivingEntity entity) { + super(entity); + this.ironGolem = (IronGolem)entity; + } + + @Override + public boolean isPlayerCreated() { + return this.ironGolem.isPlayerCreated(); + } + + @Override + public Crack getCrackiness() { + return Crack.valueOf(this.ironGolem.getCrackiness().name()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishLlama.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishLlama.java new file mode 100644 index 0000000..cc1510c --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishLlama.java @@ -0,0 +1,20 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.Llama; +import net.ouja.api.entity.neutral.LlamaVariants; +import net.ouja.dish.entity.DishEntity; + +public class DishLlama extends DishEntity implements net.ouja.api.entity.neutral.Llama { + private Llama llama; + + public DishLlama(LivingEntity entity) { + super(entity); + this.llama = (Llama)entity; + } + + @Override + public LlamaVariants getVariant() { + return LlamaVariants.valueOf(this.llama.getVariant().name()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPanda.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPanda.java new file mode 100644 index 0000000..d07cc2f --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPanda.java @@ -0,0 +1,44 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Panda; +import net.ouja.dish.entity.DishEntity; + +public class DishPanda extends DishEntity implements net.ouja.api.entity.neutral.Panda { + private Panda panda; + + public DishPanda(LivingEntity entity) { + super(entity); + this.panda = (Panda)entity; + } + + @Override + public boolean isSitting() { + return this.panda.isSitting(); + } + + @Override + public boolean isSneezing() { + return this.panda.isSneezing(); + } + + @Override + public boolean isOnBack() { + return this.panda.isOnBack(); + } + + @Override + public boolean isEating() { + return this.panda.isEating(); + } + + @Override + public boolean isRolling() { + return this.panda.isRolling(); + } + + @Override + public void sneeze(boolean b) { + this.panda.sneeze(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPiglin.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPiglin.java new file mode 100644 index 0000000..4ad4f86 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPiglin.java @@ -0,0 +1,34 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.piglin.Piglin; +import net.ouja.dish.entity.DishEntity; + +public class DishPiglin extends DishEntity implements net.ouja.api.entity.neutral.Piglin { + private Piglin piglin; + + public DishPiglin(LivingEntity entity) { + super(entity); + this.piglin = (Piglin)entity; + } + + @Override + public boolean canHunt() { + return this.piglin.canHunt(); + } + + @Override + public void setCanHunt(boolean b) { + this.piglin.setCannotHunt(b); + } + + @Override + public boolean isDancing() { + return this.piglin.isDancing(); + } + + @Override + public void setDancing(boolean b) { + this.piglin.setDancing(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPolarBear.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPolarBear.java new file mode 100644 index 0000000..603cde0 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishPolarBear.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.PolarBear; +import net.ouja.dish.entity.DishEntity; + +public class DishPolarBear extends DishEntity implements net.ouja.api.entity.neutral.PolarBear { + private PolarBear polarBear; + + public DishPolarBear(LivingEntity entity) { + super(entity); + this.polarBear = (PolarBear)entity; + } + + @Override + public boolean isStanding() { + return this.polarBear.isStanding(); + } + + @Override + public void setStanding(boolean b) { + this.polarBear.setStanding(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishSpider.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishSpider.java new file mode 100644 index 0000000..fb50e74 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishSpider.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Spider; +import net.ouja.dish.entity.DishEntity; + +public class DishSpider extends DishEntity implements net.ouja.api.entity.neutral.Spider { + private Spider spider; + + public DishSpider(LivingEntity entity) { + super(entity); + this.spider = (Spider)entity; + } + + @Override + public boolean isClimbing() { + return this.spider.isClimbing(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishTraderLlama.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishTraderLlama.java new file mode 100644 index 0000000..2f57626 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishTraderLlama.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.TraderLlama; +import net.ouja.dish.entity.DishEntity; + +public class DishTraderLlama extends DishEntity implements net.ouja.api.entity.neutral.TraderLlama { + private TraderLlama traderLlama; + + public DishTraderLlama(LivingEntity entity) { + super(entity); + this.traderLlama = (TraderLlama)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishWolf.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishWolf.java new file mode 100644 index 0000000..e29c493 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishWolf.java @@ -0,0 +1,29 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Wolf; +import net.ouja.dish.entity.DishEntity; + +public class DishWolf extends DishEntity implements net.ouja.api.entity.neutral.Wolf { + private Wolf wolf; + + public DishWolf(LivingEntity entity) { + super(entity); + this.wolf = (Wolf)entity; + } + + @Override + public boolean isWet() { + return this.wolf.isWet(); + } + + @Override + public float getTailAngle() { + return this.wolf.getTailAngle(); + } + + @Override + public boolean isInterested() { + return this.wolf.isInterested(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishZombifiedPiglin.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishZombifiedPiglin.java new file mode 100644 index 0000000..6130b23 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishZombifiedPiglin.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.neutral; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.ZombifiedPiglin; +import net.ouja.dish.entity.DishEntity; + +public class DishZombifiedPiglin extends DishEntity implements net.ouja.api.entity.neutral.ZombifiedPiglin { + private ZombifiedPiglin zombifiedPiglin; + + public DishZombifiedPiglin(LivingEntity entity) { + super(entity); + this.zombifiedPiglin = (ZombifiedPiglin)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishAllay.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishAllay.java new file mode 100644 index 0000000..93138cc --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishAllay.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.allay.Allay; +import net.ouja.dish.entity.DishEntity; + +public class DishAllay extends DishEntity implements net.ouja.api.entity.passive.Allay { + private Allay allay; + + public DishAllay(LivingEntity entity) { + super(entity); + this.allay = (Allay)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishArmadillo.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishArmadillo.java new file mode 100644 index 0000000..2ee6cea --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishArmadillo.java @@ -0,0 +1,34 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.armadillo.Armadillo; +import net.ouja.dish.entity.DishEntity; + +public class DishArmadillo extends DishEntity implements net.ouja.api.entity.passive.Armadillo { + private final Armadillo armadillo; + + public DishArmadillo(LivingEntity entity) { + super(entity); + this.armadillo = (Armadillo)entity; + } + + @Override + public boolean isScared() { + return this.armadillo.isScared(); + } + + @Override + public void setScared(boolean scared) { + this.armadillo.switchToState(scared ? Armadillo.ArmadilloState.SCARED : Armadillo.ArmadilloState.IDLE); + } + + @Override + public void rollUp() { + this.armadillo.rollUp(); + } + + @Override + public void rollOut() { + this.armadillo.rollOut(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishAxolotl.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishAxolotl.java new file mode 100644 index 0000000..08b0df2 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishAxolotl.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.axolotl.Axolotl; +import net.ouja.dish.entity.DishEntity; + +public class DishAxolotl extends DishEntity implements net.ouja.api.entity.passive.Axolotl { + private Axolotl axolotl; + + public DishAxolotl(LivingEntity entity) { + super(entity); + this.axolotl = (Axolotl)entity; + } + + @Override + public String getVariant() { + return this.axolotl.getVariant().getName(); + } + + @Override + public boolean isFromBucket() { + return this.axolotl.fromBucket(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishBat.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishBat.java new file mode 100644 index 0000000..dc7b6bf --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishBat.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ambient.Bat; +import net.ouja.dish.entity.DishEntity; + +public class DishBat extends DishEntity implements net.ouja.api.entity.passive.Bat { + private Bat bat; + + public DishBat(LivingEntity entity) { + super(entity); + this.bat = (Bat)entity; + } + + @Override + public boolean isResting() { + return this.bat.isResting(); + } + + @Override + public void setResting(boolean b) { + this.bat.setResting(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCamel.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCamel.java new file mode 100644 index 0000000..b7f5726 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCamel.java @@ -0,0 +1,39 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.camel.Camel; +import net.ouja.dish.entity.DishEntity; + +public class DishCamel extends DishEntity implements net.ouja.api.entity.passive.Camel { + private Camel camel; + + public DishCamel(LivingEntity entity) { + super(entity); + this.camel = (Camel)entity; + } + + @Override + public boolean isSitting() { + return this.camel.isCamelSitting(); + } + + @Override + public boolean isDashing() { + return this.camel.isDashing(); + } + + @Override + public void setDashing(boolean b) { + this.camel.setDashing(b); + } + + @Override + public void sitDown() { + this.camel.sitDown(); + } + + @Override + public void standUp() { + this.camel.standUp(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCat.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCat.java new file mode 100644 index 0000000..c48cb32 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCat.java @@ -0,0 +1,34 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Cat; +import net.ouja.dish.entity.DishEntity; + +public class DishCat extends DishEntity implements net.ouja.api.entity.passive.Cat { + private Cat cat; + + public DishCat(LivingEntity entity) { + super(entity); + this.cat = (net.minecraft.world.entity.animal.Cat)entity; + } + + @Override + public String getBreed() { + return cat.getVariant().toString(); + } + + @Override + public boolean isLaying() { + return cat.isLying(); + } + + @Override + public void hiss() { + cat.hiss(); + } + + @Override + public void setLaying(boolean b) { + cat.setLying(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishChicken.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishChicken.java new file mode 100644 index 0000000..71a3223 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishChicken.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Chicken; +import net.ouja.dish.entity.DishEntity; + +public class DishChicken extends DishEntity implements net.ouja.api.entity.passive.Chicken { + private Chicken chicken; + + public DishChicken(LivingEntity entity) { + super(entity); + this.chicken = (Chicken)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCod.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCod.java new file mode 100644 index 0000000..61be7f6 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCod.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Cod; +import net.ouja.dish.entity.DishEntity; + +public class DishCod extends DishEntity implements net.ouja.api.entity.passive.Cod { + private Cod cod; + + public DishCod(LivingEntity entity) { + super(entity); + this.cod = (Cod)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCow.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCow.java new file mode 100644 index 0000000..562ff67 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishCow.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Cow; +import net.ouja.dish.entity.DishEntity; + +public class DishCow extends DishEntity implements net.ouja.api.entity.passive.Cow { + private Cow cow; + + public DishCow(LivingEntity entity) { + super(entity); + this.cow = (Cow)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishDonkey.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishDonkey.java new file mode 100644 index 0000000..177ca85 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishDonkey.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.Donkey; +import net.ouja.dish.entity.DishEntity; + +public class DishDonkey extends DishEntity implements net.ouja.api.entity.passive.Donkey { + private Donkey donkey; + + public DishDonkey(LivingEntity entity) { + super(entity); + this.donkey = (Donkey)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishFox.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishFox.java new file mode 100644 index 0000000..b004669 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishFox.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Fox; +import net.ouja.dish.entity.DishEntity; + +public class DishFox extends DishEntity implements net.ouja.api.entity.passive.Fox { + private Fox fox; + + public DishFox(LivingEntity entity) { + super(entity); + this.fox = (Fox)entity; + } + + @Override + public String getVariant() { + return this.fox.getVariant().getSerializedName(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishFrog.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishFrog.java new file mode 100644 index 0000000..9f8c567 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishFrog.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.frog.Frog; +import net.ouja.dish.entity.DishEntity; + +public class DishFrog extends DishEntity implements net.ouja.api.entity.passive.Frog { + private Frog frog; + + public DishFrog(LivingEntity entity) { + super(entity); + this.frog = (Frog)entity; + } + + @Override + public String getVariant() { + return this.frog.getVariant().toString(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishGlowSquid.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishGlowSquid.java new file mode 100644 index 0000000..6165e85 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishGlowSquid.java @@ -0,0 +1,13 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.GlowSquid; + +public class DishGlowSquid extends DishSquid implements net.ouja.api.entity.passive.GlowSquid { + private GlowSquid glowSquid; + + public DishGlowSquid(LivingEntity entity) { + super(entity); + this.glowSquid = (GlowSquid)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishHorse.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishHorse.java new file mode 100644 index 0000000..9c2df85 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishHorse.java @@ -0,0 +1,26 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.Horse; +import net.ouja.api.entity.passive.HorseMarkings; +import net.ouja.api.entity.passive.HorseTypes; +import net.ouja.dish.entity.DishEntity; + +public class DishHorse extends DishEntity implements net.ouja.api.entity.passive.Horse { + private Horse horse; + + public DishHorse(LivingEntity entity) { + super(entity); + this.horse = (Horse)entity; + } + + @Override + public HorseTypes getVariant() { + return HorseTypes.valueOf(this.horse.getVariant().name()); + } + + @Override + public HorseMarkings getMarkings() { + return HorseMarkings.valueOf(this.horse.getMarkings().name()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishMule.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishMule.java new file mode 100644 index 0000000..1eeb258 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishMule.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.Mule; +import net.ouja.dish.entity.DishEntity; + +public class DishMule extends DishEntity implements net.ouja.api.entity.passive.Mule { + private Mule mule; + + public DishMule(LivingEntity entity) { + super(entity); + this.mule = (Mule)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishMushroomCow.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishMushroomCow.java new file mode 100644 index 0000000..925e5c2 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishMushroomCow.java @@ -0,0 +1,22 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.MushroomCow; +import net.ouja.api.entity.passive.MooshroomCow; +import net.ouja.api.entity.passive.MooshroomCowTypes; +import net.ouja.dish.entity.DishEntity; + +public class DishMushroomCow extends DishEntity implements MooshroomCow { + private MushroomCow mushroomCow; + + public DishMushroomCow(LivingEntity entity) { + super(entity); + this.mushroomCow = (MushroomCow)entity; + this.mushroomCow.getVariant(); + } + + @Override + public MooshroomCowTypes getVariant() { + return MooshroomCowTypes.valueOf(this.mushroomCow.getVariant().name()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishOcelot.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishOcelot.java new file mode 100644 index 0000000..28ce08a --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishOcelot.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Ocelot; +import net.ouja.dish.entity.DishEntity; + +public class DishOcelot extends DishEntity implements net.ouja.api.entity.passive.Ocelot { + private Ocelot ocelot; + + public DishOcelot(LivingEntity entity) { + super(entity); + this.ocelot = (Ocelot)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishParrot.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishParrot.java new file mode 100644 index 0000000..a6aee12 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishParrot.java @@ -0,0 +1,20 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Parrot; +import net.ouja.api.entity.passive.ParrotTypes; +import net.ouja.dish.entity.DishEntity; + +public class DishParrot extends DishEntity implements net.ouja.api.entity.passive.Parrot { + private Parrot parrot; + + public DishParrot(LivingEntity entity) { + super(entity); + this.parrot = (Parrot)entity; + } + + @Override + public ParrotTypes getVariant() { + return ParrotTypes.valueOf(this.parrot.getVariant().name()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPig.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPig.java new file mode 100644 index 0000000..6966440 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPig.java @@ -0,0 +1,30 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Pig; +import net.ouja.dish.entity.DishEntity; + +public class DishPig extends DishEntity implements net.ouja.api.entity.passive.Pig { + private Pig pig; + + public DishPig(LivingEntity entity) { + super(entity); + this.pig = (Pig)entity; + } + + @Override + public boolean canSaddle() { + return this.pig.isSaddleable(); + } + + @Override + public boolean isSaddled() { + return this.pig.isSaddled(); + } + + @Override + public void equipSaddle() { + this.pig.equipSaddle(null, SoundSource.BLOCKS); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPufferfish.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPufferfish.java new file mode 100644 index 0000000..d3ed781 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPufferfish.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Pufferfish; +import net.ouja.dish.entity.DishEntity; + +public class DishPufferfish extends DishEntity implements net.ouja.api.entity.passive.Pufferfish { + private Pufferfish pufferfish; + + public DishPufferfish(LivingEntity entity) { + super(entity); + this.pufferfish = (Pufferfish)entity; + } + + @Override + public int getPuffState() { + return this.pufferfish.getPuffState(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishRabbit.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishRabbit.java new file mode 100644 index 0000000..4f87ab7 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishRabbit.java @@ -0,0 +1,20 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Rabbit; +import net.ouja.api.entity.passive.RabbitVariants; +import net.ouja.dish.entity.DishEntity; + +public class DishRabbit extends DishEntity implements net.ouja.api.entity.passive.Rabbit { + private Rabbit rabbit; + + public DishRabbit(LivingEntity entity) { + super(entity); + this.rabbit = (Rabbit)entity; + } + + @Override + public RabbitVariants getVariant() { + return RabbitVariants.valueOf(this.rabbit.getVariant().name()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSalmon.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSalmon.java new file mode 100644 index 0000000..5c110b4 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSalmon.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Salmon; +import net.ouja.dish.entity.DishEntity; + +public class DishSalmon extends DishEntity implements net.ouja.api.entity.passive.Salmon { + private Salmon salmon; + + public DishSalmon(LivingEntity entity) { + super(entity); + this.salmon = (Salmon)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSheep.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSheep.java new file mode 100644 index 0000000..689f72b --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSheep.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Sheep; +import net.ouja.dish.entity.DishEntity; + +public class DishSheep extends DishEntity implements net.ouja.api.entity.passive.Sheep { + private final Sheep sheep; + + public DishSheep(LivingEntity entity) { + super(entity); + this.sheep = (Sheep)entity; + } + + @Override + public boolean isSheared() { + return this.sheep.isSheared(); + } + + @Override + public void setSheared(boolean b) { + this.sheep.setSheared(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSkeletonHorse.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSkeletonHorse.java new file mode 100644 index 0000000..59860c4 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSkeletonHorse.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.horse.SkeletonHorse; +import net.ouja.dish.entity.DishEntity; + +public class DishSkeletonHorse extends DishEntity implements net.ouja.api.entity.passive.SkeletonHorse { + private SkeletonHorse skeletonHorse; + + public DishSkeletonHorse(LivingEntity entity) { + super(entity); + this.skeletonHorse = (SkeletonHorse)entity; + } + + @Override + public boolean isTrap() { + return this.skeletonHorse.isTrap(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSniffer.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSniffer.java new file mode 100644 index 0000000..a53f22b --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSniffer.java @@ -0,0 +1,35 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.sniffer.Sniffer; +import net.ouja.api.entity.passive.SnifferState; +import net.ouja.dish.entity.DishEntity; + +public class DishSniffer extends DishEntity implements net.ouja.api.entity.passive.Sniffer { + private Sniffer sniffer; + + public DishSniffer(LivingEntity entity) { + super(entity); + this.sniffer = (Sniffer)entity; + } + + @Override + public boolean isPanicked() { + return this.sniffer.isPanicking(); + } + + @Override + public boolean isSearching() { + return this.sniffer.isSearching(); + } + + @Override + public boolean isTempted() { + return this.sniffer.isTempted(); + } + + @Override + public SnifferState getState() { + return SnifferState.valueOf(this.sniffer.getState().name()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSnowGolem.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSnowGolem.java new file mode 100644 index 0000000..2dff40d --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSnowGolem.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.SnowGolem; +import net.ouja.dish.entity.DishEntity; + +public class DishSnowGolem extends DishEntity implements net.ouja.api.entity.passive.SnowGolem { + private SnowGolem snowGolem; + + public DishSnowGolem(LivingEntity entity) { + super(entity); + this.snowGolem = (SnowGolem)entity; + } + + @Override + public boolean isWearingPumpkin() { + return this.snowGolem.hasPumpkin(); + } + + @Override + public void setWearingPumpkin(boolean b) { + this.snowGolem.setPumpkin(b); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSquid.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSquid.java new file mode 100644 index 0000000..a7f3395 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSquid.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Squid; +import net.ouja.dish.entity.DishEntity; + +public class DishSquid extends DishEntity implements net.ouja.api.entity.passive.Squid { + private Squid squid; + + public DishSquid(LivingEntity entity) { + super(entity); + this.squid = (Squid)entity; + } + + @Override + public void ink() { + this.squid.spawnInk(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishStrider.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishStrider.java new file mode 100644 index 0000000..918984d --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishStrider.java @@ -0,0 +1,30 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.monster.Strider; +import net.ouja.dish.entity.DishEntity; + +public class DishStrider extends DishEntity implements net.ouja.api.entity.passive.Strider { + private Strider strider; + + public DishStrider(LivingEntity entity) { + super(entity); + this.strider = (Strider)entity; + } + + @Override + public boolean canSaddle() { + return this.strider.isSaddleable(); + } + + @Override + public boolean isSaddled() { + return this.strider.isSaddled(); + } + + @Override + public void equipSaddle() { + this.strider.equipSaddle(null, SoundSource.BLOCKS); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTadpole.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTadpole.java new file mode 100644 index 0000000..2e667ab --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTadpole.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.frog.Tadpole; +import net.ouja.dish.entity.DishEntity; + +public class DishTadpole extends DishEntity implements net.ouja.api.entity.passive.Tadpole { + private Tadpole tadpole; + + public DishTadpole(LivingEntity entity) { + super(entity); + this.tadpole = (Tadpole)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTropicalFish.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTropicalFish.java new file mode 100644 index 0000000..4cc5ad1 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTropicalFish.java @@ -0,0 +1,19 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.TropicalFish; +import net.ouja.dish.entity.DishEntity; + +public class DishTropicalFish extends DishEntity implements net.ouja.api.entity.passive.TropicalFish { + private TropicalFish tropicalFish; + + public DishTropicalFish(LivingEntity entity) { + super(entity); + this.tropicalFish = (TropicalFish)entity; + } + + @Override + public net.ouja.api.entity.passive.TropicalFish.Variants getVariant() { + return net.ouja.api.entity.passive.TropicalFish.Variants.valueOf(this.tropicalFish.getVariant().name()); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTurtle.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTurtle.java new file mode 100644 index 0000000..2156252 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTurtle.java @@ -0,0 +1,24 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.Turtle; +import net.ouja.dish.entity.DishEntity; + +public class DishTurtle extends DishEntity implements net.ouja.api.entity.passive.Turtle { + private Turtle turtle; + + public DishTurtle(LivingEntity entity) { + super(entity); + this.turtle = (Turtle)entity; + } + + @Override + public boolean hasEgg() { + return this.turtle.hasEgg(); + } + + @Override + public boolean isLayingEgg() { + return this.turtle.isLayingEgg(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishVillager.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishVillager.java new file mode 100644 index 0000000..2dd626d --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishVillager.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.npc.Villager; +import net.ouja.dish.entity.DishEntity; + +public class DishVillager extends DishEntity implements net.ouja.api.entity.passive.Villager { + private Villager villager; + + public DishVillager(LivingEntity entity) { + super(entity); + this.villager = (Villager)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishWanderingTrader.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishWanderingTrader.java new file mode 100644 index 0000000..e33072d --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishWanderingTrader.java @@ -0,0 +1,14 @@ +package net.ouja.dish.entity.passive; + +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.npc.WanderingTrader; +import net.ouja.dish.entity.DishEntity; + +public class DishWanderingTrader extends DishEntity implements net.ouja.api.entity.passive.WanderingTrader { + private WanderingTrader wanderingTrader; + + public DishWanderingTrader(LivingEntity entity) { + super(entity); + this.wanderingTrader = (WanderingTrader)entity; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/network/chat/DishComponent.java b/patches/release/1.21.8/net/ouja/dish/network/chat/DishComponent.java new file mode 100644 index 0000000..7482fd5 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/network/chat/DishComponent.java @@ -0,0 +1,82 @@ +package net.ouja.dish.network.chat; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.ComponentContents; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; +import net.minecraft.network.chat.TextColor; +import net.minecraft.util.FormattedCharSequence; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +public class DishComponent implements Component { + private final Component component; + + public DishComponent(net.ouja.api.network.chat.Component fakeComponent) { + this.component = Component.literal(fakeComponent.getString()) + .setStyle( + Style.EMPTY + .withColor(TextColor.parseColor(fakeComponent.getColor()).getOrThrow()) + .withBold(fakeComponent.isBold()) + .withUnderlined(fakeComponent.isUnderlined()) + .withStrikethrough(fakeComponent.isStrikeThrough()) + .withItalic(fakeComponent.isItalic()) + ); + } + + @Override + public Style getStyle() { + return this.component.getStyle(); + } + + @Override + public ComponentContents getContents() { + return this.component.getContents(); + } + + @Override + public @NotNull String getString() { + return this.component.getString(); + } + + @Override + public List getSiblings() { + return this.component.getSiblings(); + } + + @Override + public FormattedCharSequence getVisualOrderText() { + return this.component.getVisualOrderText(); + } + + /** + * Converts a vanilla component into Dish's version of component + * @param component vanilla component class + * @return DishComponent + */ + public static net.ouja.api.network.chat.Component fromComponent(Component component) { + return net.ouja.api.network.chat.Component.create(component.getString(), component.getStyle().isBold(), component.getStyle().isUnderlined(), component.getStyle().isStrikethrough(), component.getStyle().isItalic()); + } + + public static net.ouja.api.network.chat.Component[] fromComponent(Component[] componentsIn) { + net.ouja.api.network.chat.Component[] components = new net.ouja.api.network.chat.Component[componentsIn.length]; + + for (int i = 0; i < components.length; i++) { + Component component = componentsIn[i]; + components[i] = fromComponent(component); + } + + return components; + } + + public static MutableComponent toComponent(net.ouja.api.network.chat.Component component) { + Style style = Style.EMPTY + .withColor(TextColor.parseColor(component.getColor()).getOrThrow()) + .withBold(component.isBold()) + .withUnderlined(component.isUnderlined()) + .withStrikethrough(component.isStrikeThrough()) + .withItalic(component.isItalic()); + return Component.literal(component.getString()).withStyle(style); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/plugins/PluginManager.java b/patches/release/1.21.8/net/ouja/dish/plugins/PluginManager.java new file mode 100644 index 0000000..045e796 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/plugins/PluginManager.java @@ -0,0 +1,97 @@ +package net.ouja.dish.plugins; + +import net.ouja.api.plugin.JavaPlugin; +import net.ouja.api.plugin.Plugin; +import net.ouja.dish.Dish; +import org.yaml.snakeyaml.Yaml; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Map; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +public class PluginManager { + private int MAX_CONFIG_VERSION = 1; + + public static ArrayList plugins = new ArrayList<>(); + + public PluginManager(File pluginsDir) throws IOException { + for (File file : pluginsDir.listFiles()) { + if (file.isFile() && file.getName().endsWith(".jar")) { + JarFile jar = new JarFile(file.getAbsolutePath()); + Enumeration entries = jar.entries(); + while (entries.hasMoreElements()) { + JarEntry entry = entries.nextElement(); + if (entry.getName().equalsIgnoreCase("dish.yml") || entry.getName().equalsIgnoreCase("dish.yaml")) { + InputStream is = jar.getInputStream(entry); + Map data = readConfigurationFile(is); + boolean isValid = isConfigValid(data, file.getName()); + if (!isValid) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] is not valid, skipping...", file.getName())); + continue; + } + try { + ClassLoader loader = URLClassLoader.newInstance( + new URL[]{file.getAbsoluteFile().toURI().toURL()}, + getClass().getClassLoader() + ); + Class jarClass = Class.forName(data.get("main-class").toString(), true, loader); + Class pluginClass; + try { + pluginClass = jarClass.asSubclass(JavaPlugin.class); + } catch (ClassCastException e) { + throw new ClassCastException("main class for plugin_name could not extend to JavaPlugin"); + } + Plugin plugin = ((Plugin)pluginClass.newInstance()); + plugin.onEnable(); + plugins.add(file.getName()); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InstantiationException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + } + } + } + } + + public Map readConfigurationFile(InputStream is) { + Yaml yaml = new Yaml(); + return yaml.load(is); + } + + public boolean isConfigValid(Map data, String pluginName) { + try { + if (data.get("config-version").toString() != null && (Integer.parseInt(data.get("config-version").toString()) > MAX_CONFIG_VERSION || Integer.parseInt(data.get("config-version").toString()) < 0)) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] Invalid config-version used in dish.yaml", pluginName)); + return false; + } + + if (Integer.parseInt(data.get("config-version").toString()) == 1) { + // used if needed + } + + if (data.get("main-class") == null) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] Missing main-class in dish.yaml", pluginName)); + return false; + } + + if (data.get("id") == null) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] Missing id in dish.yaml", pluginName)); + return false; + } + + return true; + } catch (Exception e) { + Dish.logger.error(String.format("[Dish Plugin Manager '%s'] Invalid dish.yaml\n%s", pluginName, e.getMessage())); + return false; + } + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/plugins/RegisteredEvents.java b/patches/release/1.21.8/net/ouja/dish/plugins/RegisteredEvents.java new file mode 100644 index 0000000..9b0a5de --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/plugins/RegisteredEvents.java @@ -0,0 +1,32 @@ +package net.ouja.dish.plugins; + +import net.ouja.api.event.EventListener; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + +public class RegisteredEvents { + public static final ArrayList listeners = new ArrayList<>(); + public static final ArrayList> classes = new ArrayList<>(); + + public RegisteredEvents(Method method, Class reflectorClass) { + listeners.add(method); + classes.add(reflectorClass); + } + + public static void callEvent(EventListener eventListener) { + for (int i = 0; i < listeners.size(); i++) { + Method method = listeners.get(i); + Class clazz = classes.get(i); + if (method.getParameterTypes()[0].toString().equals(eventListener.getClass().toString())) { + try { + method.setAccessible(true); + method.invoke(clazz.newInstance(), eventListener); + } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) { + throw new RuntimeException(e); + } + } + } + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/server/level/DishClientInformation.java b/patches/release/1.21.8/net/ouja/dish/server/level/DishClientInformation.java new file mode 100644 index 0000000..5d3efd9 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/server/level/DishClientInformation.java @@ -0,0 +1,81 @@ +package net.ouja.dish.server.level; + +import net.minecraft.world.entity.HumanoidArm; +import net.minecraft.world.entity.player.ChatVisiblity; +import net.ouja.api.server.level.ClientInformation; +import org.jetbrains.annotations.NotNull; + +public class DishClientInformation implements ClientInformation { + private final String language; + private final int viewDistance; + private final ChatVisiblity chatVisibility; + private final boolean chatColors; + private final int modelCustomisation; + private final HumanoidArm mainHand; + private final boolean textFilteringEnabled; + private final boolean allowsListing; + + public DishClientInformation(String language, int viewDistance, ChatVisiblity chatVisibility, boolean chatColors, int modelCustomisation, HumanoidArm mainHand, boolean textFilteringEnabled, boolean allowsListing) { + this.language = language; + this.viewDistance = viewDistance; + this.chatVisibility = chatVisibility; + this.chatColors = chatColors; + this.modelCustomisation = modelCustomisation; + this.mainHand = mainHand; + this.textFilteringEnabled = textFilteringEnabled; + this.allowsListing = allowsListing; + } + + public DishClientInformation(@NotNull net.minecraft.server.level.ClientInformation mcInfo) { + this( + mcInfo.language(), + mcInfo.viewDistance(), + mcInfo.chatVisibility(), + mcInfo.chatColors(), + mcInfo.modelCustomisation(), + mcInfo.mainHand(), + mcInfo.textFilteringEnabled(), + mcInfo.allowsListing() + ); + } + + @Override + public String getLanguage() { + return language; + } + + @Override + public int getViewDistance() { + return viewDistance; + } + + @Override + public int getChatVisibility() { + return chatVisibility.getId(); + } + + @Override + public boolean isChatColors() { + return chatColors; + } + + @Override + public int getModelCustomisation() { + return modelCustomisation; + } + + @Override + public String getMainHand() { + return mainHand.getSerializedName(); + } + + @Override + public boolean isTextFilteringEnabled() { + return textFilteringEnabled; + } + + @Override + public boolean isAllowsListing() { + return allowsListing; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/DishDamageSource.java b/patches/release/1.21.8/net/ouja/dish/world/DishDamageSource.java new file mode 100644 index 0000000..02ea744 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/DishDamageSource.java @@ -0,0 +1,22 @@ +package net.ouja.dish.world; + +import net.minecraft.world.entity.LivingEntity; +import net.ouja.api.entity.Entity; +import net.ouja.api.world.DamageSource; +import net.ouja.dish.entity.DishEntity; +import org.jetbrains.annotations.Nullable; + +public class DishDamageSource implements DamageSource { + private final net.minecraft.world.damagesource.DamageSource damageSource; + + public DishDamageSource(net.minecraft.world.damagesource.DamageSource damageSource) { + this.damageSource = damageSource; + } + + @Nullable + @Override + public Entity getEntity() { + if (this.damageSource.getEntity() == null) return null; + return new DishEntity((LivingEntity)this.damageSource.getEntity()).getEntity(); // call .getEntity() so that it removes "getEntity().getEntity();" for plugins + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/DishLevel.java b/patches/release/1.21.8/net/ouja/dish/world/DishLevel.java new file mode 100644 index 0000000..6b6df3e --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/DishLevel.java @@ -0,0 +1,64 @@ +package net.ouja.dish.world; + +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.ouja.api.entity.Player; +import net.ouja.api.world.Level; +import net.ouja.dish.entity.DishPlayer; + +import java.util.ArrayList; +import java.util.List; + +public class DishLevel implements Level { + private ServerLevel level; + + public DishLevel(ServerLevel level) { + this.level = level; + } + + @Override + public String getName() { + return this.level.dimensionType().effectsLocation().getPath(); + } + + @Override + public long getSeed() { + return this.level.getSeed(); + } + + @Override + public List getPlayers() { + List dishPlayers = new ArrayList<>(this.level.players().size()); + for (ServerPlayer player : this.level.players()) { + dishPlayers.add(new DishPlayer(player)); + } + return dishPlayers; + } + + @Override + public boolean isDay() { + return this.level.isDay(); + } + + @Override + public boolean isNight() { + return this.level.isNight(); + } + + @Override + public long getGameTime() { + return this.level.getGameTime(); + } + + @Override + public long getDayTime() { + return this.level.getDayTime(); + } + + @Override + public DimensionType dimension() { + if (this.level.dimension() == net.minecraft.world.level.Level.NETHER) return DimensionType.NETHER; + if (this.level.dimension() == net.minecraft.world.level.Level.END) return DimensionType.END; + return DimensionType.OVERWORLD; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/block/DishBlock.java b/patches/release/1.21.8/net/ouja/dish/world/block/DishBlock.java new file mode 100644 index 0000000..ff59569 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/block/DishBlock.java @@ -0,0 +1,27 @@ +package net.ouja.dish.world.block; + +import net.ouja.api.world.level.block.Block; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; + +public class DishBlock implements Block { + private final BlockPos pos; + private final BlockTypes blockType; + private final net.minecraft.world.level.block.Block block; + + public DishBlock(BlockPos pos, BlockTypes blockType, net.minecraft.world.level.block.Block block) { + this.pos = pos; + this.blockType = blockType; + this.block = block; + } + + @Override + public BlockPos getBlockPos() { + return this.pos; + } + + @Override + public BlockTypes getType() { + return blockType; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/block/DishBlockInfo.java b/patches/release/1.21.8/net/ouja/dish/world/block/DishBlockInfo.java new file mode 100644 index 0000000..8d8c2b6 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/block/DishBlockInfo.java @@ -0,0 +1,1010 @@ +package net.ouja.dish.world.block; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ButtonBlock; +import net.minecraft.world.level.block.DoorBlock; +import net.minecraft.world.level.block.SignBlock; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.TrapDoorBlock; +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.ouja.api.world.level.block.BlockInfo; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.dish.world.DishLevel; + +public class DishBlockInfo implements BlockInfo { + private final Block block; + private final net.minecraft.core.BlockPos blockPos; + private final Level level; + + public DishBlockInfo(Block block, net.minecraft.core.BlockPos blockPos, Level level) { + this.block = block; + this.blockPos = blockPos; + this.level = level; + } + + private net.ouja.api.world.level.block.Block getBlockClass() { + BlockPos dishBlockPos = new BlockPos(this.blockPos.getX(), this.blockPos.getY(), this.blockPos.getY(), new DishLevel((ServerLevel) this.level)); + BlockTypes blockType = BlockTypes.valueOf(BuiltInRegistries.BLOCK.getKey(block).getPath().toUpperCase()); + if (this.block instanceof StairBlock) return new DishStairBlock(dishBlockPos, blockType, this.block); + if (this.block instanceof SignBlock) { + SignBlockEntity signBlockEntity = (SignBlockEntity) this.level.getBlockEntity(this.blockPos); + return new DishSignBlock(dishBlockPos, blockType, this.block, signBlockEntity); + } + if (this.block instanceof ButtonBlock) return new DishButtonBlock(dishBlockPos, blockType, this.block); + if (this.block instanceof DoorBlock) return new DishDoorBlock(dishBlockPos, blockType, this.block, this.level); + if (this.block instanceof TrapDoorBlock) return new DishTrapdoorBlock(dishBlockPos, blockType, this.block, this.level); + + return new DishBlock(dishBlockPos, blockType, this.block); + + // TODO: 11/1/2023 add specific types to it's own class. This is here to keep track +// return switch (blockType) { +// case ACACIA_BUTTON -> null; +// case ACACIA_DOOR -> null; +// case ACACIA_FENCE -> null; +// case ACACIA_FENCE_GATE -> null; +// case ACACIA_LEAVES -> null; +// case ACACIA_LOG -> null; +// case ACACIA_PLANKS -> null; +// case ACACIA_PRESSURE_PLATE -> null; +// case ACACIA_SAPLING -> null; +// case ACACIA_SLAB -> null; +// case ACACIA_TRAPDOOR -> null; +// case ACACIA_WOOD -> null; +// case ACTIVATOR_RAIL -> null; +// case AIR -> new DishBlock(dishBlockPos, blockType, this.block); +// case ALLIUM -> null; +// case AMETHYST_BLOCK -> null; +// case AMETHYST_CLUSTER -> null; +// case ANCIENT_DEBRIS -> null; +// case ANDESITE -> null; +// case ANDESITE_SLAB -> null; +// case ANDESITE_WALL -> null; +// case ANVIL -> null; +// case ATTACHED_MELON_STEM -> null; +// case ATTACHED_PUMPKIN_STEM -> null; +// case AZALEA -> null; +// case AZALEA_LEAVES -> null; +// case AZURE_BLUET -> null; +// case BAMBOO -> null; +// case BAMBOO_BLOCK -> null; +// case BAMBOO_BUTTON -> null; +// case BAMBOO_DOOR -> null; +// case BAMBOO_FENCE -> null; +// case BAMBOO_FENCE_GATE -> null; +// case BAMBOO_MOSAIC -> null; +// case BAMBOO_MOSAIC_SLAB -> null; +// case BAMBOO_PLANKS -> null; +// case BAMBOO_PRESSURE_PLATE -> null; +// case BAMBOO_SAPLING -> null; +// case BAMBOO_SLAB -> null; +// case BAMBOO_TRAPDOOR -> null; +// case BARREL -> null; +// case BARRIER -> null; +// case BASALT -> null; +// case BEACON -> null; +// case BEDROCK -> null; +// case BEEHIVE -> null; +// case BEETROOTS -> null; +// case BEE_NEST -> null; +// case BELL -> null; +// case BIG_DRIPLEAF -> null; +// case BIG_DRIPLEAF_STEM -> null; +// case BIRCH_BUTTON -> null; +// case BIRCH_DOOR -> null; +// case BIRCH_FENCE -> null; +// case BIRCH_FENCE_GATE -> null; +// case BIRCH_LEAVES -> null; +// case BIRCH_LOG -> null; +// case BIRCH_PLANKS -> null; +// case BIRCH_PRESSURE_PLATE -> null; +// case BIRCH_SAPLING -> null; +// case BIRCH_SLAB -> null; +// case BIRCH_TRAPDOOR -> null; +// case BIRCH_WOOD -> null; +// case BLACKSTONE -> null; +// case BLACKSTONE_SLAB -> null; +// case BLACKSTONE_WALL -> null; +// case BLACK_BANNER -> null; +// case BLACK_BED -> null; +// case BLACK_CANDLE -> null; +// case BLACK_CANDLE_CAKE -> null; +// case BLACK_CARPET -> null; +// case BLACK_CONCRETE -> null; +// case BLACK_CONCRETE_POWDER -> null; +// case BLACK_GLAZED_TERRACOTTA -> null; +// case BLACK_SHULKER_BOX -> null; +// case BLACK_STAINED_GLASS -> null; +// case BLACK_STAINED_GLASS_PANE -> null; +// case BLACK_TERRACOTTA -> null; +// case BLACK_WALL_BANNER -> null; +// case BLACK_WOOL -> null; +// case BLAST_FURNACE -> null; +// case BLUE_BANNER -> null; +// case BLUE_BED -> null; +// case BLUE_CANDLE -> null; +// case BLUE_CANDLE_CAKE -> null; +// case BLUE_CARPET -> null; +// case BLUE_CONCRETE -> null; +// case BLUE_CONCRETE_POWDER -> null; +// case BLUE_GLAZED_TERRACOTTA -> null; +// case BLUE_ICE -> null; +// case BLUE_ORCHID -> null; +// case BLUE_SHULKER_BOX -> null; +// case BLUE_STAINED_GLASS -> null; +// case BLUE_STAINED_GLASS_PANE -> null; +// case BLUE_TERRACOTTA -> null; +// case BLUE_WALL_BANNER -> null; +// case BLUE_WOOL -> null; +// case BONE_BLOCK -> null; +// case BOOKSHELF -> null; +// case BRAIN_CORAL -> null; +// case BRAIN_CORAL_BLOCK -> null; +// case BRAIN_CORAL_FAN -> null; +// case BRAIN_CORAL_WALL_FAN -> null; +// case BREWING_STAND -> null; +// case BRICKS -> null; +// case BRICK_SLAB -> null; +// case BRICK_WALL -> null; +// case BROWN_BANNER -> null; +// case BROWN_BED -> null; +// case BROWN_CANDLE -> null; +// case BROWN_CANDLE_CAKE -> null; +// case BROWN_CARPET -> null; +// case BROWN_CONCRETE -> null; +// case BROWN_CONCRETE_POWDER -> null; +// case BROWN_GLAZED_TERRACOTTA -> null; +// case BROWN_MUSHROOM -> null; +// case BROWN_MUSHROOM_BLOCK -> null; +// case BROWN_SHULKER_BOX -> null; +// case BROWN_STAINED_GLASS -> null; +// case BROWN_STAINED_GLASS_PANE -> null; +// case BROWN_TERRACOTTA -> null; +// case BROWN_WALL_BANNER -> null; +// case BROWN_WOOL -> null; +// case BUBBLE_COLUMN -> null; +// case BUBBLE_CORAL -> null; +// case BUBBLE_CORAL_BLOCK -> null; +// case BUBBLE_CORAL_FAN -> null; +// case BUBBLE_CORAL_WALL_FAN -> null; +// case BUDDING_AMETHYST -> null; +// case CACTUS -> null; +// case CAKE -> null; +// case CALCITE -> null; +// case CALIBRATED_SCULK_SENSOR -> null; +// case CAMPFIRE -> null; +// case CANDLE -> null; +// case CANDLE_CAKE -> null; +// case CARROTS -> null; +// case CARTOGRAPHY_TABLE -> null; +// case CARVED_PUMPKIN -> null; +// case CAULDRON -> null; +// case CAVE_AIR -> null; +// case CAVE_VINES -> null; +// case CAVE_VINES_PLANT -> null; +// case CHAIN -> null; +// case CHAIN_COMMAND_BLOCK -> null; +// case CHERRY_BUTTON -> null; +// case CHERRY_DOOR -> null; +// case CHERRY_FENCE -> null; +// case CHERRY_FENCE_GATE -> null; +// case CHERRY_LEAVES -> null; +// case CHERRY_LOG -> null; +// case CHERRY_PLANKS -> null; +// case CHERRY_PRESSURE_PLATE -> null; +// case CHERRY_SAPLING -> null; +// case CHERRY_SLAB -> null; +// case CHERRY_TRAPDOOR -> null; +// case CHERRY_WOOD -> null; +// case CHEST -> null; +// case CHIPPED_ANVIL -> null; +// case CHISELED_BOOKSHELF -> null; +// case CHISELED_COPPER -> null; +// case CHISELED_DEEPSLATE -> null; +// case CHISELED_NETHER_BRICKS -> null; +// case CHISELED_POLISHED_BLACKSTONE -> null; +// case CHISELED_QUARTZ_BLOCK -> null; +// case CHISELED_RED_SANDSTONE -> null; +// case CHISELED_SANDSTONE -> null; +// case CHISELED_STONE_BRICKS -> null; +// case CHISELED_TUFF -> null; +// case CHISELED_TUFF_BRICKS -> null; +// case CHORUS_FLOWER -> null; +// case CHORUS_PLANT -> null; +// case CLAY -> null; +// case COAL_BLOCK -> null; +// case COAL_ORE -> null; +// case COARSE_DIRT -> null; +// case COBBLED_DEEPSLATE -> null; +// case COBBLED_DEEPSLATE_SLAB -> null; +// case COBBLED_DEEPSLATE_WALL -> null; +// case COBBLESTONE -> null; +// case COBBLESTONE_SLAB -> null; +// case COBBLESTONE_WALL -> null; +// case COBWEB -> null; +// case COCOA -> null; +// case COMMAND_BLOCK -> null; +// case COMPARATOR -> null; +// case COMPOSTER -> null; +// case CONDUIT -> null; +// case COPPER_BLOCK -> null; +// case COPPER_BULB -> null; +// case COPPER_DOOR -> null; +// case COPPER_GRATE -> null; +// case COPPER_ORE -> null; +// case COPPER_TRAPDOOR -> null; +// case CORNFLOWER -> null; +// case CRACKED_DEEPSLATE_BRICKS -> null; +// case CRACKED_DEEPSLATE_TILES -> null; +// case CRACKED_NETHER_BRICKS -> null; +// case CRACKED_POLISHED_BLACKSTONE_BRICKS -> null; +// case CRACKED_STONE_BRICKS -> null; +// case CRAFTER -> null; +// case CRAFTING_TABLE -> null; +// case CREEPER_HEAD -> null; +// case CREEPER_WALL_HEAD -> null; +// case CRIMSON_BUTTON -> null; +// case CRIMSON_DOOR -> null; +// case CRIMSON_FENCE -> null; +// case CRIMSON_FENCE_GATE -> null; +// case CRIMSON_FUNGUS -> null; +// case CRIMSON_HYPHAE -> null; +// case CRIMSON_NYLIUM -> null; +// case CRIMSON_PLANKS -> null; +// case CRIMSON_PRESSURE_PLATE -> null; +// case CRIMSON_ROOTS -> null; +// case CRIMSON_SLAB -> null; +// case CRIMSON_STEM -> null; +// case CRIMSON_TRAPDOOR -> null; +// case CRYING_OBSIDIAN -> null; +// case CUT_COPPER -> null; +// case CUT_COPPER_SLAB -> null; +// case CUT_RED_SANDSTONE -> null; +// case CUT_RED_SANDSTONE_SLAB -> null; +// case CUT_SANDSTONE -> null; +// case CUT_SANDSTONE_SLAB -> null; +// case CYAN_BANNER -> null; +// case CYAN_BED -> null; +// case CYAN_CANDLE -> null; +// case CYAN_CANDLE_CAKE -> null; +// case CYAN_CARPET -> null; +// case CYAN_CONCRETE -> null; +// case CYAN_CONCRETE_POWDER -> null; +// case CYAN_GLAZED_TERRACOTTA -> null; +// case CYAN_SHULKER_BOX -> null; +// case CYAN_STAINED_GLASS -> null; +// case CYAN_STAINED_GLASS_PANE -> null; +// case CYAN_TERRACOTTA -> null; +// case CYAN_WALL_BANNER -> null; +// case CYAN_WOOL -> null; +// case DAMAGED_ANVIL -> null; +// case DANDELION -> null; +// case DARK_OAK_BUTTON -> null; +// case DARK_OAK_DOOR -> null; +// case DARK_OAK_FENCE -> null; +// case DARK_OAK_FENCE_GATE -> null; +// case DARK_OAK_LEAVES -> null; +// case DARK_OAK_LOG -> null; +// case DARK_OAK_PLANKS -> null; +// case DARK_OAK_PRESSURE_PLATE -> null; +// case DARK_OAK_SAPLING -> null; +// case DARK_OAK_SLAB -> null; +// case DARK_OAK_TRAPDOOR -> null; +// case DARK_OAK_WOOD -> null; +// case DARK_PRISMARINE -> null; +// case DARK_PRISMARINE_SLAB -> null; +// case DAYLIGHT_DETECTOR -> null; +// case DEAD_BRAIN_CORAL -> null; +// case DEAD_BRAIN_CORAL_BLOCK -> null; +// case DEAD_BRAIN_CORAL_FAN -> null; +// case DEAD_BRAIN_CORAL_WALL_FAN -> null; +// case DEAD_BUBBLE_CORAL -> null; +// case DEAD_BUBBLE_CORAL_BLOCK -> null; +// case DEAD_BUBBLE_CORAL_FAN -> null; +// case DEAD_BUBBLE_CORAL_WALL_FAN -> null; +// case DEAD_BUSH -> null; +// case DEAD_FIRE_CORAL -> null; +// case DEAD_FIRE_CORAL_BLOCK -> null; +// case DEAD_FIRE_CORAL_FAN -> null; +// case DEAD_FIRE_CORAL_WALL_FAN -> null; +// case DEAD_HORN_CORAL -> null; +// case DEAD_HORN_CORAL_BLOCK -> null; +// case DEAD_HORN_CORAL_FAN -> null; +// case DEAD_HORN_CORAL_WALL_FAN -> null; +// case DEAD_TUBE_CORAL -> null; +// case DEAD_TUBE_CORAL_BLOCK -> null; +// case DEAD_TUBE_CORAL_FAN -> null; +// case DEAD_TUBE_CORAL_WALL_FAN -> null; +// case DECORATED_POT -> null; +// case DEEPSLATE -> null; +// case DEEPSLATE_BRICKS -> null; +// case DEEPSLATE_BRICK_SLAB -> null; +// case DEEPSLATE_BRICK_WALL -> null; +// case DEEPSLATE_COAL_ORE -> null; +// case DEEPSLATE_COPPER_ORE -> null; +// case DEEPSLATE_DIAMOND_ORE -> null; +// case DEEPSLATE_EMERALD_ORE -> null; +// case DEEPSLATE_GOLD_ORE -> null; +// case DEEPSLATE_IRON_ORE -> null; +// case DEEPSLATE_LAPIS_ORE -> null; +// case DEEPSLATE_REDSTONE_ORE -> null; +// case DEEPSLATE_TILES -> null; +// case DEEPSLATE_TILE_SLAB -> null; +// case DEEPSLATE_TILE_WALL -> null; +// case DETECTOR_RAIL -> null; +// case DIAMOND_BLOCK -> null; +// case DIAMOND_ORE -> null; +// case DIORITE -> null; +// case DIORITE_SLAB -> null; +// case DIORITE_WALL -> null; +// case DIRT -> new DishBlock(dishBlockPos, blockType, this.block); +// case DIRT_PATH -> null; +// case DISPENSER -> null; +// case DRAGON_EGG -> null; +// case DRAGON_HEAD -> null; +// case DRAGON_WALL_HEAD -> null; +// case DRIED_KELP_BLOCK -> null; +// case DRIPSTONE_BLOCK -> null; +// case DROPPER -> null; +// case EMERALD_BLOCK -> null; +// case EMERALD_ORE -> null; +// case ENCHANTING_TABLE -> null; +// case ENDER_CHEST -> null; +// case END_GATEWAY -> null; +// case END_PORTAL -> null; +// case END_PORTAL_FRAME -> null; +// case END_ROD -> null; +// case END_STONE -> null; +// case END_STONE_BRICKS -> null; +// case END_STONE_BRICK_SLAB -> null; +// case END_STONE_BRICK_WALL -> null; +// case EXPOSED_CHISELED_COPPER -> null; +// case EXPOSED_COPPER -> null; +// case EXPOSED_COPPER_BULB -> null; +// case EXPOSED_COPPER_DOOR -> null; +// case EXPOSED_COPPER_GRATE -> null; +// case EXPOSED_COPPER_TRAPDOOR -> null; +// case EXPOSED_CUT_COPPER -> null; +// case EXPOSED_CUT_COPPER_SLAB -> null; +// case FARMLAND -> null; +// case FERN -> null; +// case FIRE -> null; +// case FIRE_CORAL -> null; +// case FIRE_CORAL_BLOCK -> null; +// case FIRE_CORAL_FAN -> null; +// case FIRE_CORAL_WALL_FAN -> null; +// case FLETCHING_TABLE -> null; +// case FLOWERING_AZALEA -> null; +// case FLOWERING_AZALEA_LEAVES -> null; +// case FLOWER_POT -> null; +// case FROGSPAWN -> null; +// case FROSTED_ICE -> null; +// case FURNACE -> null; +// case GILDED_BLACKSTONE -> null; +// case GLASS -> null; +// case GLASS_PANE -> null; +// case GLOWSTONE -> null; +// case GLOW_LICHEN -> null; +// case GOLD_BLOCK -> null; +// case GOLD_ORE -> null; +// case GRANITE -> null; +// case GRANITE_SLAB -> null; +// case GRANITE_WALL -> null; +// case GRASS -> null; +// case GRASS_BLOCK -> null; +// case GRAVEL -> null; +// case GRAY_BANNER -> null; +// case GRAY_BED -> null; +// case GRAY_CANDLE -> null; +// case GRAY_CANDLE_CAKE -> null; +// case GRAY_CARPET -> null; +// case GRAY_CONCRETE -> null; +// case GRAY_CONCRETE_POWDER -> null; +// case GRAY_GLAZED_TERRACOTTA -> null; +// case GRAY_SHULKER_BOX -> null; +// case GRAY_STAINED_GLASS -> null; +// case GRAY_STAINED_GLASS_PANE -> null; +// case GRAY_TERRACOTTA -> null; +// case GRAY_WALL_BANNER -> null; +// case GRAY_WOOL -> null; +// case GREEN_BANNER -> null; +// case GREEN_BED -> null; +// case GREEN_CANDLE -> null; +// case GREEN_CANDLE_CAKE -> null; +// case GREEN_CARPET -> null; +// case GREEN_CONCRETE -> null; +// case GREEN_CONCRETE_POWDER -> null; +// case GREEN_GLAZED_TERRACOTTA -> null; +// case GREEN_SHULKER_BOX -> null; +// case GREEN_STAINED_GLASS -> null; +// case GREEN_STAINED_GLASS_PANE -> null; +// case GREEN_TERRACOTTA -> null; +// case GREEN_WALL_BANNER -> null; +// case GREEN_WOOL -> null; +// case GRINDSTONE -> null; +// case HANGING_ROOTS -> null; +// case HAY_BLOCK -> null; +// case HEAVY_WEIGHTED_PRESSURE_PLATE -> null; +// case HONEYCOMB_BLOCK -> null; +// case HONEY_BLOCK -> null; +// case HOPPER -> null; +// case HORN_CORAL -> null; +// case HORN_CORAL_BLOCK -> null; +// case HORN_CORAL_FAN -> null; +// case HORN_CORAL_WALL_FAN -> null; +// case ICE -> null; +// case INFESTED_CHISELED_STONE_BRICKS -> null; +// case INFESTED_COBBLESTONE -> null; +// case INFESTED_CRACKED_STONE_BRICKS -> null; +// case INFESTED_DEEPSLATE -> null; +// case INFESTED_MOSSY_STONE_BRICKS -> null; +// case INFESTED_STONE -> null; +// case INFESTED_STONE_BRICKS -> null; +// case IRON_BARS -> null; +// case IRON_BLOCK -> null; +// case IRON_DOOR -> null; +// case IRON_ORE -> null; +// case IRON_TRAPDOOR -> null; +// case JACK_O_LANTERN -> null; +// case JIGSAW -> null; +// case JUKEBOX -> null; +// case JUNGLE_BUTTON -> null; +// case JUNGLE_DOOR -> null; +// case JUNGLE_FENCE -> null; +// case JUNGLE_FENCE_GATE -> null; +// case JUNGLE_LEAVES -> null; +// case JUNGLE_LOG -> null; +// case JUNGLE_PLANKS -> null; +// case JUNGLE_PRESSURE_PLATE -> null; +// case JUNGLE_SAPLING -> null; +// case JUNGLE_SLAB -> null; +// case JUNGLE_TRAPDOOR -> null; +// case JUNGLE_WOOD -> null; +// case KELP -> null; +// case KELP_PLANT -> null; +// case LADDER -> null; +// case LANTERN -> null; +// case LAPIS_BLOCK -> null; +// case LAPIS_ORE -> null; +// case LARGE_AMETHYST_BUD -> null; +// case LARGE_FERN -> null; +// case LAVA -> null; +// case LAVA_CAULDRON -> null; +// case LECTERN -> null; +// case LEVER -> null; +// case LIGHT -> null; +// case LIGHTNING_ROD -> null; +// case LIGHT_BLUE_BANNER -> null; +// case LIGHT_BLUE_BED -> null; +// case LIGHT_BLUE_CANDLE -> null; +// case LIGHT_BLUE_CANDLE_CAKE -> null; +// case LIGHT_BLUE_CARPET -> null; +// case LIGHT_BLUE_CONCRETE -> null; +// case LIGHT_BLUE_CONCRETE_POWDER -> null; +// case LIGHT_BLUE_GLAZED_TERRACOTTA -> null; +// case LIGHT_BLUE_SHULKER_BOX -> null; +// case LIGHT_BLUE_STAINED_GLASS -> null; +// case LIGHT_BLUE_STAINED_GLASS_PANE -> null; +// case LIGHT_BLUE_TERRACOTTA -> null; +// case LIGHT_BLUE_WALL_BANNER -> null; +// case LIGHT_BLUE_WOOL -> null; +// case LIGHT_GRAY_BANNER -> null; +// case LIGHT_GRAY_BED -> null; +// case LIGHT_GRAY_CANDLE -> null; +// case LIGHT_GRAY_CANDLE_CAKE -> null; +// case LIGHT_GRAY_CARPET -> null; +// case LIGHT_GRAY_CONCRETE -> null; +// case LIGHT_GRAY_CONCRETE_POWDER -> null; +// case LIGHT_GRAY_GLAZED_TERRACOTTA -> null; +// case LIGHT_GRAY_SHULKER_BOX -> null; +// case LIGHT_GRAY_STAINED_GLASS -> null; +// case LIGHT_GRAY_STAINED_GLASS_PANE -> null; +// case LIGHT_GRAY_TERRACOTTA -> null; +// case LIGHT_GRAY_WALL_BANNER -> null; +// case LIGHT_GRAY_WOOL -> null; +// case LIGHT_WEIGHTED_PRESSURE_PLATE -> null; +// case LILAC -> null; +// case LILY_OF_THE_VALLEY -> null; +// case LILY_PAD -> null; +// case LIME_BANNER -> null; +// case LIME_BED -> null; +// case LIME_CANDLE -> null; +// case LIME_CANDLE_CAKE -> null; +// case LIME_CARPET -> null; +// case LIME_CONCRETE -> null; +// case LIME_CONCRETE_POWDER -> null; +// case LIME_GLAZED_TERRACOTTA -> null; +// case LIME_SHULKER_BOX -> null; +// case LIME_STAINED_GLASS -> null; +// case LIME_STAINED_GLASS_PANE -> null; +// case LIME_TERRACOTTA -> null; +// case LIME_WALL_BANNER -> null; +// case LIME_WOOL -> null; +// case LODESTONE -> null; +// case LOOM -> null; +// case MAGENTA_BANNER -> null; +// case MAGENTA_BED -> null; +// case MAGENTA_CANDLE -> null; +// case MAGENTA_CANDLE_CAKE -> null; +// case MAGENTA_CARPET -> null; +// case MAGENTA_CONCRETE -> null; +// case MAGENTA_CONCRETE_POWDER -> null; +// case MAGENTA_GLAZED_TERRACOTTA -> null; +// case MAGENTA_SHULKER_BOX -> null; +// case MAGENTA_STAINED_GLASS -> null; +// case MAGENTA_STAINED_GLASS_PANE -> null; +// case MAGENTA_TERRACOTTA -> null; +// case MAGENTA_WALL_BANNER -> null; +// case MAGENTA_WOOL -> null; +// case MAGMA_BLOCK -> null; +// case MANGROVE_BUTTON -> null; +// case MANGROVE_DOOR -> null; +// case MANGROVE_FENCE -> null; +// case MANGROVE_FENCE_GATE -> null; +// case MANGROVE_LEAVES -> null; +// case MANGROVE_LOG -> null; +// case MANGROVE_PLANKS -> null; +// case MANGROVE_PRESSURE_PLATE -> null; +// case MANGROVE_PROPAGULE -> null; +// case MANGROVE_ROOTS -> null; +// case MANGROVE_SLAB -> null; +// case MANGROVE_TRAPDOOR -> null; +// case MANGROVE_WOOD -> null; +// case MEDIUM_AMETHYST_BUD -> null; +// case MELON -> null; +// case MELON_STEM -> null; +// case MOSSY_COBBLESTONE -> null; +// case MOSSY_COBBLESTONE_SLAB -> null; +// case MOSSY_COBBLESTONE_WALL -> null; +// case MOSSY_STONE_BRICKS -> null; +// case MOSSY_STONE_BRICK_SLAB -> null; +// case MOSSY_STONE_BRICK_WALL -> null; +// case MOSS_BLOCK -> null; +// case MOSS_CARPET -> null; +// case MOVING_PISTON -> null; +// case MUD -> null; +// case MUDDY_MANGROVE_ROOTS -> null; +// case MUD_BRICKS -> null; +// case MUD_BRICK_SLAB -> null; +// case MUD_BRICK_WALL -> null; +// case MUSHROOM_STEM -> null; +// case MYCELIUM -> null; +// case NETHERITE_BLOCK -> null; +// case NETHERRACK -> null; +// case NETHER_BRICKS -> null; +// case NETHER_BRICK_FENCE -> null; +// case NETHER_BRICK_SLAB -> null; +// case NETHER_BRICK_WALL -> null; +// case NETHER_GOLD_ORE -> null; +// case NETHER_PORTAL -> null; +// case NETHER_QUARTZ_ORE -> null; +// case NETHER_SPROUTS -> null; +// case NETHER_WART -> null; +// case NETHER_WART_BLOCK -> null; +// case NOTE_BLOCK -> null; +// case OAK_BUTTON -> null; +// case OAK_DOOR -> null; +// case OAK_FENCE -> null; +// case OAK_FENCE_GATE -> null; +// case OAK_LEAVES -> null; +// case OAK_LOG -> null; +// case OAK_PLANKS -> null; +// case OAK_PRESSURE_PLATE -> null; +// case OAK_SAPLING -> null; +// case OAK_SLAB -> null; +// case OAK_TRAPDOOR -> null; +// case OAK_WOOD -> null; +// case OBSERVER -> null; +// case OBSIDIAN -> null; +// case OCHRE_FROGLIGHT -> null; +// case ORANGE_BANNER -> null; +// case ORANGE_BED -> null; +// case ORANGE_CANDLE -> null; +// case ORANGE_CANDLE_CAKE -> null; +// case ORANGE_CARPET -> null; +// case ORANGE_CONCRETE -> null; +// case ORANGE_CONCRETE_POWDER -> null; +// case ORANGE_GLAZED_TERRACOTTA -> null; +// case ORANGE_SHULKER_BOX -> null; +// case ORANGE_STAINED_GLASS -> null; +// case ORANGE_STAINED_GLASS_PANE -> null; +// case ORANGE_TERRACOTTA -> null; +// case ORANGE_TULIP -> null; +// case ORANGE_WALL_BANNER -> null; +// case ORANGE_WOOL -> null; +// case OXEYE_DAISY -> null; +// case OXIDIZED_CHISELED_COPPER -> null; +// case OXIDIZED_COPPER -> null; +// case OXIDIZED_COPPER_BULB -> null; +// case OXIDIZED_COPPER_DOOR -> null; +// case OXIDIZED_COPPER_GRATE -> null; +// case OXIDIZED_COPPER_TRAPDOOR -> null; +// case OXIDIZED_CUT_COPPER -> null; +// case OXIDIZED_CUT_COPPER_SLAB -> null; +// case PACKED_ICE -> null; +// case PACKED_MUD -> null; +// case PEARLESCENT_FROGLIGHT -> null; +// case PEONY -> null; +// case PETRIFIED_OAK_SLAB -> null; +// case PIGLIN_HEAD -> null; +// case PIGLIN_WALL_HEAD -> null; +// case PINK_BANNER -> null; +// case PINK_BED -> null; +// case PINK_CANDLE -> null; +// case PINK_CANDLE_CAKE -> null; +// case PINK_CARPET -> null; +// case PINK_CONCRETE -> null; +// case PINK_CONCRETE_POWDER -> null; +// case PINK_GLAZED_TERRACOTTA -> null; +// case PINK_PETALS -> null; +// case PINK_SHULKER_BOX -> null; +// case PINK_STAINED_GLASS -> null; +// case PINK_STAINED_GLASS_PANE -> null; +// case PINK_TERRACOTTA -> null; +// case PINK_TULIP -> null; +// case PINK_WALL_BANNER -> null; +// case PINK_WOOL -> null; +// case PISTON -> null; +// case PISTON_HEAD -> null; +// case PITCHER_CROP -> null; +// case PITCHER_PLANT -> null; +// case PLAYER_HEAD -> null; +// case PLAYER_WALL_HEAD -> null; +// case PODZOL -> null; +// case POINTED_DRIPSTONE -> null; +// case POLISHED_ANDESITE -> null; +// case POLISHED_ANDESITE_SLAB -> null; +// case POLISHED_BASALT -> null; +// case POLISHED_BLACKSTONE -> null; +// case POLISHED_BLACKSTONE_BRICKS -> null; +// case POLISHED_BLACKSTONE_BRICK_SLAB -> null; +// case POLISHED_BLACKSTONE_BRICK_WALL -> null; +// case POLISHED_BLACKSTONE_BUTTON -> null; +// case POLISHED_BLACKSTONE_PRESSURE_PLATE -> null; +// case POLISHED_BLACKSTONE_SLAB -> null; +// case POLISHED_BLACKSTONE_WALL -> null; +// case POLISHED_DEEPSLATE -> null; +// case POLISHED_DEEPSLATE_SLAB -> null; +// case POLISHED_DEEPSLATE_WALL -> null; +// case POLISHED_DIORITE -> null; +// case POLISHED_DIORITE_SLAB -> null; +// case POLISHED_GRANITE -> null; +// case POLISHED_GRANITE_SLAB -> null; +// case POLISHED_TUFF -> null; +// case POLISHED_TUFF_SLAB -> null; +// case POLISHED_TUFF_WALL -> null; +// case POPPY -> null; +// case POTATOES -> null; +// case POTTED_ACACIA_SAPLING -> null; +// case POTTED_ALLIUM -> null; +// case POTTED_AZALEA_BUSH -> null; +// case POTTED_AZURE_BLUET -> null; +// case POTTED_BAMBOO -> null; +// case POTTED_BIRCH_SAPLING -> null; +// case POTTED_BLUE_ORCHID -> null; +// case POTTED_BROWN_MUSHROOM -> null; +// case POTTED_CACTUS -> null; +// case POTTED_CHERRY_SAPLING -> null; +// case POTTED_CORNFLOWER -> null; +// case POTTED_CRIMSON_FUNGUS -> null; +// case POTTED_CRIMSON_ROOTS -> null; +// case POTTED_DANDELION -> null; +// case POTTED_DARK_OAK_SAPLING -> null; +// case POTTED_DEAD_BUSH -> null; +// case POTTED_FERN -> null; +// case POTTED_FLOWERING_AZALEA_BUSH -> null; +// case POTTED_JUNGLE_SAPLING -> null; +// case POTTED_LILY_OF_THE_VALLEY -> null; +// case POTTED_MANGROVE_PROPAGULE -> null; +// case POTTED_OAK_SAPLING -> null; +// case POTTED_ORANGE_TULIP -> null; +// case POTTED_OXEYE_DAISY -> null; +// case POTTED_PINK_TULIP -> null; +// case POTTED_POPPY -> null; +// case POTTED_RED_MUSHROOM -> null; +// case POTTED_RED_TULIP -> null; +// case POTTED_SPRUCE_SAPLING -> null; +// case POTTED_TORCHFLOWER -> null; +// case POTTED_WARPED_FUNGUS -> null; +// case POTTED_WARPED_ROOTS -> null; +// case POTTED_WHITE_TULIP -> null; +// case POTTED_WITHER_ROSE -> null; +// case POWDER_SNOW -> null; +// case POWDER_SNOW_CAULDRON -> null; +// case POWERED_RAIL -> null; +// case PRISMARINE -> null; +// case PRISMARINE_BRICKS -> null; +// case PRISMARINE_BRICK_SLAB -> null; +// case PRISMARINE_SLAB -> null; +// case PRISMARINE_WALL -> null; +// case PUMPKIN -> null; +// case PUMPKIN_STEM -> null; +// case PURPLE_BANNER -> null; +// case PURPLE_BED -> null; +// case PURPLE_CANDLE -> null; +// case PURPLE_CANDLE_CAKE -> null; +// case PURPLE_CARPET -> null; +// case PURPLE_CONCRETE -> null; +// case PURPLE_CONCRETE_POWDER -> null; +// case PURPLE_GLAZED_TERRACOTTA -> null; +// case PURPLE_SHULKER_BOX -> null; +// case PURPLE_STAINED_GLASS -> null; +// case PURPLE_STAINED_GLASS_PANE -> null; +// case PURPLE_TERRACOTTA -> null; +// case PURPLE_WALL_BANNER -> null; +// case PURPLE_WOOL -> null; +// case PURPUR_BLOCK -> null; +// case PURPUR_PILLAR -> null; +// case PURPUR_SLAB -> null; +// case QUARTZ_BLOCK -> null; +// case QUARTZ_BRICKS -> null; +// case QUARTZ_PILLAR -> null; +// case QUARTZ_SLAB -> null; +// case RAIL -> null; +// case RAW_COPPER_BLOCK -> null; +// case RAW_GOLD_BLOCK -> null; +// case RAW_IRON_BLOCK -> null; +// case REDSTONE_BLOCK -> null; +// case REDSTONE_LAMP -> null; +// case REDSTONE_ORE -> null; +// case REDSTONE_TORCH -> null; +// case REDSTONE_WALL_TORCH -> null; +// case REDSTONE_WIRE -> null; +// case RED_BANNER -> null; +// case RED_BED -> null; +// case RED_CANDLE -> null; +// case RED_CANDLE_CAKE -> null; +// case RED_CARPET -> null; +// case RED_CONCRETE -> null; +// case RED_CONCRETE_POWDER -> null; +// case RED_GLAZED_TERRACOTTA -> null; +// case RED_MUSHROOM -> null; +// case RED_MUSHROOM_BLOCK -> null; +// case RED_NETHER_BRICKS -> null; +// case RED_NETHER_BRICK_SLAB -> null; +// case RED_NETHER_BRICK_WALL -> null; +// case RED_SAND -> null; +// case RED_SANDSTONE -> null; +// case RED_SANDSTONE_SLAB -> null; +// case RED_SANDSTONE_WALL -> null; +// case RED_SHULKER_BOX -> null; +// case RED_STAINED_GLASS -> null; +// case RED_STAINED_GLASS_PANE -> null; +// case RED_TERRACOTTA -> null; +// case RED_TULIP -> null; +// case RED_WALL_BANNER -> null; +// case RED_WOOL -> null; +// case REINFORCED_DEEPSLATE -> null; +// case REPEATER -> null; +// case REPEATING_COMMAND_BLOCK -> null; +// case RESPAWN_ANCHOR -> null; +// case ROOTED_DIRT -> null; +// case ROSE_BUSH -> null; +// case SAND -> null; +// case SANDSTONE -> null; +// case SANDSTONE_SLAB -> null; +// case SANDSTONE_WALL -> null; +// case SCAFFOLDING -> null; +// case SCULK -> null; +// case SCULK_CATALYST -> null; +// case SCULK_SENSOR -> null; +// case SCULK_SHRIEKER -> null; +// case SCULK_VEIN -> null; +// case SEAGRASS -> null; +// case SEA_LANTERN -> null; +// case SEA_PICKLE -> null; +// case SHROOMLIGHT -> null; +// case SHULKER_BOX -> null; +// case SKELETON_SKULL -> null; +// case SKELETON_WALL_SKULL -> null; +// case SLIME_BLOCK -> null; +// case SMALL_AMETHYST_BUD -> null; +// case SMALL_DRIPLEAF -> null; +// case SMITHING_TABLE -> null; +// case SMOKER -> null; +// case SMOOTH_BASALT -> null; +// case SMOOTH_QUARTZ -> null; +// case SMOOTH_QUARTZ_SLAB -> null; +// case SMOOTH_RED_SANDSTONE -> null; +// case SMOOTH_RED_SANDSTONE_SLAB -> null; +// case SMOOTH_SANDSTONE -> null; +// case SMOOTH_SANDSTONE_SLAB -> null; +// case SMOOTH_STONE -> null; +// case SMOOTH_STONE_SLAB -> null; +// case SNIFFER_EGG -> null; +// case SNOW -> null; +// case SNOW_BLOCK -> null; +// case SOUL_CAMPFIRE -> null; +// case SOUL_FIRE -> null; +// case SOUL_LANTERN -> null; +// case SOUL_SAND -> null; +// case SOUL_SOIL -> null; +// case SOUL_TORCH -> null; +// case SOUL_WALL_TORCH -> null; +// case SPAWNER -> null; +// case SPONGE -> null; +// case SPORE_BLOSSOM -> null; +// case SPRUCE_BUTTON -> null; +// case SPRUCE_DOOR -> null; +// case SPRUCE_FENCE -> null; +// case SPRUCE_FENCE_GATE -> null; +// case SPRUCE_LEAVES -> null; +// case SPRUCE_LOG -> null; +// case SPRUCE_PLANKS -> null; +// case SPRUCE_PRESSURE_PLATE -> null; +// case SPRUCE_SAPLING -> null; +// case SPRUCE_SLAB -> null; +// case SPRUCE_TRAPDOOR -> null; +// case SPRUCE_WOOD -> null; +// case STICKY_PISTON -> null; +// case STONE -> null; +// case STONECUTTER -> null; +// case STONE_BRICKS -> null; +// case STONE_BRICK_SLAB -> null; +// case STONE_BRICK_WALL -> null; +// case STONE_BUTTON -> null; +// case STONE_PRESSURE_PLATE -> null; +// case STONE_SLAB -> null; +// case STRIPPED_ACACIA_LOG -> null; +// case STRIPPED_ACACIA_WOOD -> null; +// case STRIPPED_BAMBOO_BLOCK -> null; +// case STRIPPED_BIRCH_LOG -> null; +// case STRIPPED_BIRCH_WOOD -> null; +// case STRIPPED_CHERRY_LOG -> null; +// case STRIPPED_CHERRY_WOOD -> null; +// case STRIPPED_CRIMSON_HYPHAE -> null; +// case STRIPPED_CRIMSON_STEM -> null; +// case STRIPPED_DARK_OAK_LOG -> null; +// case STRIPPED_DARK_OAK_WOOD -> null; +// case STRIPPED_JUNGLE_LOG -> null; +// case STRIPPED_JUNGLE_WOOD -> null; +// case STRIPPED_MANGROVE_LOG -> null; +// case STRIPPED_MANGROVE_WOOD -> null; +// case STRIPPED_OAK_LOG -> null; +// case STRIPPED_OAK_WOOD -> null; +// case STRIPPED_SPRUCE_LOG -> null; +// case STRIPPED_SPRUCE_WOOD -> null; +// case STRIPPED_WARPED_HYPHAE -> null; +// case STRIPPED_WARPED_STEM -> null; +// case STRUCTURE_BLOCK -> null; +// case STRUCTURE_VOID -> null; +// case SUGAR_CANE -> null; +// case SUNFLOWER -> null; +// case SUSPICIOUS_GRAVEL -> null; +// case SUSPICIOUS_SAND -> null; +// case SWEET_BERRY_BUSH -> null; +// case TALL_GRASS -> null; +// case TALL_SEAGRASS -> null; +// case TARGET -> null; +// case TERRACOTTA -> null; +// case TINTED_GLASS -> null; +// case TNT -> null; +// case TORCH -> null; +// case TORCHFLOWER -> null; +// case TORCHFLOWER_CROP -> null; +// case TRAPPED_CHEST -> null; +// case TRIPWIRE -> null; +// case TRIPWIRE_HOOK -> null; +// case TUBE_CORAL -> null; +// case TUBE_CORAL_BLOCK -> null; +// case TUBE_CORAL_FAN -> null; +// case TUBE_CORAL_WALL_FAN -> null; +// case TUFF -> null; +// case TUFF_BRICKS -> null; +// case TUFF_BRICK_SLAB -> null; +// case TUFF_BRICK_WALL -> null; +// case TUFF_SLAB -> null; +// case TUFF_WALL -> null; +// case TURTLE_EGG -> null; +// case TWISTING_VINES -> null; +// case TWISTING_VINES_PLANT -> null; +// case VERDANT_FROGLIGHT -> null; +// case VINE -> null; +// case VOID_AIR -> null; +// case WALL_TORCH -> null; +// case WARPED_BUTTON -> null; +// case WARPED_DOOR -> null; +// case WARPED_FENCE -> null; +// case WARPED_FENCE_GATE -> null; +// case WARPED_FUNGUS -> null; +// case WARPED_HYPHAE -> null; +// case WARPED_NYLIUM -> null; +// case WARPED_PLANKS -> null; +// case WARPED_PRESSURE_PLATE -> null; +// case WARPED_ROOTS -> null; +// case WARPED_SLAB -> null; +// case WARPED_STEM -> null; +// case WARPED_TRAPDOOR -> null; +// case WARPED_WART_BLOCK -> null; +// case WATER -> null; +// case WATER_CAULDRON -> null; +// case WAXED_CHISELED_COPPER -> null; +// case WAXED_COPPER_BLOCK -> null; +// case WAXED_COPPER_BULB -> null; +// case WAXED_COPPER_DOOR -> null; +// case WAXED_COPPER_GRATE -> null; +// case WAXED_COPPER_TRAPDOOR -> null; +// case WAXED_CUT_COPPER -> null; +// case WAXED_CUT_COPPER_SLAB -> null; +// case WAXED_EXPOSED_CHISELED_COPPER -> null; +// case WAXED_EXPOSED_COPPER -> null; +// case WAXED_EXPOSED_COPPER_BULB -> null; +// case WAXED_EXPOSED_COPPER_DOOR -> null; +// case WAXED_EXPOSED_COPPER_GRATE -> null; +// case WAXED_EXPOSED_COPPER_TRAPDOOR -> null; +// case WAXED_EXPOSED_CUT_COPPER -> null; +// case WAXED_EXPOSED_CUT_COPPER_SLAB -> null; +// case WAXED_OXIDIZED_CHISELED_COPPER -> null; +// case WAXED_OXIDIZED_COPPER -> null; +// case WAXED_OXIDIZED_COPPER_BULB -> null; +// case WAXED_OXIDIZED_COPPER_DOOR -> null; +// case WAXED_OXIDIZED_COPPER_GRATE -> null; +// case WAXED_OXIDIZED_COPPER_TRAPDOOR -> null; +// case WAXED_OXIDIZED_CUT_COPPER -> null; +// case WAXED_OXIDIZED_CUT_COPPER_SLAB -> null; +// case WAXED_WEATHERED_CHISELED_COPPER -> null; +// case WAXED_WEATHERED_COPPER -> null; +// case WAXED_WEATHERED_COPPER_BULB -> null; +// case WAXED_WEATHERED_COPPER_DOOR -> null; +// case WAXED_WEATHERED_COPPER_GRATE -> null; +// case WAXED_WEATHERED_COPPER_TRAPDOOR -> null; +// case WAXED_WEATHERED_CUT_COPPER -> null; +// case WAXED_WEATHERED_CUT_COPPER_SLAB -> null; +// case WEATHERED_CHISELED_COPPER -> null; +// case WEATHERED_COPPER -> null; +// case WEATHERED_COPPER_BULB -> null; +// case WEATHERED_COPPER_DOOR -> null; +// case WEATHERED_COPPER_GRATE -> null; +// case WEATHERED_COPPER_TRAPDOOR -> null; +// case WEATHERED_CUT_COPPER -> null; +// case WEATHERED_CUT_COPPER_SLAB -> null; +// case WEEPING_VINES -> null; +// case WEEPING_VINES_PLANT -> null; +// case WET_SPONGE -> null; +// case WHEAT -> null; +// case WHITE_BANNER -> null; +// case WHITE_BED -> null; +// case WHITE_CANDLE -> null; +// case WHITE_CANDLE_CAKE -> null; +// case WHITE_CARPET -> null; +// case WHITE_CONCRETE -> null; +// case WHITE_CONCRETE_POWDER -> null; +// case WHITE_GLAZED_TERRACOTTA -> null; +// case WHITE_SHULKER_BOX -> null; +// case WHITE_STAINED_GLASS -> null; +// case WHITE_STAINED_GLASS_PANE -> null; +// case WHITE_TERRACOTTA -> null; +// case WHITE_TULIP -> null; +// case WHITE_WALL_BANNER -> null; +// case WHITE_WOOL -> null; +// case WITHER_ROSE -> null; +// case WITHER_SKELETON_SKULL -> null; +// case WITHER_SKELETON_WALL_SKULL -> null; +// case YELLOW_BANNER -> null; +// case YELLOW_BED -> null; +// case YELLOW_CANDLE -> null; +// case YELLOW_CANDLE_CAKE -> null; +// case YELLOW_CARPET -> null; +// case YELLOW_CONCRETE -> null; +// case YELLOW_CONCRETE_POWDER -> null; +// case YELLOW_GLAZED_TERRACOTTA -> null; +// case YELLOW_SHULKER_BOX -> null; +// case YELLOW_STAINED_GLASS -> null; +// case YELLOW_STAINED_GLASS_PANE -> null; +// case YELLOW_TERRACOTTA -> null; +// case YELLOW_WALL_BANNER -> null; +// case YELLOW_WOOL -> null; +// case ZOMBIE_HEAD -> null; +// case ZOMBIE_WALL_HEAD -> null; +// default -> null; +// }; + } + + @Override + public net.ouja.api.world.level.block.Block getBlock() { + return getBlockClass(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/block/DishButtonBlock.java b/patches/release/1.21.8/net/ouja/dish/world/block/DishButtonBlock.java new file mode 100644 index 0000000..ae9efb6 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/block/DishButtonBlock.java @@ -0,0 +1,30 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.block.Block; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.ButtonBlock; + +public class DishButtonBlock extends DishBlock implements ButtonBlock { + private final net.minecraft.world.level.block.ButtonBlock buttonBlock; + + public DishButtonBlock(BlockPos pos, BlockTypes blockType, Block block) { + super(pos, blockType, block); + this.buttonBlock = (net.minecraft.world.level.block.ButtonBlock) block; + } + + @Override + public BlockPos getBlockPos() { + return super.getBlockPos(); + } + + @Override + public BlockTypes getType() { + return super.getType(); + } + + @Override + public int getSignal() { + return this.buttonBlock.defaultBlockState().getValue(net.minecraft.world.level.block.ButtonBlock.POWERED) ? 15 : 0; + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/block/DishDoorBlock.java b/patches/release/1.21.8/net/ouja/dish/world/block/DishDoorBlock.java new file mode 100644 index 0000000..f6174a9 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/block/DishDoorBlock.java @@ -0,0 +1,32 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.ouja.api.entity.Entity; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.DoorBlock; + +import javax.annotation.Nullable; + +public class DishDoorBlock extends DishBlock implements DoorBlock { + private final net.minecraft.world.level.block.DoorBlock door; + private final Level level; + + public DishDoorBlock(BlockPos pos, BlockTypes blockType, Block block, Level level) { + super(pos, blockType, block); + this.door = (net.minecraft.world.level.block.DoorBlock) block; + this.level = level; + } + + @Override + public boolean isOpen() { + return this.door.isOpen(this.door.defaultBlockState()); + } + + @Override + public void setOpen(@Nullable Entity entity, boolean open) { + net.minecraft.core.BlockPos blockPos = new net.minecraft.core.BlockPos(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()); + this.door.setOpen(entity != null ? this.level.getEntity(entity.getId()) : null, this.level, this.door.defaultBlockState(), blockPos, open); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/block/DishSignBlock.java b/patches/release/1.21.8/net/ouja/dish/world/block/DishSignBlock.java new file mode 100644 index 0000000..04006f4 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/block/DishSignBlock.java @@ -0,0 +1,60 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SignBlock; +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.WaterLoggableBlock; +import net.ouja.api.world.level.block.entity.SignText; +import net.ouja.dish.world.block.entity.DishSignText; + +public class DishSignBlock extends DishBlock implements WaterLoggableBlock, net.ouja.api.world.level.block.SignBlock { + private final SignBlock block; + private final SignBlockEntity signBlockEntity; + private final boolean isWallSign; + private final boolean isHangingSign; + + public DishSignBlock(BlockPos pos, BlockTypes blockType, Block block, SignBlockEntity signBlockEntity) { + super(pos, blockType, block); + this.block = (SignBlock) block; + this.signBlockEntity = signBlockEntity; + this.isWallSign = blockType.getBlockName().contains("_wall_"); + this.isHangingSign = blockType.getBlockName().endsWith("_hanging_sign"); + } + + @Override + public boolean isWaterLogged() { + return !this.block.getFluidState(this.block.defaultBlockState()).isEmpty(); + } + + @Override + public boolean isWallSign() { + return isWallSign; + } + + @Override + public boolean isHangingSign() { + return isHangingSign; + } + + @Override + public boolean isWaxed() { + return signBlockEntity.isWaxed(); + } + + @Override + public void setWaxed(boolean waxed) { + signBlockEntity.setWaxed(waxed); + } + + @Override + public SignText getFrontText() { + return new DishSignText(signBlockEntity,true); + } + + @Override + public SignText getBackText() { + return new DishSignText(signBlockEntity,false); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/block/DishStairBlock.java b/patches/release/1.21.8/net/ouja/dish/world/block/DishStairBlock.java new file mode 100644 index 0000000..ae09207 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/block/DishStairBlock.java @@ -0,0 +1,26 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.StairBlock; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.WaterLoggableBlock; + +public class DishStairBlock extends DishBlock implements WaterLoggableBlock, net.ouja.api.world.level.block.StairBlock { + private final StairBlock block; + + public DishStairBlock(BlockPos pos, BlockTypes blockType, Block block) { + super(pos, blockType, block); + this.block = (StairBlock) block; + } + + @Override + public boolean isWaterLogged() { + return !this.block.getFluidState(this.block.defaultBlockState()).isEmpty(); + } + + @Override + public String direction() { + return this.block.defaultBlockState().getValue(StairBlock.FACING).getName(); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/block/DishTrapdoorBlock.java b/patches/release/1.21.8/net/ouja/dish/world/block/DishTrapdoorBlock.java new file mode 100644 index 0000000..1c3e669 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/block/DishTrapdoorBlock.java @@ -0,0 +1,38 @@ +package net.ouja.dish.world.block; + +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.TrapDoorBlock; +import net.ouja.api.entity.Player; +import net.ouja.api.world.level.block.BlockPos; +import net.ouja.api.world.level.block.BlockTypes; +import net.ouja.api.world.level.block.TrapdoorBlock; + +import javax.annotation.Nullable; + +public class DishTrapdoorBlock extends DishBlock implements TrapdoorBlock { + private final TrapDoorBlock trapdoor; + private final Level level; + + public DishTrapdoorBlock(BlockPos pos, BlockTypes blockType, Block block, Level level) { + super(pos, blockType, block); + this.trapdoor = (TrapDoorBlock) block; + this.level = level; + } + + @Override + public boolean isOpen() { + return this.trapdoor.defaultBlockState().getValue(TrapDoorBlock.OPEN); + } + + @Override + public void setOpen(@Nullable Player player, boolean open) { + net.minecraft.core.BlockPos blockPos = new net.minecraft.core.BlockPos(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()); + this.trapdoor.setOpen(player != null ? this.level.getPlayerByUUID(player.getUUID()) : null, this.level, this.trapdoor.defaultBlockState(), blockPos, open); + } + + @Override + public boolean isWaterLogged() { + return this.trapdoor.defaultBlockState().getValue(TrapDoorBlock.WATERLOGGED); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/block/entity/DishSignText.java b/patches/release/1.21.8/net/ouja/dish/world/block/entity/DishSignText.java new file mode 100644 index 0000000..3e94690 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/block/entity/DishSignText.java @@ -0,0 +1,54 @@ +package net.ouja.dish.world.block.entity; + +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.ouja.api.network.chat.Component; +import net.ouja.api.world.level.block.entity.SignText; +import net.ouja.dish.network.chat.DishComponent; + +public class DishSignText implements SignText { + private final SignBlockEntity signBlockEntity; + private final boolean isFront; + + public DishSignText(SignBlockEntity signBlockEntity, boolean front) { + this.signBlockEntity = signBlockEntity; + this.isFront = front; + } + + @Override + public Component[] getText(boolean filtered) { + if (signBlockEntity == null) return new Component[0]; + return isFront ? DishComponent.fromComponent(signBlockEntity.getFrontText().getMessages(filtered)) : DishComponent.fromComponent(signBlockEntity.getBackText().getMessages(filtered)); + } + + @Override + public boolean isGlowing() { + return isFront ? signBlockEntity.getFrontText().hasGlowingText() : signBlockEntity.getBackText().hasGlowingText(); + } + + @Override + public void setGlowing(boolean b) { + net.minecraft.world.level.block.entity.SignText text = isFront ? + signBlockEntity.getFrontText().setHasGlowingText(b) : + signBlockEntity.getBackText().setHasGlowingText(b); + + setText(text); + } + + @Override + public void setMessage(int i, Component component) { + this.setMessage(i, component, component); + } + + @Override + public void setMessage(int i, Component message, Component filtered) { + net.minecraft.world.level.block.entity.SignText text = isFront ? + signBlockEntity.getFrontText().setMessage(i, DishComponent.toComponent(message), DishComponent.toComponent(filtered)) : + signBlockEntity.getBackText().setMessage(i, DishComponent.toComponent(message), DishComponent.toComponent(filtered)); + + setText(text); + } + + private void setText(net.minecraft.world.level.block.entity.SignText text) { + signBlockEntity.updateText((signText) -> text, isFront); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/item/DishItemStack.java b/patches/release/1.21.8/net/ouja/dish/world/item/DishItemStack.java new file mode 100644 index 0000000..72ff493 --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/item/DishItemStack.java @@ -0,0 +1,140 @@ +package net.ouja.dish.world.item; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponentType; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.component.PatchedDataComponentMap; +import net.ouja.api.network.chat.Component; +import net.ouja.api.world.item.Item; +import net.ouja.api.world.item.ItemStack; +import net.ouja.dish.network.chat.DishComponent; + +public class DishItemStack implements ItemStack { + private final net.minecraft.world.item.ItemStack itemStack; + + public DishItemStack(net.minecraft.world.item.ItemStack itemStack) { + this.itemStack = itemStack; + } + + /** + * Converts vanilla's ObjectArrayList to Dishes version of it + * @param items vanilla items + * @return Dishes variant of the ItemStacks. + */ + public static ObjectArrayList convertFromVanilla(ObjectArrayList items) { + ObjectArrayList dishItems = new ObjectArrayList<>(); + + for (net.minecraft.world.item.ItemStack vanillaItem : items) { + dishItems.add(new DishItemStack(vanillaItem)); + } + + return dishItems; + } + + // TODO: 11/15/2023 Make Item classes + @Override + public Item getItem() { + return null; + } + + @Override + public boolean is(Item item) { + return false; + } + + @Override + public int getMaxStackSize() { + return this.itemStack.getMaxStackSize(); + } + + @Override + public boolean isDamageableItem() { + return this.itemStack.isDamageableItem(); + } + + @Override + public boolean isDamaged() { + return this.itemStack.isDamageableItem(); + } + + @Override + public int getDamageValue() { + return this.itemStack.getDamageValue(); + } + + @Override + public void setDamageValue(int i) { + this.itemStack.setDamageValue(i); + } + + @Override + public int getMaxDamage() { + return this.itemStack.getMaxDamage(); + } + + @Override + public ItemStack copy() { + if (this.itemStack.isEmpty()) { + return new DishItemStack(net.minecraft.world.item.ItemStack.EMPTY); + } + + net.minecraft.world.item.ItemStack itemstack = new net.minecraft.world.item.ItemStack((Holder)this.itemStack.getItem(), this.itemStack.getCount(), this.itemStack.getComponentsPatch()); + itemstack.setPopTime(this.itemStack.getPopTime()); + + return new DishItemStack(itemstack); + } + + @Override + public ItemStack copyWithCount(int i) { + if (this.itemStack.isEmpty()) { + return new DishItemStack(net.minecraft.world.item.ItemStack.EMPTY); + } + + net.minecraft.world.item.ItemStack itemstack = new net.minecraft.world.item.ItemStack((Holder)this.itemStack.getItem(), this.itemStack.getCount(), this.itemStack.getComponentsPatch()); + itemstack.setPopTime(this.itemStack.getPopTime()); + + itemstack.setCount(i); + return new DishItemStack(itemstack); + } + + @Override + public Component getHoverName() { + return DishComponent.fromComponent(this.itemStack.getHoverName()); + } + + @Override + public void setHoverName(Component component) { + DataComponentMap.Builder builder = DataComponentMap.builder().addAll(this.itemStack.getComponents()); + builder.set(DataComponents.CUSTOM_NAME, DishComponent.toComponent(component)); + this.itemStack.applyComponents(builder.build()); + } + + @Override + public void resetHoverName() { + DataComponentMap.Builder builder = DataComponentMap.builder().addAll(this.itemStack.getComponents()); + builder.set(DataComponents.CUSTOM_NAME, this.itemStack.getItem().getName(this.itemStack)); + this.itemStack.applyComponents(builder.build()); + } + + @Override + public boolean hasCustomHoverName() { + return this.itemStack.getComponents().has(DataComponents.CUSTOM_NAME); + } + + @Override + public Component getDisplayName() { + return DishComponent.fromComponent(this.itemStack.getDisplayName()); + } + + @Override + public int getCount() { + return this.itemStack.getCount(); + } + + @Override + public void setCount(int i) { + this.itemStack.setCount(i); + } +} diff --git a/patches/release/1.21.8/net/ouja/dish/world/level/chunk/DishStructure.java b/patches/release/1.21.8/net/ouja/dish/world/level/chunk/DishStructure.java new file mode 100644 index 0000000..4639ddc --- /dev/null +++ b/patches/release/1.21.8/net/ouja/dish/world/level/chunk/DishStructure.java @@ -0,0 +1,52 @@ +package net.ouja.dish.world.level.chunk; + +import net.ouja.api.world.level.chunk.Structure; +import net.ouja.api.world.level.chunk.StructureTypes; + +public class DishStructure implements Structure { + private final net.minecraft.world.level.levelgen.structure.Structure structure; + + public DishStructure(net.minecraft.world.level.levelgen.structure.Structure structure) { + this.structure = structure; + } + + @Override + public StructureTypes getType() { + if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.BURIED_TREASURE) { + return StructureTypes.BURIED_TREASURE; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.DESERT_PYRAMID) { + return StructureTypes.DESERT_PYRAMID; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.END_CITY) { + return StructureTypes.END_CITY; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.FORTRESS) { + return StructureTypes.FORTRESS; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.IGLOO) { + return StructureTypes.IGLOO; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.JIGSAW) { + return StructureTypes.JIGSAW; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.JUNGLE_TEMPLE) { + return StructureTypes.JUNGLE_TEMPLE; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.MINESHAFT) { + return StructureTypes.MINESHAFT; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.NETHER_FOSSIL) { + return StructureTypes.NETHER_FOSSIL; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.OCEAN_MONUMENT) { + return StructureTypes.OCEAN_MONUMENT; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.OCEAN_RUIN) { + return StructureTypes.OCEAN_RUIN; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.RUINED_PORTAL) { + return StructureTypes.RUINED_PORTAL; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.SHIPWRECK) { + return StructureTypes.SHIPWRECK; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.STRONGHOLD) { + return StructureTypes.STRONGHOLD; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.SWAMP_HUT) { + return StructureTypes.SWAMP_HUT; + } else if (structure.type() == net.minecraft.world.level.levelgen.structure.StructureType.WOODLAND_MANSION) { + return StructureTypes.WOODLAND_MANSION; + } else { + return null; + } + + } +} From 86d3f084ab6a8861bb023a1b7c0945a0847e2f68 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Tue, 23 Sep 2025 21:16:19 -0500 Subject: [PATCH 14/15] update to 1.21.8 --- Dish-API | 2 +- README.md | 4 +- dish/libraries/1.21.8.json | 8 +- .../1.21.8/net/minecraft/CrashReport.patch | 2 +- .../net/minecraft/commands/Commands.patch | 14 ++-- .../1.21.8/net/minecraft/server/Main.patch | 4 +- .../minecraft/server/MinecraftServer.patch | 4 +- .../server/dedicated/DedicatedServer.patch | 6 +- .../net/minecraft/server/level/ChunkMap.patch | 17 +--- .../minecraft/server/level/ServerEntity.patch | 38 ++++----- .../minecraft/server/level/ServerPlayer.patch | 18 ++--- .../server/level/ServerPlayerGameMode.patch | 4 +- .../ServerGamePacketListenerImpl.patch | 14 ++-- .../ServerLoginPacketListenerImpl.patch | 2 +- .../minecraft/server/players/PlayerList.patch | 50 ++++++------ .../world/damagesource/DamageSource.patch | 4 +- .../minecraft/world/entity/LivingEntity.patch | 52 ++++++++++-- .../minecraft/world/entity/animal/Squid.patch | 4 +- .../world/entity/animal/sniffer/Sniffer.patch | 6 +- .../world/entity/animal/wolf/Wolf.patch | 12 +++ .../world/entity/item/ItemEntity.patch | 26 +++--- .../world/entity/monster/Shulker.patch | 4 +- .../world/entity/monster/Vindicator.patch | 4 +- .../world/entity/monster/hoglin/Hoglin.patch | 4 +- .../world/entity/monster/piglin/Piglin.patch | 4 +- .../net/minecraft/world/item/BlockItem.patch | 8 +- .../net/minecraft/world/item/ItemStack.patch | 9 +-- .../minecraft/world/level/BaseSpawner.patch | 33 ++++---- .../net/minecraft/world/level/ChunkPos.patch | 8 +- .../minecraft/world/level/LevelReader.patch | 4 +- .../minecraft/world/level/block/Block.patch | 17 ++-- .../world/level/block/SignBlock.patch | 4 +- .../world/level/block/StairBlock.patch | 4 +- .../world/level/block/TrapDoorBlock.patch | 4 +- .../world/level/chunk/ChunkGenerator.patch | 21 +++-- .../level/chunk/status/ChunkStatusTasks.patch | 14 ++-- .../world/level/material/FlowingFluid.patch | 81 +++---------------- .../world/level/storage/loot/LootTable.patch | 4 +- .../1.21.8/net/ouja/dish/DishProperties.java | 10 --- .../net/ouja/dish/entity/DishPlayer.java | 2 +- .../ouja/dish/entity/neutral/DishWolf.java | 2 +- .../net/ouja/dish/entity/passive/DishPig.java | 7 +- .../ouja/dish/entity/passive/DishSheep.java | 2 +- .../ouja/dish/entity/passive/DishStrider.java | 7 +- .../dish/entity/passive/DishTropicalFish.java | 2 +- .../1.21.8/net/ouja/dish/world/DishLevel.java | 4 +- 46 files changed, 265 insertions(+), 289 deletions(-) create mode 100644 patches/release/1.21.8/net/minecraft/world/entity/animal/wolf/Wolf.patch diff --git a/Dish-API b/Dish-API index 37c42e2..6af6d41 160000 --- a/Dish-API +++ b/Dish-API @@ -1 +1 @@ -Subproject commit 37c42e22ba3f5f7e54f5bf30f4b17cc8d6821d10 +Subproject commit 6af6d41e08c836b3f25058e8ce8bbdd16912123b diff --git a/README.md b/README.md index 6a3d917..bd518f7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ repositories { } dependencies { - compileOnly("net.ouja:api:1.21-R0.2-SNAPSHOT") + compileOnly("net.ouja:api:1.21.8-R0.2-SNAPSHOT") implementation 'it.unimi.dsi:fastutil:8.5.12' } ``` @@ -41,7 +41,7 @@ Maven net.ouja api - 1.21-R0.2-SNAPSHOT + 1.21.8-R0.2-SNAPSHOT provided diff --git a/dish/libraries/1.21.8.json b/dish/libraries/1.21.8.json index 88e0038..f6574ae 100644 --- a/dish/libraries/1.21.8.json +++ b/dish/libraries/1.21.8.json @@ -1,6 +1,6 @@ { "version": "1.21.8", - "api_version": "R0.1-SNAPSHOT", + "api_version": "R0.2-SNAPSHOT", "libraries": [ { "downloads": { @@ -11,10 +11,10 @@ }, { "downloads": { - "url": "https://maven.ouja.net/net/ouja/api/1.21.8-R0.1-SNAPSHOT/api-1.21.8-R0.1-20250924.003335-1.jar", - "path": "net/ouja/api/1.21.8/1.21.8-R0.1-SNAPSHOT.jar" + "url": "https://maven.ouja.net/net/ouja/api/1.21.8-R0.2-SNAPSHOT/api-1.21.8-R0.2-20250924.021552-2.jar", + "path": "net/ouja/api/1.21.8/1.21.8-R0.2-SNAPSHOT.jar" }, - "name": "net.ouja:api:1.21.8-R0.1-SNAPSHOT" + "name": "net.ouja:api:1.21.8-R0.2-SNAPSHOT" } ] } \ No newline at end of file diff --git a/patches/release/1.21.8/net/minecraft/CrashReport.patch b/patches/release/1.21.8/net/minecraft/CrashReport.patch index a87eeb2..b80fa10 100644 --- a/patches/release/1.21.8/net/minecraft/CrashReport.patch +++ b/patches/release/1.21.8/net/minecraft/CrashReport.patch @@ -1,5 +1,5 @@ diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java -index 706b64e..1bdfec4 100644 +index b5180b2..647b8ce 100644 --- a/src/main/java/net/minecraft/CrashReport.java +++ b/src/main/java/net/minecraft/CrashReport.java @@ -34,6 +34,7 @@ public class CrashReport { diff --git a/patches/release/1.21.8/net/minecraft/commands/Commands.patch b/patches/release/1.21.8/net/minecraft/commands/Commands.patch index 896bcee..4e79966 100644 --- a/patches/release/1.21.8/net/minecraft/commands/Commands.patch +++ b/patches/release/1.21.8/net/minecraft/commands/Commands.patch @@ -1,17 +1,17 @@ diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 587b873..093661e 100644 +index e8fc7a2..e6eea96 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -143,7 +143,7 @@ public class Commands { - public static final int LEVEL_GAMEMASTERS = 2; - public static final int LEVEL_ADMINS = 3; - public static final int LEVEL_OWNERS = 4; +@@ -173,7 +173,7 @@ public class Commands { + return node.getRequirement() instanceof PermissionCheck permissionCheck && permissionCheck.requiredLevel() > 0; + } + }; - private final CommandDispatcher dispatcher = new CommandDispatcher<>(); -+ private static final CommandDispatcher dispatcher = new CommandDispatcher(); // dish -- make this static ++ private static final CommandDispatcher dispatcher = new CommandDispatcher<>(); // dish -- make this static public Commands(Commands.CommandSelection selection, CommandBuildContext context) { AdvancementCommands.register(this.dispatcher); -@@ -416,8 +416,8 @@ public class Commands { +@@ -436,8 +436,8 @@ public class Commands { }; } diff --git a/patches/release/1.21.8/net/minecraft/server/Main.patch b/patches/release/1.21.8/net/minecraft/server/Main.patch index 3df466a..90301b3 100644 --- a/patches/release/1.21.8/net/minecraft/server/Main.patch +++ b/patches/release/1.21.8/net/minecraft/server/Main.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 3cde004..a5b4913 100644 +index b6a9e7a..92cd607 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -114,6 +114,12 @@ public class Main { +@@ -119,6 +119,12 @@ public class Main { return; } diff --git a/patches/release/1.21.8/net/minecraft/server/MinecraftServer.patch b/patches/release/1.21.8/net/minecraft/server/MinecraftServer.patch index 1454230..f0611fe 100644 --- a/patches/release/1.21.8/net/minecraft/server/MinecraftServer.patch +++ b/patches/release/1.21.8/net/minecraft/server/MinecraftServer.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a049964..06a356b 100644 +index aee1ff2..3a4ae9d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1119,7 +1119,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop seenBy = Sets.newIdentityHashSet(); public TrackedEntity(final Entity entity, final int range, final int updateInterval, final boolean trackDelta) { -- this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, updateInterval, trackDelta, this::broadcast); -+ this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, updateInterval, trackDelta, this::broadcast, this.seenBy); // dish -- pass the seenBy field into ServerEntity +- this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, updateInterval, trackDelta, this::broadcast, this::broadcastIgnorePlayers); ++ this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, updateInterval, trackDelta, this::broadcast, this::broadcastIgnorePlayers, this.seenBy); // dish -- pass the seenBy field into ServerEntity this.entity = entity; this.range = range; this.lastSectionPos = SectionPos.of(entity); diff --git a/patches/release/1.21.8/net/minecraft/server/level/ServerEntity.patch b/patches/release/1.21.8/net/minecraft/server/level/ServerEntity.patch index de2692d..cf195b0 100644 --- a/patches/release/1.21.8/net/minecraft/server/level/ServerEntity.patch +++ b/patches/release/1.21.8/net/minecraft/server/level/ServerEntity.patch @@ -1,15 +1,15 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 26d9a03..c65e60d 100644 +index ad5c861..7e6d215 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -56,25 +56,27 @@ public class ServerEntity { - private final boolean trackDelta; +@@ -63,13 +63,14 @@ public class ServerEntity { private final Consumer> broadcast; + private final BiConsumer, List> broadcastWithIgnore; private final VecDeltaCodec positionCodec = new VecDeltaCodec(); + private final Set seenBy; // dish - private int lastSentYRot; - private int lastSentXRot; - private int lastSentYHeadRot; + private byte lastSentYRot; + private byte lastSentXRot; + private byte lastSentYHeadRot; private Vec3 lastSentMovement; private int tickCount; private int teleportDelay; @@ -18,21 +18,23 @@ index 26d9a03..c65e60d 100644 private boolean wasRiding; private boolean wasOnGround; @Nullable - private List> trackedDataValues; - -- public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast) { -+ public ServerEntity(ServerLevel level, Entity entity, int updateInterval, boolean trackDelta, Consumer> broadcast, Set seenBy) { // dish +@@ -82,6 +83,7 @@ public class ServerEntity { + boolean trackDelta, + Consumer> broadcast, + BiConsumer, List> broadcastWithIgnore ++ , Set seenBy // dish + ) { this.level = level; this.broadcast = broadcast; - this.entity = entity; - this.updateInterval = updateInterval; - this.trackDelta = trackDelta; - this.positionCodec.setBase(entity.trackingPosition()); +@@ -96,6 +98,7 @@ public class ServerEntity { + this.lastSentYHeadRot = Mth.packDegrees(entity.getYHeadRot()); + this.wasOnGround = entity.onGround(); + this.trackedDataValues = entity.getEntityData().getNonDefaultValues(); + this.seenBy = seenBy; // dish - this.lastSentMovement = entity.getDeltaMovement(); - this.lastSentYRot = Mth.floor(entity.getYRot() * 256.0F / 360.0F); - this.lastSentXRot = Mth.floor(entity.getXRot() * 256.0F / 360.0F); -@@ -99,7 +101,7 @@ public class ServerEntity { + } + + public void sendChanges() { +@@ -106,7 +109,7 @@ public class ServerEntity { this.lastPassengers = passengers; } diff --git a/patches/release/1.21.8/net/minecraft/server/level/ServerPlayer.patch b/patches/release/1.21.8/net/minecraft/server/level/ServerPlayer.patch index dd38908..c3b70c3 100644 --- a/patches/release/1.21.8/net/minecraft/server/level/ServerPlayer.patch +++ b/patches/release/1.21.8/net/minecraft/server/level/ServerPlayer.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 1a5123c..fa5d35d 100644 +index e05fb11..60ad45b 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -655,10 +655,25 @@ public class ServerPlayer extends Player { +@@ -811,10 +811,25 @@ public class ServerPlayer extends Player { @Override public void die(DamageSource cause) { @@ -29,7 +29,7 @@ index 1a5123c..fa5d35d 100644 this.connection .send( new ClientboundPlayerCombatKillPacket(this.getId(), deathMessage), -@@ -945,6 +960,11 @@ public class ServerPlayer extends Player { +@@ -1105,6 +1120,11 @@ public class ServerPlayer extends Player { } else if (this.bedBlocked(at, direction)) { return Either.left(Player.BedSleepingProblem.OBSTRUCTED); } else { @@ -38,20 +38,20 @@ index 1a5123c..fa5d35d 100644 + net.ouja.dish.plugins.RegisteredEvents.callEvent(event); + if (event.isCancelled()) return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_HERE); + // dish end - this.setRespawnPosition(this.level().dimension(), at, this.getYRot(), false, true); - if (this.level().isDay()) { + this.setRespawnPosition(new ServerPlayer.RespawnConfig(this.level().dimension(), at, this.getYRot(), false), true); + if (this.level().isBrightOutside()) { return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); -@@ -959,7 +979,7 @@ public class ServerPlayer extends Player { +@@ -1119,7 +1139,7 @@ public class ServerPlayer extends Player { new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0), - monster -> monster.isPreventingPlayerRest(this) + monster -> monster.isPreventingPlayerRest(this.level(), this) ); - if (!entitiesOfClass.isEmpty()) { + if (!event.canSleepWhileMonstersAreNear() && !entitiesOfClass.isEmpty()) { // dish -- PlayerSleepEvent modifies if the player can sleep while monsters are near. return Either.left(Player.BedSleepingProblem.NOT_SAFE); } } -@@ -1641,6 +1661,11 @@ public class ServerPlayer extends Player { - if (this.gameMode.getGameModeForPlayer() == GameType.SPECTATOR) { +@@ -1812,6 +1832,11 @@ public class ServerPlayer extends Player { + if (this.isSpectator()) { this.setCamera(targetEntity); } else { + // dish start diff --git a/patches/release/1.21.8/net/minecraft/server/level/ServerPlayerGameMode.patch b/patches/release/1.21.8/net/minecraft/server/level/ServerPlayerGameMode.patch index aa05a6f..8fafbd5 100644 --- a/patches/release/1.21.8/net/minecraft/server/level/ServerPlayerGameMode.patch +++ b/patches/release/1.21.8/net/minecraft/server/level/ServerPlayerGameMode.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 043f44a..97eb976 100644 +index 52b682f..3558490 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -242,6 +242,20 @@ public class ServerPlayerGameMode { +@@ -240,6 +240,20 @@ public class ServerPlayerGameMode { } else { BlockEntity blockEntity = this.level.getBlockEntity(pos); Block block = blockState.getBlock(); diff --git a/patches/release/1.21.8/net/minecraft/server/network/ServerGamePacketListenerImpl.patch b/patches/release/1.21.8/net/minecraft/server/network/ServerGamePacketListenerImpl.patch index e3dc31d..6ce0114 100644 --- a/patches/release/1.21.8/net/minecraft/server/network/ServerGamePacketListenerImpl.patch +++ b/patches/release/1.21.8/net/minecraft/server/network/ServerGamePacketListenerImpl.patch @@ -1,11 +1,11 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 45fca81..9550e4d 100644 +index 595e517..62c1059 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -401,6 +401,23 @@ public class ServerGamePacketListenerImpl - double d2 = clampHorizontal(packet.getZ()); - float f = Mth.wrapDegrees(packet.getYRot()); - float f1 = Mth.wrapDegrees(packet.getXRot()); +@@ -424,6 +424,23 @@ public class ServerGamePacketListenerImpl + double d2 = clampHorizontal(packet.position().z()); + float f = Mth.wrapDegrees(packet.yRot()); + float f1 = Mth.wrapDegrees(packet.xRot()); + // dish + // Not sure if converting the passangers to a stream, then filtering out non players then converting it back to an ArrayList is good for performance. + java.util.ArrayList players = rootVehicle.getPassengers().stream().map((e) -> { @@ -18,8 +18,8 @@ index 45fca81..9550e4d 100644 + net.ouja.api.event.vehicle.VehicleMoveEvent event = new net.ouja.api.event.vehicle.VehicleMoveEvent(players, d, d1, d2, xOld, yOld, zOld); + net.ouja.dish.plugins.RegisteredEvents.callEvent(event); + if (event.isCancelled()) { -+ rootVehicle.absMoveTo(xOld, yOld, zOld, f, f1); -+ this.send(new ClientboundMoveVehiclePacket(rootVehicle)); ++ rootVehicle.absSnapTo(xOld, yOld, zOld, f, f1); ++ this.send(ClientboundMoveVehiclePacket.fromEntity(rootVehicle)); + return; + } + // dish end diff --git a/patches/release/1.21.8/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch b/patches/release/1.21.8/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch index 3a39f91..404cb71 100644 --- a/patches/release/1.21.8/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch +++ b/patches/release/1.21.8/net/minecraft/server/network/ServerLoginPacketListenerImpl.patch @@ -1,5 +1,5 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 4efac29..7c51e09 100644 +index 8e05b79..98944fb 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -138,6 +138,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, diff --git a/patches/release/1.21.8/net/minecraft/server/players/PlayerList.patch b/patches/release/1.21.8/net/minecraft/server/players/PlayerList.patch index 0222ad1..8a61b7f 100644 --- a/patches/release/1.21.8/net/minecraft/server/players/PlayerList.patch +++ b/patches/release/1.21.8/net/minecraft/server/players/PlayerList.patch @@ -1,29 +1,29 @@ diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 47f61db..ccbd5ec 100644 +index 2a6d199..d701e9c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -214,7 +214,15 @@ public abstract class PlayerList { - mutableComponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), string); - } +@@ -224,7 +224,15 @@ public abstract class PlayerList { + mutableComponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), string); + } -- this.broadcastSystemMessage(mutableComponent.withStyle(ChatFormatting.YELLOW), false); -+ // dish start -- add event listener for players joining -+ net.ouja.api.event.player.PlayerJoinEvent event = new net.ouja.api.event.player.PlayerJoinEvent(new net.ouja.dish.entity.DishPlayer(player), net.ouja.dish.network.chat.DishComponent.fromComponent(mutableComponent)); -+ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); -+ if (event.getJoinMessage() != null) { -+ mutableComponent = net.ouja.dish.network.chat.DishComponent.toComponent(event.getJoinMessage()); -+ } else { -+ mutableComponent = mutableComponent.withStyle(ChatFormatting.YELLOW); -+ } -+ // dish end - serverGamePacketListenerImpl.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); - ServerStatus status = this.server.getStatus(); - if (status != null && !cookie.transferred()) { -@@ -224,6 +232,7 @@ public abstract class PlayerList { - player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); - this.players.add(player); - this.playersByUUID.put(player.getUUID(), player); -+ this.broadcastSystemMessage(mutableComponent, false); // dish -- remove ".withStyle()" and move this here so that when players join, they can see their own join message. - this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); - this.sendLevelInfo(player, serverLevel); - serverLevel.addNewPlayer(player); +- this.broadcastSystemMessage(mutableComponent.withStyle(ChatFormatting.YELLOW), false); ++ // dish start -- add event listener for players joining ++ net.ouja.api.event.player.PlayerJoinEvent event = new net.ouja.api.event.player.PlayerJoinEvent(new net.ouja.dish.entity.DishPlayer(player), net.ouja.dish.network.chat.DishComponent.fromComponent(mutableComponent)); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.getJoinMessage() != null) { ++ mutableComponent = net.ouja.dish.network.chat.DishComponent.toComponent(event.getJoinMessage()); ++ } else { ++ mutableComponent = mutableComponent.withStyle(ChatFormatting.YELLOW); ++ } ++ // dish end + serverGamePacketListenerImpl.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); + ServerStatus status = this.server.getStatus(); + if (status != null && !cookie.transferred()) { +@@ -234,6 +242,7 @@ public abstract class PlayerList { + player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); + this.players.add(player); + this.playersByUUID.put(player.getUUID(), player); ++ this.broadcastSystemMessage(mutableComponent, false); // dish -- remove ".withStyle()" and move this here so that when players join, they can see their own join message. + this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); + this.sendLevelInfo(player, serverLevel); + serverLevel.addNewPlayer(player); diff --git a/patches/release/1.21.8/net/minecraft/world/damagesource/DamageSource.patch b/patches/release/1.21.8/net/minecraft/world/damagesource/DamageSource.patch index e472f0b..b14cf22 100644 --- a/patches/release/1.21.8/net/minecraft/world/damagesource/DamageSource.patch +++ b/patches/release/1.21.8/net/minecraft/world/damagesource/DamageSource.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java -index f70a6e9..709f53e 100644 +index 55a7d17..fbae18d 100644 --- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java +++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java -@@ -138,4 +138,6 @@ public class DamageSource { +@@ -134,4 +134,6 @@ public class DamageSource { public Holder typeHolder() { return this.type; } diff --git a/patches/release/1.21.8/net/minecraft/world/entity/LivingEntity.patch b/patches/release/1.21.8/net/minecraft/world/entity/LivingEntity.patch index 9ce0b29..435bb49 100644 --- a/patches/release/1.21.8/net/minecraft/world/entity/LivingEntity.patch +++ b/patches/release/1.21.8/net/minecraft/world/entity/LivingEntity.patch @@ -1,19 +1,39 @@ diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3667e1d..667b504 100644 +index 8d183b8..0740f7a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1196,6 +1196,10 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -758,13 +758,18 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin + + @Nullable + public ItemEntity drop(ItemStack stack, boolean randomizeMotion, boolean includeThrower) { ++ // dish ++ net.ouja.api.event.player.PlayDropItemEvent event = new net.ouja.api.event.player.PlayDropItemEvent(new net.ouja.dish.entity.DishPlayer((ServerPlayer)this), stack.toDish()); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (event.isCancelled()) return null; ++ // dish end + if (stack.isEmpty()) { + return null; + } else if (this.level().isClientSide) { + this.swing(InteractionHand.MAIN_HAND); + return null; + } else { +- ItemEntity itemEntity = this.createItemStackToDrop(stack, randomizeMotion, includeThrower); ++ ItemEntity itemEntity = this.createItemStackToDrop(stack, randomizeMotion, includeThrower, event.getPickUpDelay()); // dish -- add pickupDelay + if (itemEntity != null) { + this.level().addFreshEntity(itemEntity); + } +@@ -1228,6 +1233,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin } if (this.isDeadOrDying()) { + if (!(this instanceof Player)) { // dish -- make sure the entity that died is not a player, then call the EntityDeathEvent. -+ net.ouja.api.event.entity.EntityDeathEvent event = new net.ouja.api.event.entity.EntityDeathEvent(this.toDish(), new net.ouja.api.world.level.block.BlockPos(this.blockPosition().getX(), this.blockPosition().getY(), this.blockPosition().getZ(), new net.ouja.dish.world.DishLevel((ServerLevel)this.level())), source.toDish(), net.ouja.dish.network.chat.DishComponent.fromComponent(this.getCombatTracker().getDeathMessage())); ++ net.ouja.api.event.entity.EntityDeathEvent event = new net.ouja.api.event.entity.EntityDeathEvent(this.toDish(), new net.ouja.api.world.level.block.BlockPos(this.blockPosition().getX(), this.blockPosition().getY(), this.blockPosition().getZ(), new net.ouja.dish.world.DishLevel((ServerLevel)this.level())), damageSource.toDish(), net.ouja.dish.network.chat.DishComponent.fromComponent(this.getCombatTracker().getDeathMessage())); + net.ouja.dish.plugins.RegisteredEvents.callEvent(event); + } // dish end - if (!this.checkTotemDeathProtection(source)) { + if (!this.checkTotemDeathProtection(damageSource)) { if (flag1) { this.makeSound(this.getDeathSound()); -@@ -2890,6 +2894,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3018,6 +3027,11 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin public void onItemPickup(ItemEntity itemEntity) { Entity owner = itemEntity.getOwner(); if (owner instanceof ServerPlayer) { @@ -25,11 +45,27 @@ index 3667e1d..667b504 100644 CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer)owner, itemEntity.getItem(), this); } } -@@ -3554,6 +3563,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - } +@@ -3136,13 +3150,13 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin + } + + @Nullable +- private ItemEntity createItemStackToDrop(ItemStack stack, boolean randomizeMotion, boolean includeThrower) { ++ private ItemEntity createItemStackToDrop(ItemStack stack, boolean randomizeMotion, boolean includeThrower, int pickupDelay) { // dish + if (stack.isEmpty()) { + return null; + } else { + double d = this.getEyeY() - 0.3F; + ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), d, this.getZ(), stack); +- itemEntity.setPickUpDelay(40); ++ itemEntity.setPickUpDelay(pickupDelay); // dish + if (includeThrower) { + itemEntity.setThrower(this); + } +@@ -3738,6 +3752,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin + return this.locatorBarIcon; } + public net.ouja.dish.entity.DishEntity toDish() { return new net.ouja.dish.entity.DishEntity(this); } // dish - public static record Fallsounds(SoundEvent small, SoundEvent big) { + public record Fallsounds(SoundEvent small, SoundEvent big) { } } diff --git a/patches/release/1.21.8/net/minecraft/world/entity/animal/Squid.patch b/patches/release/1.21.8/net/minecraft/world/entity/animal/Squid.patch index c998e3f..cd27be3 100644 --- a/patches/release/1.21.8/net/minecraft/world/entity/animal/Squid.patch +++ b/patches/release/1.21.8/net/minecraft/world/entity/animal/Squid.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java -index 120889e..e22c9fc 100644 +index a60f300..2adc4fa 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java -@@ -176,7 +176,7 @@ public class Squid extends WaterAnimal { +@@ -186,7 +186,7 @@ public class Squid extends AgeableWaterCreature { return vec3.yRot(-this.yBodyRotO * (float) (Math.PI / 180.0)); } diff --git a/patches/release/1.21.8/net/minecraft/world/entity/animal/sniffer/Sniffer.patch b/patches/release/1.21.8/net/minecraft/world/entity/animal/sniffer/Sniffer.patch index 9b15a00..25160e5 100644 --- a/patches/release/1.21.8/net/minecraft/world/entity/animal/sniffer/Sniffer.patch +++ b/patches/release/1.21.8/net/minecraft/world/entity/animal/sniffer/Sniffer.patch @@ -1,9 +1,9 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index 834f3ae..95691f3 100644 +index 72a8e2e..8d98066 100644 --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -141,7 +141,7 @@ public class Sniffer extends Animal { - return this.position().add(this.getForward().scale(2.25)); +@@ -149,7 +149,7 @@ public class Sniffer extends Animal { + return Leashable.createQuadLeashOffsets(this, -0.01, 0.63, 0.38, 1.15); } - private Sniffer.State getState() { diff --git a/patches/release/1.21.8/net/minecraft/world/entity/animal/wolf/Wolf.patch b/patches/release/1.21.8/net/minecraft/world/entity/animal/wolf/Wolf.patch new file mode 100644 index 0000000..ec02718 --- /dev/null +++ b/patches/release/1.21.8/net/minecraft/world/entity/animal/wolf/Wolf.patch @@ -0,0 +1,12 @@ +diff --git a/src/main/java/net/minecraft/world/entity/animal/wolf/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/wolf/Wolf.java +index 840b0a8..29d8a43 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/wolf/Wolf.java ++++ b/src/main/java/net/minecraft/world/entity/animal/wolf/Wolf.java +@@ -113,6 +113,7 @@ public class Wolf extends TamableAnimal implements NeutralMob { + private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39); + @Nullable + private UUID persistentAngerTarget; ++ public boolean isWet() { return this.isWet; } // dish -- add a public method to grab the private variable + + public Wolf(EntityType entityType, Level level) { + super(entityType, level); diff --git a/patches/release/1.21.8/net/minecraft/world/entity/item/ItemEntity.patch b/patches/release/1.21.8/net/minecraft/world/entity/item/ItemEntity.patch index 9bd4977..59ec451 100644 --- a/patches/release/1.21.8/net/minecraft/world/entity/item/ItemEntity.patch +++ b/patches/release/1.21.8/net/minecraft/world/entity/item/ItemEntity.patch @@ -1,23 +1,25 @@ diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index d3286a1..db9022b 100644 +index a5a7d14..e68a4df 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -342,6 +342,20 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -334,6 +334,22 @@ public class ItemEntity extends Entity implements TraceableEntity { ItemStack item = this.getItem(); Item item1 = item.getItem(); int count = item.getCount(); + // dish + // TODO: 12/11/2023 Check performance -+ net.ouja.dish.entity.DishEntity cachedThrower = new net.ouja.dish.entity.DishEntity((net.minecraft.world.entity.LivingEntity)this.cachedThrower); -+ net.ouja.api.entity.ItemEntity itemEntity = new net.ouja.api.entity.ItemEntity( -+ item.toDish(), -+ this.pickupDelay, -+ this.age, -+ cachedThrower, -+ this.thrower -+ ); -+ net.ouja.api.event.player.PlayerAttemptPickUpItem event = new net.ouja.api.event.player.PlayerAttemptPickUpItem(new net.ouja.dish.entity.DishPlayer((net.minecraft.server.level.ServerPlayer)entity), itemEntity); -+ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ if (this.thrower != null) { ++ net.ouja.dish.entity.DishEntity cachedThrower = new net.ouja.dish.entity.DishEntity((net.minecraft.world.entity.LivingEntity)this.getOwner()); ++ net.ouja.api.entity.ItemEntity itemEntity = new net.ouja.api.entity.ItemEntity( ++ item.toDish(), ++ this.pickupDelay, ++ this.age, ++ cachedThrower, ++ this.thrower.getUUID() ++ ); ++ net.ouja.api.event.player.PlayerAttemptPickUpItem event = new net.ouja.api.event.player.PlayerAttemptPickUpItem(new net.ouja.dish.entity.DishPlayer((net.minecraft.server.level.ServerPlayer)entity), itemEntity); ++ net.ouja.dish.plugins.RegisteredEvents.callEvent(event); ++ } + // dish end + if (this.pickupDelay == 0 && (this.target == null || this.target.equals(entity.getUUID())) && entity.getInventory().add(item)) { diff --git a/patches/release/1.21.8/net/minecraft/world/entity/monster/Shulker.patch b/patches/release/1.21.8/net/minecraft/world/entity/monster/Shulker.patch index 9de144f..89974d6 100644 --- a/patches/release/1.21.8/net/minecraft/world/entity/monster/Shulker.patch +++ b/patches/release/1.21.8/net/minecraft/world/entity/monster/Shulker.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java -index f7e3554..52d550f 100644 +index 60fc596..16b05e4 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java +++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java -@@ -437,7 +437,7 @@ public class Shulker extends AbstractGolem implements VariantHolder codec() { diff --git a/patches/release/1.21.8/net/minecraft/world/level/block/SignBlock.patch b/patches/release/1.21.8/net/minecraft/world/level/block/SignBlock.patch index 5b60934..e4e4559 100644 --- a/patches/release/1.21.8/net/minecraft/world/level/block/SignBlock.patch +++ b/patches/release/1.21.8/net/minecraft/world/level/block/SignBlock.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java -index c917e90..5468d52 100644 +index 84b1374..ad48bcc 100644 --- a/src/main/java/net/minecraft/world/level/block/SignBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java -@@ -147,7 +147,7 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo +@@ -160,7 +160,7 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo } @Override diff --git a/patches/release/1.21.8/net/minecraft/world/level/block/StairBlock.patch b/patches/release/1.21.8/net/minecraft/world/level/block/StairBlock.patch index f52b7c9..3fedb1a 100644 --- a/patches/release/1.21.8/net/minecraft/world/level/block/StairBlock.patch +++ b/patches/release/1.21.8/net/minecraft/world/level/block/StairBlock.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/level/block/StairBlock.java b/src/main/java/net/minecraft/world/level/block/StairBlock.java -index 105d694..beaa90a 100644 +index fe15eb5..b43e8ac 100644 --- a/src/main/java/net/minecraft/world/level/block/StairBlock.java +++ b/src/main/java/net/minecraft/world/level/block/StairBlock.java -@@ -232,7 +232,7 @@ public class StairBlock extends Block implements SimpleWaterloggedBlock { +@@ -224,7 +224,7 @@ public class StairBlock extends Block implements SimpleWaterloggedBlock { } @Override diff --git a/patches/release/1.21.8/net/minecraft/world/level/block/TrapDoorBlock.patch b/patches/release/1.21.8/net/minecraft/world/level/block/TrapDoorBlock.patch index f6cfe30..db04ba0 100644 --- a/patches/release/1.21.8/net/minecraft/world/level/block/TrapDoorBlock.patch +++ b/patches/release/1.21.8/net/minecraft/world/level/block/TrapDoorBlock.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java -index daf1f67..293f7b9 100644 +index ea79c47..a12c999 100644 --- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java -@@ -197,4 +197,17 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW +@@ -192,4 +192,17 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW protected BlockSetType getType() { return this.type; } diff --git a/patches/release/1.21.8/net/minecraft/world/level/chunk/ChunkGenerator.patch b/patches/release/1.21.8/net/minecraft/world/level/chunk/ChunkGenerator.patch index 0ec08b7..8aa022f 100644 --- a/patches/release/1.21.8/net/minecraft/world/level/chunk/ChunkGenerator.patch +++ b/patches/release/1.21.8/net/minecraft/world/level/chunk/ChunkGenerator.patch @@ -1,14 +1,12 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index d9f1aaf..0c9da6d 100644 +index 80eafb7..1149ea2 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -469,11 +469,16 @@ public abstract class ChunkGenerator { - ChunkGeneratorStructureState structureState, - StructureManager structureManager, +@@ -461,10 +461,15 @@ public abstract class ChunkGenerator { ChunkAccess chunk, -- StructureTemplateManager structureTemplateManager -+ StructureTemplateManager structureTemplateManager, -+ ServerLevel serverlevel // dish -- add serverlevel to parameters for plugins to cancel structure generation todo: remove this maybe + StructureTemplateManager structureTemplateManager, + ResourceKey level ++ , ServerLevel serverlevel // dish -- add serverlevel to parameters for plugins to cancel structure generation todo: remove this maybe ) { ChunkPos pos = chunk.getPos(); SectionPos sectionPos = SectionPos.bottomOf(chunk); @@ -19,13 +17,13 @@ index d9f1aaf..0c9da6d 100644 + // dish end structureState.possibleStructureSets() .forEach( - structureSet -> { -@@ -489,6 +494,12 @@ public abstract class ChunkGenerator { + structures -> { +@@ -480,6 +485,12 @@ public abstract class ChunkGenerator { if (structurePlacement.isStructureChunk(structureState, pos.x, pos.z)) { if (list.size() == 1) { + // dish -+ net.ouja.dish.world.level.chunk.DishStructure dishStructure = new net.ouja.dish.world.level.chunk.DishStructure(list.get(0).structure().value()); ++ net.ouja.dish.world.level.chunk.DishStructure dishStructure = new net.ouja.dish.world.level.chunk.DishStructure(list.getFirst().structure().value()); + net.ouja.api.event.world.level.chunk.StructureGenerateEvent event = new net.ouja.api.event.world.level.chunk.StructureGenerateEvent(dishStructure, dishChunkPos); + net.ouja.dish.plugins.RegisteredEvents.callEvent(event); + if (event.isCancelled()) return; @@ -33,7 +31,7 @@ index d9f1aaf..0c9da6d 100644 this.tryGenerateStructure( list.get(0), structureManager, -@@ -525,6 +536,17 @@ public abstract class ChunkGenerator { +@@ -517,6 +528,16 @@ public abstract class ChunkGenerator { } StructureSet.StructureSelectionEntry structureSelectionEntry3 = list1.get(i1); @@ -47,7 +45,6 @@ index d9f1aaf..0c9da6d 100644 + break; + } + // dish end -+ if (this.tryGenerateStructure( structureSelectionEntry3, structureManager, diff --git a/patches/release/1.21.8/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch b/patches/release/1.21.8/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch index 90d34fa..b1a14dc 100644 --- a/patches/release/1.21.8/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch +++ b/patches/release/1.21.8/net/minecraft/world/level/chunk/status/ChunkStatusTasks.patch @@ -1,14 +1,12 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java -index a76abac..c688efb 100644 +index 4c211fc..11ac01b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java +++ b/src/main/java/net/minecraft/world/level/chunk/status/ChunkStatusTasks.java -@@ -43,7 +43,8 @@ public class ChunkStatusTasks { - serverLevel.getChunkSource().getGeneratorState(), - serverLevel.structureManager(), - chunkAccess, -- worldGenContext.structureManager() -+ worldGenContext.structureManager(), -+ serverLevel // dish -- add serverLevel +@@ -49,6 +49,7 @@ public class ChunkStatusTasks { + chunk, + worldGenContext.structureManager(), + serverLevel.dimension() ++ , serverLevel // dish ); } diff --git a/patches/release/1.21.8/net/minecraft/world/level/material/FlowingFluid.patch b/patches/release/1.21.8/net/minecraft/world/level/material/FlowingFluid.patch index 0103fc8..42bda19 100644 --- a/patches/release/1.21.8/net/minecraft/world/level/material/FlowingFluid.patch +++ b/patches/release/1.21.8/net/minecraft/world/level/material/FlowingFluid.patch @@ -1,5 +1,5 @@ diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java -index 03bc74e..14c9081 100644 +index 1020544..5847aec 100644 --- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java +++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java @@ -30,6 +30,10 @@ import net.minecraft.world.phys.Vec3; @@ -13,79 +13,24 @@ index 03bc74e..14c9081 100644 public abstract class FlowingFluid extends Fluid { public static final BooleanProperty FALLING = BlockStateProperties.FALLING; public static final IntegerProperty LEVEL = BlockStateProperties.LEVEL_FLOWING; -@@ -113,7 +117,8 @@ public abstract class FlowingFluid extends Fluid { - if (!state.isEmpty()) { - BlockState blockState = level.getBlockState(pos); +@@ -112,7 +116,8 @@ public abstract class FlowingFluid extends Fluid { + protected void spread(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) { + if (!fluidState.isEmpty()) { BlockPos blockPos = pos.below(); - BlockState blockState1 = level.getBlockState(blockPos); + BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish + if (blockState1 == null) return; // dish - FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState1); - if (this.canSpreadTo(level, pos, blockState, Direction.DOWN, blockPos, blockState1, level.getFluidState(blockPos), newLiquid.getType())) { - this.spreadTo(level, blockPos, blockState1, Direction.DOWN, newLiquid); -@@ -139,7 +144,8 @@ public abstract class FlowingFluid extends Fluid { + FluidState fluidState1 = blockState1.getFluidState(); + if (this.canMaybePassThrough(level, pos, blockState, Direction.DOWN, blockPos, blockState1, fluidState1)) { + FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState1); +@@ -146,7 +151,9 @@ public abstract class FlowingFluid extends Fluid { Direction direction = entry.getKey(); FluidState fluidState1 = entry.getValue(); BlockPos blockPos = pos.relative(direction); -- BlockState blockState1 = level.getBlockState(blockPos); +- this.spreadTo(level, blockPos, level.getBlockState(blockPos), direction, fluidState1); + BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish + if (blockState1 == null) continue; // dish - if (this.canSpreadTo(level, pos, blockState, direction, blockPos, blockState1, level.getFluidState(blockPos), fluidState1.getType())) { - this.spreadTo(level, blockPos, blockState1, direction, fluidState1); - } -@@ -153,7 +159,8 @@ public abstract class FlowingFluid extends Fluid { - - for (Direction direction : Direction.Plane.HORIZONTAL) { - BlockPos blockPos = pos.relative(direction); -- BlockState blockState1 = level.getBlockState(blockPos); -+ BlockState blockState1 = level.getBlockStateIfLoaded(blockPos); // dish -+ if (blockState1 == null) continue; - FluidState fluidState = blockState1.getFluidState(); - if (fluidState.getType().isSame(this) && this.canPassThroughWall(direction, level, pos, blockState, blockPos, blockState1)) { - if (fluidState.isSource()) { -@@ -268,10 +275,22 @@ public abstract class FlowingFluid extends Fluid { - if (direction1 != direction) { - BlockPos blockPos = spreadPos.relative(direction1); - short cacheKey = getCacheKey(sourcePos, blockPos); -+ /* - Pair pair = stateCache.computeIfAbsent(cacheKey, key -> { - BlockState blockState1 = level.getBlockState(blockPos); - return Pair.of(blockState1, blockState1.getFluidState()); - }); -+ */ -+ // dish -+ Pair pair = stateCache.get(cacheKey); -+ if (pair == null) { -+ BlockState blockStateD = level.getBlockStateIfLoaded(blockPos); -+ if (blockStateD == null) continue; -+ -+ pair = Pair.of(blockStateD, blockStateD.getFluidState()); -+ stateCache.put(cacheKey, pair); -+ } -+ // dish end - BlockState blockState = pair.getFirst(); - FluidState fluidState = pair.getSecond(); - if (this.canPassThrough(level, this.getFlowing(), spreadPos, currentSpreadState, direction1, blockPos, blockState, fluidState)) { -@@ -341,10 +360,22 @@ public abstract class FlowingFluid extends Fluid { - for (Direction direction : Direction.Plane.HORIZONTAL) { - BlockPos blockPos = pos.relative(direction); - short cacheKey = getCacheKey(pos, blockPos); -+ /* - Pair pair = map1.computeIfAbsent(cacheKey, key -> { - BlockState blockState1 = level.getBlockState(blockPos); - return Pair.of(blockState1, blockState1.getFluidState()); - }); -+ */ -+ // dish -+ Pair pair = map1.get(cacheKey); -+ if (pair == null) { -+ BlockState blockStateD = level.getBlockStateIfLoaded(blockPos); -+ if (blockStateD == null) continue; -+ -+ pair = Pair.of(blockStateD, blockStateD.getFluidState()); -+ map1.put(cacheKey, pair); -+ } -+ // dish end - BlockState blockState = pair.getFirst(); - FluidState fluidState = pair.getSecond(); - FluidState newLiquid = this.getNewLiquid(level, blockPos, blockState); ++ this.spreadTo(level, blockPos, blockState1, direction, fluidState1); + } + } + } diff --git a/patches/release/1.21.8/net/minecraft/world/level/storage/loot/LootTable.patch b/patches/release/1.21.8/net/minecraft/world/level/storage/loot/LootTable.patch index db2466a..4a94e79 100644 --- a/patches/release/1.21.8/net/minecraft/world/level/storage/loot/LootTable.patch +++ b/patches/release/1.21.8/net/minecraft/world/level/storage/loot/LootTable.patch @@ -1,8 +1,8 @@ diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -index b806cc8..83157b6 100644 +index bef910c..bfde7b2 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java -@@ -146,6 +146,12 @@ public class LootTable { +@@ -151,6 +151,12 @@ public class LootTable { RandomSource random = lootContext.getRandom(); List availableSlots = this.getAvailableSlots(container, random); this.shuffleAndSplitItems(randomItems, availableSlots.size(), random); diff --git a/patches/release/1.21.8/net/ouja/dish/DishProperties.java b/patches/release/1.21.8/net/ouja/dish/DishProperties.java index c116153..05c4672 100644 --- a/patches/release/1.21.8/net/ouja/dish/DishProperties.java +++ b/patches/release/1.21.8/net/ouja/dish/DishProperties.java @@ -27,16 +27,6 @@ public boolean isHardcore() { return this.properties.motd; } - @Override - public boolean canSpawnAnimals() { - return this.properties.spawnAnimals; - } - - @Override - public boolean canSpawnNpcs() { - return this.properties.spawnNpcs; - } - @Override public boolean isPvPEnabled() { return this.properties.pvp; diff --git a/patches/release/1.21.8/net/ouja/dish/entity/DishPlayer.java b/patches/release/1.21.8/net/ouja/dish/entity/DishPlayer.java index 6c1e212..b4b30c3 100644 --- a/patches/release/1.21.8/net/ouja/dish/entity/DishPlayer.java +++ b/patches/release/1.21.8/net/ouja/dish/entity/DishPlayer.java @@ -42,7 +42,7 @@ public DishPlayer(ServerPlayer player) { @Override public Level getLevel() { if (isConsole()) return null; - return new DishLevel(player.getServer().getLevel(player.getCommandSenderWorld().dimension())); + return new DishLevel(player.getServer().getLevel(player.level().dimension())); } @Override diff --git a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishWolf.java b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishWolf.java index e29c493..159f1c9 100644 --- a/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishWolf.java +++ b/patches/release/1.21.8/net/ouja/dish/entity/neutral/DishWolf.java @@ -1,7 +1,7 @@ package net.ouja.dish.entity.neutral; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.animal.Wolf; +import net.minecraft.world.entity.animal.wolf.Wolf; import net.ouja.dish.entity.DishEntity; public class DishWolf extends DishEntity implements net.ouja.api.entity.neutral.Wolf { diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPig.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPig.java index 6966440..c03a83d 100644 --- a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPig.java +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishPig.java @@ -1,8 +1,11 @@ package net.ouja.dish.entity.passive; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.animal.Pig; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.ouja.dish.entity.DishEntity; public class DishPig extends DishEntity implements net.ouja.api.entity.passive.Pig { @@ -15,7 +18,7 @@ public DishPig(LivingEntity entity) { @Override public boolean canSaddle() { - return this.pig.isSaddleable(); + return true; } @Override @@ -25,6 +28,6 @@ public boolean isSaddled() { @Override public void equipSaddle() { - this.pig.equipSaddle(null, SoundSource.BLOCKS); + this.pig.setItemSlot(EquipmentSlot.SADDLE, new ItemStack(Items.SADDLE)); } } diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSheep.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSheep.java index 689f72b..d03167c 100644 --- a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSheep.java +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishSheep.java @@ -1,7 +1,7 @@ package net.ouja.dish.entity.passive; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.animal.Sheep; +import net.minecraft.world.entity.animal.sheep.Sheep; import net.ouja.dish.entity.DishEntity; public class DishSheep extends DishEntity implements net.ouja.api.entity.passive.Sheep { diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishStrider.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishStrider.java index 918984d..7be3ad5 100644 --- a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishStrider.java +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishStrider.java @@ -1,8 +1,11 @@ package net.ouja.dish.entity.passive; import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.monster.Strider; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.ouja.dish.entity.DishEntity; public class DishStrider extends DishEntity implements net.ouja.api.entity.passive.Strider { @@ -15,7 +18,7 @@ public DishStrider(LivingEntity entity) { @Override public boolean canSaddle() { - return this.strider.isSaddleable(); + return true; } @Override @@ -25,6 +28,6 @@ public boolean isSaddled() { @Override public void equipSaddle() { - this.strider.equipSaddle(null, SoundSource.BLOCKS); + this.strider.setItemSlot(EquipmentSlot.SADDLE, new ItemStack(Items.SADDLE)); } } diff --git a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTropicalFish.java b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTropicalFish.java index 4cc5ad1..4ed5f15 100644 --- a/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTropicalFish.java +++ b/patches/release/1.21.8/net/ouja/dish/entity/passive/DishTropicalFish.java @@ -14,6 +14,6 @@ public DishTropicalFish(LivingEntity entity) { @Override public net.ouja.api.entity.passive.TropicalFish.Variants getVariant() { - return net.ouja.api.entity.passive.TropicalFish.Variants.valueOf(this.tropicalFish.getVariant().name()); + return net.ouja.api.entity.passive.TropicalFish.Variants.valueOf(this.tropicalFish.getPattern().name()); } } diff --git a/patches/release/1.21.8/net/ouja/dish/world/DishLevel.java b/patches/release/1.21.8/net/ouja/dish/world/DishLevel.java index 6b6df3e..b5bab79 100644 --- a/patches/release/1.21.8/net/ouja/dish/world/DishLevel.java +++ b/patches/release/1.21.8/net/ouja/dish/world/DishLevel.java @@ -37,12 +37,12 @@ public List getPlayers() { @Override public boolean isDay() { - return this.level.isDay(); + return this.level.dimensionType().hasSkyLight() && !this.level.isDarkOutside(); } @Override public boolean isNight() { - return this.level.isNight(); + return this.level.dimensionType().hasSkyLight() && this.level.isDarkOutside(); } @Override From 4715cefe6a64c0f305d156d158b7731948fcfd58 Mon Sep 17 00:00:00 2001 From: iris <60985521+KaiAF@users.noreply.github.com> Date: Tue, 23 Sep 2025 21:44:54 -0500 Subject: [PATCH 15/15] fix compiling --- dish/compile.js | 18 +++++++++--------- .../1.21.8/net/ouja/dish/DishProperties.java | 10 ++++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/dish/compile.js b/dish/compile.js index 9561e3c..f17bb93 100644 --- a/dish/compile.js +++ b/dish/compile.js @@ -17,7 +17,7 @@ const stdio = [process.stdin, process.stdout, process.stderr]; return process.exit(1); } - const version = fs.readFileSync('dish/workspace/src/main/java/net/minecraft/DetectedVersion.java').toString().split('this.name = "')[1].split('"')[0]; + const version = fs.readFileSync('dish/workspace/src/main/java/net/minecraft/SharedConstants.java').toString().split('VERSION_STRING = "')[1].split('"')[0]; log(`Found version '${version}'`); if (!fs.existsSync(`cache/${version}`)) { error(`Missing cache for version '${version}'`); @@ -70,7 +70,7 @@ const stdio = [process.stdin, process.stdout, process.stderr]; createClassPath(version); fs.writeFileSync('Dish-Bundler/libs/META-INF/main-class', 'net.minecraft.server.Main'); log('Getting version.json'); - execSync(`cd cache/${version} && jar xf server-${version}.jar version.json`, { stdio }); + execSync(`cd cache/${version} && jar xf server.jar version.json`, { stdio }); const VERSION = JSON.parse(fs.readFileSync(`cache/${version}/version.json`).toString()); VERSION.build_time = new Date(); VERSION.dishVersion = dishVersion; @@ -91,12 +91,12 @@ const stdio = [process.stdin, process.stdout, process.stderr]; function remapServer(version) { let mappings = fs.readFileSync(`cache/${version}/mappings.txt`).toString(); - mappings = mappings.replace('net.minecraft.Util$10 -> ac$2:', 'net.minecraft.Util$2 -> ac$2:'); - mappings = mappings.replace('net.minecraft.Util$11 -> ac$3:', 'net.minecraft.Util$3 -> ac$3:'); - mappings = mappings.replace('net.minecraft.Util$2 -> ac$4:', 'net.minecraft.Util$4 -> ac$4:'); + mappings = mappings.replace('net.minecraft.Util$10 -> ag$2:', 'net.minecraft.Util$2 -> ag$2:'); + mappings = mappings.replace('net.minecraft.Util$11 -> ag$3:', 'net.minecraft.Util$3 -> ag$3:'); + mappings = mappings.replace('net.minecraft.Util$2 -> ag$4:', 'net.minecraft.Util$4 -> ag$4:'); fs.writeFileSync(`cache/${version}/mappings.txt`, mappings); log('Remapped mappings'); - const jarName = fs.readdirSync('dish/workspace/build/libs').filter(f => f.startsWith('DishMC-' + version) && f.endsWith('.jar'))[0]; + const jarName = fs.readdirSync('dish/workspace/build/libs').filter(f => f.toLowerCase() === 'dishmc-' + version + '.jar')[0]; if (!jarName) return error(`Could not find jar '${jarName}'`); execSync(`java -jar libs/specialsource.jar -i dish/workspace/build/libs/${jarName} -o server-${version}-dirty.jar -m cache/${version}/mappings.txt --reverse`, { stdio }); } @@ -104,8 +104,8 @@ function remapServer(version) { function readLibraries(version) { log('Reading libraries'); let libraries_list = ''; - if (!fs.existsSync(`cache/${version}.json`)) return error('Could not find dependencies json file!'); - const version_meta = JSON.parse(fs.readFileSync(`cache/${version}.json`).toString()); + if (!fs.existsSync(`cache/${version}/${version}.json`)) return error('Could not find dependencies json file!'); + const version_meta = JSON.parse(fs.readFileSync(`cache/${version}/${version}.json`).toString()); const dish_meta = JSON.parse(fs.readFileSync(`dish/libraries/${version}.json`).toString()); /** * Minecraft Libraries @@ -146,7 +146,7 @@ function readVersions(version) { function createClassPath(version) { log('Creating classpath-joined'); - const version_meta = JSON.parse(fs.readFileSync(`cache/${version}.json`).toString()); + const version_meta = JSON.parse(fs.readFileSync(`cache/${version}/${version}.json`).toString()); const libraries = version_meta.libraries.map(v => 'libraries/' + v.downloads.artifact.path); libraries.push(`versions/${version}/server-${version}.jar`); fs.writeFileSync('Dish-Bundler/libs/META-INF/classpath-joined', libraries.join(';')); diff --git a/patches/release/1.21.8/net/ouja/dish/DishProperties.java b/patches/release/1.21.8/net/ouja/dish/DishProperties.java index 05c4672..ff3a437 100644 --- a/patches/release/1.21.8/net/ouja/dish/DishProperties.java +++ b/patches/release/1.21.8/net/ouja/dish/DishProperties.java @@ -86,4 +86,14 @@ public boolean isWhitelistEnabled() { public boolean acceptsServerTransfers() { return this.properties.acceptsTransfers; } + + @Override + public String getBugReportLink() { + return this.properties.bugReportLink; + } + + @Override + public int getPauseWhenEmpty() { + return this.properties.pauseWhenEmptySeconds; + } }