diff --git a/.gitignore b/.gitignore index b34d8464..02a7c6c4 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ src-todo # Files from Forge MDK forge*changelog.txt + +.vscode/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1a61c98d..5f326ed4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id 'eclipse' id 'maven-publish' - id 'net.minecraftforge.gradle' version '5.1.+' + id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' } @@ -104,16 +104,16 @@ dependencies { minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}" // RPG Gods - compileOnly fg.deobf("curse.maven:rpggods-${project.rpggods_project}:${project.rpggods_file}") - runtimeOnly fg.deobf("curse.maven:rpggods-${project.rpggods_project}:${project.rpggods_file}") + //compileOnly fg.deobf("curse.maven:rpggods-${project.rpggods_project}:${project.rpggods_file}") + //runtimeOnly fg.deobf("curse.maven:rpggods-${project.rpggods_project}:${project.rpggods_file}") // JEI - compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}") - runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}") + //compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}") + //runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}") // Better Combat - implementation fg.deobf("me.shedaniel.cloth:cloth-config-forge:${project.cloth_config_version}") - implementation fg.deobf("dev.kosmx.player-anim:player-animation-lib-forge:${project.player_animator_version}") - implementation fg.deobf("maven.modrinth:better-combat:${project.better_combat_version}-forge") + //implementation fg.deobf("me.shedaniel.cloth:cloth-config-forge:${project.cloth_config_version}") + //implementation fg.deobf("dev.kosmx.player-anim:player-animation-lib-forge:${project.player_animator_version}") + //implementation fg.deobf("maven.modrinth:better-combat:${project.better_combat_version}-forge") } // This block of code expands all the gradle properties in the specified resource targets. diff --git a/gradle.properties b/gradle.properties index 661897ae..77b4fd8c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,25 +1,25 @@ org.gradle.jvmargs=-Xmx4G org.gradle.daemon=false -minecraft_version=1.19.2 -minecraft_version_range=[1.19.2,) +minecraft_version=1.20.1 +minecraft_version_range=[1.20.1,1.21) mappings_channel=official -mappings_version=1.19.2 +mappings_version=1.20.1 # Mod properties mod_name=Greek Fantasy mod_id=greekfantasy -mod_version=19.2.6 +mod_version=20.1.0 mod_authors="skyjay1" mod_description="Get your Greek on!" maven_group=skyjay1.greekfantasy archives_base_name=greekfantasy #Dependencies -forge_version=43.1.47 -forge_version_range=[43.1,) -loader_version_range=[43,) +forge_version=47.2.0 +forge_version_range=[47.2,) +loader_version_range=[47,) rpggods_project=601680 -rpggods_file=4018407 -jei_version=11.2.0.256 -cloth_config_version=8.2.88 -player_animator_version=0.4.0-test1 -better_combat_version=1.4.4+1.19 +rpggods_file=5029473 +jei_version=15.2.0.27 +cloth_config_version=11.1.118 +player_animator_version=1.0.2+1.20 +better_combat_version=1.8.5+1.20.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7645e290..559efb4c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip diff --git a/src/main/java/greekfantasy/GFConfig.java b/src/main/java/greekfantasy/GFConfig.java index c1f8740a..cc152d69 100644 --- a/src/main/java/greekfantasy/GFConfig.java +++ b/src/main/java/greekfantasy/GFConfig.java @@ -1,5 +1,7 @@ package greekfantasy; +import net.minecraft.core.registries.Registries; + import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import net.minecraft.resources.ResourceLocation; @@ -83,7 +85,8 @@ public class GFConfig { public final ForgeConfigSpec.DoubleValue SHADE_SPAWN_CHANCE; public final ForgeConfigSpec.DoubleValue SATYR_SHAMAN_CHANCE; public final ForgeConfigSpec.DoubleValue SCYLLA_SPAWN_CHANCE; - private static final ResourceLocation SATYR_SONG_FALLBACK = new ResourceLocation(GreekFantasy.MODID, "greensleeves"); + private static final ResourceLocation SATYR_SONG_FALLBACK = new ResourceLocation(GreekFantasy.MODID, + "greensleeves"); private final ForgeConfigSpec.ConfigValue SATYR_SONG; private ResourceLocation satyrSong; public final ForgeConfigSpec.BooleanValue SHADE_IMMUNE_TO_NONOWNER; @@ -229,7 +232,8 @@ public GFConfig(final ForgeConfigSpec.Builder builder) { builder.push("mobs"); CIRCE_SPAWN_CHANCE = builder.defineInRange("circe_spawn_chance", 2.0F, 0.0F, 100.0F); - GIANT_BOAR_NON_NETHER = builder.comment("Whether a hoglin must be outside of the nether to be turned to a Giant Boar") + GIANT_BOAR_NON_NETHER = builder + .comment("Whether a hoglin must be outside of the nether to be turned to a Giant Boar") .define("giant_boar_non_nether", true); ELPIS_SPAWN_CHANCE = builder .comment("Percent chance that opening a mysterious box spawns an Elpis") @@ -276,9 +280,10 @@ public GFConfig(final ForgeConfigSpec.Builder builder) { CURSE_OF_CIRCE_ENABLED = builder.define("curse_of_circe_enabled", true); CURSE_OF_CIRCE_DURATION = builder.defineInRange("curse_of_circe_duration", 900, 1, 24000); CURSE_OF_CIRCE_WHITELIST = builder.comment("Mobs that can be affected by the Curse of Circe.", - "Accepts entity id or mod id with wildcard.", - "Example: [\"minecraft:zombie\", \"othermod:" + WILDCARD + "\"]") - .defineList("curse_of_circe_whitelist", List.of(curseOfCirceWhitelistDefault), o -> o instanceof String); + "Accepts entity id or mod id with wildcard.", + "Example: [\"minecraft:zombie\", \"othermod:" + WILDCARD + "\"]") + .defineList("curse_of_circe_whitelist", List.of(curseOfCirceWhitelistDefault), + o -> o instanceof String); MIRRORING_EFFECT_ENABLED = builder.define("mirroring_enabled", false); PETRIFIED_NERF = builder .comment("When true, Petrified applies slowness instead of stunning") @@ -291,7 +296,8 @@ public GFConfig(final ForgeConfigSpec.Builder builder) { builder.push("palladium"); PALLADIUM_ENABLED = builder.comment("Whether the Palladium can prevent monster spawns") .define("palladium_enabled", true); - PALLADIUM_CHUNK_RANGE = builder.comment("The radius (in chunks) of the area protected by Palladium blocks (0=same chunk only)") + PALLADIUM_CHUNK_RANGE = builder + .comment("The radius (in chunks) of the area protected by Palladium blocks (0=same chunk only)") .defineInRange("palladium_chunk_range", 2, 0, 3); PALLADIUM_Y_RANGE = builder.comment("The vertical area (in blocks) protected by Palladium blocks") .defineInRange("palladium_y_range", 128, 0, 255); @@ -299,8 +305,8 @@ public GFConfig(final ForgeConfigSpec.Builder builder) { builder.push("mob_spawns"); SPAWN_DIMENSION_WHITELIST = builder.comment("Dimensions in which mobs can spawn.", - "Accepts dimension id or mod id with wildcard.", - "Example: [\"minecraft:the_nether\", \"rftoolsdim:" + WILDCARD + "\"]") + "Accepts dimension id or mod id with wildcard.", + "Example: [\"minecraft:the_nether\", \"rftoolsdim:" + WILDCARD + "\"]") .define("spawn_dimensions", Lists.newArrayList("minecraft:" + WILDCARD)); IS_SPAWN_DIMENSION_WHITELIST = builder.comment("true if the above list is a whitelist, false for blacklist") .define("is_whitelist", true); @@ -308,8 +314,8 @@ public GFConfig(final ForgeConfigSpec.Builder builder) { builder.comment("Feature generation chances (higher number = more features)").push("features"); FEATURE_DIMENSION_WHITELIST = builder.comment("Dimensions in which mobs can spawn.", - "Accepts dimension id or mod id with wildcard.", - "Example: [\"minecraft:the_nether\", \"rftoolsdim:" + WILDCARD + "\"]") + "Accepts dimension id or mod id with wildcard.", + "Example: [\"minecraft:the_nether\", \"rftoolsdim:" + WILDCARD + "\"]") .define("spawn_dimensions", Lists.newArrayList("minecraft:" + WILDCARD)); IS_FEATURE_DIMENSION_WHITELIST = builder.comment("true if the above list is a whitelist, false for blacklist") .define("is_whitelist", true); @@ -343,7 +349,7 @@ public void bake() { showPythonBossBar = SHOW_PYTHON_BOSS_BAR.get(); showScyllaBossBar = SHOW_SCYLLA_BOSS_BAR.get(); satyrSong = ResourceLocation.tryParse(SATYR_SONG.get()); - if(null == satyrSong) { + if (null == satyrSong) { satyrSong = SATYR_SONG_FALLBACK; } // mob effects @@ -484,8 +490,10 @@ public boolean spawnMatchesDimension(final ServerLevel level) { return matchesDimension(spawnDimensionWhitelist, isSpawnDimensionWhitelist, level.dimension().location()); } - private static boolean matchesDimension(final List list, final boolean isWhitelist, final ResourceLocation dimensionId) { + private static boolean matchesDimension(final List list, final boolean isWhitelist, + final ResourceLocation dimensionId) { // check dimension id or mod id - return isWhitelist == (list.contains(dimensionId.toString()) || list.contains(dimensionId.getNamespace() + ":" + WILDCARD)); + return isWhitelist == (list.contains(dimensionId.toString()) + || list.contains(dimensionId.getNamespace() + ":" + WILDCARD)); } } diff --git a/src/main/java/greekfantasy/GFEvents.java b/src/main/java/greekfantasy/GFEvents.java index 5b1a776c..dc7e2e8a 100644 --- a/src/main/java/greekfantasy/GFEvents.java +++ b/src/main/java/greekfantasy/GFEvents.java @@ -75,6 +75,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.entity.EntityTypeTest; import net.minecraft.world.level.entity.LevelEntityGetter; +import net.minecraft.util.AbortableIterationConsumer; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; @@ -97,7 +98,8 @@ import net.minecraftforge.event.entity.living.LivingEntityUseItemEvent; import net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent; import net.minecraftforge.event.entity.living.LivingEvent; -import net.minecraftforge.event.entity.living.LivingSpawnEvent; +import net.minecraftforge.event.level.LevelEvent; +import net.minecraftforge.event.entity.living.MobSpawnEvent; import net.minecraftforge.event.entity.living.MobEffectEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.event.entity.player.PlayerEvent; @@ -122,8 +124,12 @@ public final class GFEvents { public static final class ForgeHandler { public static final UUID STEP_HEIGHT_MODIFIER = UUID.fromString("3b9d697f-8823-4e0e-b704-be09f54712d7"); - /** Used in the client tick event to ensure items with Overstep provide a step height attribute bonus **/ - private static final AttributeModifier stepHeightModifier = new AttributeModifier(STEP_HEIGHT_MODIFIER, "Armor step height modifier", 0.62D, AttributeModifier.Operation.ADDITION);; + /** + * Used in the client tick event to ensure items with Overstep provide a step + * height attribute bonus + **/ + private static final AttributeModifier stepHeightModifier = new AttributeModifier(STEP_HEIGHT_MODIFIER, + "Armor step height modifier", 0.62D, AttributeModifier.Operation.ADDITION);; /** * Used to spawn a shade with the player's XP when they die. @@ -132,37 +138,40 @@ public static final class ForgeHandler { **/ @SubscribeEvent(priority = EventPriority.HIGHEST) public static void onPlayerDeath(final LivingDeathEvent event) { - if (!event.isCanceled() && !event.getEntity().level.isClientSide() && event.getEntity() instanceof Player player) { + if (!event.isCanceled() && !event.getEntity().level().isClientSide() + && event.getEntity() instanceof Player player) { // attempt to spawn a shade if (!player.isSpectator() && player.experienceLevel > 3 - && !player.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) + && !player.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) && player.getRandom().nextFloat() * 100.0F < GreekFantasy.CONFIG.SHADE_SPAWN_CHANCE.get()) { // save XP value int xp = player.totalExperience; // remove XP from player player.giveExperienceLevels(-(player.experienceLevel + 1)); // give XP to shade and spawn into world - final Shade shade = GFRegistry.EntityReg.SHADE.get().create(player.level); + final Shade shade = GFRegistry.EntityReg.SHADE.get().create(player.level()); shade.moveTo(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); shade.setStoredXP(Mth.floor(xp * 0.9F)); shade.setOwnerUUID(player.getUUID()); shade.setPersistenceRequired(); - player.level.addFreshEntity(shade); + player.level().addFreshEntity(shade); } } } /** - * Used to summon a Geryon when a cow is killed and other spawn conditions are met + * Used to summon a Geryon when a cow is killed and other spawn conditions are + * met * * @param event the living death event */ @SubscribeEvent public static void onLivingDeath(final LivingDeathEvent event) { - if (!event.isCanceled() && event.getEntity().isEffectiveAi() && event.getSource().getEntity() instanceof Player) { + if (!event.isCanceled() && event.getEntity().isEffectiveAi() + && event.getSource().getEntity() instanceof Player) { // check if the cow was killed by a player and if geryon can spawn here final BlockPos deathPos = event.getEntity().blockPosition(); - if (event.getEntity() instanceof Cow && Geryon.canGeryonSpawnOn(event.getEntity().level, deathPos)) { + if (event.getEntity() instanceof Cow && Geryon.canGeryonSpawnOn(event.getEntity().level(), deathPos)) { // check for Geryon Head blocks nearby final List heads = new ArrayList<>(); final int r = 3; @@ -171,14 +180,15 @@ public static void onLivingDeath(final LivingDeathEvent event) { for (int y = -2; y <= 2; y++) { for (int z = -r; z <= r; z++) { pos.setWithOffset(deathPos, x, y, z); - if (event.getEntity().level.getBlockState(pos).is(GFRegistry.BlockReg.GIGANTE_HEAD.get())) { + if (event.getEntity().level().getBlockState(pos) + .is(GFRegistry.BlockReg.GIGANTE_HEAD.get())) { heads.add(pos.immutable()); } // if we found at least three heads, remove them and spawn a geryon if (heads.size() >= 3) { - heads.subList(0, 3).forEach(p -> event.getEntity().level.destroyBlock(p, false)); + heads.subList(0, 3).forEach(p -> event.getEntity().level().destroyBlock(p, false)); final float yaw = Mth.wrapDegrees(event.getSource().getEntity().getYRot() + 180.0F); - Geryon.spawnGeryon(event.getEntity().level, deathPos, yaw); + Geryon.spawnGeryon(event.getEntity().level(), deathPos, yaw); return; } } @@ -190,11 +200,12 @@ public static void onLivingDeath(final LivingDeathEvent event) { /** * Used to prevent or increase projectile damage when wearing certain armor + * * @param event the projectile impact event */ @SubscribeEvent(priority = EventPriority.HIGH) public static void onProjectileImpact(final ProjectileImpactEvent event) { - if(!event.getProjectile().level.isClientSide() + if (!event.getProjectile().level().isClientSide() && event.getRayTraceResult().getType() == HitResult.Type.ENTITY && event.getRayTraceResult() instanceof EntityHitResult entityHitResult && entityHitResult.getEntity() instanceof LivingEntity livingEntity) { @@ -204,9 +215,11 @@ public static void onProjectileImpact(final ProjectileImpactEvent event) { GreekFantasy.LOGGER.debug("dot=" + dot); final int achillesCount = HellenicArmorItem.getAchillesCount(livingEntity); // determine if the entity is wearing armor and immune to projectiles - if(achillesCount > 0 && HellenicArmorItem.isImmune(livingEntity, event.getProjectile(), dot, achillesCount)) { + if (achillesCount > 0 + && HellenicArmorItem.isImmune(livingEntity, event.getProjectile(), dot, achillesCount)) { // reflect the projectile motion - event.getProjectile().setDeltaMovement(event.getProjectile().getDeltaMovement().multiply(-1.0D, 1.0D, -1.0D)); + event.getProjectile() + .setDeltaMovement(event.getProjectile().getDeltaMovement().multiply(-1.0D, 1.0D, -1.0D)); // cancel the event event.setCanceled(true); // damage the armor @@ -214,7 +227,7 @@ public static void onProjectileImpact(final ProjectileImpactEvent event) { return; } // determine if entity is wearing armor and weak to arrow projectiles - if(achillesCount > 0 && event.getProjectile() instanceof AbstractArrow arrow + if (achillesCount > 0 && event.getProjectile() instanceof AbstractArrow arrow && HellenicArmorItem.isCritical(livingEntity, arrow, dot, achillesCount)) { // double the damage of the projectile arrow.setBaseDamage(arrow.getBaseDamage() * (2.0D + 0.5D * achillesCount)); @@ -223,10 +236,11 @@ public static void onProjectileImpact(final ProjectileImpactEvent event) { } // determine if the entity is wearing nemean lion hide and immune to projectile ItemStack helmet = livingEntity.getItemBySlot(EquipmentSlot.HEAD); - if(achillesCount == 0 && helmet.is(GFRegistry.ItemReg.NEMEAN_LION_HIDE.get()) + if (achillesCount == 0 && helmet.is(GFRegistry.ItemReg.NEMEAN_LION_HIDE.get()) && NemeanLionHideItem.isImmune(livingEntity, event.getProjectile(), dot)) { // reflect the projectile motion - event.getProjectile().setDeltaMovement(event.getProjectile().getDeltaMovement().multiply(-1.0D, 1.0D, -1.0D)); + event.getProjectile() + .setDeltaMovement(event.getProjectile().getDeltaMovement().multiply(-1.0D, 1.0D, -1.0D)); // cancel the event event.setCanceled(true); // damage the armor @@ -237,9 +251,10 @@ public static void onProjectileImpact(final ProjectileImpactEvent event) { } /** - * @param first the first entity - * @param second the second entity - * @param horizontalOnly true if the dot product should only account for horizontal facing + * @param first the first entity + * @param second the second entity + * @param horizontalOnly true if the dot product should only account for + * horizontal facing * @return the dot product between the facing directions of two entities */ private static double getDotProduct(final Entity first, final Entity second, final boolean horizontalOnly) { @@ -255,22 +270,23 @@ private static double getDotProduct(final Entity first, final Entity second, fin /** * Used to handle Prisoner of Hades effect * (updating portal cooldown and removing when out of the nether) + * * @param event */ @SubscribeEvent public static void onLivingTick(final LivingEvent.LivingTickEvent event) { // only handle event on server - if(event.getEntity().level.isClientSide()) { + if (event.getEntity().level().isClientSide()) { return; } // handle Prisoner of Hades mob effect final MobEffect prisonerOfHades = GFRegistry.MobEffectReg.PRISONER_OF_HADES.get(); - if(event.getEntity().hasEffect(prisonerOfHades)) { + if (event.getEntity().hasEffect(prisonerOfHades)) { // remove when not in nether - if (event.getEntity().level.dimension() != Level.NETHER + if (event.getEntity().level().dimension() != Level.NETHER || (GreekFantasy.isRGLoaded() && event.getEntity() instanceof Player player - && RGCompat.getInstance().canRemovePrisonerEffect(player))) { + && RGCompat.getInstance().canRemovePrisonerEffect(player))) { event.getEntity().removeEffect(prisonerOfHades); } else { // set portal cooldown @@ -280,23 +296,25 @@ public static void onLivingTick(final LivingEvent.LivingTickEvent event) { // update silkstep enchantment if (GreekFantasy.CONFIG.isSilkstepEnabled() - && event.getEntity().getItemBySlot(EquipmentSlot.FEET).getEnchantmentLevel(GFRegistry.EnchantmentReg.SILKSTEP.get()) > 0 + && event.getEntity().getItemBySlot(EquipmentSlot.FEET) + .getEnchantmentLevel(GFRegistry.EnchantmentReg.SILKSTEP.get()) > 0 && (!(event.getEntity() instanceof Player player && player.getAbilities().flying)) && event.getEntity().stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) { // this variable will become true if the player is collided with a cobweb boolean cobweb = false; // check all blocks within player's bounding box AABB axisalignedbb = event.getEntity().getBoundingBox(); - BlockPos blockpos = new BlockPos(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D); - BlockPos blockpos1 = new BlockPos(axisalignedbb.maxX - 0.001D, axisalignedbb.maxY - 0.001D, axisalignedbb.maxZ - 0.001D); + BlockPos blockpos = BlockPos.containing(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, + axisalignedbb.minZ + 0.001D); + BlockPos blockpos1 = BlockPos.containing(axisalignedbb.maxX - 0.001D, axisalignedbb.maxY - 0.001D, + axisalignedbb.maxZ - 0.001D); BlockPos.MutableBlockPos blockpos$mutable = new BlockPos.MutableBlockPos(); - entryloop: - for (int i = blockpos.getX(); i <= blockpos1.getX(); ++i) { + entryloop: for (int i = blockpos.getX(); i <= blockpos1.getX(); ++i) { for (int j = blockpos.getY(); j <= blockpos1.getY(); ++j) { for (int k = blockpos.getZ(); k <= blockpos1.getZ(); ++k) { blockpos$mutable.set(i, j, k); // if the block is a cobweb, exit the loops and change the motion multiplier - if (event.getEntity().level.getBlockState(blockpos$mutable).is(Blocks.COBWEB)) { + if (event.getEntity().level().getBlockState(blockpos$mutable).is(Blocks.COBWEB)) { cobweb = true; break entryloop; } @@ -305,18 +323,19 @@ public static void onLivingTick(final LivingEvent.LivingTickEvent event) { } // actually reset the speed multiplier if (cobweb) { - event.getEntity().stuckSpeedMultiplier = Vec3.ZERO; + event.getEntity().stuckSpeedMultiplier = Vec3.ZERO; } } } /** * Used to change player pose when under Curse of Circe. + * * @param event */ @SubscribeEvent public static void onPlayerTick(final TickEvent.PlayerTickEvent event) { - if(event.phase != TickEvent.Phase.START || !event.player.isAlive()) { + if (event.phase != TickEvent.Phase.START || !event.player.isAlive()) { return; } @@ -334,7 +353,7 @@ public static void onPlayerTick(final TickEvent.PlayerTickEvent event) { } // update pose when player is under curse of circe - if(GreekFantasy.CONFIG.isCurseOfCirceEnabled()) { + if (GreekFantasy.CONFIG.isCurseOfCirceEnabled()) { final boolean curseOfCirce = event.player.hasEffect(GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get()); final Pose forcedPose = event.player.getForcedPose(); // update the forced pose @@ -349,11 +368,11 @@ public static void onPlayerTick(final TickEvent.PlayerTickEvent event) { } // every few ticks, ensure that flying players can still fly - if (GreekFantasy.CONFIG.isFlyingEnabled() && event.player.level instanceof ServerLevel && + if (GreekFantasy.CONFIG.isFlyingEnabled() && event.player.level() instanceof ServerLevel && !event.player.isCreative() && !event.player.isSpectator() && event.player.tickCount > 10 - && event.player.level.getGameTime() % 11 == 0) { + && event.player.level().getGameTime() % 11 == 0) { // load saved data - final GFSavedData data = GFSavedData.getOrCreate((ServerLevel) event.player.level); + final GFSavedData data = GFSavedData.getOrCreate((ServerLevel) event.player.level()); // remove flying players who do not meet the conditions if (data.hasFlyingPlayer(event.player) && !GFSavedData.validatePlayer(event.player)) { data.removeFlyingPlayer(event.player); @@ -369,9 +388,11 @@ public static void onPlayerTick(final TickEvent.PlayerTickEvent event) { @SubscribeEvent public static void onChangeEquipment(final LivingEquipmentChangeEvent event) { // Check which equipment was changed and if it is a player - if (GreekFantasy.CONFIG.isFlyingEnabled() && event.getEntity() instanceof Player player && player.level instanceof ServerLevel - && event.getSlot() == EquipmentSlot.FEET && event.getTo().is(GFRegistry.ItemReg.WINGED_SANDALS.get())) { - GFSavedData data = GFSavedData.getOrCreate((ServerLevel) player.level); + if (GreekFantasy.CONFIG.isFlyingEnabled() && event.getEntity() instanceof Player player + && player.level() instanceof ServerLevel + && event.getSlot() == EquipmentSlot.FEET + && event.getTo().is(GFRegistry.ItemReg.WINGED_SANDALS.get())) { + GFSavedData data = GFSavedData.getOrCreate((ServerLevel) player.level()); // ensure player meets conditions before enabling flight if (GFSavedData.validatePlayer(player)) { data.addFlyingPlayer(player); @@ -394,6 +415,7 @@ public static void onPlayerAttack(final AttackEntityEvent event) { /** * Used to prevent breaking of blocks when the player is stunned or petrified + * * @param event the break speed event */ @SubscribeEvent @@ -406,6 +428,7 @@ public static void onBreakSpeed(final PlayerEvent.BreakSpeed event) { /** * Used to prevent using items on blocks when the player is stunned or petrified + * * @param event the right click block event */ @SubscribeEvent @@ -418,10 +441,12 @@ public static void onRightClickBlock(final PlayerInteractEvent.RightClickBlock e /** * @param entity the living entity - * @return true if the entity is alive and has either the stunned or petrified effect + * @return true if the entity is alive and has either the stunned or petrified + * effect */ private static boolean isStunnedOrPetrified(@Nullable LivingEntity entity) { - return entity != null && entity.isAlive() && (entity.hasEffect(GFRegistry.MobEffectReg.STUNNED.get()) || entity.hasEffect(GFRegistry.MobEffectReg.PETRIFIED.get())); + return entity != null && entity.isAlive() && (entity.hasEffect(GFRegistry.MobEffectReg.STUNNED.get()) + || entity.hasEffect(GFRegistry.MobEffectReg.PETRIFIED.get())); } /** @@ -432,7 +457,7 @@ private static boolean isStunnedOrPetrified(@Nullable LivingEntity entity) { **/ @SubscribeEvent public static void onLivingTarget(final LivingChangeTargetEvent event) { - if(null == event.getNewTarget() || event.getEntity().level.isClientSide()) { + if (null == event.getNewTarget() || event.getEntity().level().isClientSide()) { return; } // check mob or target for curse of circe @@ -440,7 +465,7 @@ public static void onLivingTarget(final LivingChangeTargetEvent event) { && event.getEntity() instanceof Mob mob && event.getNewTarget() != mob.getLastHurtByMob() && (mob.hasEffect(GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get()) - || event.getNewTarget().hasEffect(GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get()))) { + || event.getNewTarget().hasEffect(GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get()))) { // remove attack target event.setNewTarget(null); } @@ -450,11 +475,12 @@ public static void onLivingTarget(final LivingChangeTargetEvent event) { event.setNewTarget(null); } // check mob for capability - if(event.getEntity().getType() == EntityType.GUARDIAN + if (event.getEntity().getType() == EntityType.GUARDIAN && event.getEntity() instanceof PathfinderMob mob && event.getNewTarget() instanceof Player player) { - LazyOptional CAP = event.getEntity().getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP); - if(CAP.isPresent() && CAP.orElse(FriendlyGuardian.EMPTY).isNeutralTowardPlayer(mob, player)) { + LazyOptional CAP = event.getEntity() + .getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP); + if (CAP.isPresent() && CAP.orElse(FriendlyGuardian.EMPTY).isNeutralTowardPlayer(mob, player)) { // remove attack target event.setNewTarget(null); } @@ -463,33 +489,37 @@ public static void onLivingTarget(final LivingChangeTargetEvent event) { /** * Used to update client when Curse of Circe is applied + * * @param event the potion added event */ @SubscribeEvent public static void onMobEffectStart(final MobEffectEvent.Added event) { - if(!event.getEntity().level.isClientSide() + if (!event.getEntity().level().isClientSide() && GreekFantasy.CONFIG.isCurseOfCirceEnabled() && event.getEffectInstance() != null && event.getEffectInstance().getEffect() == GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get() && event.getOldEffectInstance() == null) { // update health - if(event.getOldEffectInstance() == null) { - float health = Mth.clamp(event.getEntity().getHealth(), 1.0F, event.getEntity().getMaxHealth() + (float) CurseOfCirceEffect.HEALTH_MODIFIER); + if (event.getOldEffectInstance() == null) { + float health = Mth.clamp(event.getEntity().getHealth(), 1.0F, + event.getEntity().getMaxHealth() + (float) CurseOfCirceEffect.HEALTH_MODIFIER); event.getEntity().setHealth(health); } // send packet GreekFantasy.CHANNEL.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(() -> event.getEntity()), - SCurseOfCircePacket.addEffect(event.getEntity().getId(), event.getEffectInstance().getDuration())); + SCurseOfCircePacket.addEffect(event.getEntity().getId(), + event.getEffectInstance().getDuration())); } } /** * Used to update client when Curse of Circe is removed + * * @param event the potion added event */ @SubscribeEvent public static void onMobEffectRemove(final MobEffectEvent.Remove event) { - if(!event.getEntity().level.isClientSide() && GreekFantasy.CONFIG.isCurseOfCirceEnabled() + if (!event.getEntity().level().isClientSide() && GreekFantasy.CONFIG.isCurseOfCirceEnabled() && event.getEffectInstance() != null && event.getEffectInstance().getEffect() == GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get()) { // send packet @@ -500,11 +530,12 @@ public static void onMobEffectRemove(final MobEffectEvent.Remove event) { /** * Used to update client when Curse of Circe is expired + * * @param event the potion added event */ @SubscribeEvent public static void onMobEffectExpire(final MobEffectEvent.Expired event) { - if(!event.getEntity().level.isClientSide() && GreekFantasy.CONFIG.isCurseOfCirceEnabled() + if (!event.getEntity().level().isClientSide() && GreekFantasy.CONFIG.isCurseOfCirceEnabled() && event.getEffectInstance() != null && event.getEffectInstance().getEffect() == GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get()) { // send packet @@ -522,18 +553,21 @@ public static void onEntityPlaceBlock(final BlockEvent.EntityPlaceEvent event) { if (!event.isCanceled() && event.getPlacedBlock().is(SummonBossUtil.BRONZE_BLOCK) && event.getLevel() instanceof Level) { // delegate to SummonBossUtil - SummonBossUtil.onPlaceBronzeBlock((Level) event.getLevel(), event.getPos(), event.getPlacedBlock(), event.getEntity()); + SummonBossUtil.onPlaceBronzeBlock((Level) event.getLevel(), event.getPos(), event.getPlacedBlock(), + event.getEntity()); } } /** * Used to add a step height modifier to items with Overstep enchantment + * * @param event the attribute modifier event */ @SubscribeEvent public static void onItemAttributeModifiers(final ItemAttributeModifierEvent event) { // determine if step height modifer should apply - if(event.getSlotType() == EquipmentSlot.FEET && event.getItemStack().getEnchantmentLevel(GFRegistry.EnchantmentReg.OVERSTEP.get()) > 0) { + if (event.getSlotType() == EquipmentSlot.FEET + && event.getItemStack().getEnchantmentLevel(GFRegistry.EnchantmentReg.OVERSTEP.get()) > 0) { event.addModifier(ForgeMod.STEP_HEIGHT_ADDITION.get(), stepHeightModifier); } } @@ -545,48 +579,61 @@ public static void onItemAttributeModifiers(final ItemAttributeModifierEvent eve **/ @SubscribeEvent public static void onEntityJoinWorld(final EntityJoinLevelEvent event) { - if(event.getEntity() instanceof final PathfinderMob mob && !event.getEntity().level.isClientSide()) { + if (event.getEntity() instanceof final PathfinderMob mob && !event.getEntity().level().isClientSide()) { // add wither skeleton goal to avoid orthus - if(mob.getType() == EntityType.WITHER_SKELETON) { + if (mob.getType() == EntityType.WITHER_SKELETON) { mob.goalSelector.addGoal(3, new AvoidEntityGoal<>(mob, Orthus.class, 6.0F, 1.0D, 1.2D)); } // add rabbit goal to avoid cerastes - if(mob.getType() == EntityType.RABBIT && ((Rabbit)event.getEntity()).getRabbitType() != 99) { + if (mob.getType() == EntityType.RABBIT && ((Rabbit) event.getEntity()).getVariant().id() != 99) { mob.goalSelector.addGoal(3, new AvoidEntityGoal<>(mob, Cerastes.class, 6.0F, 1.0D, 1.2D, e -> e instanceof Cerastes cerastes && !cerastes.isHiding())); } // add guardian goals to attack enemies and move to ocean villages - if(mob.getType() == EntityType.GUARDIAN) { - Predicate predicate = entity -> entity instanceof Enemy && !(entity instanceof Guardian) && entity.isInWater() && entity.distanceToSqr(mob) > 9.0D; - mob.targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(mob, LivingEntity.class, 10, true, false, predicate) { - @Override - public boolean canUse() { - return super.canUse() && this.mob.getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP).orElse(FriendlyGuardian.EMPTY).isEnabled(); - } - }); - if(GreekFantasy.CONFIG.GUARDIAN_SEEK_OCEAN_VILLAGE.get()) { - mob.goalSelector.addGoal(3, new MoveToStructureGoal(mob, 1.0D, 4, 8, 10, new ResourceLocation(GreekFantasy.MODID, "ocean_village"), BehaviorUtils::getRandomSwimmablePos) { - @Override - public boolean canUse() { - return super.canUse() && this.mob.getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP).orElse(FriendlyGuardian.EMPTY).isEnabled(); - } - }); + if (mob.getType() == EntityType.GUARDIAN) { + Predicate predicate = entity -> entity instanceof Enemy + && !(entity instanceof Guardian) && entity.isInWater() && entity.distanceToSqr(mob) > 9.0D; + mob.targetSelector.addGoal(1, + new NearestAttackableTargetGoal<>(mob, LivingEntity.class, 10, true, false, predicate) { + @Override + public boolean canUse() { + return super.canUse() && this.mob.getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP) + .orElse(FriendlyGuardian.EMPTY).isEnabled(); + } + }); + if (GreekFantasy.CONFIG.GUARDIAN_SEEK_OCEAN_VILLAGE.get()) { + mob.goalSelector.addGoal(3, + new MoveToStructureGoal(mob, 1.0D, 4, 8, 10, + new ResourceLocation(GreekFantasy.MODID, "ocean_village"), + BehaviorUtils::getRandomSwimmablePos) { + @Override + public boolean canUse() { + return super.canUse() + && this.mob.getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP) + .orElse(FriendlyGuardian.EMPTY).isEnabled(); + } + }); } } // add dolphin goals to be tempted by tritons and move to ocean villages - if(mob.getType() == EntityType.DOLPHIN && mob instanceof Dolphin dolphin) { - mob.goalSelector.addGoal(2, new DolphinTemptByTritonGoal(dolphin, 0.9D, Ingredient.of(ItemTags.FISHES))); + if (mob.getType() == EntityType.DOLPHIN && mob instanceof Dolphin dolphin) { + mob.goalSelector.addGoal(2, + new DolphinTemptByTritonGoal(dolphin, 0.9D, Ingredient.of(ItemTags.FISHES))); if (GreekFantasy.CONFIG.DOLPHIN_SEEK_OCEAN_VILLAGE.get()) { - mob.goalSelector.addGoal(3, new MoveToStructureGoal(dolphin, 1.0D, 5, 10, 15, new ResourceLocation(GreekFantasy.MODID, "ocean_village"), BehaviorUtils::getRandomSwimmablePos)); + mob.goalSelector.addGoal(3, + new MoveToStructureGoal(dolphin, 1.0D, 5, 10, 15, + new ResourceLocation(GreekFantasy.MODID, "ocean_village"), + BehaviorUtils::getRandomSwimmablePos)); } } // add drowned goals to attack tritons and naiads - if(mob.getType() == EntityType.DROWNED) { + if (mob.getType() == EntityType.DROWNED) { mob.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(mob, Triton.class, false)); mob.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(mob, Naiad.class, true, false)); } // add zombie goal to attack automaton - if(mob.getType() == EntityType.ZOMBIE || mob.getType() == EntityType.DROWNED || mob.getType() == EntityType.HUSK) { + if (mob.getType() == EntityType.ZOMBIE || mob.getType() == EntityType.DROWNED + || mob.getType() == EntityType.HUSK) { mob.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(mob, Automaton.class, true)); } } @@ -598,18 +645,21 @@ public boolean canUse() { * @param event the spawn event **/ @SubscribeEvent - public static void onLivingCheckSpawn(final LivingSpawnEvent.CheckSpawn event) { + public static void onLivingCheckSpawn(final MobSpawnEvent.SpawnPlacementCheck event) { final int cRadius = GreekFantasy.CONFIG.getPalladiumChunkRange(); final int cVertical = GreekFantasy.CONFIG.getPalladiumYRange() / 2; // divide by 2 to center on block - if (GreekFantasy.CONFIG.isPalladiumEnabled() && !event.getEntity().level.isClientSide() - && (event.getSpawnReason() == MobSpawnType.NATURAL - || event.getSpawnReason() == MobSpawnType.REINFORCEMENT - || event.getSpawnReason() == MobSpawnType.PATROL - || event.getSpawnReason() == MobSpawnType.SPAWNER) - && event.getLevel() instanceof ServerLevel level - && event.getEntity() instanceof Enemy && event.getEntity().canChangeDimensions()) { + // In 1.20.1, SpawnPlacementCheck no longer has getEntity() + // We use getEntityType() and getSpawnType() instead + if (GreekFantasy.CONFIG.isPalladiumEnabled() + && (event.getSpawnType() == MobSpawnType.NATURAL + || event.getSpawnType() == MobSpawnType.REINFORCEMENT + || event.getSpawnType() == MobSpawnType.PATROL + || event.getSpawnType() == MobSpawnType.SPAWNER) + && event.getLevel() instanceof ServerLevel level) { + // Check if the entity type is a hostile mob + EntityType entityType = event.getEntityType(); // determine spawn area - final BlockPos eventPos = new BlockPos(event.getX(), event.getY(), event.getZ()); + final BlockPos eventPos = event.getPos(); final ChunkPos eventChunkPos = new ChunkPos(eventPos); final ChunkPos minChunkPos = new ChunkPos(eventChunkPos.x - cRadius, eventChunkPos.z - cRadius); final ChunkPos maxChunkPos = new ChunkPos(eventChunkPos.x + cRadius, eventChunkPos.z + cRadius); @@ -620,9 +670,10 @@ public static void onLivingCheckSpawn(final LivingSpawnEvent.CheckSpawn event) { // search each chunk in range for a palladium LevelEntityGetter entityGetter = level.getEntities(); entityGetter.get(EntityTypeTest.forClass(Palladium.class), aabb, e -> { - if(event.getResult() != Event.Result.DENY) { + if (event.getResult() != Event.Result.DENY) { event.setResult(Event.Result.DENY); } + return AbortableIterationConsumer.Continuation.CONTINUE; }); } } @@ -630,26 +681,28 @@ public static void onLivingCheckSpawn(final LivingSpawnEvent.CheckSpawn event) { /** * Used to sometimes replace Witch with Circe when a witch is spawned. * - * @param event the LivingSpawnEvent.SpecialSpawn + * @param event the MobSpawnEvent.PositionCheck */ @SubscribeEvent - public static void onEntitySpawn(final LivingSpawnEvent.SpecialSpawn event) { + public static void onEntitySpawn(final MobSpawnEvent.PositionCheck event) { // check if the entity is a witch if (event.getEntity() != null && event.getEntity().getType() == EntityType.WITCH && event.getLevel() instanceof ServerLevel level - && (event.getLevel().getRandom().nextDouble() * 100.0D) < GreekFantasy.CONFIG.CIRCE_SPAWN_CHANCE.get()) { + && (event.getLevel().getRandom().nextDouble() * 100.0D) < GreekFantasy.CONFIG.CIRCE_SPAWN_CHANCE + .get()) { event.setCanceled(true); // spawn Circe instead of witch - BlockPos pos = new BlockPos(event.getX(), event.getY(), event.getZ()); + BlockPos pos = BlockPos.containing(event.getX(), event.getY(), event.getZ()); final Circe circe = GFRegistry.EntityReg.CIRCE.get().create((Level) event.getLevel()); circe.moveTo(event.getX(), event.getY(), event.getZ(), 0, 0); level.addFreshEntity(circe); - circe.finalizeSpawn(level, level.getCurrentDifficultyAt(pos), event.getSpawnReason(), null, null); + circe.finalizeSpawn(level, level.getCurrentDifficultyAt(pos), event.getSpawnType(), null, null); } } /** - * Used to replace ocelot with Nemean Lion when the former is struck by lightning + * Used to replace ocelot with Nemean Lion when the former is struck by + * lightning * (while under the Strength potion effect) * * @param event the EntityStruckByLightning event @@ -658,17 +711,18 @@ public static void onEntitySpawn(final LivingSpawnEvent.SpecialSpawn event) { public static void onEntityStruckByLightning(final EntityStruckByLightningEvent event) { if (event.getEntity() instanceof LivingEntity livingEntity && livingEntity.getType() == EntityType.OCELOT && livingEntity.getEffect(MobEffects.DAMAGE_BOOST) != null - && livingEntity.level.getDifficulty() != Difficulty.PEACEFUL - && livingEntity.level.random.nextFloat() * 100.0F < GreekFantasy.CONFIG.NEMEAN_LION_LIGHTNING_CHANCE.get()) { + && livingEntity.level().getDifficulty() != Difficulty.PEACEFUL + && livingEntity.level().random.nextFloat() + * 100.0F < GreekFantasy.CONFIG.NEMEAN_LION_LIGHTNING_CHANCE.get()) { // remove the entity and spawn a nemean lion - NemeanLion lion = GFRegistry.EntityReg.NEMEAN_LION.get().create(event.getEntity().level); + NemeanLion lion = GFRegistry.EntityReg.NEMEAN_LION.get().create(event.getEntity().level()); lion.copyPosition(event.getEntity()); if (event.getEntity().hasCustomName()) { lion.setCustomName(event.getEntity().getCustomName()); lion.setCustomNameVisible(event.getEntity().isCustomNameVisible()); } lion.setPersistenceRequired(); - event.getEntity().level.addFreshEntity(lion); + event.getEntity().level().addFreshEntity(lion); event.getEntity().discard(); } } @@ -682,16 +736,16 @@ public static void onEntityStruckByLightning(final EntityStruckByLightningEvent **/ @SubscribeEvent public static void onPlayerInteract(final PlayerInteractEvent.EntityInteract event) { - if(event.isCanceled() || !(event.getLevel() instanceof ServerLevel)) { + if (event.isCanceled() || !(event.getLevel() instanceof ServerLevel)) { return; } - if(event.isCancelable() && isStunnedOrPetrified(event.getEntity())) { + if (event.isCancelable() && isStunnedOrPetrified(event.getEntity())) { event.setCanceled(true); return; } ServerLevel level = (ServerLevel) event.getLevel(); // when player uses poisonous potato on adult hoglin while outside the nether - if ((!GreekFantasy.CONFIG.GIANT_BOAR_NON_NETHER.get() || level.dimension() != Level.NETHER) + if ((!GreekFantasy.CONFIG.GIANT_BOAR_NON_NETHER.get() || event.getLevel().dimension() != Level.NETHER) && event.getTarget().getType() == EntityType.HOGLIN && event.getTarget() instanceof Hoglin hoglin && event.getItemStack().is(GiantBoar.TRIGGER)) { @@ -729,19 +783,20 @@ public static void onPlayerInteract(final PlayerInteractEvent.EntityInteract eve } } - /** * Canceled when the player is stunned or petrified. - * Used to trigger Lord of the Sea when the player starts using an enchanted trident + * Used to trigger Lord of the Sea when the player starts using an enchanted + * trident + * * @param event the use item start event */ @SubscribeEvent public static void onPlayerStartUsingItem(final LivingEntityUseItemEvent.Start event) { - if(event.isCancelable() && isStunnedOrPetrified(event.getEntity())) { + if (event.isCancelable() && isStunnedOrPetrified(event.getEntity())) { event.setCanceled(true); return; } - if(!event.getEntity().level.isClientSide() && event.getEntity() instanceof ServerPlayer player + if (!event.getEntity().level().isClientSide() && event.getEntity() instanceof ServerPlayer player && !event.isCanceled() && event.getItem().is(Items.TRIDENT) && event.getItem().getEnchantmentLevel(GFRegistry.EnchantmentReg.LORD_OF_THE_SEA.get()) > 0 && !player.getCooldowns().isOnCooldown(Items.TRIDENT) @@ -754,11 +809,12 @@ public static void onPlayerStartUsingItem(final LivingEntityUseItemEvent.Start e /** * Canceled when the player is stunned or petrified + * * @param event the use item tick event */ @SubscribeEvent public static void onPlayerTickUsingItem(final LivingEntityUseItemEvent.Tick event) { - if(event.isCancelable() && isStunnedOrPetrified(event.getEntity())) { + if (event.isCancelable() && isStunnedOrPetrified(event.getEntity())) { event.setCanceled(true); return; } @@ -767,19 +823,20 @@ public static void onPlayerTickUsingItem(final LivingEntityUseItemEvent.Tick eve /** * Canceled when the player is stunned or petrified. * Used to run daybreak enchantment when right clicking while holding a clock. + * * @param event the player right click item event */ @SubscribeEvent public static void onPlayerRightClickItem(final PlayerInteractEvent.RightClickItem event) { - if(event.isCancelable() && isStunnedOrPetrified(event.getEntity())) { + if (event.isCancelable() && isStunnedOrPetrified(event.getEntity())) { event.setCanceled(true); return; } - if(!event.getEntity().level.isClientSide() && event.getEntity() instanceof ServerPlayer player + if (!event.getEntity().level().isClientSide() && event.getEntity() instanceof ServerPlayer player && !event.isCanceled() && event.getItemStack().is(Items.CLOCK) && event.getItemStack().getEnchantmentLevel(GFRegistry.EnchantmentReg.DAYBREAK.get()) > 0 - && player.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT) - && player.level.getDayTime() % 24000L > 13000L + && player.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT) + && player.level().getDayTime() % 24000L > 13000L && (!GreekFantasy.isRGLoaded() || RGCompat.getInstance().canUseDaybreak(player))) { // cancel the event event.setCanceled(true); @@ -789,7 +846,7 @@ public static void onPlayerRightClickItem(final PlayerInteractEvent.RightClickIt @SubscribeEvent public static void onAttachCapabilities(final AttachCapabilitiesEvent event) { - if(event.getObject() instanceof Guardian) { + if (event.getObject() instanceof Guardian) { event.addCapability(FriendlyGuardian.REGISTRY_NAME, new FriendlyGuardian.Provider()); } } @@ -798,23 +855,25 @@ private static void useLordOfTheSea(final ServerPlayer player, final ItemStack i final BlockHitResult raytrace = ThunderboltItem.raytraceFromEntity(player, 48.0F); // add a lightning bolt at the resulting position if (raytrace.getType() != HitResult.Type.MISS) { - final Whirl whirl = GFRegistry.EntityReg.WHIRL.get().create(player.level); - final BlockPos pos = new BlockPos(raytrace.getLocation()); + final Whirl whirl = GFRegistry.EntityReg.WHIRL.get().create(player.level()); + final BlockPos pos = BlockPos.containing(raytrace.getLocation()); // make sure there is enough water here - if (player.level.getFluidState(pos).is(FluidTags.WATER) - && player.level.getFluidState(pos.below((int) Math.ceil(whirl.getBbHeight()))).is(FluidTags.WATER)) { + if (player.level().getFluidState(pos).is(FluidTags.WATER) + && player.level().getFluidState(pos.below((int) Math.ceil(whirl.getBbHeight()))) + .is(FluidTags.WATER)) { // summon a powerful whirl with limited life and mob attracting turned on - whirl.moveTo(raytrace.getLocation().x(), raytrace.getLocation().y() - whirl.getBbHeight(), raytrace.getLocation().z(), 0, 0); - player.level.addFreshEntity(whirl); + whirl.moveTo(raytrace.getLocation().x(), raytrace.getLocation().y() - whirl.getBbHeight(), + raytrace.getLocation().z(), 0, 0); + player.level().addFreshEntity(whirl); whirl.setLimitedLife(GreekFantasy.CONFIG.LORD_OF_THE_SEA_WHIRL_LIFESPAN.get() * 20); whirl.setAttractMobs(true); whirl.playSound(SoundEvents.TRIDENT_THUNDER, 1.5F, 0.6F + whirl.getRandom().nextFloat() * 0.32F); // summon a lightning bolt - LightningBolt bolt = EntityType.LIGHTNING_BOLT.create(player.level); + LightningBolt bolt = EntityType.LIGHTNING_BOLT.create(player.level()); bolt.setSilent(true); bolt.setPos(raytrace.getLocation().x(), raytrace.getLocation().y(), raytrace.getLocation().z()); bolt.setVisualOnly(true); - player.level.addFreshEntity(bolt); + player.level().addFreshEntity(bolt); // cooldown and item damage player.getCooldowns().addCooldown(item.getItem(), 100); if (!player.isCreative()) { @@ -825,7 +884,7 @@ private static void useLordOfTheSea(final ServerPlayer player, final ItemStack i } private static void useDaybreak(final ServerPlayer player, final ItemStack item) { - final ServerLevel world = player.getLevel(); + final ServerLevel world = player.serverLevel(); long nextDay = world.getLevelData().getDayTime() + 24000L; world.setDayTime(nextDay - nextDay % 24000L); // break the item @@ -843,11 +902,21 @@ public static void onRegisterCapabilities(RegisterCapabilitiesEvent event) { event.register(IFriendlyGuardian.class); } + @SubscribeEvent + public static void onBuildCreativeModeTabContents(net.minecraftforge.event.BuildCreativeModeTabContentsEvent event) { + if (event.getTabKey() == GFRegistry.ItemReg.GF_TAB.getKey()) { + // Add all mod items to the creative tab + GFRegistry.ItemReg.getItemsRegister().getEntries().forEach(item -> { + event.accept(item.get()); + }); + } + } + @SubscribeEvent public static void onAddPackFinders(final AddPackFindersEvent event) { - if(event.getPackType() == PackType.SERVER_DATA) { + if (event.getPackType() == PackType.SERVER_DATA) { // register RPG Gods data pack - if(GreekFantasy.isRGLoaded()) { + if (GreekFantasy.isRGLoaded()) { GreekFantasy.LOGGER.info("Greek Fantasy detected RPG Gods, registering data pack now"); registerAddon(event, "data_rpggods"); } @@ -855,16 +924,20 @@ public static void onAddPackFinders(final AddPackFindersEvent event) { } private static void registerAddon(final AddPackFindersEvent event, final String packName) { - event.addRepositorySource((packConsumer, constructor) -> { - Pack pack = Pack.create(GreekFantasy.MODID + ":" + packName, true, () -> { - Path path = ModList.get().getModFileById(GreekFantasy.MODID).getFile().findResource("/" + packName); - return new PathPackResources(packName, path); - }, constructor, Pack.Position.TOP, PackSource.DEFAULT); - + // In 1.20.1, addRepositorySource takes a single RepositorySource parameter + event.addRepositorySource(packConsumer -> { + Path path = ModList.get().getModFileById(GreekFantasy.MODID).getFile().findResource("/" + packName); + Pack.ResourcesSupplier resourcesSupplier = (packId) -> new PathPackResources(packId, true, path); + Pack pack = Pack.readMetaAndCreate( + GreekFantasy.MODID + ":" + packName, + net.minecraft.network.chat.Component.literal(packName), + true, + resourcesSupplier, + event.getPackType(), + Pack.Position.TOP, + PackSource.DEFAULT); if (pack != null) { packConsumer.accept(pack); - } else { - GreekFantasy.LOGGER.error(GreekFantasy.MODID + ": Failed to register data pack \"" + packName + "\""); } }); } diff --git a/src/main/java/greekfantasy/GFRegistry.java b/src/main/java/greekfantasy/GFRegistry.java index 39367d56..79516418 100644 --- a/src/main/java/greekfantasy/GFRegistry.java +++ b/src/main/java/greekfantasy/GFRegistry.java @@ -1,4 +1,7 @@ package greekfantasy; +import net.minecraft.world.level.block.state.properties.BlockSetType; + +import net.minecraft.core.registries.Registries; import com.google.common.collect.ImmutableList; import com.mojang.serialization.Codec; @@ -239,8 +242,8 @@ import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceType; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType; import net.minecraft.world.level.material.Fluids; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.MaterialColor; +// Material removed in 1.20.1 +import net.minecraft.world.level.material.MapColor; import net.minecraftforge.common.ForgeSpawnEggItem; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; @@ -261,1312 +264,1671 @@ import java.util.function.Consumer; import java.util.function.Supplier; -@SuppressWarnings({"unused", "RedundantTypeArguments"}) +@SuppressWarnings({ "unused", "RedundantTypeArguments" }) public final class GFRegistry { - private static final String MODID = GreekFantasy.MODID; - - private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); - private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); - private static final DeferredRegister BANNER_PATTERNS = DeferredRegister.create(Registry.BANNER_PATTERN.key(), MODID); - private static final DeferredRegister POTIONS = DeferredRegister.create(ForgeRegistries.POTIONS, MODID); - private static final DeferredRegister MOB_EFFECTS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, MODID); - private static final DeferredRegister> LOOT_MODIFIER_SERIALIZERS = DeferredRegister.create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, MODID); - private static final DeferredRegister ENCHANTMENTS = DeferredRegister.create(ForgeRegistries.ENCHANTMENTS, MODID); - private static final DeferredRegister> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, MODID); - private static final DeferredRegister> BLOCK_ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID); - private static final DeferredRegister> RECIPE_SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, MODID); - private static final DeferredRegister> FEATURES = DeferredRegister.create(ForgeRegistries.FEATURES, MODID); - private static final DeferredRegister> STRUCTURE_TYPES = DeferredRegister.create(Registry.STRUCTURE_TYPES.key(), MODID); - private static final DeferredRegister STRUCTURE_PIECE_TYPES = DeferredRegister.create(Registry.STRUCTURE_PIECE.key(), MODID); - private static final DeferredRegister> PLACEMENT_MODIFIER_TYPES = DeferredRegister.create(Registry.PLACEMENT_MODIFIERS.key(), MODID); - private static final DeferredRegister> PARTICLE_TYPES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, MODID); - private static final DeferredRegister> STRUCTURE_MODIFIERS = DeferredRegister.create(ForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, MODID); - - public static void register() { - BlockReg.register(); - ItemReg.register(); - BannerPatternReg.register(); - PotionReg.register(); - LootModifierReg.register(); - MobEffectReg.register(); - EnchantmentReg.register(); - EntityReg.register(); - BlockEntityReg.register(); - RecipeReg.register(); - ParticleReg.register(); - StructureReg.register(); - StructureProcessorReg.register(); - FeatureReg.register(); - PlacementTypeReg.register(); - StructureModifierReg.register(); - } - - - public static final class BlockReg { + private static final String MODID = GreekFantasy.MODID; + + private static final DeferredRegister BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID); + private static final DeferredRegister ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID); + private static final DeferredRegister BANNER_PATTERNS = DeferredRegister + .create(Registries.BANNER_PATTERN, MODID); + private static final DeferredRegister POTIONS = DeferredRegister.create(ForgeRegistries.POTIONS, MODID); + private static final DeferredRegister MOB_EFFECTS = DeferredRegister + .create(ForgeRegistries.MOB_EFFECTS, MODID); + private static final DeferredRegister> LOOT_MODIFIER_SERIALIZERS = DeferredRegister + .create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, MODID); + private static final DeferredRegister ENCHANTMENTS = DeferredRegister + .create(ForgeRegistries.ENCHANTMENTS, MODID); + private static final DeferredRegister> ENTITY_TYPES = DeferredRegister + .create(ForgeRegistries.ENTITY_TYPES, MODID); + private static final DeferredRegister> BLOCK_ENTITY_TYPES = DeferredRegister + .create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID); + private static final DeferredRegister> RECIPE_SERIALIZERS = DeferredRegister + .create(ForgeRegistries.RECIPE_SERIALIZERS, MODID); + private static final DeferredRegister> FEATURES = DeferredRegister.create(ForgeRegistries.FEATURES, + MODID); + private static final DeferredRegister> STRUCTURE_TYPES = DeferredRegister + .create(Registries.STRUCTURE_TYPE, MODID); + private static final DeferredRegister STRUCTURE_PIECE_TYPES = DeferredRegister + .create(Registries.STRUCTURE_PIECE, MODID); + private static final DeferredRegister> PLACEMENT_MODIFIER_TYPES = DeferredRegister + .create(Registries.PLACEMENT_MODIFIER_TYPE, MODID); + private static final DeferredRegister> PARTICLE_TYPES = DeferredRegister + .create(ForgeRegistries.PARTICLE_TYPES, MODID); + private static final DeferredRegister> STRUCTURE_MODIFIERS = DeferredRegister + .create(ForgeRegistries.Keys.STRUCTURE_MODIFIER_SERIALIZERS, MODID); public static void register() { - BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); - // register blocks and items together - registerBlockPolishedEtc("limestone", Block.Properties.of(Material.STONE, MaterialColor.STONE).requiresCorrectToolForDrops().strength(1.5F, 6.0F)); - registerBlockPolishedEtc("marble", Block.Properties.of(Material.STONE, MaterialColor.QUARTZ).requiresCorrectToolForDrops().strength(1.5F, 6.0F)); - registerBlockPolishedChiseledAndBricks("cretan_stone", BlockBehaviour.Properties.of(Material.STONE, MaterialColor.CLAY).requiresCorrectToolForDrops().strength(80.0F, 3600.0F)); - registerLogsPlanksEtc("olive", 2.0F, 3.0F, MaterialColor.WOOD, MaterialColor.SAND, 5, 5, 20); - registerLogsPlanksEtc("pomegranate", 2.2F, 3.0F, MaterialColor.TERRACOTTA_PURPLE, MaterialColor.CRIMSON_STEM, 0, 0, 0); - registerLeaves("olive", 30, 60); - registerLeaves("pomegranate", 0, 0); - registerLeaves("golden", 30, 60); - // register terracotta vase - RegistryObject COLORLESS_VASE = BLOCKS.register("terracotta_vase", () -> - new VaseBlock(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.TERRACOTTA_ORANGE) - .strength(0.5F, 1.0F).noOcclusion())); - GFRegistry.ItemReg.registerItemBlock(COLORLESS_VASE); - // register colored terracotta vases - for (DyeColor dyeColor : DyeColor.values()) { - RegistryObject VASE = BLOCKS.register(dyeColor.getSerializedName() + "_terracotta_vase", () -> - new VaseBlock(BlockBehaviour.Properties.of(Material.STONE, dyeColor.getMaterialColor()) - .strength(0.5F, 1.0F).noOcclusion())); - GFRegistry.ItemReg.registerItemBlock(VASE); - } + BlockReg.register(); + ItemReg.register(); + BannerPatternReg.register(); + PotionReg.register(); + LootModifierReg.register(); + MobEffectReg.register(); + EnchantmentReg.register(); + EntityReg.register(); + BlockEntityReg.register(); + RecipeReg.register(); + ParticleReg.register(); + StructureReg.register(); + StructureProcessorReg.register(); + FeatureReg.register(); + PlacementTypeReg.register(); + StructureModifierReg.register(); } - public static final RegistryObject LIMESTONE = RegistryObject.create(new ResourceLocation(MODID, "limestone"), ForgeRegistries.BLOCKS); - public static final RegistryObject MARBLE = RegistryObject.create(new ResourceLocation(MODID, "marble"), ForgeRegistries.BLOCKS); - public static final RegistryObject OLIVE_LOG = RegistryObject.create(new ResourceLocation(MODID, "olive_log"), ForgeRegistries.BLOCKS); - public static final RegistryObject POMEGRANATE_LOG = RegistryObject.create(new ResourceLocation(MODID, "pomegranate_log"), ForgeRegistries.BLOCKS); - public static final RegistryObject OLIVE_LEAVES = RegistryObject.create(new ResourceLocation(MODID, "olive_leaves"), ForgeRegistries.BLOCKS); - public static final RegistryObject POMEGRANATE_LEAVES = RegistryObject.create(new ResourceLocation(MODID, "pomegranate_leaves"), ForgeRegistries.BLOCKS); - public static final RegistryObject GOLDEN_LEAVES = RegistryObject.create(new ResourceLocation(MODID, "golden_leaves"), ForgeRegistries.BLOCKS); - public static final RegistryObject CRETAN_STONE_BRICK = RegistryObject.create(new ResourceLocation(MODID, "cretan_stone_brick"), ForgeRegistries.BLOCKS); - public static final RegistryObject POLISHED_CRETAN_STONE = RegistryObject.create(new ResourceLocation(MODID, "polished_cretan_stone"), ForgeRegistries.BLOCKS); - public static final RegistryObject CRACKED_CRETAN_STONE_BRICK = RegistryObject.create(new ResourceLocation(MODID, "cracked_cretan_stone_brick"), ForgeRegistries.BLOCKS); - public static final RegistryObject CRACKED_POLISHED_CRETAN_STONE = RegistryObject.create(new ResourceLocation(MODID, "cracked_polished_cretan_stone"), ForgeRegistries.BLOCKS); - public static final RegistryObject BRONZE_BLOCK = BLOCKS.register("bronze_block", () -> - new Block(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_BROWN) - .requiresCorrectToolForDrops().strength(3.0F, 6.0F) - .sound(SoundType.METAL))); - public static final RegistryObject ICHOR_INFUSED_GEARBOX = BLOCKS.register("ichor_infused_gearbox", () -> - new RotatedPillarBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_ORANGE) - .requiresCorrectToolForDrops().strength(3.0F, 6.0F) - .sound(SoundType.METAL))); - public static final RegistryObject MYSTERIOUS_BOX = BLOCKS.register("mysterious_box", () -> - new MysteriousBoxBlock(BlockBehaviour.Properties.of(Material.WOOD) - .strength(0.8F, 3.0F).sound(SoundType.WOOD).noOcclusion())); - public static final RegistryObject GIGANTE_HEAD = BLOCKS.register("gigante_head", () -> - new MobHeadBlock(BlockEntityReg.GIGANTE_HEAD, BlockBehaviour.Properties.of(Material.DECORATION).strength(1.0F).noOcclusion())); - public static final RegistryObject ORTHUS_HEAD = BLOCKS.register("orthus_head", () -> - new OrthusHeadBlock(BlockEntityReg.ORTHUS_HEAD, BlockBehaviour.Properties.of(Material.DECORATION).strength(1.0F).noOcclusion())); - public static final RegistryObject CERBERUS_HEAD = BLOCKS.register("cerberus_head", () -> - new CerberusHeadBlock(BlockEntityReg.CERBERUS_HEAD, BlockBehaviour.Properties.of(Material.DECORATION).strength(1.0F).noOcclusion())); - public static final RegistryObject OIL_LAMP = BLOCKS.register("oil_lamp", () -> - new OilLampBlock(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.COLOR_BROWN) - .noOcclusion().lightLevel(b -> b.getValue(OilLampBlock.LIT) ? 11 : 0).strength(0.2F, 0.1F))); - public static final RegistryObject OLIVE_OIL = BLOCKS.register("olive_oil", () -> - new OliveOilBlock(BlockBehaviour.Properties.of(Material.FIRE) - .noOcclusion().noCollission().instabreak() - .randomTicks().lightLevel(b -> b.getValue(OliveOilBlock.LIT) ? 11 : 0).sound(SoundType.WET_GRASS))); - public static final RegistryObject GOLDEN_STRING = BLOCKS.register("golden_string", () -> - new GoldenStringBlock(BlockBehaviour.Properties.of(Material.DECORATION) - .lightLevel(b -> 8).instabreak().noCollission().noOcclusion().sound(SoundType.WOOL))); - public static final RegistryObject OLIVE_SAPLING = BLOCKS.register("olive_sapling", () -> - new SaplingBlock(new OliveTreeGrower(), BlockBehaviour.Properties.of(Material.PLANT) - .noCollission().randomTicks().instabreak().sound(SoundType.GRASS))); - public static final RegistryObject POMEGRANATE_SAPLING = BLOCKS.register("pomegranate_sapling", () -> - new PomegranateSaplingBlock(new PomegranateTreeGrower(), BlockBehaviour.Properties.of(Material.PLANT) - .noCollission().randomTicks().instabreak().sound(SoundType.GRASS))); - public static final RegistryObject GOLDEN_SAPLING = BLOCKS.register("golden_sapling", () -> - new SaplingBlock(new GoldenTreeGrower(), BlockBehaviour.Properties.of(Material.PLANT) - .noCollission().randomTicks().instabreak().sound(SoundType.GRASS))); - public static final RegistryObject NEST = BLOCKS.register("nest", () -> - new NestBlock(Block.Properties.of(Material.GRASS, MaterialColor.COLOR_BROWN) - .strength(0.5F).sound(SoundType.GRASS) - .hasPostProcess((s, r, p) -> true).noOcclusion())); - public static final RegistryObject WILD_ROSE = BLOCKS.register("wild_rose", () -> - new WildRoseBlock(MobEffects.SATURATION, 9, Block.Properties.of(Material.PLANT).noCollission().instabreak().sound(SoundType.GRASS))); - public static final RegistryObject REEDS = BLOCKS.register("reeds", () -> - new ReedsBlock(Block.Properties.of(Material.REPLACEABLE_WATER_PLANT).noCollission().instabreak() - .offsetType(BlockBehaviour.OffsetType.XZ).randomTicks().sound(SoundType.CROP))); - public static final RegistryObject LIGHT = BLOCKS.register("light", () -> - new LightBlock(BlockBehaviour.Properties.copy(Blocks.LIGHT))); - - /** - * Registers all of the following: log, stripped log, wood, stripped wood, planks, stairs, slab, door, trapdoor - * - * @param registryName the base registry name - * @param strength the destroy time - * @param hardness the explosion resistance - * @param side the material color of the side - * @param top the material color of the top - * @param fireSpread the fire spread chance. The higher the number returned, the faster fire will spread around this block. - * @param logFlammability Chance that fire will spread and consume the log. 300 being a 100% chance, 0, being a 0% chance. - * @param planksFlammability Chance that fire will spread and consume the plank. 300 being a 100% chance, 0, being a 0% chance. - */ - private static void registerLogsPlanksEtc(final String registryName, final float strength, final float hardness, - final MaterialColor side, final MaterialColor top, - final int fireSpread, final int logFlammability, final int planksFlammability) { - // create properties to apply to wood and non-rotatable variants - final BlockBehaviour.Properties woodProperties = BlockBehaviour.Properties - .of(Material.WOOD, side) - .strength(strength, hardness).sound(SoundType.WOOD); - // create properties to apply to log (multiple material colors) - final BlockBehaviour.Properties logProperties = BlockBehaviour.Properties - .of(Material.WOOD, (state) -> state.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y ? top : side) - .strength(strength, hardness).sound(SoundType.WOOD); - // create properties to apply to doors and trapdoors - final Block.Properties doorProperties = BlockBehaviour.Properties - .of(Material.WOOD, side) - .strength(strength, hardness).sound(SoundType.WOOD) - .noOcclusion().isValidSpawn((b, i, p, a) -> false); - - // register blocks - final RegistryObject strippedLog = BLOCKS.register("stripped_" + registryName + "_log", () -> - new RotatedPillarBlock(woodProperties) { - @Override - public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return fireSpread; + public static final class BlockReg { + + public static void register() { + BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); + // register blocks and items together + registerBlockPolishedEtc("limestone", Block.Properties.of().mapColor(MapColor.STONE) + .requiresCorrectToolForDrops().strength(1.5F, 6.0F)); + registerBlockPolishedEtc("marble", Block.Properties.of().mapColor(MapColor.QUARTZ) + .requiresCorrectToolForDrops().strength(1.5F, 6.0F)); + registerBlockPolishedChiseledAndBricks("cretan_stone", BlockBehaviour.Properties + .of().mapColor(MapColor.CLAY).requiresCorrectToolForDrops() + .strength(80.0F, 3600.0F)); + registerLogsPlanksEtc("olive", 2.0F, 3.0F, MapColor.WOOD, MapColor.SAND, 5, 5, 20); + registerLogsPlanksEtc("pomegranate", 2.2F, 3.0F, MapColor.TERRACOTTA_PURPLE, + MapColor.CRIMSON_STEM, 0, 0, 0); + registerLeaves("olive", 30, 60); + registerLeaves("pomegranate", 0, 0); + registerLeaves("golden", 30, 60); + // register terracotta vase + RegistryObject COLORLESS_VASE = BLOCKS.register("terracotta_vase", + () -> new VaseBlock(BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_ORANGE) + .strength(0.5F, 1.0F).noOcclusion())); + GFRegistry.ItemReg.registerItemBlock(COLORLESS_VASE); + // register colored terracotta vases + for (DyeColor dyeColor : DyeColor.values()) { + RegistryObject VASE = BLOCKS.register( + dyeColor.getSerializedName() + "_terracotta_vase", + () -> new VaseBlock(BlockBehaviour.Properties + .of().mapColor(dyeColor.getMapColor()) + .strength(0.5F, 1.0F).noOcclusion())); + GFRegistry.ItemReg.registerItemBlock(VASE); } + } - @Override - public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return logFlammability; - } - } - ); - final RegistryObject strippedWood = BLOCKS.register("stripped_" + registryName + "_wood", () -> - new RotatedPillarBlock(woodProperties) { - @Override - public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return fireSpread; - } + public static final RegistryObject LIMESTONE = RegistryObject + .create(new ResourceLocation(MODID, "limestone"), ForgeRegistries.BLOCKS); + public static final RegistryObject MARBLE = RegistryObject + .create(new ResourceLocation(MODID, "marble"), ForgeRegistries.BLOCKS); + public static final RegistryObject OLIVE_LOG = RegistryObject + .create(new ResourceLocation(MODID, "olive_log"), ForgeRegistries.BLOCKS); + public static final RegistryObject POMEGRANATE_LOG = RegistryObject + .create(new ResourceLocation(MODID, "pomegranate_log"), ForgeRegistries.BLOCKS); + public static final RegistryObject OLIVE_LEAVES = RegistryObject + .create(new ResourceLocation(MODID, "olive_leaves"), ForgeRegistries.BLOCKS); + public static final RegistryObject POMEGRANATE_LEAVES = RegistryObject + .create(new ResourceLocation(MODID, "pomegranate_leaves"), ForgeRegistries.BLOCKS); + public static final RegistryObject GOLDEN_LEAVES = RegistryObject + .create(new ResourceLocation(MODID, "golden_leaves"), ForgeRegistries.BLOCKS); + public static final RegistryObject CRETAN_STONE_BRICK = RegistryObject + .create(new ResourceLocation(MODID, "cretan_stone_brick"), ForgeRegistries.BLOCKS); + public static final RegistryObject POLISHED_CRETAN_STONE = RegistryObject + .create(new ResourceLocation(MODID, "polished_cretan_stone"), ForgeRegistries.BLOCKS); + public static final RegistryObject CRACKED_CRETAN_STONE_BRICK = RegistryObject.create( + new ResourceLocation(MODID, "cracked_cretan_stone_brick"), ForgeRegistries.BLOCKS); + public static final RegistryObject CRACKED_POLISHED_CRETAN_STONE = RegistryObject.create( + new ResourceLocation(MODID, "cracked_polished_cretan_stone"), ForgeRegistries.BLOCKS); + public static final RegistryObject BRONZE_BLOCK = BLOCKS.register("bronze_block", + () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN) + .requiresCorrectToolForDrops().strength(3.0F, 6.0F) + .sound(SoundType.METAL))); + public static final RegistryObject ICHOR_INFUSED_GEARBOX = BLOCKS.register( + "ichor_infused_gearbox", + () -> new RotatedPillarBlock( + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE) + .requiresCorrectToolForDrops().strength(3.0F, 6.0F) + .sound(SoundType.METAL))); + public static final RegistryObject MYSTERIOUS_BOX = BLOCKS.register("mysterious_box", + () -> new MysteriousBoxBlock(BlockBehaviour.Properties.of() + .strength(0.8F, 3.0F).sound(SoundType.WOOD).noOcclusion())); + public static final RegistryObject GIGANTE_HEAD = BLOCKS.register("gigante_head", + () -> new MobHeadBlock(BlockEntityReg.GIGANTE_HEAD, BlockBehaviour.Properties + .of().strength(1.0F).noOcclusion())); + public static final RegistryObject ORTHUS_HEAD = BLOCKS.register("orthus_head", + () -> new OrthusHeadBlock(BlockEntityReg.ORTHUS_HEAD, BlockBehaviour.Properties + .of().strength(1.0F).noOcclusion())); + public static final RegistryObject CERBERUS_HEAD = BLOCKS.register("cerberus_head", + () -> new CerberusHeadBlock(BlockEntityReg.CERBERUS_HEAD, BlockBehaviour.Properties + .of().strength(1.0F).noOcclusion())); + public static final RegistryObject OIL_LAMP = BLOCKS.register("oil_lamp", + () -> new OilLampBlock(BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BROWN) + .noOcclusion().lightLevel(b -> b.getValue(OilLampBlock.LIT) ? 11 : 0) + .strength(0.2F, 0.1F))); + public static final RegistryObject OLIVE_OIL = BLOCKS.register("olive_oil", + () -> new OliveOilBlock(BlockBehaviour.Properties.of() + .noOcclusion().noCollission().instabreak() + .randomTicks().lightLevel(b -> b.getValue(OliveOilBlock.LIT) ? 11 : 0) + .sound(SoundType.WET_GRASS))); + public static final RegistryObject GOLDEN_STRING = BLOCKS.register("golden_string", + () -> new GoldenStringBlock(BlockBehaviour.Properties.of() + .lightLevel(b -> 8).instabreak().noCollission().noOcclusion() + .sound(SoundType.WOOL))); + public static final RegistryObject OLIVE_SAPLING = BLOCKS.register("olive_sapling", + () -> new SaplingBlock(new OliveTreeGrower(), BlockBehaviour.Properties.of() + .noCollission().randomTicks().instabreak().sound(SoundType.GRASS))); + public static final RegistryObject POMEGRANATE_SAPLING = BLOCKS.register("pomegranate_sapling", + () -> new PomegranateSaplingBlock(new PomegranateTreeGrower(), + BlockBehaviour.Properties.of() + .noCollission().randomTicks().instabreak() + .sound(SoundType.GRASS))); + public static final RegistryObject GOLDEN_SAPLING = BLOCKS.register("golden_sapling", + () -> new SaplingBlock(new GoldenTreeGrower(), BlockBehaviour.Properties.of() + .noCollission().randomTicks().instabreak().sound(SoundType.GRASS))); + public static final RegistryObject NEST = BLOCKS.register("nest", + () -> new NestBlock(Block.Properties.of().mapColor(MapColor.COLOR_BROWN) + .strength(0.5F).sound(SoundType.GRASS) + .hasPostProcess((s, r, p) -> true).noOcclusion())); + public static final RegistryObject WILD_ROSE = BLOCKS.register("wild_rose", + () -> new WildRoseBlock(MobEffects.SATURATION, 9, Block.Properties.of().noCollission() + .instabreak().sound(SoundType.GRASS))); + public static final RegistryObject REEDS = BLOCKS.register("reeds", + () -> new ReedsBlock(Block.Properties.of().noCollission().instabreak() + .offsetType(BlockBehaviour.OffsetType.XZ).randomTicks() + .sound(SoundType.CROP))); + public static final RegistryObject LIGHT = BLOCKS.register("light", + () -> new LightBlock(BlockBehaviour.Properties.copy(Blocks.LIGHT))); + + /** + * Registers all of the following: log, stripped log, wood, stripped wood, + * planks, stairs, slab, door, trapdoor + * + * @param registryName the base registry name + * @param strength the destroy time + * @param hardness the explosion resistance + * @param side the material color of the side + * @param top the material color of the top + * @param fireSpread the fire spread chance. The higher the number + * returned, the faster fire will spread around this + * block. + * @param logFlammability Chance that fire will spread and consume the log. + * 300 being a 100% chance, 0, being a 0% chance. + * @param planksFlammability Chance that fire will spread and consume the plank. + * 300 being a 100% chance, 0, being a 0% chance. + */ + private static void registerLogsPlanksEtc(final String registryName, final float strength, + final float hardness, + final MapColor side, final MapColor top, + final int fireSpread, final int logFlammability, final int planksFlammability) { + // create properties to apply to wood and non-rotatable variants + final BlockBehaviour.Properties woodProperties = BlockBehaviour.Properties + .of().mapColor(side).ignitedByLava() + .strength(strength, hardness).sound(SoundType.WOOD); + // create properties to apply to log (multiple material colors) + final BlockBehaviour.Properties logProperties = BlockBehaviour.Properties + .of() + .mapColor((state) -> state.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y + ? top + : side) + .ignitedByLava() + .strength(strength, hardness).sound(SoundType.WOOD); + // create properties to apply to doors and trapdoors + final Block.Properties doorProperties = BlockBehaviour.Properties + .of().mapColor(side).ignitedByLava() + .strength(strength, hardness).sound(SoundType.WOOD) + .noOcclusion().isValidSpawn((b, i, p, a) -> false); + + // register blocks + final RegistryObject strippedLog = BLOCKS.register("stripped_" + registryName + "_log", + () -> new RotatedPillarBlock(woodProperties) { + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return fireSpread; + } + + @Override + public int getFlammability(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return logFlammability; + } + }); + final RegistryObject strippedWood = BLOCKS.register("stripped_" + registryName + "_wood", + () -> new RotatedPillarBlock(woodProperties) { + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return fireSpread; + } + + @Override + public int getFlammability(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return logFlammability; + } + }); + final RegistryObject log = BLOCKS.register(registryName + "_log", + () -> new RotatedPillarBlock(logProperties) { + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return fireSpread; + } + + @Override + public int getFlammability(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return logFlammability; + } + + @Override + public BlockState getToolModifiedState(BlockState state, + UseOnContext context, ToolAction toolAction, + boolean simulate) { + if (toolAction == ToolActions.AXE_STRIP) { + return strippedLog.get().defaultBlockState().setValue( + RotatedPillarBlock.AXIS, + state.getValue(RotatedPillarBlock.AXIS)); + } + return super.getToolModifiedState(state, context, toolAction, + simulate); + } + }); + final RegistryObject wood = BLOCKS.register(registryName + "_wood", + () -> new RotatedPillarBlock(woodProperties) { + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return fireSpread; + } + + @Override + public int getFlammability(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return logFlammability; + } + + @Override + public BlockState getToolModifiedState(BlockState state, + UseOnContext context, ToolAction toolAction, + boolean simulate) { + if (toolAction == ToolActions.AXE_STRIP) { + return strippedWood.get().defaultBlockState().setValue( + RotatedPillarBlock.AXIS, + state.getValue(RotatedPillarBlock.AXIS)); + } + return super.getToolModifiedState(state, context, toolAction, + simulate); + } + }); + final RegistryObject planks = BLOCKS.register(registryName + "_planks", + () -> new Block(woodProperties) { + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return fireSpread; + } + + @Override + public int getFlammability(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return planksFlammability; + } + }); + final RegistryObject slab = BLOCKS.register(registryName + "_slab", + () -> new SlabBlock(woodProperties) { + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return fireSpread; + } + + @Override + public int getFlammability(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return planksFlammability; + } + }); + final RegistryObject stairs = BLOCKS.register(registryName + "_stairs", + () -> new StairBlock(() -> planks.get().defaultBlockState(), woodProperties) { + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return fireSpread; + } + + @Override + public int getFlammability(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return planksFlammability; + } + }); + final RegistryObject door = BLOCKS.register(registryName + "_door", + () -> new DoorBlock(doorProperties, BlockSetType.OAK)); + final RegistryObject trapdoor = BLOCKS.register(registryName + "_trapdoor", + () -> new TrapDoorBlock(doorProperties, BlockSetType.OAK)); + // block items + GFRegistry.ItemReg.registerItemBlock(log); + GFRegistry.ItemReg.registerItemBlock(strippedLog); + GFRegistry.ItemReg.registerItemBlock(wood); + GFRegistry.ItemReg.registerItemBlock(strippedWood); + GFRegistry.ItemReg.registerItemBlock(planks); + GFRegistry.ItemReg.registerItemBlock(slab); + GFRegistry.ItemReg.registerItemBlock(stairs); + GFRegistry.ItemReg.registerItemBlock(door); + GFRegistry.ItemReg.registerItemBlock(trapdoor); + } - @Override - public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return logFlammability; - } - } - ); - final RegistryObject log = BLOCKS.register(registryName + "_log", () -> - new RotatedPillarBlock(logProperties) { - @Override - public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return fireSpread; - } + /** + * Registers a leaves block. + * + * @param registryName the base registry name + * @param fireSpread the fire spread chance. The higher the number returned, + * the faster fire will spread around this block. + * @param flammability Chance that fire will spread and consume the block. 300 + * being a 100% chance, 0, being a 0% chance. + */ + private static void registerLeaves(final String registryName, final int fireSpread, + final int flammability) { + final RegistryObject leaves = BLOCKS.register(registryName + "_leaves", + () -> new LeavesBlock(Block.Properties + .of().mapColor(MapColor.PLANT).strength(0.2F).randomTicks() + .sound(SoundType.GRASS) + .noOcclusion() + .isValidSpawn(GFRegistry.BlockReg::allowsSpawnOnLeaves) + .isSuffocating((s, r, p) -> false) + .isViewBlocking((s, r, p) -> false)) { + @Override + public int getFireSpreadSpeed(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return fireSpread; + } + + @Override + public int getFlammability(BlockState state, BlockGetter world, + BlockPos pos, Direction face) { + return flammability; + } + }); + // block items + GFRegistry.ItemReg.registerItemBlock(leaves); + } - @Override - public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return logFlammability; - } + /** + * Registers the following: block, slab, stairs, pillar, polished block, + * polished slab, polished stairs + * + * @param registryName the base registry name. + * @param properties the block properties + */ + private static void registerBlockPolishedEtc(final String registryName, + final Block.Properties properties) { + // raw, slab, and stairs + final RegistryObject raw = BLOCKS.register(registryName, () -> new Block(properties)); + final RegistryObject slab = BLOCKS.register(registryName + "_slab", + () -> new SlabBlock(properties)); + final RegistryObject stairs = BLOCKS.register(registryName + "_stairs", + () -> new StairBlock(() -> raw.get().defaultBlockState(), properties)); + // polished, slab, and stairs + final RegistryObject polished = BLOCKS.register("polished_" + registryName, + () -> new Block(properties)); + final RegistryObject polishedSlab = BLOCKS.register("polished_" + registryName + "_slab", + () -> new SlabBlock(properties)); + final RegistryObject polishedStairs = BLOCKS.register( + "polished_" + registryName + "_stairs", + () -> new StairBlock(() -> polished.get().defaultBlockState(), properties)); + // pillar + final RegistryObject pillar = BLOCKS.register(registryName + "_pillar", + () -> new PillarBlock(properties)); + // block items + GFRegistry.ItemReg.registerItemBlock(raw); + GFRegistry.ItemReg.registerItemBlock(slab); + GFRegistry.ItemReg.registerItemBlock(stairs); + GFRegistry.ItemReg.registerItemBlock(polished); + GFRegistry.ItemReg.registerItemBlock(polishedSlab); + GFRegistry.ItemReg.registerItemBlock(polishedStairs); + GFRegistry.ItemReg.registerItemBlock(pillar); + } - @Override - public BlockState getToolModifiedState(BlockState state, UseOnContext context, ToolAction toolAction, boolean simulate) { - if (toolAction == ToolActions.AXE_STRIP) { - return strippedLog.get().defaultBlockState().setValue(RotatedPillarBlock.AXIS, state.getValue(RotatedPillarBlock.AXIS)); - } - return super.getToolModifiedState(state, context, toolAction, simulate); - } - } - ); - final RegistryObject wood = BLOCKS.register(registryName + "_wood", () -> - new RotatedPillarBlock(woodProperties) { - @Override - public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return fireSpread; - } + /** + * Registers the following: block, chiseled, polished, cracked polished, brick, + * chiseled brick, cracked brick + * + * @param registryName the base registry name + * @param properties the block properties + */ + private static void registerBlockPolishedChiseledAndBricks(final String registryName, + final Block.Properties properties) { + // raw, polished, chiseled, brick, and chiseled_brick + ItemReg.registerItemBlock(BLOCKS.register(registryName, () -> new Block(properties))); + ItemReg.registerItemBlock( + BLOCKS.register("chiseled_" + registryName, () -> new Block(properties))); + ItemReg.registerItemBlock( + BLOCKS.register("polished_" + registryName, () -> new Block(properties))); + ItemReg.registerItemBlock(BLOCKS.register("cracked_polished_" + registryName, + () -> new Block(properties))); + ItemReg.registerItemBlock( + BLOCKS.register(registryName + "_brick", () -> new Block(properties))); + ItemReg.registerItemBlock(BLOCKS.register("chiseled_" + registryName + "_brick", + () -> new Block(properties))); + ItemReg.registerItemBlock(BLOCKS.register("cracked_" + registryName + "_brick", + () -> new Block(properties))); + } - @Override - public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return logFlammability; - } + private static Boolean allowsSpawnOnLeaves(BlockState state, BlockGetter reader, BlockPos pos, + EntityType entity) { + return entity == EntityType.OCELOT || entity == EntityType.PARROT; // || entity == + // EntityReg.DRYAD_ENTITY || + // entity == + // EntityReg.LAMPAD_ENTITY; + } - @Override - public BlockState getToolModifiedState(BlockState state, UseOnContext context, ToolAction toolAction, boolean simulate) { - if (toolAction == ToolActions.AXE_STRIP) { - return strippedWood.get().defaultBlockState().setValue(RotatedPillarBlock.AXIS, state.getValue(RotatedPillarBlock.AXIS)); - } - return super.getToolModifiedState(state, context, toolAction, simulate); - } - } - ); - final RegistryObject planks = BLOCKS.register(registryName + "_planks", () -> - new Block(woodProperties) { - @Override - public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return fireSpread; - } + } - @Override - public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return planksFlammability; - } - } - ); - final RegistryObject slab = BLOCKS.register(registryName + "_slab", () -> - new SlabBlock(woodProperties) { - @Override - public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return fireSpread; - } + public static final class ItemReg { + + public static final DeferredRegister CREATIVE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, GreekFantasy.MODID); + + public static final RegistryObject GF_TAB = CREATIVE_TABS.register("greekfantasy_tab", () -> + CreativeModeTab.builder() + .icon(() -> new net.minecraft.world.item.ItemStack(ItemReg.GOLDEN_FLEECE.get())) + .title(net.minecraft.network.chat.Component.translatable("itemGroup.greekfantasy")) + .build()); + + private static final FoodProperties OLIVES_FOOD = new FoodProperties.Builder().nutrition(2) + .saturationMod(0.2F).build(); + private static final FoodProperties POMEGRANATE_FOOD = new FoodProperties.Builder().nutrition(4) + .saturationMod(0.3F) + .effect(() -> new MobEffectInstance(MobEffectReg.PRISONER_OF_HADES.get(), 6000), 1.0F) + .build(); + private static final FoodProperties AMBROSIA_FOOD = new FoodProperties.Builder().nutrition(4) + .saturationMod(1.2F).alwaysEat() + .effect(() -> new MobEffectInstance(MobEffects.REGENERATION, 400, 1), 1.0F) + .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 800, 0), 1.0F) + .effect(() -> new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0), 1.0F) + .effect(() -> new MobEffectInstance(MobEffects.ABSORPTION, 2400, 3), 1.0F).build(); + private static final FoodProperties OLIVE_SALVE_FOOD = new FoodProperties.Builder().alwaysEat().build(); + private static final FoodProperties PINECONE_FOOD = new FoodProperties.Builder().nutrition(1) + .saturationMod(0.0125F).build(); + + public static void register() { + ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); + CREATIVE_TABS.register(FMLJavaModLoadingContext.get().getModEventBus()); + FMLJavaModLoadingContext.get().getModEventBus() + .addListener(GFRegistry.ItemReg::registerComposterRecipes); + } - @Override - public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return planksFlammability; - } - } - ); - final RegistryObject stairs = BLOCKS.register(registryName + "_stairs", () -> - new StairBlock(() -> planks.get().defaultBlockState(), woodProperties) { - @Override - public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return fireSpread; - } + public static DeferredRegister getItemsRegister() { + return ITEMS; + } - @Override - public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return planksFlammability; - } - } - ); - final RegistryObject door = BLOCKS.register(registryName + "_door", () -> new DoorBlock(doorProperties)); - final RegistryObject trapdoor = BLOCKS.register(registryName + "_trapdoor", () -> new TrapDoorBlock(doorProperties)); - // block items - GFRegistry.ItemReg.registerItemBlock(log); - GFRegistry.ItemReg.registerItemBlock(strippedLog); - GFRegistry.ItemReg.registerItemBlock(wood); - GFRegistry.ItemReg.registerItemBlock(strippedWood); - GFRegistry.ItemReg.registerItemBlock(planks); - GFRegistry.ItemReg.registerItemBlock(slab); - GFRegistry.ItemReg.registerItemBlock(stairs); - GFRegistry.ItemReg.registerItemBlock(door); - GFRegistry.ItemReg.registerItemBlock(trapdoor); - } + private static void registerComposterRecipes(final FMLCommonSetupEvent event) { + event.enqueueWork(() -> { + ComposterBlock.COMPOSTABLES.put(GOLDEN_SAPLING.get().asItem(), 0.3F); + ComposterBlock.COMPOSTABLES.put(OLIVES.get().asItem(), 0.3F); + ComposterBlock.COMPOSTABLES.put(PINECONE.get().asItem(), 0.3F); + ComposterBlock.COMPOSTABLES.put(POMEGRANATE_SAPLING.get().asItem(), 0.3F); + ComposterBlock.COMPOSTABLES.put(POMEGRANATE.get().asItem(), 0.65F); + ComposterBlock.COMPOSTABLES.put(REEDS.get().asItem(), 0.5F); + ComposterBlock.COMPOSTABLES.put(WILD_ROSE.get().asItem(), 0.85F); + }); + } - /** - * Registers a leaves block. - * - * @param registryName the base registry name - * @param fireSpread the fire spread chance. The higher the number returned, the faster fire will spread around this block. - * @param flammability Chance that fire will spread and consume the block. 300 being a 100% chance, 0, being a 0% chance. - */ - private static void registerLeaves(final String registryName, final int fireSpread, final int flammability) { - final RegistryObject leaves = BLOCKS.register(registryName + "_leaves", () -> - new LeavesBlock(Block.Properties - .of(Material.LEAVES).strength(0.2F).randomTicks().sound(SoundType.GRASS) - .noOcclusion().isValidSpawn(GFRegistry.BlockReg::allowsSpawnOnLeaves).isSuffocating((s, r, p) -> false) - .isViewBlocking((s, r, p) -> false)) { - @Override - public int getFireSpreadSpeed(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return fireSpread; - } + //// LEGENDARY WEAPONS //// + public static final RegistryObject THUNDERBOLT = ITEMS.register("thunderbolt", + () -> new ThunderboltItem(new Item.Properties().rarity(Rarity.UNCOMMON) + .durability(170))); + public static final RegistryObject WAND_OF_CIRCE = ITEMS.register("wand_of_circe", + () -> new WandOfCirceItem( + new Item.Properties().rarity(Rarity.RARE).durability(54))); + public static final RegistryObject AVERNAL_BOW = ITEMS.register("avernal_bow", + () -> new EnchantedBowItem.AvernalBowItem(new Item.Properties() + .rarity(Rarity.UNCOMMON).durability(384))); + public static final RegistryObject APOLLO_BOW = ITEMS.register("apollo_bow", + () -> new EnchantedBowItem.ApolloBowItem( + new Item.Properties().rarity(Rarity.EPIC).durability(434))); + public static final RegistryObject ARTEMIS_BOW = ITEMS.register("artemis_bow", + () -> new EnchantedBowItem.ArtemisBowItem( + new Item.Properties().rarity(Rarity.EPIC).durability(434))); + + //// WEAPONS //// + public static final RegistryObject WOODEN_CLUB = ITEMS.register("wooden_club", + () -> new ClubItem(Tiers.WOOD, new Item.Properties().stacksTo(1))); + public static final RegistryObject STONE_CLUB = ITEMS.register("stone_club", + () -> new ClubItem(Tiers.STONE, new Item.Properties().stacksTo(1))); + public static final RegistryObject IRON_CLUB = ITEMS.register("iron_club", + () -> new ClubItem(Tiers.IRON, new Item.Properties().stacksTo(1))); + public static final RegistryObject BIDENT = ITEMS.register("bident", () -> new BidentItem( + Tiers.DIAMOND, + new Item.Properties().rarity(Rarity.UNCOMMON).setNoRepair())); + public static final RegistryObject WOODEN_SPEAR = ITEMS.register("wooden_spear", + () -> new SpearItem(Tiers.WOOD, new Item.Properties())); + public static final RegistryObject FLINT_SPEAR = ITEMS.register("flint_spear", + () -> new SpearItem(GFTiers.FLINT, new Item.Properties())); + public static final RegistryObject STONE_SPEAR = ITEMS.register("stone_spear", + () -> new SpearItem(Tiers.STONE, new Item.Properties())); + public static final RegistryObject IRON_SPEAR = ITEMS.register("iron_spear", + () -> new SpearItem(Tiers.IRON, new Item.Properties())); + public static final RegistryObject GOLDEN_SPEAR = ITEMS.register("golden_spear", + () -> new SpearItem(Tiers.GOLD, new Item.Properties())); + public static final RegistryObject DIAMOND_SPEAR = ITEMS.register("diamond_spear", + () -> new SpearItem(Tiers.DIAMOND, new Item.Properties())); + public static final RegistryObject NETHERITE_SPEAR = ITEMS.register("netherite_spear", + () -> new SpearItem(Tiers.NETHERITE, new Item.Properties())); + public static final RegistryObject FLINT_KNIFE = ITEMS.register("flint_knife", + () -> new KnifeItem(GFTiers.FLINT, 3, -1.7F, -1.0F, + new Item.Properties().stacksTo(1))); + public static final RegistryObject IVORY_SWORD = ITEMS.register("ivory_sword", + () -> new IvorySwordItem(GFTiers.IVORY, 3, -2.2F, + new Item.Properties().stacksTo(1))); + public static final RegistryObject THROWING_AXE = ITEMS.register("throwing_axe", + () -> new ThrowingAxeItem(Tiers.IRON, 6.0F, -3.1F, + new Item.Properties().rarity(Rarity.RARE))); + public static final RegistryObject DRAGON_TOOTH_ROD = ITEMS.register("dragon_tooth_rod", + () -> new DragonToothRodItem( + new Item.Properties().rarity(Rarity.EPIC).durability(128))); + public static final RegistryObject DISCUS = ITEMS.register("discus", + () -> new DiscusItem(new Item.Properties().stacksTo(16))); + public static final RegistryObject GREEK_FIRE = ITEMS.register("greek_fire", + () -> new GreekFireItem(new Item.Properties().stacksTo(16))); + public static final RegistryObject WEB_BALL = ITEMS.register("web_ball", + () -> new WebBallItem(new Item.Properties().stacksTo(16))); + + //// LEGENDARY TOOLS AND ITEMS //// + public static final RegistryObject BRONZE_FEATHER = ITEMS.register("bronze_feather", + () -> new BronzeFeatherItem(new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final RegistryObject DRAGON_TOOTH = ITEMS.register("dragon_tooth", + () -> new DragonToothItem(new Item.Properties().rarity(Rarity.RARE))); + public static final RegistryObject MIRROR = ITEMS.register("mirror", + () -> new Item(new Item.Properties().stacksTo(1))); + public static final RegistryObject CONCH = ITEMS.register("conch", () -> new ConchItem( + new Item.Properties().rarity(Rarity.RARE).stacksTo(1).durability(64))); + public static final RegistryObject UNICORN_HORN = ITEMS.register("unicorn_horn", + () -> new UnicornHornItem(new Item.Properties().rarity(Rarity.UNCOMMON) + .durability(44))); + public static final RegistryObject HEART_OF_TALOS = ITEMS.register("heart_of_talos", + () -> new Item(new Item.Properties().rarity(Rarity.RARE).stacksTo(16))); + public static final RegistryObject BAG_OF_WIND = ITEMS.register("bag_of_wind", + () -> new BagOfWindItem( + new Item.Properties().rarity(Rarity.RARE).durability(24))); + public static final RegistryObject STAFF_OF_HEALING = ITEMS.register("staff_of_healing", + () -> new StaffOfHealingItem( + new Item.Properties().rarity(Rarity.RARE).durability(384))); + public static final RegistryObject THYRSUS = ITEMS.register("thyrsus", + () -> new ThyrsusItem(GFTiers.THYRSUS, 2.5F, -2.2F, new Item.Properties())); + public static final RegistryObject AMBROSIA = ITEMS.register("ambrosia", + () -> new HasCraftRemainderItem(ItemReg.HORN, new Item.Properties() + .food(AMBROSIA_FOOD).rarity(Rarity.EPIC))); + public static final RegistryObject HORN_OF_PLENTY = ITEMS.register("horn_of_plenty", + () -> new HornOfPlentyItem(ItemReg.HORN, new Item.Properties() + .durability(24).rarity(Rarity.UNCOMMON))); + public static final RegistryObject GOLDEN_FLEECE = ITEMS.register("golden_fleece", + () -> new Item(new Item.Properties().rarity(Rarity.RARE))); + public static final RegistryObject GOLDEN_BALL = ITEMS.register("golden_ball", + () -> new GoldenBallItem(new Item.Properties().rarity(Rarity.UNCOMMON) + .durability(680))); + public static final RegistryObject ICHOR = ITEMS.register("ichor", + () -> new Item(new Item.Properties().rarity(Rarity.RARE)) { + @Override + public boolean isFoil(ItemStack stack) { + return true; + } + }); + public static final RegistryObject SPIDER_BANNER_PATTERN = ITEMS.register("spider_banner_pattern", + () -> new BannerPatternItem( + TagKey.create(Registries.BANNER_PATTERN, + new ResourceLocation(GreekFantasy.MODID, + "pattern_item/spider")), + new Item.Properties().stacksTo(1).rarity(Rarity.RARE))); + + //// LEGENDARY ARMOR //// + public static final RegistryObject HELM_OF_DARKNESS = ITEMS.register("helm_of_darkness", + () -> new HelmOfDarknessItem(GFArmorMaterials.AVERNAL, + new Item.Properties().rarity(Rarity.EPIC))); + public static final RegistryObject WINGED_SANDALS = ITEMS.register("winged_sandals", + () -> new WingedSandalsItem(GFArmorMaterials.WINGED, + new Item.Properties().rarity(Rarity.EPIC))); + public static final RegistryObject NEMEAN_LION_HIDE = ITEMS.register("nemean_lion_hide", + () -> new NemeanLionHideItem(GFArmorMaterials.NEMEAN, EquipmentSlot.HEAD, + new Item.Properties().rarity(Rarity.RARE).setNoRepair())); + + //// ARMOR //// + public static final RegistryObject HELLENIC_HELMET = ITEMS.register("hellenic_helmet", + () -> new HellenicArmorItem(GFArmorMaterials.HELLENIC, EquipmentSlot.HEAD, + new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final RegistryObject HELLENIC_CHESTPLATE = ITEMS.register("hellenic_chestplate", + () -> new HellenicArmorItem(GFArmorMaterials.HELLENIC, EquipmentSlot.CHEST, + new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final RegistryObject HELLENIC_LEGGINGS = ITEMS.register("hellenic_leggings", + () -> new HellenicArmorItem(GFArmorMaterials.HELLENIC, EquipmentSlot.LEGS, + new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final RegistryObject HELLENIC_BOOTS = ITEMS.register("hellenic_boots", + () -> new HellenicArmorItem(GFArmorMaterials.HELLENIC, EquipmentSlot.FEET, + new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final RegistryObject SNAKESKIN_HELMET = ITEMS.register("snakeskin_helmet", + () -> new SnakeskinArmorItem(GFArmorMaterials.SNAKESKIN, EquipmentSlot.HEAD, + new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final RegistryObject SNAKESKIN_CHESTPLATE = ITEMS.register("snakeskin_chestplate", + () -> new SnakeskinArmorItem(GFArmorMaterials.SNAKESKIN, EquipmentSlot.CHEST, + new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final RegistryObject SNAKESKIN_LEGGINGS = ITEMS.register("snakeskin_leggings", + () -> new SnakeskinArmorItem(GFArmorMaterials.SNAKESKIN, EquipmentSlot.LEGS, + new Item.Properties().rarity(Rarity.UNCOMMON))); + public static final RegistryObject SNAKESKIN_BOOTS = ITEMS.register("snakeskin_boots", + () -> new SnakeskinArmorItem(GFArmorMaterials.SNAKESKIN, EquipmentSlot.FEET, + new Item.Properties().rarity(Rarity.UNCOMMON))); + + //// MISC ITEMS //// + public static final RegistryObject QUEST = ITEMS.register("quest", + () -> new QuestItem(new Item.Properties())); + public static final RegistryObject PANFLUTE = ITEMS.register("panflute", + () -> new InstrumentItem(new Item.Properties().stacksTo(1), + () -> SoundEvents.NOTE_BLOCK_FLUTE.value())); + public static final RegistryObject WOODEN_LYRE = ITEMS.register("wooden_lyre", + () -> new InstrumentItem(new Item.Properties().stacksTo(1), + () -> SoundEvents.NOTE_BLOCK_HARP.value())); + public static final RegistryObject GOLDEN_LYRE = ITEMS.register("golden_lyre", + () -> new InstrumentItem( + new Item.Properties().rarity(Rarity.UNCOMMON).stacksTo(1), + () -> SoundEvents.NOTE_BLOCK_GUITAR.value())); + public static final RegistryObject OLIVES = ITEMS.register("olives", + () -> new Item(new Item.Properties().food(OLIVES_FOOD))); + public static final RegistryObject OLIVE_OIL = ITEMS.register("olive_oil", () -> new OliveOilItem( + BlockReg.OLIVE_OIL.get(), + new Item.Properties().stacksTo(16).craftRemainder(Items.GLASS_BOTTLE))); + public static final RegistryObject OLIVE_SALVE = ITEMS.register("olive_salve", + () -> new OliveSalveItem( + new Item.Properties().stacksTo(1).food(OLIVE_SALVE_FOOD))); + public static final RegistryObject POMEGRANATE = ITEMS.register("pomegranate", + () -> new Item(new Item.Properties().food(POMEGRANATE_FOOD))); + + //// CRAFTING MATERIALS //// + public static final RegistryObject AVERNAL_FEATHER = ITEMS.register("avernal_feather", + () -> new Item(new Item.Properties())); + public static final RegistryObject AVERNAL_HAIR = ITEMS.register("avernal_hair", + () -> new Item(new Item.Properties())); + public static final RegistryObject AVERNAL_WING = ITEMS.register("avernal_wing", + () -> new Item(new Item.Properties())); + public static final RegistryObject AVERNAL_HIDE = ITEMS.register("avernal_hide", + () -> new Item(new Item.Properties())); + public static final RegistryObject AVERNAL_CLAW = ITEMS.register("avernal_claw", + () -> new Item(new Item.Properties())); + public static final RegistryObject AVERNAL_SHARD = ITEMS.register("avernal_shard", + () -> new Item(new Item.Properties())); + public static final RegistryObject ICHOR_INFUSED_GEAR = ITEMS.register("ichor_infused_gear", + () -> new Item(new Item.Properties())); + public static final RegistryObject GOLDEN_STRING = ITEMS.register("golden_string", + () -> new Item(new Item.Properties())); + public static final RegistryObject GORGON_BLOOD = ITEMS.register("gorgon_blood", + () -> new GorgonBloodItem(new Item.Properties().stacksTo(16) + .craftRemainder(Items.GLASS_BOTTLE))); + public static final RegistryObject BOAR_EAR = ITEMS.register("boar_ear", + () -> new Item(new Item.Properties())); + public static final RegistryObject BOAR_TUSK = ITEMS.register("boar_tusk", + () -> new Item(new Item.Properties())); + public static final RegistryObject DEADLY_FANG = ITEMS.register("deadly_fang", + () -> new Item(new Item.Properties())); + public static final RegistryObject GOLDEN_BRIDLE = ITEMS.register("golden_bridle", + () -> new Item(new Item.Properties())); + public static final RegistryObject HORN = ITEMS.register("horn", + () -> new Item(new Item.Properties())); + public static final RegistryObject PINECONE = ITEMS.register("pinecone", + () -> new Item(new Item.Properties().food(PINECONE_FOOD))); + public static final RegistryObject REEDS = ITEMS.register("reeds", + () -> new BlockItem(BlockReg.REEDS.get(), new Item.Properties())); + public static final RegistryObject SCYLLA_BONE = ITEMS.register("scylla_bone", + () -> new Item(new Item.Properties())); + public static final RegistryObject SNAKESKIN = ITEMS.register("snakeskin", + () -> new Item(new Item.Properties())); + public static final RegistryObject TOUGH_SNAKESKIN = ITEMS.register("tough_snakeskin", + () -> new Item(new Item.Properties().rarity(Rarity.UNCOMMON))); + //// BRONZE SCRAP //// + public static final RegistryObject BRONZE_INGOT = ITEMS.register("bronze_ingot", + () -> new Item(new Item.Properties())); + public static final RegistryObject BRONZE_NUGGET = ITEMS.register("bronze_nugget", + () -> new Item(new Item.Properties())); + public static final RegistryObject BRONZE_BOWL = ITEMS.register("bronze_bowl", + () -> new BronzeScrapItem(new Item.Properties())); + public static final RegistryObject BRONZE_COINS = ITEMS.register("bronze_coins", + () -> new BronzeScrapItem(new Item.Properties())); + public static final RegistryObject BRONZE_CUIRASS = ITEMS.register("bronze_cuirass", + () -> new BronzeScrapItem(new Item.Properties())); + public static final RegistryObject BRONZE_FIGURINE = ITEMS.register("bronze_figurine", + () -> new BronzeScrapItem(new Item.Properties())); + public static final RegistryObject BRONZE_GOBLET = ITEMS.register("bronze_goblet", + () -> new BronzeScrapItem(new Item.Properties())); + public static final RegistryObject BRONZE_HELMET = ITEMS.register("bronze_helmet", + () -> new BronzeScrapItem(new Item.Properties())); + public static final RegistryObject BRONZE_SHIELD = ITEMS.register("bronze_shield", + () -> new BronzeScrapItem(new Item.Properties())); + public static final RegistryObject BRONZE_VASE = ITEMS.register("bronze_vase", + () -> new BronzeScrapItem(new Item.Properties())); + + //// SPAWN EGGS //// + public static final RegistryObject ARA_SPAWN_EGG = ITEMS.register("ara_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.ARA, 0xffffff, 0xbbbbbb, + new Item.Properties())); + public static final RegistryObject ARACHNE_SPAWN_EGG = ITEMS.register("arachne_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.ARACHNE, 0x9c7b50, 0xa80e0e, + new Item.Properties())); + public static final RegistryObject ARION_SPAWN_EGG = ITEMS.register("arion_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.ARION, 0xdfc014, 0xb58614, + new Item.Properties())); + public static final RegistryObject CENTAUR_SPAWN_EGG = ITEMS.register("centaur_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.CENTAUR, 0x734933, 0x83251f, + new Item.Properties())); + public static final RegistryObject CERASTES_SPAWN_EGG = ITEMS.register("cerastes_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.CERASTES, 0x847758, 0x997c4d, + new Item.Properties())); + public static final RegistryObject CIRCE_SPAWN_EGG = ITEMS.register("circe_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.CIRCE, 0x844797, 0xe8c669, + new Item.Properties())); + public static final RegistryObject CRETAN_MINOTAUR_SPAWN_EGG = ITEMS.register( + "cretan_minotaur_spawn_egg", () -> new ForgeSpawnEggItem(EntityReg.CRETAN_MINOTAUR, + 0x2a2a2a, 0x734933, new Item.Properties())); + public static final RegistryObject CYCLOPS_SPAWN_EGG = ITEMS.register("cyclops_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.CYCLOPS, 0xda662c, 0x2c1e0e, + new Item.Properties())); + public static final RegistryObject CYPRIAN_SPAWN_EGG = ITEMS.register("cyprian_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.CYPRIAN, 0x443626, 0x83251f, + new Item.Properties())); + public static final RegistryObject DRAKAINA_SPAWN_EGG = ITEMS.register("drakaina_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.DRAKAINA, 0x724e36, 0x398046, + new Item.Properties())); + public static final RegistryObject DRYAD_SPAWN_EGG = ITEMS.register("dryad_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.DRYAD, 0x443626, 0xfed93f, + new Item.Properties())); + public static final RegistryObject ELPIS_SPAWN_EGG = ITEMS.register("elpis_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.ELPIS, 0xe7aae4, 0xeeeeee, + new Item.Properties())); + public static final RegistryObject EMPUSA_SPAWN_EGG = ITEMS.register("empusa_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.EMPUSA, 0x222222, 0x83251f, + new Item.Properties())); + public static final RegistryObject FURY_SPAWN_EGG = ITEMS.register("fury_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.FURY, 0xbd4444, 0x6c2426, + new Item.Properties())); + public static final RegistryObject GIANT_BOAR_SPAWN_EGG = ITEMS.register("giant_boar_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.GIANT_BOAR, 0x5b433a, 0xe8a074, + new Item.Properties())); + public static final RegistryObject GIGANTE_SPAWN_EGG = ITEMS.register("gigante_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.GIGANTE, 0xd3dba7, 0x6a602b, + new Item.Properties())); + public static final RegistryObject GOLDEN_RAM_SPAWN_EGG = ITEMS.register("golden_ram_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.GOLDEN_RAM, 0xdfc014, 0xd08d26, + new Item.Properties())); + public static final RegistryObject GORGON_SPAWN_EGG = ITEMS.register("gorgon_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.GORGON, 0x3a8228, 0xbcbcbc, + new Item.Properties())); + public static final RegistryObject HARPY_SPAWN_EGG = ITEMS.register("harpy_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.HARPY, 0x724e36, 0x332411, + new Item.Properties())); + public static final RegistryObject HYDRA_SPAWN_EGG = ITEMS.register("hydra_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.HYDRA, 0x372828, 0x9d4217, + new Item.Properties())); + public static final RegistryObject LAMPAD_SPAWN_EGG = ITEMS.register("lampad_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.LAMPAD, 0x643026, 0xfed93f, + new Item.Properties())); + public static final RegistryObject MAD_COW_SPAWN_EGG = ITEMS.register("mad_cow_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.MAD_COW, 0x443626, 0xcf9797, + new Item.Properties())); + public static final RegistryObject MAKHAI_SPAWN_EGG = ITEMS.register("makhai_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.MAKHAI, 0x513f38, 0xf33531, + new Item.Properties())); + public static final RegistryObject MINOTAUR_SPAWN_EGG = ITEMS.register("minotaur_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.MINOTAUR, 0x443626, 0x734933, + new Item.Properties())); + public static final RegistryObject NAIAD_SPAWN_EGG = ITEMS.register("naiad_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.NAIAD, 0x7caba1, 0xe67830, + new Item.Properties())); + public static final RegistryObject NEMEAN_LION_SPAWN_EGG = ITEMS.register("nemean_lion_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.NEMEAN_LION, 0xd08d26, 0x7d3107, + new Item.Properties())); + public static final RegistryObject ORTHUS_SPAWN_EGG = ITEMS.register("orthus_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.ORTHUS, 0x493569, 0xe42e2e, + new Item.Properties())); + public static final RegistryObject PEGASUS_SPAWN_EGG = ITEMS.register("pegasus_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.PEGASUS, 0x916535, 0xe8e8e8, + new Item.Properties())); + public static final RegistryObject PYTHON_SPAWN_EGG = ITEMS.register("python_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.PYTHON, 0x3a8228, 0x1e4c11, + new Item.Properties())); + public static final RegistryObject SATYR_SPAWN_EGG = ITEMS.register("satyr_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.SATYR, 0x54371d, 0xa16648, + new Item.Properties())); + public static final RegistryObject SHADE_SPAWN_EGG = ITEMS.register("shade_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.SHADE, 0x222222, 0x000000, + new Item.Properties())); + public static final RegistryObject SIREN_SPAWN_EGG = ITEMS.register("siren_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.SIREN, 0x729f92, 0x398046, + new Item.Properties())); + public static final RegistryObject STYMPHALIAN_SPAWN_EGG = ITEMS.register("stymphalian_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.STYMPHALIAN, 0x684822, 0xc08845, + new Item.Properties())); + public static final RegistryObject TRITON_SPAWN_EGG = ITEMS.register("triton_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.TRITON, 0x527f72, 0x398046, + new Item.Properties())); + public static final RegistryObject UNICORN_SPAWN_EGG = ITEMS.register("unicorn_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.UNICORN, 0xeeeeee, 0xe8e8e8, + new Item.Properties())); + public static final RegistryObject WHIRL_SPAWN_EGG = ITEMS.register("whirl_spawn_egg", + () -> new ForgeSpawnEggItem(EntityReg.WHIRL, 0x1EF6FF, 0xededed, + new Item.Properties())); + + // TODO spawn eggs for other bosses? bull, geryon, talos, cerberus, charybdis + + //// LEGENDARY ITEM BLOCKS //// + public static final RegistryObject PALLADIUM = ITEMS.register("palladium", + () -> new PalladiumItem( + new Item.Properties().rarity(Rarity.RARE).stacksTo(1))); + + //// ITEM BLOCKS //// + public static final RegistryObject BRONZE_BLOCK = registerItemBlock(BlockReg.BRONZE_BLOCK); + public static final RegistryObject ICHOR_INFUSED_GEARBOX = registerItemBlock( + BlockReg.ICHOR_INFUSED_GEARBOX, p -> p.rarity(Rarity.RARE)); + public static final RegistryObject MYSTERIOUS_BOX = registerItemBlock( + BlockReg.MYSTERIOUS_BOX, p -> p.rarity(Rarity.UNCOMMON)); + public static final RegistryObject GIGANTE_HEAD = ITEMS.register("gigante_head", + () -> new GiganteHeadItem(BlockReg.GIGANTE_HEAD.get(), + new Item.Properties())); + public static final RegistryObject ORTHUS_HEAD = ITEMS.register("orthus_head", + () -> new OrthusHeadItem(BlockReg.ORTHUS_HEAD.get(), + new Item.Properties())); + public static final RegistryObject CERBERUS_HEAD = ITEMS.register("cerberus_head", + () -> new CerberusHeadItem(BlockReg.CERBERUS_HEAD.get(), + new Item.Properties())); + public static final RegistryObject OIL_LAMP = registerItemBlock(BlockReg.OIL_LAMP); + public static final RegistryObject OLIVE_SAPLING = registerItemBlock(BlockReg.OLIVE_SAPLING); + public static final RegistryObject POMEGRANATE_SAPLING = registerItemBlock( + BlockReg.POMEGRANATE_SAPLING); + public static final RegistryObject GOLDEN_SAPLING = registerItemBlock( + BlockReg.GOLDEN_SAPLING, p -> p.rarity(Rarity.UNCOMMON)); + public static final RegistryObject WILD_ROSE = registerItemBlock(BlockReg.WILD_ROSE, + p -> p.rarity(Rarity.UNCOMMON)); + public static final RegistryObject NEST = registerItemBlock(BlockReg.NEST); + + /** + * Registers an item for the given block + * + * @param blockSupplier the block supplier + * @return the BlockItem registry object + */ + private static RegistryObject registerItemBlock( + final RegistryObject blockSupplier) { + return ITEMS.register(blockSupplier.getId().getPath(), itemBlock(blockSupplier, p -> { + })); + } - @Override - public int getFlammability(BlockState state, BlockGetter world, BlockPos pos, Direction face) { - return flammability; - } - } - ); - // block items - GFRegistry.ItemReg.registerItemBlock(leaves); - } + /** + * Registers an item for the given block + * + * @param blockSupplier the block supplier + * @param consumer the item properties consumer + * @return the BlockItem registry object + */ + private static RegistryObject registerItemBlock( + final RegistryObject blockSupplier, + Consumer consumer) { + return ITEMS.register(blockSupplier.getId().getPath(), itemBlock(blockSupplier, consumer)); + } - /** - * Registers the following: block, slab, stairs, pillar, polished block, polished slab, polished stairs - * - * @param registryName the base registry name. - * @param properties the block properties - */ - private static void registerBlockPolishedEtc(final String registryName, final Block.Properties properties) { - // raw, slab, and stairs - final RegistryObject raw = BLOCKS.register(registryName, () -> new Block(properties)); - final RegistryObject slab = BLOCKS.register(registryName + "_slab", () -> new SlabBlock(properties)); - final RegistryObject stairs = BLOCKS.register(registryName + "_stairs", () -> new StairBlock(() -> raw.get().defaultBlockState(), properties)); - // polished, slab, and stairs - final RegistryObject polished = BLOCKS.register("polished_" + registryName, () -> new Block(properties)); - final RegistryObject polishedSlab = BLOCKS.register("polished_" + registryName + "_slab", () -> new SlabBlock(properties)); - final RegistryObject polishedStairs = BLOCKS.register("polished_" + registryName + "_stairs", () -> new StairBlock(() -> polished.get().defaultBlockState(), properties)); - // pillar - final RegistryObject pillar = BLOCKS.register(registryName + "_pillar", () -> new PillarBlock(properties)); - // block items - GFRegistry.ItemReg.registerItemBlock(raw); - GFRegistry.ItemReg.registerItemBlock(slab); - GFRegistry.ItemReg.registerItemBlock(stairs); - GFRegistry.ItemReg.registerItemBlock(polished); - GFRegistry.ItemReg.registerItemBlock(polishedSlab); - GFRegistry.ItemReg.registerItemBlock(polishedStairs); - GFRegistry.ItemReg.registerItemBlock(pillar); + /** + * Creates a block item supplier for the given block + * + * @param blockSupplier the block supplier + * @return a supplier for the block item + */ + private static Supplier itemBlock(final RegistryObject blockSupplier, + Consumer consumer) { + Item.Properties props = new Item.Properties(); + consumer.accept(props); + return () -> new BlockItem(blockSupplier.get(), props); + } } - /** - * Registers the following: block, chiseled, polished, cracked polished, brick, chiseled brick, cracked brick - * - * @param registryName the base registry name - * @param properties the block properties - */ - private static void registerBlockPolishedChiseledAndBricks(final String registryName, final Block.Properties properties) { - // raw, polished, chiseled, brick, and chiseled_brick - ItemReg.registerItemBlock(BLOCKS.register(registryName, () -> new Block(properties))); - ItemReg.registerItemBlock(BLOCKS.register("chiseled_" + registryName, () -> new Block(properties))); - ItemReg.registerItemBlock(BLOCKS.register("polished_" + registryName, () -> new Block(properties))); - ItemReg.registerItemBlock(BLOCKS.register("cracked_polished_" + registryName, () -> new Block(properties))); - ItemReg.registerItemBlock(BLOCKS.register(registryName + "_brick", () -> new Block(properties))); - ItemReg.registerItemBlock(BLOCKS.register("chiseled_" + registryName + "_brick", () -> new Block(properties))); - ItemReg.registerItemBlock(BLOCKS.register("cracked_" + registryName + "_brick", () -> new Block(properties))); - } + public static final class BannerPatternReg { + public static void register() { + BANNER_PATTERNS.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - private static Boolean allowsSpawnOnLeaves(BlockState state, BlockGetter reader, BlockPos pos, EntityType entity) { - return entity == EntityType.OCELOT || entity == EntityType.PARROT; // || entity == EntityReg.DRYAD_ENTITY || entity == EntityReg.LAMPAD_ENTITY; + public static final RegistryObject SPIDER = BANNER_PATTERNS.register("spider", + () -> new BannerPattern("gf:spi")); } - } - - public static final class ItemReg { + public static final class EntityReg { - public static final CreativeModeTab GF_TAB = new CreativeModeTab(GreekFantasy.MODID) { - @Override - public ItemStack makeIcon() { - return new ItemStack(PANFLUTE.get()); - } - }; + public static void register() { + ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + // event listeners + FMLJavaModLoadingContext.get().getModEventBus() + .addListener(GFRegistry.EntityReg::registerEntityAttributes); + } - private static final FoodProperties OLIVES_FOOD = new FoodProperties.Builder().nutrition(2).saturationMod(0.2F).build(); - private static final FoodProperties POMEGRANATE_FOOD = new FoodProperties.Builder().nutrition(4).saturationMod(0.3F) - .effect(() -> new MobEffectInstance(MobEffectReg.PRISONER_OF_HADES.get(), 6000), 1.0F).build(); - private static final FoodProperties AMBROSIA_FOOD = new FoodProperties.Builder().nutrition(4).saturationMod(1.2F).alwaysEat() - .effect(() -> new MobEffectInstance(MobEffects.REGENERATION, 400, 1), 1.0F) - .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 800, 0), 1.0F) - .effect(() -> new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 800, 0), 1.0F) - .effect(() -> new MobEffectInstance(MobEffects.ABSORPTION, 2400, 3), 1.0F).build(); - private static final FoodProperties OLIVE_SALVE_FOOD = new FoodProperties.Builder().alwaysEat().build(); - private static final FoodProperties PINECONE_FOOD = new FoodProperties.Builder().nutrition(1).saturationMod(0.0125F).build(); + private static void registerEntityAttributes(EntityAttributeCreationEvent event) { + register(event, AUTOMATON.get(), Automaton::createAttributes, Mob::checkMobSpawnRules); + register(event, ARA.get(), Ara::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); + register(event, ARACHNE.get(), Arachne::createAttributes, Monster::checkMonsterSpawnRules); + register(event, ARION.get(), Arion::createAttributes, Mob::checkMobSpawnRules); + register(event, BABY_SPIDER.get(), BabySpider::createAttributes, + Monster::checkMonsterSpawnRules); + register(event, BRONZE_BULL.get(), BronzeBull::createAttributes, + Monster::checkMonsterSpawnRules); + register(event, CENTAUR.get(), Centaur::createAttributes, Mob::checkMobSpawnRules); + register(event, CERASTES.get(), Cerastes::createAttributes, Cerastes::checkCerastesSpawnRules); + register(event, CERBERUS.get(), Cerberus::createAttributes, + SpawnRulesUtil::checkMonsterSpawnRules); + register(event, CHARYBDIS.get(), Charybdis::createAttributes, + SpawnRulesUtil::checkWaterMonsterSpawnRules); + register(event, CIRCE.get(), Circe::createAttributes, Monster::checkMonsterSpawnRules); + register(event, CRETAN_MINOTAUR.get(), CretanMinotaur::createAttributes, + Monster::checkMonsterSpawnRules); + register(event, CYCLOPS.get(), Cyclops::createAttributes, Monster::checkMonsterSpawnRules); + register(event, CYPRIAN.get(), Cyprian::createAttributes, + SpawnRulesUtil::checkMonsterSpawnRules); + register(event, DRAKAINA.get(), Drakaina::createAttributes, Monster::checkMonsterSpawnRules); + register(event, DRYAD.get(), Dryad::createAttributes, Mob::checkMobSpawnRules); + register(event, ELPIS.get(), Elpis::createAttributes, Mob::checkMobSpawnRules); + register(event, EMPUSA.get(), Empusa::createAttributes, Empusa::checkEmpusaSpawnRules); + register(event, FURY.get(), Fury::createAttributes, Monster::checkAnyLightMonsterSpawnRules); + register(event, GERYON.get(), Geryon::createAttributes, Monster::checkMonsterSpawnRules); + register(event, GIANT_BOAR.get(), GiantBoar::createAttributes, + SpawnRulesUtil::checkMonsterSpawnRules); + register(event, GIGANTE.get(), Gigante::createAttributes, Mob::checkMobSpawnRules); + register(event, GOLDEN_RAM.get(), GoldenRam::createAttributes, Mob::checkMobSpawnRules); + register(event, GORGON.get(), Gorgon::createAttributes, Monster::checkMonsterSpawnRules); + register(event, HARPY.get(), Harpy::createAttributes, Monster::checkAnyLightMonsterSpawnRules); + register(event, HYDRA.get(), Hydra::createAttributes, Monster::checkMonsterSpawnRules); + register(event, HYDRA_HEAD.get(), HydraHead::createAttributes, null); + register(event, LAMPAD.get(), Lampad::createAttributes, Mob::checkMobSpawnRules); + register(event, MAD_COW.get(), MadCow::createAttributes, + SpawnRulesUtil::checkMonsterSpawnRules); + register(event, MAKHAI.get(), Makhai::createAttributes, + SpawnRulesUtil::checkAnyLightMonsterSpawnRules); + register(event, MINOTAUR.get(), Minotaur::createAttributes, Monster::checkMonsterSpawnRules); + register(event, NAIAD.get(), Naiad::createAttributes, SpawnRulesUtil::checkWaterMobSpawnRules); + register(event, NEMEAN_LION.get(), NemeanLion::createAttributes, + Monster::checkMonsterSpawnRules); + register(event, ORTHUS.get(), Orthus::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); + event.put(PALLADIUM.get(), Palladium.createAttributes().build()); + register(event, PEGASUS.get(), Pegasus::createAttributes, Mob::checkMobSpawnRules); + register(event, PYTHON.get(), Python::createAttributes, Monster::checkMonsterSpawnRules); + register(event, SATYR.get(), Satyr::createAttributes, Mob::checkMobSpawnRules); + register(event, SCYLLA.get(), Scylla::createAttributes, + SpawnRulesUtil::checkWaterMonsterSpawnRules); + register(event, SHADE.get(), Shade::createAttributes, Monster::checkMonsterSpawnRules); + register(event, SIREN.get(), Siren::createAttributes, Siren::checkSirenSpawnRules); + register(event, SPARTI.get(), Sparti::createAttributes, Mob::checkMobSpawnRules); + register(event, STYMPHALIAN.get(), Stymphalian::createAttributes, + Monster::checkMonsterSpawnRules); + register(event, TALOS.get(), Talos::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); + register(event, TRITON.get(), Triton::createAttributes, + SpawnRulesUtil::checkWaterMobSpawnRules); + register(event, UNICORN.get(), Unicorn::createAttributes, Mob::checkMobSpawnRules); + register(event, WHIRL.get(), Whirl::createAttributes, SpawnRulesUtil::checkWaterMobSpawnRules); + } - public static void register() { - ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); - FMLJavaModLoadingContext.get().getModEventBus().addListener(GFRegistry.ItemReg::registerComposterRecipes); - } + /** + * Helper method to register mob entity attributes and placement predicates at + * the same time. + * + * @param event the entity attribute creation event + * @param entityType the entity type + * @param attributeSupplier a supplier to the attribute builder + * @param placementPredicate the placement predicate, can be null + * @param a mob entity + */ + private static void register(final EntityAttributeCreationEvent event, + final EntityType entityType, + Supplier attributeSupplier, + @Nullable final SpawnPlacements.SpawnPredicate placementPredicate) { + // register attributes + event.put(entityType, attributeSupplier.get().build()); + // register placement + if (placementPredicate != null) { + final SpawnPlacements.Type placementType = entityType + .getCategory() == MobCategory.WATER_CREATURE + ? SpawnPlacements.Type.IN_WATER + : SpawnPlacements.Type.ON_GROUND; + // wrap the spawn predicate in one that also checks dimension predicate + final SpawnPlacements.SpawnPredicate placement = (entity, level, reason, pos, + rand) -> GreekFantasy.CONFIG.spawnMatchesDimension(level.getLevel()) + && placementPredicate.test(entity, level, reason, pos, + rand); + // actually register the placement + SpawnPlacements.register(entityType, placementType, + Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, placement); + } + } - private static void registerComposterRecipes(final FMLCommonSetupEvent event) { - event.enqueueWork(() -> { - ComposterBlock.COMPOSTABLES.put(GOLDEN_SAPLING.get().asItem(), 0.3F); - ComposterBlock.COMPOSTABLES.put(OLIVES.get().asItem(), 0.3F); - ComposterBlock.COMPOSTABLES.put(PINECONE.get().asItem(), 0.3F); - ComposterBlock.COMPOSTABLES.put(POMEGRANATE_SAPLING.get().asItem(), 0.3F); - ComposterBlock.COMPOSTABLES.put(POMEGRANATE.get().asItem(), 0.65F); - ComposterBlock.COMPOSTABLES.put(REEDS.get().asItem(), 0.5F); - ComposterBlock.COMPOSTABLES.put(WILD_ROSE.get().asItem(), 0.85F); - }); + // creature + public static final RegistryObject> AUTOMATON = ENTITY_TYPES + .register("automaton", () -> EntityType.Builder.of(Automaton::new, MobCategory.MISC) + .sized(0.94F, 2.48F) + .build("automaton")); + public static final RegistryObject> ARA = ENTITY_TYPES.register("ara", + () -> EntityType.Builder.of(Ara::new, MobCategory.MONSTER) + .sized(0.67F, 1.8F) + .build("ara")); + public static final RegistryObject> ARACHNE = ENTITY_TYPES + .register("arachne", () -> EntityType.Builder.of(Arachne::new, MobCategory.MONSTER) + .sized(0.94F, 1.9F) + .build("arachne")); + public static final RegistryObject> ARION = ENTITY_TYPES.register("arion", + () -> EntityType.Builder.of(Arion::new, MobCategory.CREATURE) + .sized(1.39F, 1.98F) + .build("arion")); + public static final RegistryObject> BABY_SPIDER = ENTITY_TYPES + .register("baby_spider", + () -> EntityType.Builder.of(BabySpider::new, MobCategory.MONSTER) + .sized(0.5F, 0.65F) + .build("baby_spider")); + public static final RegistryObject> BRONZE_BULL = ENTITY_TYPES + .register("bronze_bull", + () -> EntityType.Builder.of(BronzeBull::new, MobCategory.MONSTER) + .sized(1.95F, 2.98F).fireImmune() + .build("bronze_bull")); + public static final RegistryObject> CENTAUR = ENTITY_TYPES + .register("centaur", () -> EntityType.Builder.of(Centaur::new, MobCategory.CREATURE) + .sized(1.39F, 2.49F) + .build("centaur")); + public static final RegistryObject> CERASTES = ENTITY_TYPES + .register("cerastes", () -> EntityType.Builder.of(Cerastes::new, MobCategory.CREATURE) + .sized(0.98F, 0.94F) + .build("cerastes")); + public static final RegistryObject> CERBERUS = ENTITY_TYPES + .register("cerberus", () -> EntityType.Builder.of(Cerberus::new, MobCategory.MONSTER) + .sized(1.98F, 1.9F).fireImmune() + .build("cerberus")); + public static final RegistryObject> CHARYBDIS = ENTITY_TYPES + .register("charybdis", + () -> EntityType.Builder.of(Charybdis::new, MobCategory.WATER_CREATURE) + .sized(5.9F, 7.9F).fireImmune() + .build("charybdis")); + public static final RegistryObject> CIRCE = ENTITY_TYPES.register("circe", + () -> EntityType.Builder.of(Circe::new, MobCategory.MONSTER) + .sized(0.67F, 1.8F) + .build("circe")); + public static final RegistryObject> CRETAN_MINOTAUR = ENTITY_TYPES + .register("cretan_minotaur", + () -> EntityType.Builder.of(CretanMinotaur::new, MobCategory.MONSTER) + .sized(0.989F, 3.395F).fireImmune() + .build("cretan_minotaur")); + public static final RegistryObject> CYCLOPS = ENTITY_TYPES + .register("cyclops", () -> EntityType.Builder.of(Cyclops::new, MobCategory.MONSTER) + .sized(0.99F, 2.92F) + .build("cyclops")); + public static final RegistryObject> CYPRIAN = ENTITY_TYPES + .register("cyprian", () -> EntityType.Builder.of(Cyprian::new, MobCategory.MONSTER) + .sized(1.39F, 2.49F) + .build("cyprian")); + public static final RegistryObject> DRAKAINA = ENTITY_TYPES + .register("drakaina", () -> EntityType.Builder.of(Drakaina::new, MobCategory.MONSTER) + .sized(0.9F, 1.9F) + .build("drakaina")); + public static final RegistryObject> DRAGON_TOOTH_HOOK = ENTITY_TYPES + .register("dragon_tooth_hook", () -> EntityType.Builder + .of(DragonToothHook::new, MobCategory.MISC) + .noSave().noSummon().sized(0.25F, 0.25F).clientTrackingRange(4) + .updateInterval(5) + .build("dragon_tooth_hook")); + public static final RegistryObject> DRYAD = ENTITY_TYPES.register("dryad", + () -> EntityType.Builder.of(Dryad::new, MobCategory.CREATURE) + .sized(0.48F, 1.8F) + .build("dryad")); + public static final RegistryObject> ELPIS = ENTITY_TYPES.register("elpis", + () -> EntityType.Builder.of(Elpis::new, MobCategory.CREATURE) + .sized(0.45F, 0.45F).fireImmune() + .build("elpis")); + public static final RegistryObject> EMPUSA = ENTITY_TYPES + .register("empusa", () -> EntityType.Builder.of(Empusa::new, MobCategory.MONSTER) + .sized(0.67F, 1.8F).fireImmune() + .build("empusa")); + public static final RegistryObject> FURY = ENTITY_TYPES.register("fury", + () -> EntityType.Builder.of(Fury::new, MobCategory.MONSTER) + .sized(0.67F, 1.4F).fireImmune() + .build("fury")); + public static final RegistryObject> GERYON = ENTITY_TYPES + .register("geryon", () -> EntityType.Builder.of(Geryon::new, MobCategory.MONSTER) + .sized(1.98F, 4.96F).fireImmune() + .build("geryon")); + public static final RegistryObject> GIGANTE = ENTITY_TYPES + .register("gigante", () -> EntityType.Builder.of(Gigante::new, MobCategory.CREATURE) + .sized(1.98F, 4.79F) + .build("gigante")); + public static final RegistryObject> GOLDEN_RAM = ENTITY_TYPES + .register("golden_ram", + () -> EntityType.Builder.of(GoldenRam::new, MobCategory.CREATURE) + .sized(0.96F, 1.56F) + .build("golden_ram")); + public static final RegistryObject> GORGON = ENTITY_TYPES + .register("gorgon", () -> EntityType.Builder.of(Gorgon::new, MobCategory.MONSTER) + .sized(0.9F, 1.9F) + .build("gorgon")); + public static final RegistryObject> HARPY = ENTITY_TYPES.register("harpy", + () -> EntityType.Builder.of(Harpy::new, MobCategory.MONSTER) + .sized(0.7F, 1.8F) + .build("harpy")); + public static final RegistryObject> HYDRA = ENTITY_TYPES.register("hydra", + () -> EntityType.Builder.of(Hydra::new, MobCategory.MONSTER) + .sized(2.4F, 2.24F).fireImmune() + .build("hydra")); + public static final RegistryObject> HYDRA_HEAD = ENTITY_TYPES + .register("hydra_head", () -> EntityType.Builder.of(HydraHead::new, MobCategory.MISC) + .sized(0.68F, 1.88F).noSummon() + .build("hydra_head")); + public static final RegistryObject> GIANT_BOAR = ENTITY_TYPES + .register("giant_boar", () -> EntityType.Builder.of(GiantBoar::new, MobCategory.MONSTER) + .sized(2.653F, 2.66F) + .build("giant_boar")); + public static final RegistryObject> LAMPAD = ENTITY_TYPES + .register("lampad", () -> EntityType.Builder.of(Lampad::new, MobCategory.CREATURE) + .sized(0.48F, 1.8F).fireImmune() + .build("lampad")); + public static final RegistryObject> MAD_COW = ENTITY_TYPES + .register("mad_cow", () -> EntityType.Builder.of(MadCow::new, MobCategory.MONSTER) + .sized(0.9F, 1.4F) + .build("mad_cow")); + public static final RegistryObject> MAKHAI = ENTITY_TYPES + .register("makhai", () -> EntityType.Builder.of(Makhai::new, MobCategory.CREATURE) + .sized(0.70F, 1.8F) + .build("makhai")); + public static final RegistryObject> MINOTAUR = ENTITY_TYPES + .register("minotaur", () -> EntityType.Builder.of(Minotaur::new, MobCategory.MONSTER) + .sized(0.7F, 1.94F) + .build("minotaur")); + public static final RegistryObject> NAIAD = ENTITY_TYPES.register("naiad", + () -> EntityType.Builder.of(Naiad::new, MobCategory.WATER_CREATURE) + .sized(0.48F, 1.8F) + .build("naiad")); + public static final RegistryObject> NEMEAN_LION = ENTITY_TYPES + .register("nemean_lion", + () -> EntityType.Builder.of(NemeanLion::new, MobCategory.MONSTER) + .sized(1.92F, 2.28F).fireImmune() + .build("nemean_lion")); + public static final RegistryObject> ORTHUS = ENTITY_TYPES + .register("orthus", () -> EntityType.Builder.of(Orthus::new, MobCategory.MONSTER) + .sized(0.6F, 0.85F).fireImmune() + .build("orthus")); + public static final RegistryObject> PEGASUS = ENTITY_TYPES + .register("pegasus", () -> EntityType.Builder.of(Pegasus::new, MobCategory.CREATURE) + .sized(1.39F, 1.98F) + .build("pegasus")); + public static final RegistryObject> PYTHON = ENTITY_TYPES + .register("python", () -> EntityType.Builder.of(Python::new, MobCategory.MONSTER) + .sized(1.4F, 1.9F).fireImmune() + .build("python")); + public static final RegistryObject> SATYR = ENTITY_TYPES.register("satyr", + () -> EntityType.Builder.of(Satyr::new, MobCategory.CREATURE) + .sized(0.67F, 1.8F) + .build("satyr")); + public static final RegistryObject> SCYLLA = ENTITY_TYPES + .register("scylla", () -> EntityType.Builder.of(Scylla::new, MobCategory.WATER_CREATURE) + .sized(1.92F, 4.4F).fireImmune() + .build("scylla")); + public static final RegistryObject> SHADE = ENTITY_TYPES.register("shade", + () -> EntityType.Builder.of(Shade::new, MobCategory.MONSTER) + .sized(0.67F, 1.8F).fireImmune() + .build("shade")); + public static final RegistryObject> SIREN = ENTITY_TYPES.register("siren", + () -> EntityType.Builder.of(Siren::new, MobCategory.WATER_CREATURE) + .sized(0.6F, 1.9F) + .build("siren")); + public static final RegistryObject> SPARTI = ENTITY_TYPES + .register("sparti", () -> EntityType.Builder.of(Sparti::new, MobCategory.CREATURE) + .sized(0.6F, 1.98F) + .build("sparti")); + public static final RegistryObject> STYMPHALIAN = ENTITY_TYPES + .register("stymphalian", + () -> EntityType.Builder.of(Stymphalian::new, MobCategory.MONSTER) + .sized(0.7F, 0.7F) + .build("stymphalian")); + public static final RegistryObject> TALOS = ENTITY_TYPES.register("talos", + () -> EntityType.Builder.of(Talos::new, MobCategory.MONSTER) + .sized(1.98F, 4.96F).fireImmune() + .build("talos")); + public static final RegistryObject> TRITON = ENTITY_TYPES + .register("triton", () -> EntityType.Builder.of(Triton::new, MobCategory.WATER_CREATURE) + .sized(0.6F, 1.9F) + .build("triton")); + public static final RegistryObject> UNICORN = ENTITY_TYPES + .register("unicorn", () -> EntityType.Builder.of(Unicorn::new, MobCategory.CREATURE) + .sized(1.39F, 1.98F) + .build("unicorn")); + public static final RegistryObject> WHIRL = ENTITY_TYPES.register("whirl", + () -> EntityType.Builder.of(Whirl::new, MobCategory.WATER_CREATURE) + .sized(2.9F, 5.0F) + .build("whirl")); + // other + public static final RegistryObject> BRONZE_FEATHER = ENTITY_TYPES + .register("bronze_feather", + () -> EntityType.Builder + .of(BronzeFeather::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon() + .clientTrackingRange(4).updateInterval(10) + .build("bronze_feather")); + public static final RegistryObject> CURSE = ENTITY_TYPES.register("curse", + () -> EntityType.Builder.of(Curse::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4) + .updateInterval(10) + .build("curse")); + public static final RegistryObject> CURSE_OF_CIRCE = ENTITY_TYPES + .register("curse_of_circe", + () -> EntityType.Builder + .of(CurseOfCirce::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon() + .clientTrackingRange(4).updateInterval(10) + .build("curse_of_circe")); + public static final RegistryObject> DISCUS = ENTITY_TYPES + .register("discus", () -> EntityType.Builder.of(Discus::new, MobCategory.MISC) + .sized(0.45F, 0.45F).noSummon().clientTrackingRange(4) + .updateInterval(10) + .build("discus")); + public static final RegistryObject> DRAGON_TOOTH = ENTITY_TYPES + .register("dragon_tooth", + () -> EntityType.Builder + .of(DragonTooth::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon() + .clientTrackingRange(4).updateInterval(10) + .build("dragon_tooth")); + public static final RegistryObject> GREEK_FIRE = ENTITY_TYPES + .register("greek_fire", + () -> EntityType.Builder.of(GreekFire::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon() + .clientTrackingRange(4).updateInterval(10) + .build("greek_fire")); + public static final RegistryObject> HEALING_SPELL = ENTITY_TYPES + .register("healing_spell", + () -> EntityType.Builder + .of(HealingSpell::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon() + .clientTrackingRange(4).updateInterval(10) + .build("healing_spell")); + public static final RegistryObject> PALLADIUM = ENTITY_TYPES + .register("palladium", () -> EntityType.Builder.of(Palladium::new, MobCategory.MISC) + .sized(0.98F, 2.24F).fireImmune() + .build("palladium")); + public static final RegistryObject> POISON_SPIT = ENTITY_TYPES + .register("poison_spit", + () -> EntityType.Builder + .of(PoisonSpit::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon() + .clientTrackingRange(4).updateInterval(10) + .build("poison_spit")); + public static final RegistryObject> SPEAR = ENTITY_TYPES.register("spear", + () -> EntityType.Builder.of(Spear::new, MobCategory.MISC) + .sized(0.5F, 0.5F).noSummon().clientTrackingRange(4).updateInterval(20) + .build("spear")); + public static final RegistryObject> THROWING_AXE = ENTITY_TYPES + .register("throwing_axe", () -> EntityType.Builder + .of(ThrowingAxe::new, MobCategory.MISC) + .sized(0.5F, 0.5F).noSummon().clientTrackingRange(4).updateInterval(20) + .build("throwing_axe")); + public static final RegistryObject> WATER_SPELL = ENTITY_TYPES + .register("water_spell", + () -> EntityType.Builder + .of(WaterSpell::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon() + .clientTrackingRange(4).updateInterval(10) + .build("water_spell")); + public static final RegistryObject> WEB_BALL = ENTITY_TYPES + .register("web_ball", + () -> EntityType.Builder.of(WebBall::new, MobCategory.MISC) + .sized(0.25F, 0.25F).fireImmune().noSummon() + .clientTrackingRange(4).updateInterval(10) + .build("web_ball")); } - //// LEGENDARY WEAPONS //// - public static final RegistryObject THUNDERBOLT = ITEMS.register("thunderbolt", () -> - new ThunderboltItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON).durability(170))); - public static final RegistryObject WAND_OF_CIRCE = ITEMS.register("wand_of_circe", () -> - new WandOfCirceItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE).durability(54))); - public static final RegistryObject AVERNAL_BOW = ITEMS.register("avernal_bow", () -> - new EnchantedBowItem.AvernalBowItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON).durability(384))); - public static final RegistryObject APOLLO_BOW = ITEMS.register("apollo_bow", () -> - new EnchantedBowItem.ApolloBowItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.EPIC).durability(434))); - public static final RegistryObject ARTEMIS_BOW = ITEMS.register("artemis_bow", () -> - new EnchantedBowItem.ArtemisBowItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.EPIC).durability(434))); - - //// WEAPONS //// - public static final RegistryObject WOODEN_CLUB = ITEMS.register("wooden_club", () -> - new ClubItem(Tiers.WOOD, new Item.Properties().tab(GF_TAB).stacksTo(1))); - public static final RegistryObject STONE_CLUB = ITEMS.register("stone_club", () -> - new ClubItem(Tiers.STONE, new Item.Properties().tab(GF_TAB).stacksTo(1))); - public static final RegistryObject IRON_CLUB = ITEMS.register("iron_club", () -> - new ClubItem(Tiers.IRON, new Item.Properties().tab(GF_TAB).stacksTo(1))); - public static final RegistryObject BIDENT = ITEMS.register("bident", () -> - new BidentItem(Tiers.DIAMOND, new Item.Properties().rarity(Rarity.UNCOMMON).tab(GF_TAB).setNoRepair())); - public static final RegistryObject WOODEN_SPEAR = ITEMS.register("wooden_spear", () -> - new SpearItem(Tiers.WOOD, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject FLINT_SPEAR = ITEMS.register("flint_spear", () -> - new SpearItem(GFTiers.FLINT, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject STONE_SPEAR = ITEMS.register("stone_spear", () -> - new SpearItem(Tiers.STONE, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject IRON_SPEAR = ITEMS.register("iron_spear", () -> - new SpearItem(Tiers.IRON, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject GOLDEN_SPEAR = ITEMS.register("golden_spear", () -> - new SpearItem(Tiers.GOLD, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject DIAMOND_SPEAR = ITEMS.register("diamond_spear", () -> - new SpearItem(Tiers.DIAMOND, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject NETHERITE_SPEAR = ITEMS.register("netherite_spear", () -> - new SpearItem(Tiers.NETHERITE, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject FLINT_KNIFE = ITEMS.register("flint_knife", () -> - new KnifeItem(GFTiers.FLINT, 3, -1.7F, -1.0F, new Item.Properties().tab(GF_TAB).stacksTo(1))); - public static final RegistryObject IVORY_SWORD = ITEMS.register("ivory_sword", () -> - new IvorySwordItem(GFTiers.IVORY, 3, -2.2F, new Item.Properties().tab(GF_TAB).stacksTo(1))); - public static final RegistryObject THROWING_AXE = ITEMS.register("throwing_axe", () -> - new ThrowingAxeItem(Tiers.IRON, 6.0F, -3.1F, new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE))); - public static final RegistryObject DRAGON_TOOTH_ROD = ITEMS.register("dragon_tooth_rod", () -> - new DragonToothRodItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.EPIC).durability(128))); - public static final RegistryObject DISCUS = ITEMS.register("discus", () -> - new DiscusItem(new Item.Properties().tab(GF_TAB).stacksTo(16))); - public static final RegistryObject GREEK_FIRE = ITEMS.register("greek_fire", () -> - new GreekFireItem(new Item.Properties().tab(GF_TAB).stacksTo(16))); - public static final RegistryObject WEB_BALL = ITEMS.register("web_ball", () -> - new WebBallItem(new Item.Properties().tab(GF_TAB).stacksTo(16))); - - //// LEGENDARY TOOLS AND ITEMS //// - public static final RegistryObject BRONZE_FEATHER = ITEMS.register("bronze_feather", () -> - new BronzeFeatherItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - public static final RegistryObject DRAGON_TOOTH = ITEMS.register("dragon_tooth", () -> - new DragonToothItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE))); - public static final RegistryObject MIRROR = ITEMS.register("mirror", () -> - new Item(new Item.Properties().tab(GF_TAB).stacksTo(1))); - public static final RegistryObject CONCH = ITEMS.register("conch", () -> - new ConchItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE).stacksTo(1).durability(64))); - public static final RegistryObject UNICORN_HORN = ITEMS.register("unicorn_horn", () -> - new UnicornHornItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON).durability(44))); - public static final RegistryObject HEART_OF_TALOS = ITEMS.register("heart_of_talos", () -> - new Item(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE).stacksTo(16))); - public static final RegistryObject BAG_OF_WIND = ITEMS.register("bag_of_wind", () -> - new BagOfWindItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE).durability(24))); - public static final RegistryObject STAFF_OF_HEALING = ITEMS.register("staff_of_healing", () -> - new StaffOfHealingItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE).durability(384))); - public static final RegistryObject THYRSUS = ITEMS.register("thyrsus", () -> - new ThyrsusItem(GFTiers.THYRSUS, 2.5F, -2.2F, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject AMBROSIA = ITEMS.register("ambrosia", () -> - new HasCraftRemainderItem(ItemReg.HORN, new Item.Properties().tab(GF_TAB).food(AMBROSIA_FOOD).rarity(Rarity.EPIC))); - public static final RegistryObject HORN_OF_PLENTY = ITEMS.register("horn_of_plenty", () -> - new HornOfPlentyItem(ItemReg.HORN, new Item.Properties().tab(GF_TAB).durability(24).rarity(Rarity.UNCOMMON))); - public static final RegistryObject GOLDEN_FLEECE = ITEMS.register("golden_fleece", () -> - new Item(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE))); - public static final RegistryObject GOLDEN_BALL = ITEMS.register("golden_ball", () -> - new GoldenBallItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON).durability(680))); - public static final RegistryObject ICHOR = ITEMS.register("ichor", () -> - new Item(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE)) { - @Override - public boolean isFoil(ItemStack stack) { - return true; - } - }); - public static final RegistryObject SPIDER_BANNER_PATTERN = ITEMS.register("spider_banner_pattern", () -> - new BannerPatternItem(TagKey.create(Registry.BANNER_PATTERN_REGISTRY, new ResourceLocation(GreekFantasy.MODID, "pattern_item/spider")), new Item.Properties().tab(GF_TAB).stacksTo(1).rarity(Rarity.RARE))); - - //// LEGENDARY ARMOR //// - public static final RegistryObject HELM_OF_DARKNESS = ITEMS.register("helm_of_darkness", () -> - new HelmOfDarknessItem(GFArmorMaterials.AVERNAL, new Item.Properties().tab(GF_TAB).rarity(Rarity.EPIC))); - public static final RegistryObject WINGED_SANDALS = ITEMS.register("winged_sandals", () -> - new WingedSandalsItem(GFArmorMaterials.WINGED, new Item.Properties().tab(GF_TAB).rarity(Rarity.EPIC))); - public static final RegistryObject NEMEAN_LION_HIDE = ITEMS.register("nemean_lion_hide", () -> - new NemeanLionHideItem(GFArmorMaterials.NEMEAN, EquipmentSlot.HEAD, - new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE).setNoRepair())); - - //// ARMOR //// - public static final RegistryObject HELLENIC_HELMET = ITEMS.register("hellenic_helmet", () -> - new HellenicArmorItem(GFArmorMaterials.HELLENIC, EquipmentSlot.HEAD, new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - public static final RegistryObject HELLENIC_CHESTPLATE = ITEMS.register("hellenic_chestplate", () -> - new HellenicArmorItem(GFArmorMaterials.HELLENIC, EquipmentSlot.CHEST, new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - public static final RegistryObject HELLENIC_LEGGINGS = ITEMS.register("hellenic_leggings", () -> - new HellenicArmorItem(GFArmorMaterials.HELLENIC, EquipmentSlot.LEGS, new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - public static final RegistryObject HELLENIC_BOOTS = ITEMS.register("hellenic_boots", () -> - new HellenicArmorItem(GFArmorMaterials.HELLENIC, EquipmentSlot.FEET, new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - public static final RegistryObject SNAKESKIN_HELMET = ITEMS.register("snakeskin_helmet", () -> - new SnakeskinArmorItem(GFArmorMaterials.SNAKESKIN, EquipmentSlot.HEAD, new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - public static final RegistryObject SNAKESKIN_CHESTPLATE = ITEMS.register("snakeskin_chestplate", () -> - new SnakeskinArmorItem(GFArmorMaterials.SNAKESKIN, EquipmentSlot.CHEST, new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - public static final RegistryObject SNAKESKIN_LEGGINGS = ITEMS.register("snakeskin_leggings", () -> - new SnakeskinArmorItem(GFArmorMaterials.SNAKESKIN, EquipmentSlot.LEGS, new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - public static final RegistryObject SNAKESKIN_BOOTS = ITEMS.register("snakeskin_boots", () -> - new SnakeskinArmorItem(GFArmorMaterials.SNAKESKIN, EquipmentSlot.FEET, new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - - //// MISC ITEMS //// - public static final RegistryObject QUEST = ITEMS.register("quest", () -> - new QuestItem(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject PANFLUTE = ITEMS.register("panflute", () -> - new InstrumentItem(new Item.Properties().tab(GF_TAB).stacksTo(1), () -> SoundEvents.NOTE_BLOCK_FLUTE)); - public static final RegistryObject WOODEN_LYRE = ITEMS.register("wooden_lyre", () -> - new InstrumentItem(new Item.Properties().tab(GF_TAB).stacksTo(1), () -> SoundEvents.NOTE_BLOCK_HARP)); - public static final RegistryObject GOLDEN_LYRE = ITEMS.register("golden_lyre", () -> - new InstrumentItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON).stacksTo(1), () -> SoundEvents.NOTE_BLOCK_GUITAR)); - public static final RegistryObject OLIVES = ITEMS.register("olives", () -> - new Item(new Item.Properties().tab(GF_TAB).food(OLIVES_FOOD))); - public static final RegistryObject OLIVE_OIL = ITEMS.register("olive_oil", () -> - new OliveOilItem(BlockReg.OLIVE_OIL.get(), new Item.Properties().tab(GF_TAB).stacksTo(16).craftRemainder(Items.GLASS_BOTTLE))); - public static final RegistryObject OLIVE_SALVE = ITEMS.register("olive_salve", () -> - new OliveSalveItem(new Item.Properties().tab(GF_TAB).stacksTo(1).food(OLIVE_SALVE_FOOD))); - public static final RegistryObject POMEGRANATE = ITEMS.register("pomegranate", () -> - new Item(new Item.Properties().tab(GF_TAB).food(POMEGRANATE_FOOD))); - - //// CRAFTING MATERIALS //// - public static final RegistryObject AVERNAL_FEATHER = ITEMS.register("avernal_feather", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject AVERNAL_HAIR = ITEMS.register("avernal_hair", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject AVERNAL_WING = ITEMS.register("avernal_wing", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject AVERNAL_HIDE = ITEMS.register("avernal_hide", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject AVERNAL_CLAW = ITEMS.register("avernal_claw", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject AVERNAL_SHARD = ITEMS.register("avernal_shard", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject ICHOR_INFUSED_GEAR = ITEMS.register("ichor_infused_gear", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject GOLDEN_STRING = ITEMS.register("golden_string", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject GORGON_BLOOD = ITEMS.register("gorgon_blood", () -> new GorgonBloodItem(new Item.Properties().tab(GF_TAB).stacksTo(16).craftRemainder(Items.GLASS_BOTTLE))); - public static final RegistryObject BOAR_EAR = ITEMS.register("boar_ear", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BOAR_TUSK = ITEMS.register("boar_tusk", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject DEADLY_FANG = ITEMS.register("deadly_fang", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject GOLDEN_BRIDLE = ITEMS.register("golden_bridle", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject HORN = ITEMS.register("horn", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject PINECONE = ITEMS.register("pinecone", () -> new Item(new Item.Properties().tab(GF_TAB).food(PINECONE_FOOD))); - public static final RegistryObject REEDS = ITEMS.register("reeds", () -> new BlockItem(BlockReg.REEDS.get(), new Item.Properties().tab(GF_TAB))); - public static final RegistryObject SCYLLA_BONE = ITEMS.register("scylla_bone", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject SNAKESKIN = ITEMS.register("snakeskin", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject TOUGH_SNAKESKIN = ITEMS.register("tough_snakeskin", () -> new Item(new Item.Properties().tab(GF_TAB).rarity(Rarity.UNCOMMON))); - //// BRONZE SCRAP //// - public static final RegistryObject BRONZE_INGOT = ITEMS.register("bronze_ingot", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_NUGGET = ITEMS.register("bronze_nugget", () -> new Item(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_BOWL = ITEMS.register("bronze_bowl", () -> new BronzeScrapItem(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_COINS = ITEMS.register("bronze_coins", () -> new BronzeScrapItem(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_CUIRASS = ITEMS.register("bronze_cuirass", () -> new BronzeScrapItem(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_FIGURINE = ITEMS.register("bronze_figurine", () -> new BronzeScrapItem(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_GOBLET = ITEMS.register("bronze_goblet", () -> new BronzeScrapItem(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_HELMET = ITEMS.register("bronze_helmet", () -> new BronzeScrapItem(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_SHIELD = ITEMS.register("bronze_shield", () -> new BronzeScrapItem(new Item.Properties().tab(GF_TAB))); - public static final RegistryObject BRONZE_VASE = ITEMS.register("bronze_vase", () -> new BronzeScrapItem(new Item.Properties().tab(GF_TAB))); - - //// SPAWN EGGS //// - public static final RegistryObject ARA_SPAWN_EGG = ITEMS.register("ara_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.ARA, 0xffffff, 0xbbbbbb, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject ARACHNE_SPAWN_EGG = ITEMS.register("arachne_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.ARACHNE, 0x9c7b50, 0xa80e0e, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject ARION_SPAWN_EGG = ITEMS.register("arion_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.ARION, 0xdfc014, 0xb58614, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject CENTAUR_SPAWN_EGG = ITEMS.register("centaur_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.CENTAUR, 0x734933, 0x83251f, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject CERASTES_SPAWN_EGG = ITEMS.register("cerastes_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.CERASTES, 0x847758, 0x997c4d, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject CIRCE_SPAWN_EGG = ITEMS.register("circe_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.CIRCE, 0x844797, 0xe8c669, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject CRETAN_MINOTAUR_SPAWN_EGG = ITEMS.register("cretan_minotaur_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.CRETAN_MINOTAUR, 0x2a2a2a, 0x734933, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject CYCLOPS_SPAWN_EGG = ITEMS.register("cyclops_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.CYCLOPS, 0xda662c, 0x2c1e0e, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject CYPRIAN_SPAWN_EGG = ITEMS.register("cyprian_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.CYPRIAN, 0x443626, 0x83251f, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject DRAKAINA_SPAWN_EGG = ITEMS.register("drakaina_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.DRAKAINA, 0x724e36, 0x398046, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject DRYAD_SPAWN_EGG = ITEMS.register("dryad_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.DRYAD, 0x443626, 0xfed93f, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject ELPIS_SPAWN_EGG = ITEMS.register("elpis_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.ELPIS, 0xe7aae4, 0xeeeeee, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject EMPUSA_SPAWN_EGG = ITEMS.register("empusa_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.EMPUSA, 0x222222, 0x83251f, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject FURY_SPAWN_EGG = ITEMS.register("fury_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.FURY, 0xbd4444, 0x6c2426, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject GIANT_BOAR_SPAWN_EGG = ITEMS.register("giant_boar_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.GIANT_BOAR, 0x5b433a, 0xe8a074, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject GIGANTE_SPAWN_EGG = ITEMS.register("gigante_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.GIGANTE, 0xd3dba7, 0x6a602b, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject GOLDEN_RAM_SPAWN_EGG = ITEMS.register("golden_ram_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.GOLDEN_RAM, 0xdfc014, 0xd08d26, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject GORGON_SPAWN_EGG = ITEMS.register("gorgon_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.GORGON, 0x3a8228, 0xbcbcbc, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject HARPY_SPAWN_EGG = ITEMS.register("harpy_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.HARPY, 0x724e36, 0x332411, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject HYDRA_SPAWN_EGG = ITEMS.register("hydra_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.HYDRA, 0x372828, 0x9d4217, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject LAMPAD_SPAWN_EGG = ITEMS.register("lampad_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.LAMPAD, 0x643026, 0xfed93f, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject MAD_COW_SPAWN_EGG = ITEMS.register("mad_cow_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.MAD_COW, 0x443626, 0xcf9797, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject MAKHAI_SPAWN_EGG = ITEMS.register("makhai_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.MAKHAI, 0x513f38, 0xf33531, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject MINOTAUR_SPAWN_EGG = ITEMS.register("minotaur_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.MINOTAUR, 0x443626, 0x734933, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject NAIAD_SPAWN_EGG = ITEMS.register("naiad_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.NAIAD, 0x7caba1, 0xe67830, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject NEMEAN_LION_SPAWN_EGG = ITEMS.register("nemean_lion_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.NEMEAN_LION, 0xd08d26, 0x7d3107, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject ORTHUS_SPAWN_EGG = ITEMS.register("orthus_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.ORTHUS, 0x493569, 0xe42e2e, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject PEGASUS_SPAWN_EGG = ITEMS.register("pegasus_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.PEGASUS, 0x916535, 0xe8e8e8, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject PYTHON_SPAWN_EGG = ITEMS.register("python_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.PYTHON, 0x3a8228, 0x1e4c11, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject SATYR_SPAWN_EGG = ITEMS.register("satyr_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.SATYR, 0x54371d, 0xa16648, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject SHADE_SPAWN_EGG = ITEMS.register("shade_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.SHADE, 0x222222, 0x000000, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject SIREN_SPAWN_EGG = ITEMS.register("siren_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.SIREN, 0x729f92, 0x398046, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject STYMPHALIAN_SPAWN_EGG = ITEMS.register("stymphalian_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.STYMPHALIAN, 0x684822, 0xc08845, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject TRITON_SPAWN_EGG = ITEMS.register("triton_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.TRITON, 0x527f72, 0x398046, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject UNICORN_SPAWN_EGG = ITEMS.register("unicorn_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.UNICORN, 0xeeeeee, 0xe8e8e8, new Item.Properties().tab(GF_TAB))); - public static final RegistryObject WHIRL_SPAWN_EGG = ITEMS.register("whirl_spawn_egg", () -> - new ForgeSpawnEggItem(EntityReg.WHIRL, 0x1EF6FF, 0xededed, new Item.Properties().tab(GF_TAB))); - - // TODO spawn eggs for other bosses? bull, geryon, talos, cerberus, charybdis - - //// LEGENDARY ITEM BLOCKS //// - public static final RegistryObject PALLADIUM = ITEMS.register("palladium", () -> - new PalladiumItem(new Item.Properties().tab(GF_TAB).rarity(Rarity.RARE).stacksTo(1))); - - //// ITEM BLOCKS //// - public static final RegistryObject BRONZE_BLOCK = registerItemBlock(BlockReg.BRONZE_BLOCK); - public static final RegistryObject ICHOR_INFUSED_GEARBOX = registerItemBlock(BlockReg.ICHOR_INFUSED_GEARBOX, p -> p.rarity(Rarity.RARE)); - public static final RegistryObject MYSTERIOUS_BOX = registerItemBlock(BlockReg.MYSTERIOUS_BOX, p -> p.rarity(Rarity.UNCOMMON)); - public static final RegistryObject GIGANTE_HEAD = ITEMS.register("gigante_head", () -> new GiganteHeadItem(BlockReg.GIGANTE_HEAD.get(), new Item.Properties().tab(GF_TAB))); - public static final RegistryObject ORTHUS_HEAD = ITEMS.register("orthus_head", () -> new OrthusHeadItem(BlockReg.ORTHUS_HEAD.get(), new Item.Properties().tab(GF_TAB))); - public static final RegistryObject CERBERUS_HEAD = ITEMS.register("cerberus_head", () -> new CerberusHeadItem(BlockReg.CERBERUS_HEAD.get(), new Item.Properties().tab(GF_TAB))); - public static final RegistryObject OIL_LAMP = registerItemBlock(BlockReg.OIL_LAMP); - public static final RegistryObject OLIVE_SAPLING = registerItemBlock(BlockReg.OLIVE_SAPLING); - public static final RegistryObject POMEGRANATE_SAPLING = registerItemBlock(BlockReg.POMEGRANATE_SAPLING); - public static final RegistryObject GOLDEN_SAPLING = registerItemBlock(BlockReg.GOLDEN_SAPLING, p -> p.rarity(Rarity.UNCOMMON)); - public static final RegistryObject WILD_ROSE = registerItemBlock(BlockReg.WILD_ROSE, p -> p.rarity(Rarity.UNCOMMON)); - public static final RegistryObject NEST = registerItemBlock(BlockReg.NEST); - - /** - * Registers an item for the given block - * - * @param blockSupplier the block supplier - * @return the BlockItem registry object - */ - private static RegistryObject registerItemBlock(final RegistryObject blockSupplier) { - return ITEMS.register(blockSupplier.getId().getPath(), itemBlock(blockSupplier, p -> {})); - } + public static final class BlockEntityReg { - /** - * Registers an item for the given block - * - * @param blockSupplier the block supplier - * @param consumer the item properties consumer - * @return the BlockItem registry object - */ - private static RegistryObject registerItemBlock(final RegistryObject blockSupplier, Consumer consumer) { - return ITEMS.register(blockSupplier.getId().getPath(), itemBlock(blockSupplier, consumer)); - } + public static void register() { + BLOCK_ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - /** - * Creates a block item supplier for the given block - * - * @param blockSupplier the block supplier - * @return a supplier for the block item - */ - private static Supplier itemBlock(final RegistryObject blockSupplier, Consumer consumer) { - Item.Properties props = new Item.Properties().tab(GF_TAB); - consumer.accept(props); - return () -> new BlockItem(blockSupplier.get(), props); + public static final RegistryObject> CERBERUS_HEAD = BLOCK_ENTITY_TYPES + .register("cerberus_head", () -> BlockEntityType.Builder + .of((pos, state) -> new MobHeadBlockEntity( + BlockEntityReg.CERBERUS_HEAD.get(), pos, state), + BlockReg.CERBERUS_HEAD.get()) + .build(null)); + + public static final RegistryObject> GIGANTE_HEAD = BLOCK_ENTITY_TYPES + .register("gigante_head", () -> BlockEntityType.Builder + .of((pos, state) -> new MobHeadBlockEntity( + BlockEntityReg.GIGANTE_HEAD.get(), pos, state), + BlockReg.GIGANTE_HEAD.get()) + .build(null)); + + public static final RegistryObject> ORTHUS_HEAD = BLOCK_ENTITY_TYPES + .register("orthus_head", () -> BlockEntityType.Builder + .of((pos, state) -> new MobHeadBlockEntity( + BlockEntityReg.ORTHUS_HEAD.get(), pos, state), + BlockReg.ORTHUS_HEAD.get()) + .build(null)); + + public static final RegistryObject> VASE = BLOCK_ENTITY_TYPES + .register("vase", () -> { + // create set of vase blocks using registry objects + Set vaseBlocks = new HashSet<>(); + vaseBlocks.add(RegistryObject + .create(new ResourceLocation(MODID, "terracotta_vase"), + ForgeRegistries.BLOCKS) + .get()); + for (final DyeColor dyeColor : DyeColor.values()) { + vaseBlocks.add(RegistryObject.create( + new ResourceLocation(MODID, + dyeColor.getSerializedName() + + "_terracotta_vase"), + ForgeRegistries.BLOCKS).get()); + } + // create block entity type + return BlockEntityType.Builder + .of(VaseBlockEntity::new, vaseBlocks.toArray(new Block[0])) + .build(null); + }); } - } - public static final class BannerPatternReg { - public static void register() { - BANNER_PATTERNS.register(FMLJavaModLoadingContext.get().getModEventBus()); - } + public static final class PotionReg { - public static final RegistryObject SPIDER = BANNER_PATTERNS.register("spider", () -> - new BannerPattern("gf:spi")); - } + public static void register() { + POTIONS.register(FMLJavaModLoadingContext.get().getModEventBus()); + // add setup listener + FMLJavaModLoadingContext.get().getModEventBus().addListener(PotionReg::registerPotionRecipes); + } - public static final class EntityReg { + public static final RegistryObject MIRRORING = POTIONS.register("mirroring", + () -> new Potion(new MobEffectInstance(MobEffectReg.MIRRORING.get(), 3600))); + public static final RegistryObject LONG_MIRRORING = POTIONS.register("long_mirroring", + () -> new Potion(new MobEffectInstance(MobEffectReg.MIRRORING.get(), 9600))); + + public static final RegistryObject CURSE_OF_CIRCE = POTIONS.register("curse_of_circe", + () -> new Potion(new MobEffectInstance(MobEffectReg.CURSE_OF_CIRCE.get(), 3600))); + public static final RegistryObject LONG_CURSE_OF_CIRCE = POTIONS.register("long_curse_of_circe", + () -> new Potion(new MobEffectInstance(MobEffectReg.CURSE_OF_CIRCE.get(), 9600))); + + public static final RegistryObject SLOW_SWIM = POTIONS.register("slow_swim", + () -> new Potion(new MobEffectInstance(MobEffectReg.SLOW_SWIM.get(), 3600))); + public static final RegistryObject LONG_SLOW_SWIM = POTIONS.register("long_slow_swim", + () -> new Potion(new MobEffectInstance(MobEffectReg.SLOW_SWIM.get(), 9600))); + + public static void registerPotionRecipes(final FMLCommonSetupEvent event) { + event.enqueueWork(() -> { + final ItemStack awkward = PotionUtils.setPotion(new ItemStack(Items.POTION), + Potions.AWKWARD); + // Mirroring potion + if (GreekFantasy.CONFIG.isMirroringEffectEnabled()) { + // create item stacks + final ItemStack mirroring = PotionUtils.setPotion(new ItemStack(Items.POTION), + MIRRORING.get()); + final ItemStack splashMirroring = PotionUtils + .setPotion(new ItemStack(Items.SPLASH_POTION), MIRRORING.get()); + final ItemStack lingeringMirroring = PotionUtils.setPotion( + new ItemStack(Items.LINGERING_POTION), MIRRORING.get()); + // Add brewing recipes + BrewingRecipeRegistry.addRecipe( + Ingredient.of(awkward), + Ingredient.of(new ItemStack(ItemReg.SNAKESKIN.get())), + mirroring); + BrewingRecipeRegistry.addRecipe(Ingredient.of(mirroring), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.POTION), + LONG_MIRRORING.get())); + BrewingRecipeRegistry.addRecipe(Ingredient.of(mirroring), + Ingredient.of(new ItemStack(Items.GUNPOWDER)), splashMirroring); + BrewingRecipeRegistry.addRecipe(Ingredient.of(mirroring), + Ingredient.of(new ItemStack(Items.DRAGON_BREATH)), + lingeringMirroring); + BrewingRecipeRegistry.addRecipe(Ingredient.of(splashMirroring), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), + LONG_MIRRORING.get())); + BrewingRecipeRegistry.addRecipe(Ingredient.of(lingeringMirroring), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), + LONG_MIRRORING.get())); + } + // Curse of Circe potion + if (GreekFantasy.CONFIG.isCurseOfCirceEnabled()) { + // create item stacks + final ItemStack curseOfCirce = PotionUtils + .setPotion(new ItemStack(Items.POTION), CURSE_OF_CIRCE.get()); + final ItemStack splashCurseOfCirce = PotionUtils.setPotion( + new ItemStack(Items.SPLASH_POTION), CURSE_OF_CIRCE.get()); + final ItemStack lingeringCurseOfCirce = PotionUtils.setPotion( + new ItemStack(Items.LINGERING_POTION), CURSE_OF_CIRCE.get()); + // Add brewing recipes + BrewingRecipeRegistry.addRecipe( + Ingredient.of(awkward), + Ingredient.of(new ItemStack(ItemReg.BOAR_EAR.get())), + curseOfCirce); + BrewingRecipeRegistry.addRecipe(Ingredient.of(curseOfCirce), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.POTION), + LONG_CURSE_OF_CIRCE.get())); + BrewingRecipeRegistry.addRecipe(Ingredient.of(curseOfCirce), + Ingredient.of(new ItemStack(Items.GUNPOWDER)), + splashCurseOfCirce); + BrewingRecipeRegistry.addRecipe(Ingredient.of(curseOfCirce), + Ingredient.of(new ItemStack(Items.DRAGON_BREATH)), + lingeringCurseOfCirce); + BrewingRecipeRegistry.addRecipe(Ingredient.of(splashCurseOfCirce), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), + LONG_CURSE_OF_CIRCE.get())); + BrewingRecipeRegistry.addRecipe(Ingredient.of(lingeringCurseOfCirce), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), + LONG_CURSE_OF_CIRCE.get())); + } + // Slow Swim potion + // create item stacks + final ItemStack slowSwim = PotionUtils.setPotion(new ItemStack(Items.POTION), + SLOW_SWIM.get()); + final ItemStack splashSlowSwim = PotionUtils + .setPotion(new ItemStack(Items.SPLASH_POTION), SLOW_SWIM.get()); + final ItemStack lingeringSlowSwim = PotionUtils + .setPotion(new ItemStack(Items.LINGERING_POTION), SLOW_SWIM.get()); + // Add brewing recipes + BrewingRecipeRegistry.addRecipe( + Ingredient.of(PotionUtils.setPotion(new ItemStack(Items.POTION), + Potions.TURTLE_MASTER)), + Ingredient.of(new ItemStack(Items.FERMENTED_SPIDER_EYE)), slowSwim); + BrewingRecipeRegistry.addRecipe(Ingredient.of(slowSwim), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.POTION), + LONG_SLOW_SWIM.get())); + BrewingRecipeRegistry.addRecipe(Ingredient.of(slowSwim), + Ingredient.of(new ItemStack(Items.GUNPOWDER)), splashSlowSwim); + BrewingRecipeRegistry.addRecipe(Ingredient.of(slowSwim), + Ingredient.of(new ItemStack(Items.DRAGON_BREATH)), lingeringSlowSwim); + BrewingRecipeRegistry.addRecipe(Ingredient.of(splashSlowSwim), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), + LONG_SLOW_SWIM.get())); + BrewingRecipeRegistry.addRecipe(Ingredient.of(lingeringSlowSwim), + Ingredient.of(new ItemStack(Items.REDSTONE)), + PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), + LONG_SLOW_SWIM.get())); + }); + } - public static void register() { - ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); - // event listeners - FMLJavaModLoadingContext.get().getModEventBus().addListener(GFRegistry.EntityReg::registerEntityAttributes); } - private static void registerEntityAttributes(EntityAttributeCreationEvent event) { - register(event, AUTOMATON.get(), Automaton::createAttributes, Mob::checkMobSpawnRules); - register(event, ARA.get(), Ara::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); - register(event, ARACHNE.get(), Arachne::createAttributes, Monster::checkMonsterSpawnRules); - register(event, ARION.get(), Arion::createAttributes, Mob::checkMobSpawnRules); - register(event, BABY_SPIDER.get(), BabySpider::createAttributes, Monster::checkMonsterSpawnRules); - register(event, BRONZE_BULL.get(), BronzeBull::createAttributes, Monster::checkMonsterSpawnRules); - register(event, CENTAUR.get(), Centaur::createAttributes, Mob::checkMobSpawnRules); - register(event, CERASTES.get(), Cerastes::createAttributes, Cerastes::checkCerastesSpawnRules); - register(event, CERBERUS.get(), Cerberus::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); - register(event, CHARYBDIS.get(), Charybdis::createAttributes, SpawnRulesUtil::checkWaterMonsterSpawnRules); - register(event, CIRCE.get(), Circe::createAttributes, Monster::checkMonsterSpawnRules); - register(event, CRETAN_MINOTAUR.get(), CretanMinotaur::createAttributes, Monster::checkMonsterSpawnRules); - register(event, CYCLOPS.get(), Cyclops::createAttributes, Monster::checkMonsterSpawnRules); - register(event, CYPRIAN.get(), Cyprian::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); - register(event, DRAKAINA.get(), Drakaina::createAttributes, Monster::checkMonsterSpawnRules); - register(event, DRYAD.get(), Dryad::createAttributes, Mob::checkMobSpawnRules); - register(event, ELPIS.get(), Elpis::createAttributes, Mob::checkMobSpawnRules); - register(event, EMPUSA.get(), Empusa::createAttributes, Empusa::checkEmpusaSpawnRules); - register(event, FURY.get(), Fury::createAttributes, Monster::checkAnyLightMonsterSpawnRules); - register(event, GERYON.get(), Geryon::createAttributes, Monster::checkMonsterSpawnRules); - register(event, GIANT_BOAR.get(), GiantBoar::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); - register(event, GIGANTE.get(), Gigante::createAttributes, Mob::checkMobSpawnRules); - register(event, GOLDEN_RAM.get(), GoldenRam::createAttributes, Mob::checkMobSpawnRules); - register(event, GORGON.get(), Gorgon::createAttributes, Monster::checkMonsterSpawnRules); - register(event, HARPY.get(), Harpy::createAttributes, Monster::checkAnyLightMonsterSpawnRules); - register(event, HYDRA.get(), Hydra::createAttributes, Monster::checkMonsterSpawnRules); - register(event, HYDRA_HEAD.get(), HydraHead::createAttributes, null); - register(event, LAMPAD.get(), Lampad::createAttributes, Mob::checkMobSpawnRules); - register(event, MAD_COW.get(), MadCow::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); - register(event, MAKHAI.get(), Makhai::createAttributes, SpawnRulesUtil::checkAnyLightMonsterSpawnRules); - register(event, MINOTAUR.get(), Minotaur::createAttributes, Monster::checkMonsterSpawnRules); - register(event, NAIAD.get(), Naiad::createAttributes, SpawnRulesUtil::checkWaterMobSpawnRules); - register(event, NEMEAN_LION.get(), NemeanLion::createAttributes, Monster::checkMonsterSpawnRules); - register(event, ORTHUS.get(), Orthus::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); - event.put(PALLADIUM.get(), Palladium.createAttributes().build()); - register(event, PEGASUS.get(), Pegasus::createAttributes, Mob::checkMobSpawnRules); - register(event, PYTHON.get(), Python::createAttributes, Monster::checkMonsterSpawnRules); - register(event, SATYR.get(), Satyr::createAttributes, Mob::checkMobSpawnRules); - register(event, SCYLLA.get(), Scylla::createAttributes, SpawnRulesUtil::checkWaterMonsterSpawnRules); - register(event, SHADE.get(), Shade::createAttributes, Monster::checkMonsterSpawnRules); - register(event, SIREN.get(), Siren::createAttributes, Siren::checkSirenSpawnRules); - register(event, SPARTI.get(), Sparti::createAttributes, Mob::checkMobSpawnRules); - register(event, STYMPHALIAN.get(), Stymphalian::createAttributes, Monster::checkMonsterSpawnRules); - register(event, TALOS.get(), Talos::createAttributes, SpawnRulesUtil::checkMonsterSpawnRules); - register(event, TRITON.get(), Triton::createAttributes, SpawnRulesUtil::checkWaterMobSpawnRules); - register(event, UNICORN.get(), Unicorn::createAttributes, Mob::checkMobSpawnRules); - register(event, WHIRL.get(), Whirl::createAttributes, SpawnRulesUtil::checkWaterMobSpawnRules); - } + public static final class MobEffectReg { - /** - * Helper method to register mob entity attributes and placement predicates at the same time. - * @param event the entity attribute creation event - * @param entityType the entity type - * @param attributeSupplier a supplier to the attribute builder - * @param placementPredicate the placement predicate, can be null - * @param a mob entity - */ - private static void register(final EntityAttributeCreationEvent event, final EntityType entityType, - Supplier attributeSupplier, - @Nullable final SpawnPlacements.SpawnPredicate placementPredicate) { - // register attributes - event.put(entityType, attributeSupplier.get().build()); - // register placement - if (placementPredicate != null) { - final SpawnPlacements.Type placementType = entityType.getCategory() == MobCategory.WATER_CREATURE ? SpawnPlacements.Type.IN_WATER : SpawnPlacements.Type.ON_GROUND; - // wrap the spawn predicate in one that also checks dimension predicate - final SpawnPlacements.SpawnPredicate placement = (entity, level, reason, pos, rand) -> - GreekFantasy.CONFIG.spawnMatchesDimension(level.getLevel()) && placementPredicate.test(entity, level, reason, pos, rand); - // actually register the placement - SpawnPlacements.register(entityType, placementType, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, placement); - } - } + public static void register() { + MOB_EFFECTS.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - // creature - public static final RegistryObject> AUTOMATON = ENTITY_TYPES.register("automaton", () -> - EntityType.Builder.of(Automaton::new, MobCategory.MISC) - .sized(0.94F, 2.48F) - .build("automaton")); - public static final RegistryObject> ARA = ENTITY_TYPES.register("ara", () -> - EntityType.Builder.of(Ara::new, MobCategory.MONSTER) - .sized(0.67F, 1.8F) - .build("ara")); - public static final RegistryObject> ARACHNE = ENTITY_TYPES.register("arachne", () -> - EntityType.Builder.of(Arachne::new, MobCategory.MONSTER) - .sized(0.94F, 1.9F) - .build("arachne")); - public static final RegistryObject> ARION = ENTITY_TYPES.register("arion", () -> - EntityType.Builder.of(Arion::new, MobCategory.CREATURE) - .sized(1.39F, 1.98F) - .build("arion")); - public static final RegistryObject> BABY_SPIDER = ENTITY_TYPES.register("baby_spider", () -> - EntityType.Builder.of(BabySpider::new, MobCategory.MONSTER) - .sized(0.5F, 0.65F) - .build("baby_spider")); - public static final RegistryObject> BRONZE_BULL = ENTITY_TYPES.register("bronze_bull", () -> - EntityType.Builder.of(BronzeBull::new, MobCategory.MONSTER) - .sized(1.95F, 2.98F).fireImmune() - .build("bronze_bull")); - public static final RegistryObject> CENTAUR = ENTITY_TYPES.register("centaur", () -> - EntityType.Builder.of(Centaur::new, MobCategory.CREATURE) - .sized(1.39F, 2.49F) - .build("centaur")); - public static final RegistryObject> CERASTES = ENTITY_TYPES.register("cerastes", () -> - EntityType.Builder.of(Cerastes::new, MobCategory.CREATURE) - .sized(0.98F, 0.94F) - .build("cerastes")); - public static final RegistryObject> CERBERUS = ENTITY_TYPES.register("cerberus", () -> - EntityType.Builder.of(Cerberus::new, MobCategory.MONSTER) - .sized(1.98F, 1.9F).fireImmune() - .build("cerberus")); - public static final RegistryObject> CHARYBDIS = ENTITY_TYPES.register("charybdis", () -> - EntityType.Builder.of(Charybdis::new, MobCategory.WATER_CREATURE) - .sized(5.9F, 7.9F).fireImmune() - .build("charybdis")); - public static final RegistryObject> CIRCE = ENTITY_TYPES.register("circe", () -> - EntityType.Builder.of(Circe::new, MobCategory.MONSTER) - .sized(0.67F, 1.8F) - .build("circe")); - public static final RegistryObject> CRETAN_MINOTAUR = ENTITY_TYPES.register("cretan_minotaur", () -> - EntityType.Builder.of(CretanMinotaur::new, MobCategory.MONSTER) - .sized(0.989F, 3.395F).fireImmune() - .build("cretan_minotaur")); - public static final RegistryObject> CYCLOPS = ENTITY_TYPES.register("cyclops", () -> - EntityType.Builder.of(Cyclops::new, MobCategory.MONSTER) - .sized(0.99F, 2.92F) - .build("cyclops")); - public static final RegistryObject> CYPRIAN = ENTITY_TYPES.register("cyprian", () -> - EntityType.Builder.of(Cyprian::new, MobCategory.MONSTER) - .sized(1.39F, 2.49F) - .build("cyprian")); - public static final RegistryObject> DRAKAINA = ENTITY_TYPES.register("drakaina", () -> - EntityType.Builder.of(Drakaina::new, MobCategory.MONSTER) - .sized(0.9F, 1.9F) - .build("drakaina")); - public static final RegistryObject> DRAGON_TOOTH_HOOK = ENTITY_TYPES.register("dragon_tooth_hook", () -> - EntityType.Builder.of(DragonToothHook::new, MobCategory.MISC) - .noSave().noSummon().sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(5) - .build("dragon_tooth_hook")); - public static final RegistryObject> DRYAD = ENTITY_TYPES.register("dryad", () -> - EntityType.Builder.of(Dryad::new, MobCategory.CREATURE) - .sized(0.48F, 1.8F) - .build("dryad")); - public static final RegistryObject> ELPIS = ENTITY_TYPES.register("elpis", () -> - EntityType.Builder.of(Elpis::new, MobCategory.CREATURE) - .sized(0.45F, 0.45F).fireImmune() - .build("elpis")); - public static final RegistryObject> EMPUSA = ENTITY_TYPES.register("empusa", () -> - EntityType.Builder.of(Empusa::new, MobCategory.MONSTER) - .sized(0.67F, 1.8F).fireImmune() - .build("empusa")); - public static final RegistryObject> FURY = ENTITY_TYPES.register("fury", () -> - EntityType.Builder.of(Fury::new, MobCategory.MONSTER) - .sized(0.67F, 1.4F).fireImmune() - .build("fury")); - public static final RegistryObject> GERYON = ENTITY_TYPES.register("geryon", () -> - EntityType.Builder.of(Geryon::new, MobCategory.MONSTER) - .sized(1.98F, 4.96F).fireImmune() - .build("geryon")); - public static final RegistryObject> GIGANTE = ENTITY_TYPES.register("gigante", () -> - EntityType.Builder.of(Gigante::new, MobCategory.CREATURE) - .sized(1.98F, 4.79F) - .build("gigante")); - public static final RegistryObject> GOLDEN_RAM = ENTITY_TYPES.register("golden_ram", () -> - EntityType.Builder.of(GoldenRam::new, MobCategory.CREATURE) - .sized(0.96F, 1.56F) - .build("golden_ram")); - public static final RegistryObject> GORGON = ENTITY_TYPES.register("gorgon", () -> - EntityType.Builder.of(Gorgon::new, MobCategory.MONSTER) - .sized(0.9F, 1.9F) - .build("gorgon")); - public static final RegistryObject> HARPY = ENTITY_TYPES.register("harpy", () -> - EntityType.Builder.of(Harpy::new, MobCategory.MONSTER) - .sized(0.7F, 1.8F) - .build("harpy")); - public static final RegistryObject> HYDRA = ENTITY_TYPES.register("hydra", () -> - EntityType.Builder.of(Hydra::new, MobCategory.MONSTER) - .sized(2.4F, 2.24F).fireImmune() - .build("hydra")); - public static final RegistryObject> HYDRA_HEAD = ENTITY_TYPES.register("hydra_head", () -> - EntityType.Builder.of(HydraHead::new, MobCategory.MISC) - .sized(0.68F, 1.88F).noSummon() - .build("hydra_head")); - public static final RegistryObject> GIANT_BOAR = ENTITY_TYPES.register("giant_boar", () -> - EntityType.Builder.of(GiantBoar::new, MobCategory.MONSTER) - .sized(2.653F, 2.66F) - .build("giant_boar")); - public static final RegistryObject> LAMPAD = ENTITY_TYPES.register("lampad", () -> - EntityType.Builder.of(Lampad::new, MobCategory.CREATURE) - .sized(0.48F, 1.8F).fireImmune() - .build("lampad")); - public static final RegistryObject> MAD_COW = ENTITY_TYPES.register("mad_cow", () -> - EntityType.Builder.of(MadCow::new, MobCategory.MONSTER) - .sized(0.9F, 1.4F) - .build("mad_cow")); - public static final RegistryObject> MAKHAI = ENTITY_TYPES.register("makhai", () -> - EntityType.Builder.of(Makhai::new, MobCategory.CREATURE) - .sized(0.70F, 1.8F) - .build("makhai")); - public static final RegistryObject> MINOTAUR = ENTITY_TYPES.register("minotaur", () -> - EntityType.Builder.of(Minotaur::new, MobCategory.MONSTER) - .sized(0.7F, 1.94F) - .build("minotaur")); - public static final RegistryObject> NAIAD = ENTITY_TYPES.register("naiad", () -> - EntityType.Builder.of(Naiad::new, MobCategory.WATER_CREATURE) - .sized(0.48F, 1.8F) - .build("naiad")); - public static final RegistryObject> NEMEAN_LION = ENTITY_TYPES.register("nemean_lion", () -> - EntityType.Builder.of(NemeanLion::new, MobCategory.MONSTER) - .sized(1.92F, 2.28F).fireImmune() - .build("nemean_lion")); - public static final RegistryObject> ORTHUS = ENTITY_TYPES.register("orthus", () -> - EntityType.Builder.of(Orthus::new, MobCategory.MONSTER) - .sized(0.6F, 0.85F).fireImmune() - .build("orthus")); - public static final RegistryObject> PEGASUS = ENTITY_TYPES.register("pegasus", () -> - EntityType.Builder.of(Pegasus::new, MobCategory.CREATURE) - .sized(1.39F, 1.98F) - .build("pegasus")); - public static final RegistryObject> PYTHON = ENTITY_TYPES.register("python", () -> - EntityType.Builder.of(Python::new, MobCategory.MONSTER) - .sized(1.4F, 1.9F).fireImmune() - .build("python")); - public static final RegistryObject> SATYR = ENTITY_TYPES.register("satyr", () -> - EntityType.Builder.of(Satyr::new, MobCategory.CREATURE) - .sized(0.67F, 1.8F) - .build("satyr")); - public static final RegistryObject> SCYLLA = ENTITY_TYPES.register("scylla", () -> - EntityType.Builder.of(Scylla::new, MobCategory.WATER_CREATURE) - .sized(1.92F, 4.4F).fireImmune() - .build("scylla")); - public static final RegistryObject> SHADE = ENTITY_TYPES.register("shade", () -> - EntityType.Builder.of(Shade::new, MobCategory.MONSTER) - .sized(0.67F, 1.8F).fireImmune() - .build("shade")); - public static final RegistryObject> SIREN = ENTITY_TYPES.register("siren", () -> - EntityType.Builder.of(Siren::new, MobCategory.WATER_CREATURE) - .sized(0.6F, 1.9F) - .build("siren")); - public static final RegistryObject> SPARTI = ENTITY_TYPES.register("sparti", () -> - EntityType.Builder.of(Sparti::new, MobCategory.CREATURE) - .sized(0.6F, 1.98F) - .build("sparti")); - public static final RegistryObject> STYMPHALIAN = ENTITY_TYPES.register("stymphalian", () -> - EntityType.Builder.of(Stymphalian::new, MobCategory.MONSTER) - .sized(0.7F, 0.7F) - .build("stymphalian")); - public static final RegistryObject> TALOS = ENTITY_TYPES.register("talos", () -> - EntityType.Builder.of(Talos::new, MobCategory.MONSTER) - .sized(1.98F, 4.96F).fireImmune() - .build("talos")); - public static final RegistryObject> TRITON = ENTITY_TYPES.register("triton", () -> - EntityType.Builder.of(Triton::new, MobCategory.WATER_CREATURE) - .sized(0.6F, 1.9F) - .build("triton")); - public static final RegistryObject> UNICORN = ENTITY_TYPES.register("unicorn", () -> - EntityType.Builder.of(Unicorn::new, MobCategory.CREATURE) - .sized(1.39F, 1.98F) - .build("unicorn")); - public static final RegistryObject> WHIRL = ENTITY_TYPES.register("whirl", () -> - EntityType.Builder.of(Whirl::new, MobCategory.WATER_CREATURE) - .sized(2.9F, 5.0F) - .build("whirl")); - // other - public static final RegistryObject> BRONZE_FEATHER = ENTITY_TYPES.register("bronze_feather", () -> - EntityType.Builder.of(BronzeFeather::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("bronze_feather")); - public static final RegistryObject> CURSE = ENTITY_TYPES.register("curse", () -> - EntityType.Builder.of(Curse::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("curse")); - public static final RegistryObject> CURSE_OF_CIRCE = ENTITY_TYPES.register("curse_of_circe", () -> - EntityType.Builder.of(CurseOfCirce::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("curse_of_circe")); - public static final RegistryObject> DISCUS = ENTITY_TYPES.register("discus", () -> - EntityType.Builder.of(Discus::new, MobCategory.MISC) - .sized(0.45F, 0.45F).noSummon().clientTrackingRange(4).updateInterval(10) - .build("discus")); - public static final RegistryObject> DRAGON_TOOTH = ENTITY_TYPES.register("dragon_tooth", () -> - EntityType.Builder.of(DragonTooth::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("dragon_tooth")); - public static final RegistryObject> GREEK_FIRE = ENTITY_TYPES.register("greek_fire", () -> - EntityType.Builder.of(GreekFire::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("greek_fire")); - public static final RegistryObject> HEALING_SPELL = ENTITY_TYPES.register("healing_spell", () -> - EntityType.Builder.of(HealingSpell::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("healing_spell")); - public static final RegistryObject> PALLADIUM = ENTITY_TYPES.register("palladium", () -> - EntityType.Builder.of(Palladium::new, MobCategory.MISC) - .sized(0.98F, 2.24F).fireImmune() - .build("palladium")); - public static final RegistryObject> POISON_SPIT = ENTITY_TYPES.register("poison_spit", () -> - EntityType.Builder.of(PoisonSpit::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("poison_spit")); - public static final RegistryObject> SPEAR = ENTITY_TYPES.register("spear", () -> - EntityType.Builder.of(Spear::new, MobCategory.MISC) - .sized(0.5F, 0.5F).noSummon().clientTrackingRange(4).updateInterval(20) - .build("spear")); - public static final RegistryObject> THROWING_AXE = ENTITY_TYPES.register("throwing_axe", () -> - EntityType.Builder.of(ThrowingAxe::new, MobCategory.MISC) - .sized(0.5F, 0.5F).noSummon().clientTrackingRange(4).updateInterval(20) - .build("throwing_axe")); - public static final RegistryObject> WATER_SPELL = ENTITY_TYPES.register("water_spell", () -> - EntityType.Builder.of(WaterSpell::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("water_spell")); - public static final RegistryObject> WEB_BALL = ENTITY_TYPES.register("web_ball", () -> - EntityType.Builder.of(WebBall::new, MobCategory.MISC) - .sized(0.25F, 0.25F).fireImmune().noSummon().clientTrackingRange(4).updateInterval(10) - .build("web_ball")); - } - - public static final class BlockEntityReg { + public static final RegistryObject CURSE_OF_CIRCE = MOB_EFFECTS.register("curse_of_circe", + () -> new CurseOfCirceEffect()); + public static final RegistryObject MIRRORING = MOB_EFFECTS.register("mirroring", + () -> new MirroringEffect()); + public static final RegistryObject PETRIFIED = MOB_EFFECTS.register("petrified", + () -> new StunnedEffect()); + public static final RegistryObject PRISONER_OF_HADES = MOB_EFFECTS + .register("prisoner_of_hades", () -> new PrisonerOfHadesEffect()); + public static final RegistryObject STUNNED = MOB_EFFECTS.register("stunned", + () -> new StunnedEffect()); + public static final RegistryObject SLOW_SWIM = MOB_EFFECTS.register("slow_swim", + () -> new SlowSwimEffect()); - public static void register() { - BLOCK_ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); } - public static final RegistryObject> CERBERUS_HEAD = BLOCK_ENTITY_TYPES.register("cerberus_head", () -> - BlockEntityType.Builder.of((pos, state) -> - new MobHeadBlockEntity(BlockEntityReg.CERBERUS_HEAD.get(), pos, state), - BlockReg.CERBERUS_HEAD.get()) - .build(null) - ); - - public static final RegistryObject> GIGANTE_HEAD = BLOCK_ENTITY_TYPES.register("gigante_head", () -> - BlockEntityType.Builder.of((pos, state) -> - new MobHeadBlockEntity(BlockEntityReg.GIGANTE_HEAD.get(), pos, state), - BlockReg.GIGANTE_HEAD.get()) - .build(null) - ); - - public static final RegistryObject> ORTHUS_HEAD = BLOCK_ENTITY_TYPES.register("orthus_head", () -> - BlockEntityType.Builder.of((pos, state) -> - new MobHeadBlockEntity(BlockEntityReg.ORTHUS_HEAD.get(), pos, state), - BlockReg.ORTHUS_HEAD.get()) - .build(null) - ); - - public static final RegistryObject> VASE = BLOCK_ENTITY_TYPES.register("vase", () -> { - // create set of vase blocks using registry objects - Set vaseBlocks = new HashSet<>(); - vaseBlocks.add(RegistryObject.create(new ResourceLocation(MODID, "terracotta_vase"), ForgeRegistries.BLOCKS).get()); - for (final DyeColor dyeColor : DyeColor.values()) { - vaseBlocks.add(RegistryObject.create(new ResourceLocation(MODID, dyeColor.getSerializedName() + "_terracotta_vase"), ForgeRegistries.BLOCKS).get()); - } - // create block entity type - return BlockEntityType.Builder.of(VaseBlockEntity::new, vaseBlocks.toArray(new Block[0])) - .build(null); - }); - } - - - public static final class PotionReg { + public static final class EnchantmentReg { - public static void register() { - POTIONS.register(FMLJavaModLoadingContext.get().getModEventBus()); - // add setup listener - FMLJavaModLoadingContext.get().getModEventBus().addListener(PotionReg::registerPotionRecipes); - } - - public static final RegistryObject MIRRORING = POTIONS.register("mirroring", - () -> new Potion(new MobEffectInstance(MobEffectReg.MIRRORING.get(), 3600))); - public static final RegistryObject LONG_MIRRORING = POTIONS.register("long_mirroring", - () -> new Potion(new MobEffectInstance(MobEffectReg.MIRRORING.get(), 9600))); - - public static final RegistryObject CURSE_OF_CIRCE = POTIONS.register("curse_of_circe", - () -> new Potion(new MobEffectInstance(MobEffectReg.CURSE_OF_CIRCE.get(), 3600))); - public static final RegistryObject LONG_CURSE_OF_CIRCE = POTIONS.register("long_curse_of_circe", - () -> new Potion(new MobEffectInstance(MobEffectReg.CURSE_OF_CIRCE.get(), 9600))); - - public static final RegistryObject SLOW_SWIM = POTIONS.register("slow_swim", - () -> new Potion(new MobEffectInstance(MobEffectReg.SLOW_SWIM.get(), 3600))); - public static final RegistryObject LONG_SLOW_SWIM = POTIONS.register("long_slow_swim", - () -> new Potion(new MobEffectInstance(MobEffectReg.SLOW_SWIM.get(), 9600))); - - - public static void registerPotionRecipes(final FMLCommonSetupEvent event) { - event.enqueueWork(() -> { - final ItemStack awkward = PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.AWKWARD); - // Mirroring potion - if (GreekFantasy.CONFIG.isMirroringEffectEnabled()) { - // create item stacks - final ItemStack mirroring = PotionUtils.setPotion(new ItemStack(Items.POTION), MIRRORING.get()); - final ItemStack splashMirroring = PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), MIRRORING.get()); - final ItemStack lingeringMirroring = PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), MIRRORING.get()); - // Add brewing recipes - BrewingRecipeRegistry.addRecipe( - Ingredient.of(awkward), - Ingredient.of(new ItemStack(ItemReg.SNAKESKIN.get())), mirroring); - BrewingRecipeRegistry.addRecipe(Ingredient.of(mirroring), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.POTION), LONG_MIRRORING.get())); - BrewingRecipeRegistry.addRecipe(Ingredient.of(mirroring), Ingredient.of(new ItemStack(Items.GUNPOWDER)), splashMirroring); - BrewingRecipeRegistry.addRecipe(Ingredient.of(mirroring), Ingredient.of(new ItemStack(Items.DRAGON_BREATH)), lingeringMirroring); - BrewingRecipeRegistry.addRecipe(Ingredient.of(splashMirroring), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), LONG_MIRRORING.get())); - BrewingRecipeRegistry.addRecipe(Ingredient.of(lingeringMirroring), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), LONG_MIRRORING.get())); + public static void register() { + ENCHANTMENTS.register(FMLJavaModLoadingContext.get().getModEventBus()); } - // Curse of Circe potion - if (GreekFantasy.CONFIG.isCurseOfCirceEnabled()) { - // create item stacks - final ItemStack curseOfCirce = PotionUtils.setPotion(new ItemStack(Items.POTION), CURSE_OF_CIRCE.get()); - final ItemStack splashCurseOfCirce = PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), CURSE_OF_CIRCE.get()); - final ItemStack lingeringCurseOfCirce = PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), CURSE_OF_CIRCE.get()); - // Add brewing recipes - BrewingRecipeRegistry.addRecipe( - Ingredient.of(awkward), - Ingredient.of(new ItemStack(ItemReg.BOAR_EAR.get())), curseOfCirce); - BrewingRecipeRegistry.addRecipe(Ingredient.of(curseOfCirce), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.POTION), LONG_CURSE_OF_CIRCE.get())); - BrewingRecipeRegistry.addRecipe(Ingredient.of(curseOfCirce), Ingredient.of(new ItemStack(Items.GUNPOWDER)), splashCurseOfCirce); - BrewingRecipeRegistry.addRecipe(Ingredient.of(curseOfCirce), Ingredient.of(new ItemStack(Items.DRAGON_BREATH)), lingeringCurseOfCirce); - BrewingRecipeRegistry.addRecipe(Ingredient.of(splashCurseOfCirce), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), LONG_CURSE_OF_CIRCE.get())); - BrewingRecipeRegistry.addRecipe(Ingredient.of(lingeringCurseOfCirce), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), LONG_CURSE_OF_CIRCE.get())); - } - // Slow Swim potion - // create item stacks - final ItemStack slowSwim = PotionUtils.setPotion(new ItemStack(Items.POTION), SLOW_SWIM.get()); - final ItemStack splashSlowSwim = PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), SLOW_SWIM.get()); - final ItemStack lingeringSlowSwim = PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), SLOW_SWIM.get()); - // Add brewing recipes - BrewingRecipeRegistry.addRecipe( - Ingredient.of(PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.TURTLE_MASTER)), - Ingredient.of(new ItemStack(Items.FERMENTED_SPIDER_EYE)), slowSwim); - BrewingRecipeRegistry.addRecipe(Ingredient.of(slowSwim), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.POTION), LONG_SLOW_SWIM.get())); - BrewingRecipeRegistry.addRecipe(Ingredient.of(slowSwim), Ingredient.of(new ItemStack(Items.GUNPOWDER)), splashSlowSwim); - BrewingRecipeRegistry.addRecipe(Ingredient.of(slowSwim), Ingredient.of(new ItemStack(Items.DRAGON_BREATH)), lingeringSlowSwim); - BrewingRecipeRegistry.addRecipe(Ingredient.of(splashSlowSwim), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), LONG_SLOW_SWIM.get())); - BrewingRecipeRegistry.addRecipe(Ingredient.of(lingeringSlowSwim), Ingredient.of(new ItemStack(Items.REDSTONE)), - PotionUtils.setPotion(new ItemStack(Items.LINGERING_POTION), LONG_SLOW_SWIM.get())); - }); - } - - } - public static final class MobEffectReg { + public static final RegistryObject BANE_OF_SERPENTS = ENCHANTMENTS.register( + "bane_of_serpents", () -> new BaneOfSerpentsEnchantment(Enchantment.Rarity.UNCOMMON)); + public static final RegistryObject DAYBREAK = ENCHANTMENTS.register("daybreak", + () -> new DeityEnchantment(Enchantment.Rarity.RARE, EnchantmentCategory.BREAKABLE, + EquipmentSlot.MAINHAND, 1, i -> i.is(Items.CLOCK))); + public static final RegistryObject FLYING = ENCHANTMENTS.register("flying", + () -> new DeityEnchantment(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.ARMOR_FEET, + EquipmentSlot.FEET, 1, i -> i.is(ItemReg.WINGED_SANDALS.get()))); + public static final RegistryObject FIREFLASH = ENCHANTMENTS.register("fireflash", + () -> new DeityEnchantment(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.WEAPON, + EquipmentSlot.MAINHAND, 1, i -> i.is(ItemReg.THUNDERBOLT.get()))); + public static final RegistryObject HUNTING = ENCHANTMENTS.register("hunting", + () -> new HuntingEnchantment(Enchantment.Rarity.COMMON)); + public static final RegistryObject LORD_OF_THE_SEA = ENCHANTMENTS + .register("lord_of_the_sea", + () -> new DeityEnchantment(Enchantment.Rarity.VERY_RARE, + EnchantmentCategory.TRIDENT, EquipmentSlot.MAINHAND, 1, + i -> i.is(Items.TRIDENT))); + public static final RegistryObject MIRRORING = ENCHANTMENTS.register("mirroring", + () -> new MirroringEnchantment(Enchantment.Rarity.UNCOMMON)); + public static final RegistryObject OVERSTEP = ENCHANTMENTS.register("overstep", + () -> new OverstepEnchantment(Enchantment.Rarity.UNCOMMON)); + public static final RegistryObject POISONING = ENCHANTMENTS.register("poisoning", + () -> new PoisoningEnchantment(Enchantment.Rarity.VERY_RARE)); + public static final RegistryObject RAISING = ENCHANTMENTS.register("raising", + () -> new DeityEnchantment(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.WEAPON, + EquipmentSlot.MAINHAND, 1, i -> i.is(ItemReg.BIDENT.get()))); + public static final RegistryObject SILKSTEP = ENCHANTMENTS.register("silkstep", + () -> new SilkstepEnchantment(Enchantment.Rarity.RARE)); + public static final RegistryObject SMASHING = ENCHANTMENTS.register("smashing", + () -> new SmashingEnchantment(Enchantment.Rarity.VERY_RARE)); - public static void register() { - MOB_EFFECTS.register(FMLJavaModLoadingContext.get().getModEventBus()); } - public static final RegistryObject CURSE_OF_CIRCE = MOB_EFFECTS.register("curse_of_circe", () -> new CurseOfCirceEffect()); - public static final RegistryObject MIRRORING = MOB_EFFECTS.register("mirroring", () -> new MirroringEffect()); - public static final RegistryObject PETRIFIED = MOB_EFFECTS.register("petrified", () -> new StunnedEffect()); - public static final RegistryObject PRISONER_OF_HADES = MOB_EFFECTS.register("prisoner_of_hades", () -> new PrisonerOfHadesEffect()); - public static final RegistryObject STUNNED = MOB_EFFECTS.register("stunned", () -> new StunnedEffect()); - public static final RegistryObject SLOW_SWIM = MOB_EFFECTS.register("slow_swim", () -> new SlowSwimEffect()); - - } - + public static final class LootModifierReg { - public static final class EnchantmentReg { - - public static void register() { - ENCHANTMENTS.register(FMLJavaModLoadingContext.get().getModEventBus()); - } + public static void register() { + LOOT_MODIFIER_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - public static final RegistryObject BANE_OF_SERPENTS = ENCHANTMENTS.register("bane_of_serpents", () -> - new BaneOfSerpentsEnchantment(Enchantment.Rarity.UNCOMMON)); - public static final RegistryObject DAYBREAK = ENCHANTMENTS.register("daybreak", () -> - new DeityEnchantment(Enchantment.Rarity.RARE, EnchantmentCategory.BREAKABLE, EquipmentSlot.MAINHAND, 1, i -> i.is(Items.CLOCK))); - public static final RegistryObject FLYING = ENCHANTMENTS.register("flying", () -> - new DeityEnchantment(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.ARMOR_FEET, EquipmentSlot.FEET, 1, i -> i.is(ItemReg.WINGED_SANDALS.get()))); - public static final RegistryObject FIREFLASH = ENCHANTMENTS.register("fireflash", () -> - new DeityEnchantment(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.WEAPON, EquipmentSlot.MAINHAND, 1, i -> i.is(ItemReg.THUNDERBOLT.get()))); - public static final RegistryObject HUNTING = ENCHANTMENTS.register("hunting", () -> - new HuntingEnchantment(Enchantment.Rarity.COMMON)); - public static final RegistryObject LORD_OF_THE_SEA = ENCHANTMENTS.register("lord_of_the_sea", () -> - new DeityEnchantment(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.TRIDENT, EquipmentSlot.MAINHAND, 1, i -> i.is(Items.TRIDENT))); - public static final RegistryObject MIRRORING = ENCHANTMENTS.register("mirroring", () -> - new MirroringEnchantment(Enchantment.Rarity.UNCOMMON)); - public static final RegistryObject OVERSTEP = ENCHANTMENTS.register("overstep", () -> - new OverstepEnchantment(Enchantment.Rarity.UNCOMMON)); - public static final RegistryObject POISONING = ENCHANTMENTS.register("poisoning", () -> - new PoisoningEnchantment(Enchantment.Rarity.VERY_RARE)); - public static final RegistryObject RAISING = ENCHANTMENTS.register("raising", () -> - new DeityEnchantment(Enchantment.Rarity.VERY_RARE, EnchantmentCategory.WEAPON, EquipmentSlot.MAINHAND, 1, i -> i.is(ItemReg.BIDENT.get()))); - public static final RegistryObject SILKSTEP = ENCHANTMENTS.register("silkstep", () -> - new SilkstepEnchantment(Enchantment.Rarity.RARE)); - public static final RegistryObject SMASHING = ENCHANTMENTS.register("smashing", () -> - new SmashingEnchantment(Enchantment.Rarity.VERY_RARE)); - - - } - - public static final class LootModifierReg { + public static final RegistryObject> REPLACE_DROPS_MODIFIER = LOOT_MODIFIER_SERIALIZERS + .register( + "replace_drops", ReplaceDropsLootModifier.CODEC_SUPPLIER); + public static final RegistryObject> BRONZE_SCRAP_MODIFIER = LOOT_MODIFIER_SERIALIZERS + .register( + "bronze_scrap", BronzeScrapLootModifier.CODEC_SUPPLIER); + public static final RegistryObject> QUEST_MODIFIER = LOOT_MODIFIER_SERIALIZERS + .register( + "quest", QuestLootModifier.CODEC_SUPPLIER); - public static void register() { - LOOT_MODIFIER_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus()); } - public static final RegistryObject> REPLACE_DROPS_MODIFIER = LOOT_MODIFIER_SERIALIZERS.register( - "replace_drops", ReplaceDropsLootModifier.CODEC_SUPPLIER); - public static final RegistryObject> BRONZE_SCRAP_MODIFIER = LOOT_MODIFIER_SERIALIZERS.register( - "bronze_scrap", BronzeScrapLootModifier.CODEC_SUPPLIER); - public static final RegistryObject> QUEST_MODIFIER = LOOT_MODIFIER_SERIALIZERS.register( - "quest", QuestLootModifier.CODEC_SUPPLIER); + public static final class RecipeReg { - } - - public static final class RecipeReg { + public static void register() { + RECIPE_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - public static void register() { - RECIPE_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus()); + public static final RegistryObject OLIVE_SALVE = RECIPE_SERIALIZERS + .register(SalveRecipe.Serializer.CATEGORY, () -> new SalveRecipe.Serializer()); } - public static final RegistryObject OLIVE_SALVE = RECIPE_SERIALIZERS.register(SalveRecipe.Serializer.CATEGORY, () -> - new SalveRecipe.Serializer()); - } + public static final class ParticleReg { - public static final class ParticleReg { + public static void register() { + PARTICLE_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - public static void register() { - PARTICLE_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + public static final RegistryObject GORGON = PARTICLE_TYPES.register("gorgon", + () -> new SimpleParticleType(true)); } - public static final RegistryObject GORGON = PARTICLE_TYPES.register("gorgon", () -> - new SimpleParticleType(true)); - } + public static final class StructureProcessorReg { - public static final class StructureProcessorReg { + public static void register() { + FMLJavaModLoadingContext.get().getModEventBus() + .addListener(StructureProcessorReg::registerStructureProcessors); + } - public static void register() { - FMLJavaModLoadingContext.get().getModEventBus().addListener(StructureProcessorReg::registerStructureProcessors); + public static StructureProcessorType LOC_PROCESSOR; + public static StructureProcessorType CENTAUR_PROCESSOR; + public static StructureProcessorType SATYR_PROCESSOR; + public static StructureProcessorType OCEAN_VILLAGE_PROCESSOR; + + private static void registerStructureProcessors(final FMLCommonSetupEvent event) { + event.enqueueWork(() -> { + // register loc processor + ResourceLocation locProcessorId = new ResourceLocation(GreekFantasy.MODID, "loc"); + LOC_PROCESSOR = StructureProcessorType.register(locProcessorId.toString(), + LocStructureProcessor.CODEC); + // register satyr processor + ResourceLocation satyrProcessorId = new ResourceLocation(GreekFantasy.MODID, "satyr"); + SATYR_PROCESSOR = StructureProcessorType.register(satyrProcessorId.toString(), + SatyrStructureProcessor.CODEC); + // register centaur processor + ResourceLocation centaurProcessorId = new ResourceLocation(GreekFantasy.MODID, + "centaur"); + CENTAUR_PROCESSOR = StructureProcessorType.register(centaurProcessorId.toString(), + CentaurStructureProcessor.CODEC); + // register ocean village processor + ResourceLocation oceanVillageProcessorId = new ResourceLocation(GreekFantasy.MODID, + "ocean_village"); + OCEAN_VILLAGE_PROCESSOR = StructureProcessorType.register( + oceanVillageProcessorId.toString(), + OceanVillageStructureProcessor.CODEC); + + }); + } } - public static StructureProcessorType LOC_PROCESSOR; - public static StructureProcessorType CENTAUR_PROCESSOR; - public static StructureProcessorType SATYR_PROCESSOR; - public static StructureProcessorType OCEAN_VILLAGE_PROCESSOR; - - private static void registerStructureProcessors(final FMLCommonSetupEvent event) { - event.enqueueWork(() -> { - // register loc processor - ResourceLocation locProcessorId = new ResourceLocation(GreekFantasy.MODID, "loc"); - LOC_PROCESSOR = StructureProcessorType.register(locProcessorId.toString(), LocStructureProcessor.CODEC); - // register satyr processor - ResourceLocation satyrProcessorId = new ResourceLocation(GreekFantasy.MODID, "satyr"); - SATYR_PROCESSOR = StructureProcessorType.register(satyrProcessorId.toString(), SatyrStructureProcessor.CODEC); - // register centaur processor - ResourceLocation centaurProcessorId = new ResourceLocation(GreekFantasy.MODID, "centaur"); - CENTAUR_PROCESSOR = StructureProcessorType.register(centaurProcessorId.toString(), CentaurStructureProcessor.CODEC); - // register ocean village processor - ResourceLocation oceanVillageProcessorId = new ResourceLocation(GreekFantasy.MODID, "ocean_village"); - OCEAN_VILLAGE_PROCESSOR = StructureProcessorType.register(oceanVillageProcessorId.toString(), OceanVillageStructureProcessor.CODEC); - - }); - } - } + public static final class StructureReg { - public static final class StructureReg { + public static void register() { + STRUCTURE_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + STRUCTURE_PIECE_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - public static void register() { - STRUCTURE_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); - STRUCTURE_PIECE_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + public static final RegistryObject> MAZE = STRUCTURE_TYPES.register("maze", + () -> () -> MazeStructure.CODEC); + public static final RegistryObject MAZE_ROOM = STRUCTURE_PIECE_TYPES + .register("maze", () -> (config, tag) -> new MazePiece(tag)); + public static final RegistryObject> OCEAN_VILLAGE = STRUCTURE_TYPES + .register("ocean_village", () -> () -> OceanVillageStructure.CODEC); } - public static final RegistryObject> MAZE = STRUCTURE_TYPES.register("maze", () -> - () -> MazeStructure.CODEC); - public static final RegistryObject MAZE_ROOM = STRUCTURE_PIECE_TYPES.register("maze", () -> - (config, tag) -> new MazePiece(tag)); - public static final RegistryObject> OCEAN_VILLAGE = STRUCTURE_TYPES.register("ocean_village", () -> - () -> OceanVillageStructure.CODEC); - } + public static final class FeatureReg { - public static final class FeatureReg { + public static void register() { + FEATURES.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - public static void register() { - FEATURES.register(FMLJavaModLoadingContext.get().getModEventBus()); + public static RegistryObject OLIVE_TREE_FEATURE = FEATURES.register("olive_tree", + () -> new OliveTreeFeature(TreeConfiguration.CODEC)); + public static RegistryObject HARPY_NEST_FEATURE = FEATURES.register("harpy_nest", + () -> new HarpyNestFeature(TreeConfiguration.CODEC)); } - public static RegistryObject OLIVE_TREE_FEATURE = FEATURES.register("olive_tree", () -> - new OliveTreeFeature(TreeConfiguration.CODEC)); - public static RegistryObject HARPY_NEST_FEATURE = FEATURES.register("harpy_nest", () -> - new HarpyNestFeature(TreeConfiguration.CODEC)); - } + public static final class PlacementTypeReg { - public static final class PlacementTypeReg { + public static void register() { + PLACEMENT_MODIFIER_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - public static void register() { - PLACEMENT_MODIFIER_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); + public static final RegistryObject> DIMENSION_FILTER = PLACEMENT_MODIFIER_TYPES + .register("dimension", () -> () -> DimensionFilter.CODEC); } - public static final RegistryObject> DIMENSION_FILTER = PLACEMENT_MODIFIER_TYPES.register("dimension", () -> () -> DimensionFilter.CODEC); - } + public static final class StructureModifierReg { - public static final class StructureModifierReg { + public static void register() { + STRUCTURE_MODIFIERS.register(FMLJavaModLoadingContext.get().getModEventBus()); + } - public static void register() { - STRUCTURE_MODIFIERS.register(FMLJavaModLoadingContext.get().getModEventBus()); + public static final RegistryObject> ADD_SPAWNS_MODIFIER = STRUCTURE_MODIFIERS + .register("add_spawn", () -> AddSpawnsStructureModifier.CODEC); } - - public static final RegistryObject> ADD_SPAWNS_MODIFIER = STRUCTURE_MODIFIERS.register("add_spawn", () -> AddSpawnsStructureModifier.CODEC); - } } diff --git a/src/main/java/greekfantasy/block/CerberusHeadBlock.java b/src/main/java/greekfantasy/block/CerberusHeadBlock.java index 9b6bd496..b91ed02d 100644 --- a/src/main/java/greekfantasy/block/CerberusHeadBlock.java +++ b/src/main/java/greekfantasy/block/CerberusHeadBlock.java @@ -1,4 +1,5 @@ package greekfantasy.block; +import net.minecraft.core.registries.Registries; import greekfantasy.blockentity.MobHeadBlockEntity; import net.minecraft.core.BlockPos; diff --git a/src/main/java/greekfantasy/block/MobHeadBlock.java b/src/main/java/greekfantasy/block/MobHeadBlock.java index 0739b37f..3542e214 100644 --- a/src/main/java/greekfantasy/block/MobHeadBlock.java +++ b/src/main/java/greekfantasy/block/MobHeadBlock.java @@ -1,4 +1,5 @@ package greekfantasy.block; +import net.minecraft.core.registries.Registries; import greekfantasy.blockentity.MobHeadBlockEntity; import net.minecraft.core.BlockPos; diff --git a/src/main/java/greekfantasy/block/MysteriousBoxBlock.java b/src/main/java/greekfantasy/block/MysteriousBoxBlock.java index 487e89c1..93244a97 100644 --- a/src/main/java/greekfantasy/block/MysteriousBoxBlock.java +++ b/src/main/java/greekfantasy/block/MysteriousBoxBlock.java @@ -104,7 +104,7 @@ public InteractionResult use(final BlockState state, final Level level, final Bl level.playSound(player, pos, SoundEvents.BARREL_OPEN, SoundSource.BLOCKS, 0.8F + level.getRandom().nextFloat() * 0.4F, 0.8F + level.getRandom().nextFloat() * 0.4F); - if(!player.level.isClientSide() && MysteriousBoxManager.onBoxOpened(level, player, state, pos)) { + if(!player.level().isClientSide() && MysteriousBoxManager.onBoxOpened(level, player, state, pos)) { level.setBlock(pos, state.setValue(OPEN, true), Block.UPDATE_CLIENTS); } return InteractionResult.CONSUME; @@ -127,7 +127,7 @@ public boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, 0.8F + level.getRandom().nextFloat() * 0.4F, 0.8F + level.getRandom().nextFloat() * 0.4F); // open the box and replace with opened variant of block - if(!player.level.isClientSide() && MysteriousBoxManager.onBoxOpened(level, player, state, pos)) { + if(!player.level().isClientSide() && MysteriousBoxManager.onBoxOpened(level, player, state, pos)) { level.setBlock(pos, state.setValue(OPEN, true), Block.UPDATE_CLIENTS); } return false; diff --git a/src/main/java/greekfantasy/block/OliveOilBlock.java b/src/main/java/greekfantasy/block/OliveOilBlock.java index 320587e4..0ee69a6d 100644 --- a/src/main/java/greekfantasy/block/OliveOilBlock.java +++ b/src/main/java/greekfantasy/block/OliveOilBlock.java @@ -218,7 +218,7 @@ public boolean placeLiquid(LevelAccessor level, BlockPos pos, BlockState state, public void entityInside(BlockState state, Level level, BlockPos pos, Entity entityIn) { if (state.getValue(LIT) && !entityIn.fireImmune()) { entityIn.setRemainingFireTicks(level.getRandom().nextInt(5) + 5); - entityIn.hurt(DamageSource.IN_FIRE, this.fireDamage); + entityIn.hurt(level.damageSources().inFire(), this.fireDamage); } super.entityInside(state, level, pos, entityIn); diff --git a/src/main/java/greekfantasy/block/OrthusHeadBlock.java b/src/main/java/greekfantasy/block/OrthusHeadBlock.java index 53214747..6567417e 100644 --- a/src/main/java/greekfantasy/block/OrthusHeadBlock.java +++ b/src/main/java/greekfantasy/block/OrthusHeadBlock.java @@ -1,4 +1,5 @@ package greekfantasy.block; +import net.minecraft.core.registries.Registries; import greekfantasy.blockentity.MobHeadBlockEntity; import net.minecraft.core.BlockPos; diff --git a/src/main/java/greekfantasy/block/PomegranateSaplingBlock.java b/src/main/java/greekfantasy/block/PomegranateSaplingBlock.java index a44cbb70..e07d97a6 100644 --- a/src/main/java/greekfantasy/block/PomegranateSaplingBlock.java +++ b/src/main/java/greekfantasy/block/PomegranateSaplingBlock.java @@ -29,7 +29,7 @@ public void advanceTree(ServerLevel world, BlockPos pos, BlockState state, Rando } else { // explode when not in nether world.removeBlock(pos, false); - world.explode(null, null, null, pos.getX(), pos.getY(), pos.getZ(), 2.0F, true, Explosion.BlockInteraction.DESTROY); + world.explode(null, null, null, pos.getX(), pos.getY(), pos.getZ(), 2.0F, true, Level.ExplosionInteraction.BLOCK); } } } diff --git a/src/main/java/greekfantasy/block/ReedsBlock.java b/src/main/java/greekfantasy/block/ReedsBlock.java index fe6d6a65..ac0ec878 100644 --- a/src/main/java/greekfantasy/block/ReedsBlock.java +++ b/src/main/java/greekfantasy/block/ReedsBlock.java @@ -109,8 +109,8 @@ protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) boolean hasSupport = state.is(Blocks.GRAVEL) || state.is(Blocks.SAND) || super.mayPlaceOn(state, level, pos); if (hasSupport) { final boolean nextToWater = isWater(level, pos.above()) || isNextToWater(level, pos); - final boolean belowReplaceable = level.getBlockState(pos.above(1)).getMaterial().isReplaceable() - && level.getBlockState(pos.above(2)).getMaterial().isReplaceable() + final boolean belowReplaceable = level.getBlockState(pos.above(1)).canBeReplaced() + && level.getBlockState(pos.above(2)).canBeReplaced() && level.getFluidState(pos.above(2)).is(Fluids.EMPTY); return nextToWater && belowReplaceable; } diff --git a/src/main/java/greekfantasy/blockentity/VaseBlockEntity.java b/src/main/java/greekfantasy/blockentity/VaseBlockEntity.java index 9f40d9ca..58068b50 100644 --- a/src/main/java/greekfantasy/blockentity/VaseBlockEntity.java +++ b/src/main/java/greekfantasy/blockentity/VaseBlockEntity.java @@ -60,15 +60,15 @@ public void handleUpdateTag(final CompoundTag tag) { inventoryChanged(); } - //INVENTORY // + // INVENTORY // public NonNullList getInventory() { return this.inventory; } public void dropAllItems() { - if (this.level != null && !this.level.isClientSide()) { - Containers.dropContents(this.level, this.getBlockPos(), this.getInventory()); + if (this.getLevel() != null && !this.getLevel().isClientSide()) { + Containers.dropContents(this.getLevel(), this.getBlockPos(), this.getInventory()); } this.inventoryChanged(); } @@ -111,7 +111,8 @@ public ItemStack getItem(int index) { } /** - * Removes up to a specified number of items from an inventory slot and returns them in a new stack. + * Removes up to a specified number of items from an inventory slot and returns + * them in a new stack. */ @Override public ItemStack removeItem(int index, int count) { @@ -129,7 +130,8 @@ public ItemStack removeItemNoUpdate(int index) { } /** - * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). + * Sets the given item stack to the specified slot in the inventory (can be + * crafting or armor sections). */ @Override public void setItem(int index, ItemStack stack) { @@ -141,10 +143,11 @@ public void setItem(int index, ItemStack stack) { @Override public boolean stillValid(Player player) { - if (this.level.getBlockEntity(this.worldPosition) != this) { + if (this.getLevel().getBlockEntity(this.worldPosition) != this) { return false; } else { - return !(player.distanceToSqr((double) this.worldPosition.getX() + 0.5D, (double) this.worldPosition.getY() + 0.5D, + return !(player.distanceToSqr((double) this.worldPosition.getX() + 0.5D, + (double) this.worldPosition.getY() + 0.5D, (double) this.worldPosition.getZ() + 0.5D) > 64.0D); } } diff --git a/src/main/java/greekfantasy/client/GFClientEvents.java b/src/main/java/greekfantasy/client/GFClientEvents.java index daf2e04c..69e63d18 100644 --- a/src/main/java/greekfantasy/client/GFClientEvents.java +++ b/src/main/java/greekfantasy/client/GFClientEvents.java @@ -1,5 +1,7 @@ package greekfantasy.client; +import net.minecraft.core.registries.Registries; + import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; import greekfantasy.client.armor.HellenicArmorModel; @@ -145,7 +147,10 @@ public final class GFClientEvents { public static final class ForgeHandler { - /** Used in render living event as a replacement for entities that should be rendered as pigs **/ + /** + * Used in render living event as a replacement for entities that should be + * rendered as pigs + **/ private static FakePigRenderer pigRenderer; /** Used in the client tick event to handle movement when riding a pegasus **/ private static boolean wasJumping; @@ -160,17 +165,21 @@ public static final class ForgeHandler { @SubscribeEvent(priority = EventPriority.HIGH) public static void onRenderLiving(final RenderLivingEvent.Pre event) { // cancel rendering when helm of darkness is equipped - if (GreekFantasy.CONFIG.helmHidesArmor() && event.getEntity().getItemBySlot(EquipmentSlot.HEAD).is(GFRegistry.ItemReg.HELM_OF_DARKNESS.get())) { + if (GreekFantasy.CONFIG.helmHidesArmor() && event.getEntity().getItemBySlot(EquipmentSlot.HEAD) + .is(GFRegistry.ItemReg.HELM_OF_DARKNESS.get())) { event.setCanceled(true); return; } // render pig when curse of circe is applied - if (GreekFantasy.CONFIG.isCurseOfCirceEnabled() && event.getEntity().hasEffect(GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get())) { + if (GreekFantasy.CONFIG.isCurseOfCirceEnabled() + && event.getEntity().hasEffect(GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get())) { // lazy-load pig renderer if (null == pigRenderer) { Minecraft mc = Minecraft.getInstance(); - EntityRendererProvider.Context context = new EntityRendererProvider.Context(mc.getEntityRenderDispatcher(), - mc.getItemRenderer(), mc.getBlockRenderer(), mc.gameRenderer.itemInHandRenderer, mc.getResourceManager(), mc.getEntityModels(), mc.font); + EntityRendererProvider.Context context = new EntityRendererProvider.Context( + mc.getEntityRenderDispatcher(), + mc.getItemRenderer(), mc.getBlockRenderer(), mc.gameRenderer.itemInHandRenderer, + mc.getResourceManager(), mc.getEntityModels(), mc.font); pigRenderer = new FakePigRenderer<>(context); } // render pig @@ -192,10 +201,11 @@ public static void onRenderLiving(final RenderLivingEvent.Pre event) { @SubscribeEvent(priority = EventPriority.HIGH) public static void onRenderHand(final RenderHandEvent event) { final Minecraft mc = Minecraft.getInstance(); - if(null == mc.player) { + if (null == mc.player) { return; } - if (GreekFantasy.CONFIG.helmHidesArmor() && mc.player.getItemBySlot(EquipmentSlot.HEAD).is(GFRegistry.ItemReg.HELM_OF_DARKNESS.get())) { + if (GreekFantasy.CONFIG.helmHidesArmor() + && mc.player.getItemBySlot(EquipmentSlot.HEAD).is(GFRegistry.ItemReg.HELM_OF_DARKNESS.get())) { event.setCanceled(true); return; } @@ -215,7 +225,7 @@ public static void onRenderHand(final RenderHandEvent event) { public static void onClientTick(final TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) { final Minecraft mc = Minecraft.getInstance(); - if (mc.player != null && mc.player.isRidingJumpable() && mc.player.getVehicle() instanceof Pegasus pegasus) { + if (mc.player != null && mc.player.isPassenger() && mc.player.getVehicle() instanceof Pegasus pegasus) { mc.player.jumpRidingTicks = -10; if (mc.player.input.jumping && !wasJumping) { // if starting to jump, set flag @@ -230,7 +240,8 @@ public static void onClientTick(final TickEvent.ClientTickEvent event) { } /** - * This method enables or disabled autojump based on the level of Overstep enchantment + * This method enables or disabled autojump based on the level of Overstep + * enchantment * on the player feet item. * * @param event the player tick event (only handles TickEvent.Phase.START) @@ -243,7 +254,8 @@ public static void onPlayerTick(final TickEvent.PlayerTickEvent event) { final Minecraft mc = Minecraft.getInstance(); ItemStack feet = player.getItemBySlot(EquipmentSlot.FEET); // check if the player is wearing an item with overstep enchantment in feet slot - final boolean hasOverstep = !feet.isEmpty() && feet.isDamageableItem() && feet.getMaxDamage() - feet.getDamageValue() > WingedSandalsItem.BROKEN + final boolean hasOverstep = !feet.isEmpty() && feet.isDamageableItem() + && feet.getMaxDamage() - feet.getDamageValue() > WingedSandalsItem.BROKEN && feet.getEnchantmentLevel(GFRegistry.EnchantmentReg.OVERSTEP.get()) > 0; // if the player has overstep and is not sneaking, disable autojump if (hasOverstep && !player.isCrouching() && player.isAutoJumpEnabled()) { @@ -269,15 +281,19 @@ public static void registerPlayerLayers(final EntityRenderersEvent.AddLayers eve // add layer renders to default model if (event.getSkin("default") instanceof PlayerRenderer playerRenderer) { playerRenderer.addLayer(new NemeanLionHideLayer<>(playerRenderer, - new NemeanArmorModel<>(event.getEntityModels().bakeLayer(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE)), - new NemeanArmorModel<>(event.getEntityModels().bakeLayer(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE)))); + new NemeanArmorModel<>( + event.getEntityModels().bakeLayer(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE)), + new NemeanArmorModel<>( + event.getEntityModels().bakeLayer(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE)))); playerRenderer.addLayer(new PlayerSoulFireLayer<>(playerRenderer)); } // add layer renders to slim model if (event.getSkin("slim") instanceof PlayerRenderer playerRenderer) { playerRenderer.addLayer(new NemeanLionHideLayer<>(playerRenderer, - new NemeanArmorModel<>(event.getEntityModels().bakeLayer(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE)), - new NemeanArmorModel<>(event.getEntityModels().bakeLayer(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE)))); + new NemeanArmorModel<>( + event.getEntityModels().bakeLayer(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE)), + new NemeanArmorModel<>( + event.getEntityModels().bakeLayer(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE)))); playerRenderer.addLayer(new PlayerSoulFireLayer<>(playerRenderer)); } } @@ -286,8 +302,10 @@ public static void registerPlayerLayers(final EntityRenderersEvent.AddLayers eve public static void registerEntityLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) { // register layer definitions // armor - event.registerLayerDefinition(HellenicArmorModel.HELLENIC_ARMOR_MODEL_RESOURCE, HellenicArmorModel::createBodyLayer); - event.registerLayerDefinition(WingedSandalsModel.WINGED_SANDALS_MODEL_RESOURCE, WingedSandalsModel::createBodyLayer); + event.registerLayerDefinition(HellenicArmorModel.HELLENIC_ARMOR_MODEL_RESOURCE, + HellenicArmorModel::createBodyLayer); + event.registerLayerDefinition(WingedSandalsModel.WINGED_SANDALS_MODEL_RESOURCE, + WingedSandalsModel::createBodyLayer); // creature event.registerLayerDefinition(AraModel.ARA_MODEL_RESOURCE, AraModel::createBodyLayer); event.registerLayerDefinition(ArachneModel.ARACHNE_MODEL_RESOURCE, ArachneModel::createBodyLayer); @@ -305,8 +323,10 @@ public static void registerEntityLayerDefinitions(EntityRenderersEvent.RegisterL event.registerLayerDefinition(ElpisModel.ELPIS_MODEL_RESOURCE, ElpisModel::createBodyLayer); event.registerLayerDefinition(EmpusaModel.EMPUSA_MODEL_RESOURCE, EmpusaModel::createBodyLayer); event.registerLayerDefinition(FuryModel.FURY_MODEL_RESOURCE, FuryModel::createBodyLayer); - event.registerLayerDefinition(GeryonModel.GERYON_MODEL_RESOURCE, () -> GeryonModel.createBodyLayer(CubeDeformation.NONE)); - event.registerLayerDefinition(GeryonModel.GERYON_ARMOR_MODEL_RESOURCE, () -> GeryonModel.createBodyLayer(new CubeDeformation(0.25F))); + event.registerLayerDefinition(GeryonModel.GERYON_MODEL_RESOURCE, + () -> GeryonModel.createBodyLayer(CubeDeformation.NONE)); + event.registerLayerDefinition(GeryonModel.GERYON_ARMOR_MODEL_RESOURCE, + () -> GeryonModel.createBodyLayer(new CubeDeformation(0.25F))); event.registerLayerDefinition(GiganteModel.GIGANTE_MODEL_RESOURCE, GiganteModel::createBodyLayer); event.registerLayerDefinition(GoldenRamModel.RAM_MODEL_RESOURCE, GoldenRamModel::createBodyLayer); event.registerLayerDefinition(GorgonModel.GORGON_MODEL_RESOURCE, GorgonModel::createBodyLayer); @@ -316,23 +336,28 @@ public static void registerEntityLayerDefinitions(EntityRenderersEvent.RegisterL event.registerLayerDefinition(HydraHeadModel.HYDRA_HEAD_MODEL_RESOURCE, HydraHeadModel::createBodyLayer); event.registerLayerDefinition(MakhaiModel.MAKHAI_MODEL_RESOURCE, MakhaiModel::createBodyLayer); event.registerLayerDefinition(MinotaurModel.MINOTAUR_MODEL_RESOURCE, MinotaurModel::createBodyLayer); - event.registerLayerDefinition(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE, NemeanArmorModel::createBodyLayer); + event.registerLayerDefinition(NemeanArmorModel.NEMEAN_ARMOR_MODEL_RESOURCE, + NemeanArmorModel::createBodyLayer); event.registerLayerDefinition(NemeanLionModel.NEMEAN_LION_MODEL_RESOURCE, NemeanLionModel::createBodyLayer); event.registerLayerDefinition(NymphModel.NYMPH_LAYER_LOCATION, NymphModel::createBodyLayer); event.registerLayerDefinition(OrthusModel.ORTHUS_MODEL_RESOURCE, OrthusModel::createBodyLayer); event.registerLayerDefinition(PalladiumModel.PALLADIUM_MODEL_RESOURCE, PalladiumModel::createBodyLayer); event.registerLayerDefinition(PegasusModel.PEGASUS_MODEL_RESOURCE, PegasusModel::createBodyLayer); event.registerLayerDefinition(PythonModel.PYTHON_MODEL_RESOURCE, PythonModel::createBodyLayer); - event.registerLayerDefinition(SatyrModel.SATYR_MODEL_RESOURCE, () -> SatyrModel.createBodyLayer(CubeDeformation.NONE)); - event.registerLayerDefinition(SatyrModel.SATYR_INNER_ARMOR_MODEL_RESOURCE, () -> SatyrModel.createBodyLayer(new CubeDeformation(0.25F))); + event.registerLayerDefinition(SatyrModel.SATYR_MODEL_RESOURCE, + () -> SatyrModel.createBodyLayer(CubeDeformation.NONE)); + event.registerLayerDefinition(SatyrModel.SATYR_INNER_ARMOR_MODEL_RESOURCE, + () -> SatyrModel.createBodyLayer(new CubeDeformation(0.25F))); event.registerLayerDefinition(ScyllaModel.SCYLLA_MODEL_RESOURCE, ScyllaModel::createBodyLayer); event.registerLayerDefinition(ShadeModel.SHADE_MODEL_RESOURCE, ShadeModel::createBodyLayer); event.registerLayerDefinition(SirenModel.SIREN_MODEL_RESOURCE, SirenModel::createBodyLayer); - event.registerLayerDefinition(StymphalianModel.STYMPHALIAN_MODEL_RESOURCE, StymphalianModel::createBodyLayer); + event.registerLayerDefinition(StymphalianModel.STYMPHALIAN_MODEL_RESOURCE, + StymphalianModel::createBodyLayer); event.registerLayerDefinition(TritonModel.TRITON_MODEL_RESOURCE, TritonModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.UNICORN_MODEL_RESOURCE, UnicornModel::createBodyLayer); // other - event.registerLayerDefinition(CerberusHeadModel.CERBERUS_HEAD_MODEL_RESOURCE, CerberusHeadModel::createLayer); + event.registerLayerDefinition(CerberusHeadModel.CERBERUS_HEAD_MODEL_RESOURCE, + CerberusHeadModel::createLayer); event.registerLayerDefinition(GiganteHeadModel.GIGANTE_HEAD_MODEL_RESOURCE, GiganteHeadModel::createLayer); event.registerLayerDefinition(OrthusHeadModel.ORTHUS_HEAD_MODEL_RESOURCE, OrthusHeadModel::createLayer); event.registerLayerDefinition(SpearModel.SPEAR_MODEL_RESOURCE, TridentModel::createLayer); @@ -392,12 +417,14 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer // other event.registerEntityRenderer(GFRegistry.EntityReg.BRONZE_FEATHER.get(), ThrownItemRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.CURSE.get(), SpellRenderer.CurseRenderer::new); - event.registerEntityRenderer(GFRegistry.EntityReg.CURSE_OF_CIRCE.get(), SpellRenderer.CurseOfCirceRenderer::new); + event.registerEntityRenderer(GFRegistry.EntityReg.CURSE_OF_CIRCE.get(), + SpellRenderer.CurseOfCirceRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.DISCUS.get(), ThrownItemRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.DRAGON_TOOTH.get(), ThrownItemRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.DRAGON_TOOTH_HOOK.get(), DragonToothHookRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.GREEK_FIRE.get(), ThrownItemRenderer::new); - event.registerEntityRenderer(GFRegistry.EntityReg.HEALING_SPELL.get(), SpellRenderer.HealingSpellRenderer::new); + event.registerEntityRenderer(GFRegistry.EntityReg.HEALING_SPELL.get(), + SpellRenderer.HealingSpellRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.PALLADIUM.get(), PalladiumRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.POISON_SPIT.get(), SpellRenderer.PoisonSpitRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.SPEAR.get(), SpearRenderer::new); @@ -405,9 +432,12 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer event.registerEntityRenderer(GFRegistry.EntityReg.WATER_SPELL.get(), SpellRenderer.WaterSpellRenderer::new); event.registerEntityRenderer(GFRegistry.EntityReg.WEB_BALL.get(), ThrownItemRenderer::new); // register block entities - event.registerBlockEntityRenderer(GFRegistry.BlockEntityReg.CERBERUS_HEAD.get(), CerberusHeadBlockEntityRenderer::new); - event.registerBlockEntityRenderer(GFRegistry.BlockEntityReg.GIGANTE_HEAD.get(), GiganteHeadBlockEntityRenderer::new); - event.registerBlockEntityRenderer(GFRegistry.BlockEntityReg.ORTHUS_HEAD.get(), OrthusHeadBlockEntityRenderer::new); + event.registerBlockEntityRenderer(GFRegistry.BlockEntityReg.CERBERUS_HEAD.get(), + CerberusHeadBlockEntityRenderer::new); + event.registerBlockEntityRenderer(GFRegistry.BlockEntityReg.GIGANTE_HEAD.get(), + GiganteHeadBlockEntityRenderer::new); + event.registerBlockEntityRenderer(GFRegistry.BlockEntityReg.ORTHUS_HEAD.get(), + OrthusHeadBlockEntityRenderer::new); event.registerBlockEntityRenderer(GFRegistry.BlockEntityReg.VASE.get(), VaseBlockEntityRenderer::new); } @@ -420,9 +450,13 @@ public static void registerEntityRenderers(EntityRenderersEvent.RegisterRenderer @SubscribeEvent public static void registerBlockColors(final RegisterColorHandlersEvent.Block event) { event.register((BlockState stateIn, BlockAndTintGetter level, BlockPos pos, int tintIndex) -> 0xD8E3D0, - RegistryObject.create(new ResourceLocation(GreekFantasy.MODID, "olive_leaves"), ForgeRegistries.BLOCKS).get()); + RegistryObject + .create(new ResourceLocation(GreekFantasy.MODID, "olive_leaves"), ForgeRegistries.BLOCKS) + .get()); event.register((BlockState stateIn, BlockAndTintGetter level, BlockPos pos, int tintIndex) -> 0x80f66b, - RegistryObject.create(new ResourceLocation(GreekFantasy.MODID, "golden_leaves"), ForgeRegistries.BLOCKS).get()); + RegistryObject + .create(new ResourceLocation(GreekFantasy.MODID, "golden_leaves"), ForgeRegistries.BLOCKS) + .get()); } /** @@ -434,14 +468,18 @@ public static void registerBlockColors(final RegisterColorHandlersEvent.Block ev @SubscribeEvent public static void registerItemColors(final RegisterColorHandlersEvent.Item event) { event.register((ItemStack item, int tintIndex) -> 0xD8E3D0, - RegistryObject.create(new ResourceLocation(GreekFantasy.MODID, "olive_leaves"), ForgeRegistries.ITEMS).get()); + RegistryObject + .create(new ResourceLocation(GreekFantasy.MODID, "olive_leaves"), ForgeRegistries.ITEMS) + .get()); event.register((ItemStack item, int tintIndex) -> 0x80f66b, - RegistryObject.create(new ResourceLocation(GreekFantasy.MODID, "golden_leaves"), ForgeRegistries.ITEMS).get()); + RegistryObject + .create(new ResourceLocation(GreekFantasy.MODID, "golden_leaves"), ForgeRegistries.ITEMS) + .get()); } @SubscribeEvent public static void registerParticleProviders(final RegisterParticleProvidersEvent event) { - event.register(GFRegistry.ParticleReg.GORGON.get(), new GorgonParticle.Provider()); + event.registerSpecial(GFRegistry.ParticleReg.GORGON.get(), new GorgonParticle.Provider()); } private static void registerModelProperties() { @@ -474,18 +512,24 @@ private static void registerModelProperties() { private static void registerUsingProperties(final Item usingItem, final String propertyName) { ItemProperties.register(usingItem, new ResourceLocation(propertyName), - (item, world, entity, tintIndex) -> (entity != null && entity.isUsingItem() && entity.getUseItem() == item) ? 1.0F : 0.0F); + (item, world, entity, + tintIndex) -> (entity != null && entity.isUsingItem() && entity.getUseItem() == item) ? 1.0F + : 0.0F); } private static void registerBowProperties(final Item bow) { ItemProperties.register(bow, new ResourceLocation("pull"), (item, world, entity, tintIndex) -> { - if (entity == null) return 0.0F; - if (entity.getUseItem() != item) return 0.0F; + if (entity == null) + return 0.0F; + if (entity.getUseItem() != item) + return 0.0F; return (item.getUseDuration() - entity.getUseItemRemainingTicks()) / 20.0F; }); ItemProperties.register(bow, new ResourceLocation("pulling"), - (item, world, entity, tintIndex) -> (entity != null && entity.isUsingItem() && entity.getUseItem() == item) ? 1.0F : 0.0F); + (item, world, entity, + tintIndex) -> (entity != null && entity.isUsingItem() && entity.getUseItem() == item) ? 1.0F + : 0.0F); } private static void registerFishingRodProperties(final Item rod) { @@ -499,14 +543,18 @@ private static void registerFishingRodProperties(final Item rod) { isOffhand = false; } - return (isMainhand || isOffhand) && entity instanceof Player && ((Player)entity).fishing != null ? 1.0F : 0.0F; + return (isMainhand || isOffhand) && entity instanceof Player && ((Player) entity).fishing != null + ? 1.0F + : 0.0F; } }); } private static void registerSpearProperties(final Item spear) { - ItemProperties.register(spear, new ResourceLocation("throwing"), (item, world, entity, tintIndex) -> - (entity != null && entity.isUsingItem() && entity.getUseItem() == item) ? 1.0F : 0.0F); + ItemProperties.register(spear, new ResourceLocation("throwing"), + (item, world, entity, + tintIndex) -> (entity != null && entity.isUsingItem() && entity.getUseItem() == item) ? 1.0F + : 0.0F); } } diff --git a/src/main/java/greekfantasy/client/armor/WingedSandalsModel.java b/src/main/java/greekfantasy/client/armor/WingedSandalsModel.java index b9dcf2af..5885207f 100644 --- a/src/main/java/greekfantasy/client/armor/WingedSandalsModel.java +++ b/src/main/java/greekfantasy/client/armor/WingedSandalsModel.java @@ -65,7 +65,7 @@ public void setupAnim(LivingEntity entity, float limbSwing, float limbSwingAmoun public void setupWingsAnim(LivingEntity entity) { float ageInTicks = entity.tickCount + Minecraft.getInstance().getFrameTime(); // animate wings - final float wingSpeed = entity.isOnGround() ? 0.64F : 1.18F; + final float wingSpeed = entity.onGround() ? 0.64F : 1.18F; final float wingSpan = 0.76854F; final float wingAngle = wingSpan - Mth.cos((ageInTicks + entity.getId()) * wingSpeed) * wingSpan * 0.65F; this.rightWing.yRot = wingAngle; diff --git a/src/main/java/greekfantasy/client/blockentity/CerberusHeadBlockEntityRenderer.java b/src/main/java/greekfantasy/client/blockentity/CerberusHeadBlockEntityRenderer.java index 298433e2..70691d55 100644 --- a/src/main/java/greekfantasy/client/blockentity/CerberusHeadBlockEntityRenderer.java +++ b/src/main/java/greekfantasy/client/blockentity/CerberusHeadBlockEntityRenderer.java @@ -15,6 +15,7 @@ import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class CerberusHeadBlockEntityRenderer extends MobHeadBlockEntityRenderer { @@ -60,12 +61,12 @@ public void onResourceManagerReload(ResourceManager resourceManager) { } @Override - public void renderByItem(ItemStack item, ItemTransforms.TransformType transform, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLightIn, int combinedOverlayIn) { + public void renderByItem(ItemStack item, ItemDisplayContext transform, PoseStack poseStack, MultiBufferSource bufferSource, int light, int overlay) { poseStack.pushPose(); poseStack.translate(-4.0F / 16.0F, 3.0F / 16.0F, 0.0F); poseStack.scale(-1.0F, -1.0F, 1.0F); VertexConsumer vertexBuilder = ItemRenderer.getFoilBufferDirect(bufferSource, this.model.renderType(TEXTURE), false, item.hasFoil()); - model.renderToBuffer(poseStack, vertexBuilder, combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + model.renderToBuffer(poseStack, vertexBuilder, light, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); poseStack.popPose(); } } diff --git a/src/main/java/greekfantasy/client/blockentity/GiganteHeadBlockEntityRenderer.java b/src/main/java/greekfantasy/client/blockentity/GiganteHeadBlockEntityRenderer.java index 98dea7ea..16e8d324 100644 --- a/src/main/java/greekfantasy/client/blockentity/GiganteHeadBlockEntityRenderer.java +++ b/src/main/java/greekfantasy/client/blockentity/GiganteHeadBlockEntityRenderer.java @@ -16,6 +16,7 @@ import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class GiganteHeadBlockEntityRenderer extends MobHeadBlockEntityRenderer { @@ -62,12 +63,12 @@ public void onResourceManagerReload(ResourceManager resourceManager) { } @Override - public void renderByItem(ItemStack item, ItemTransforms.TransformType transform, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLightIn, int combinedOverlayIn) { + public void renderByItem(ItemStack item, ItemDisplayContext transform, PoseStack poseStack, MultiBufferSource bufferSource, int light, int overlay) { poseStack.pushPose(); poseStack.translate(0.0F, 4.0F / 16.0F, 0.0F); poseStack.scale(-1.0F, -1.0F, 1.0F); VertexConsumer vertexBuilder = ItemRenderer.getFoilBufferDirect(bufferSource, this.model.renderType(TEXTURE), false, item.hasFoil()); - model.renderToBuffer(poseStack, vertexBuilder, combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + model.renderToBuffer(poseStack, vertexBuilder, light, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); poseStack.popPose(); } } diff --git a/src/main/java/greekfantasy/client/blockentity/MobHeadBlockEntityRenderer.java b/src/main/java/greekfantasy/client/blockentity/MobHeadBlockEntityRenderer.java index 0d1782b1..8125c302 100644 --- a/src/main/java/greekfantasy/client/blockentity/MobHeadBlockEntityRenderer.java +++ b/src/main/java/greekfantasy/client/blockentity/MobHeadBlockEntityRenderer.java @@ -2,7 +2,8 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Vector3f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.block.MobHeadBlock; import greekfantasy.blockentity.MobHeadBlockEntity; import net.minecraft.client.model.Model; @@ -34,8 +35,8 @@ public void render(MobHeadBlockEntity blockEntity, float partialTicks, PoseStack // apply wall rotations, if any poseStack.translate(0.5D, 1.0F, 0.5D); - poseStack.mulPose(Vector3f.XP.rotationDegrees(180.0F)); - poseStack.mulPose(Vector3f.YP.rotationDegrees(rotation)); + poseStack.mulPose(Axis.XP.rotationDegrees(180.0F)); + poseStack.mulPose(Axis.YP.rotationDegrees(rotation)); applyRotations(poseStack, blockEntity.onWall()); poseStack.scale(scale, scale, scale); VertexConsumer vertexBuilder = bufferSource.getBuffer(RenderType.entityCutoutNoCull(texture)); diff --git a/src/main/java/greekfantasy/client/blockentity/OrthusHeadBlockEntityRenderer.java b/src/main/java/greekfantasy/client/blockentity/OrthusHeadBlockEntityRenderer.java index cf2d9838..82129a7f 100644 --- a/src/main/java/greekfantasy/client/blockentity/OrthusHeadBlockEntityRenderer.java +++ b/src/main/java/greekfantasy/client/blockentity/OrthusHeadBlockEntityRenderer.java @@ -15,6 +15,7 @@ import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; public class OrthusHeadBlockEntityRenderer extends MobHeadBlockEntityRenderer { @@ -65,12 +66,12 @@ public void onResourceManagerReload(ResourceManager resourceManager) { } @Override - public void renderByItem(ItemStack item, ItemTransforms.TransformType transform, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLightIn, int combinedOverlayIn) { + public void renderByItem(ItemStack item, ItemDisplayContext transform, PoseStack poseStack, MultiBufferSource bufferSource, int light, int overlay) { poseStack.pushPose(); poseStack.translate(0.0F, 0.0F, -2.0F / 16.0F); poseStack.scale(-1.0F, -1.0F, 1.0F); VertexConsumer vertexBuilder = ItemRenderer.getFoilBufferDirect(bufferSource, this.model.renderType(TEXTURE), false, item.hasFoil()); - model.renderToBuffer(poseStack, vertexBuilder, combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + model.renderToBuffer(poseStack, vertexBuilder, light, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); poseStack.popPose(); } } diff --git a/src/main/java/greekfantasy/client/blockentity/VaseBlockEntityRenderer.java b/src/main/java/greekfantasy/client/blockentity/VaseBlockEntityRenderer.java index 64ea9ce3..1ec6fecb 100644 --- a/src/main/java/greekfantasy/client/blockentity/VaseBlockEntityRenderer.java +++ b/src/main/java/greekfantasy/client/blockentity/VaseBlockEntityRenderer.java @@ -1,8 +1,9 @@ package greekfantasy.client.blockentity; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Matrix4f; -import com.mojang.math.Vector3f; +import org.joml.Matrix4f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.GreekFantasy; import greekfantasy.block.VaseBlock; import greekfantasy.blockentity.VaseBlockEntity; @@ -10,6 +11,7 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.client.renderer.entity.EntityRenderDispatcher; @@ -43,11 +45,11 @@ public void render(VaseBlockEntity vaseBlockEntity, float partialTicks, PoseStac poseStack.pushPose(); // transforms poseStack.translate(0.5D, 0.70D, 0.5D); - poseStack.mulPose(Vector3f.YN.rotationDegrees(rotation)); + poseStack.mulPose(Axis.YN.rotationDegrees(rotation)); poseStack.scale(scale, scale, scale); // render the item stack - Minecraft.getInstance().getItemRenderer().renderStatic(itemstack, ItemTransforms.TransformType.FIXED, packedLight, - OverlayTexture.NO_OVERLAY, poseStack, bufferSource, 0); + Minecraft.getInstance().getItemRenderer().renderStatic(itemstack, ItemDisplayContext.FIXED, packedLight, + OverlayTexture.NO_OVERLAY, poseStack, bufferSource, vaseBlockEntity.getLevel(), 0); // finish rendering poseStack.popPose(); // render nameplate @@ -65,7 +67,7 @@ protected boolean shouldRenderName(final BlockEntity blockEntity) { if(renderManager.distanceToSqr(pos.x, pos.y, pos.z) < (distance * distance) && mc.hitResult != null && mc.hitResult.getType() == HitResult.Type.BLOCK) { - BlockPos blockPos = new BlockPos(mc.hitResult.getLocation()); + BlockPos blockPos = BlockPos.containing(mc.hitResult.getLocation()); BlockState blockState = blockEntity.getLevel().getBlockState(blockPos); return blockPos.equals(blockEntity.getBlockPos()) && blockState.is(blockEntity.getBlockState().getBlock()); } @@ -86,8 +88,8 @@ protected void renderNameTag(VaseBlockEntity blockEntity, Component name, PoseSt int j = (int)(f1 * 255.0F) << 24; Font font = context.getFont(); float f2 = (float)(-font.width(name) / 2); - font.drawInBatch(name, f2, 0.0F, 553648127, false, matrix4f, multiBufferSource, true, j, packedLight); - font.drawInBatch(name, f2, 0.0F, -1, false, matrix4f, multiBufferSource, false, 0, packedLight); + font.drawInBatch(name, f2, 0.0F, 553648127, false, matrix4f, multiBufferSource, Font.DisplayMode.NORMAL, j, packedLight); + font.drawInBatch(name, f2, 0.0F, -1, false, matrix4f, multiBufferSource, Font.DisplayMode.NORMAL, 0, packedLight); poseStack.popPose(); } diff --git a/src/main/java/greekfantasy/client/entity/CentaurRenderer.java b/src/main/java/greekfantasy/client/entity/CentaurRenderer.java index 32b71899..9227c97f 100644 --- a/src/main/java/greekfantasy/client/entity/CentaurRenderer.java +++ b/src/main/java/greekfantasy/client/entity/CentaurRenderer.java @@ -22,7 +22,7 @@ public class CentaurRenderer extends HumanoidMobRenderer extends HumanoidMobRenderer extends MobRenderer BODY_TEXTURE_MAP.put(Variant.BROWN, new ResourceLocation(GreekFantasy.MODID, "textures/entity/satyr/brown.png")); BODY_TEXTURE_MAP.put(Variant.CHESTNUT, new ResourceLocation(GreekFantasy.MODID, "textures/entity/satyr/chestnut.png")); BODY_TEXTURE_MAP.put(Variant.CREAMY, new ResourceLocation(GreekFantasy.MODID, "textures/entity/satyr/creamy.png")); - BODY_TEXTURE_MAP.put(Variant.DARKBROWN, new ResourceLocation(GreekFantasy.MODID, "textures/entity/satyr/darkbrown.png")); + BODY_TEXTURE_MAP.put(Variant.DARK_BROWN, new ResourceLocation(GreekFantasy.MODID, "textures/entity/satyr/darkbrown.png")); BODY_TEXTURE_MAP.put(Variant.GRAY, new ResourceLocation(GreekFantasy.MODID, "textures/entity/satyr/gray.png")); BODY_TEXTURE_MAP.put(Variant.WHITE, new ResourceLocation(GreekFantasy.MODID, "textures/entity/satyr/white.png")); } diff --git a/src/main/java/greekfantasy/client/entity/SpartiRenderer.java b/src/main/java/greekfantasy/client/entity/SpartiRenderer.java index ee9a603d..91519973 100644 --- a/src/main/java/greekfantasy/client/entity/SpartiRenderer.java +++ b/src/main/java/greekfantasy/client/entity/SpartiRenderer.java @@ -21,7 +21,7 @@ public SpartiRenderer(EntityRendererProvider.Context context) { public SpartiRenderer(EntityRendererProvider.Context context, ModelLayerLocation model, ModelLayerLocation innerArmor, ModelLayerLocation outerArmor) { super(context, new SkeletonModel<>(context.bakeLayer(model)), 0.5F); - this.addLayer(new HumanoidArmorLayer<>(this, new SkeletonModel<>(context.bakeLayer(innerArmor)), new SkeletonModel<>(context.bakeLayer(outerArmor)))); + this.addLayer(new HumanoidArmorLayer<>(this, new SkeletonModel<>(context.bakeLayer(innerArmor)), new SkeletonModel<>(context.bakeLayer(outerArmor)), context.getModelManager())); this.addLayer(new SpartiClothingLayer<>(this, context.getModelSet())); } diff --git a/src/main/java/greekfantasy/client/entity/SpearRenderer.java b/src/main/java/greekfantasy/client/entity/SpearRenderer.java index 66f4faf6..2a4b39ce 100644 --- a/src/main/java/greekfantasy/client/entity/SpearRenderer.java +++ b/src/main/java/greekfantasy/client/entity/SpearRenderer.java @@ -2,7 +2,8 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Vector3f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.client.entity.model.SpearModel; import greekfantasy.entity.misc.Spear; import net.minecraft.client.model.geom.EntityModelSet; @@ -14,6 +15,7 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider; import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.Mth; @@ -32,8 +34,8 @@ public SpearRenderer(EntityRendererProvider.Context context) { public void render(T entity, float renderOffsetX, float partialTick, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight) { poseStack.pushPose(); - poseStack.mulPose(Vector3f.YP.rotationDegrees(Mth.lerp(partialTick, entity.yRotO, entity.getYRot()) - 90.0F)); - poseStack.mulPose(Vector3f.ZP.rotationDegrees(Mth.lerp(partialTick, entity.xRotO, entity.getXRot()) + 90.0F)); + poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTick, entity.yRotO, entity.getYRot()) - 90.0F)); + poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTick, entity.xRotO, entity.getXRot()) + 90.0F)); VertexConsumer vertexconsumer = ItemRenderer.getFoilBufferDirect(bufferSource, this.model.renderType(getTextureLocation(entity)), false, entity.hasFoil()); this.model.renderToBuffer(poseStack, vertexconsumer, packedLight, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); @@ -66,11 +68,11 @@ public void onResourceManagerReload(ResourceManager resourceManager) { } @Override - public void renderByItem(ItemStack item, ItemTransforms.TransformType transform, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLightIn, int combinedOverlayIn) { + public void renderByItem(ItemStack item, ItemDisplayContext transform, PoseStack poseStack, MultiBufferSource bufferSource, int light, int overlay) { poseStack.pushPose(); poseStack.scale(-1.0F, -1.0F, 1.0F); VertexConsumer vertexBuilder = ItemRenderer.getFoilBufferDirect(bufferSource, this.spearModel.renderType(texture), false, item.hasFoil()); - spearModel.renderToBuffer(poseStack, vertexBuilder, combinedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); + spearModel.renderToBuffer(poseStack, vertexBuilder, light, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); poseStack.popPose(); } } diff --git a/src/main/java/greekfantasy/client/entity/layer/AraFlintLayer.java b/src/main/java/greekfantasy/client/entity/layer/AraFlintLayer.java index 51cb4d1f..72f1d04a 100644 --- a/src/main/java/greekfantasy/client/entity/layer/AraFlintLayer.java +++ b/src/main/java/greekfantasy/client/entity/layer/AraFlintLayer.java @@ -1,12 +1,14 @@ package greekfantasy.client.entity.layer; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Vector3f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.client.entity.model.AraModel; import greekfantasy.entity.monster.Ara; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.texture.OverlayTexture; @@ -40,12 +42,12 @@ public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int // transforms this.getParentModel().body.translateAndRotate(poseStack); poseStack.translate(tx, ty, tz); - poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); + poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); poseStack.scale(scale, -scale, -scale); - poseStack.mulPose(Vector3f.YP.rotationDegrees(spin)); + poseStack.mulPose(Axis.YP.rotationDegrees(spin)); // render the item stack - Minecraft.getInstance().getItemRenderer().renderStatic(itemStack, ItemTransforms.TransformType.FIXED, - packedLight, OverlayTexture.NO_OVERLAY, poseStack, multiBufferSource, 0); + Minecraft.getInstance().getItemRenderer().renderStatic(itemStack, ItemDisplayContext.FIXED, + packedLight, OverlayTexture.NO_OVERLAY, poseStack, multiBufferSource, entity.level(), entity.getId()); // finish rendering poseStack.popPose(); } diff --git a/src/main/java/greekfantasy/client/entity/layer/EmpusaHairLayer.java b/src/main/java/greekfantasy/client/entity/layer/EmpusaHairLayer.java index b55dd5c5..17a9a81d 100644 --- a/src/main/java/greekfantasy/client/entity/layer/EmpusaHairLayer.java +++ b/src/main/java/greekfantasy/client/entity/layer/EmpusaHairLayer.java @@ -1,7 +1,8 @@ package greekfantasy.client.entity.layer; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Vector3f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.client.entity.model.EmpusaModel; import greekfantasy.entity.monster.Empusa; import net.minecraft.client.Minecraft; @@ -28,7 +29,7 @@ public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int poseStack.pushPose(); this.getParentModel().getHeadPart().translateAndRotate(poseStack); poseStack.translate(0.5D * scale, -0.5, -0.5D * scale); - poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); + poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); poseStack.scale(scale, -scale, -scale); // render fire here // note: packed light flag 15728640 uses world light, 15728880 uses constant/full light diff --git a/src/main/java/greekfantasy/client/entity/layer/HalfHorseLayer.java b/src/main/java/greekfantasy/client/entity/layer/HalfHorseLayer.java index d3279290..d895f249 100644 --- a/src/main/java/greekfantasy/client/entity/layer/HalfHorseLayer.java +++ b/src/main/java/greekfantasy/client/entity/layer/HalfHorseLayer.java @@ -25,7 +25,7 @@ public class HalfHorseLayer, A extends HumanoidModel> extends HumanoidArmorLayer { public NemeanLionHideLayer(RenderLayerParent parent, A model1, A model2) { - super(parent, model1, model2); + super(parent, model1, model2, Minecraft.getInstance().getModelManager()); } @Override diff --git a/src/main/java/greekfantasy/client/entity/layer/PalladiumTorchLayer.java b/src/main/java/greekfantasy/client/entity/layer/PalladiumTorchLayer.java index 3dcf7c9d..a72fa400 100644 --- a/src/main/java/greekfantasy/client/entity/layer/PalladiumTorchLayer.java +++ b/src/main/java/greekfantasy/client/entity/layer/PalladiumTorchLayer.java @@ -1,12 +1,14 @@ package greekfantasy.client.entity.layer; import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Vector3f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.client.entity.model.PalladiumModel; import greekfantasy.entity.Palladium; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.ItemTransforms; +import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.client.renderer.entity.RenderLayerParent; import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.texture.OverlayTexture; @@ -30,12 +32,12 @@ public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int poseStack.pushPose(); // transforms this.getParentModel().translateToHand(HumanoidArm.RIGHT, poseStack); - poseStack.mulPose(Vector3f.XP.rotationDegrees(-90.0F)); - poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0F)); + poseStack.mulPose(Axis.XP.rotationDegrees(-90.0F)); + poseStack.mulPose(Axis.YP.rotationDegrees(180.0F)); poseStack.translate(1.0F / 16.0F, 0.125D, -0.625D); // render the item stack - Minecraft.getInstance().getItemRenderer().renderStatic(entity, itemStack, ItemTransforms.TransformType.THIRD_PERSON_RIGHT_HAND, - false, poseStack, multiBufferSource, entity.level, packedLightIn, OverlayTexture.NO_OVERLAY, 0); + Minecraft.getInstance().getItemRenderer().renderStatic(entity, itemStack, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, + false, poseStack, multiBufferSource, entity.level(), packedLightIn, OverlayTexture.NO_OVERLAY, 0); // finish rendering poseStack.popPose(); } diff --git a/src/main/java/greekfantasy/client/entity/layer/PegasusWingLayer.java b/src/main/java/greekfantasy/client/entity/layer/PegasusWingLayer.java index 6645a047..cb3db455 100644 --- a/src/main/java/greekfantasy/client/entity/layer/PegasusWingLayer.java +++ b/src/main/java/greekfantasy/client/entity/layer/PegasusWingLayer.java @@ -23,7 +23,7 @@ public class PegasusWingLayer extends RenderLayer bodyParts() { public void translateToHand(HumanoidArm arm, PoseStack poseStack) { this.body.translateAndRotate(poseStack); this.item.translateAndRotate(poseStack); - poseStack.mulPose(Vector3f.XP.rotation(-0.53633232F)); + poseStack.mulPose(Axis.XP.rotation(-0.53633232F)); poseStack.scale(0.7F, 0.7F, 0.7F); } diff --git a/src/main/java/greekfantasy/client/entity/model/NymphModel.java b/src/main/java/greekfantasy/client/entity/model/NymphModel.java index 43dd1cda..215cede6 100644 --- a/src/main/java/greekfantasy/client/entity/model/NymphModel.java +++ b/src/main/java/greekfantasy/client/entity/model/NymphModel.java @@ -2,7 +2,8 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Vector3f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.GreekFantasy; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -75,7 +76,7 @@ public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, i // translate and rotate based on swim amount if (swimAmount > 0.0F) { poseStack.translate(0.0D, swimAmount * 1.375D, swimAmount * -0.4D); - poseStack.mulPose(Vector3f.XP.rotationDegrees(swimAmount * 90.0F)); + poseStack.mulPose(Axis.XP.rotationDegrees(swimAmount * 90.0F)); } // render model super.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); diff --git a/src/main/java/greekfantasy/client/entity/model/TritonModel.java b/src/main/java/greekfantasy/client/entity/model/TritonModel.java index 59b748cc..7d603e6e 100644 --- a/src/main/java/greekfantasy/client/entity/model/TritonModel.java +++ b/src/main/java/greekfantasy/client/entity/model/TritonModel.java @@ -3,7 +3,8 @@ import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Vector3f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.GreekFantasy; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.geom.ModelLayerLocation; @@ -110,7 +111,7 @@ public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, i // translate and rotate based on swim amount if (swimAmount > 0.0F) { poseStack.translate(0.0D, swimAmount * 1.175D, swimAmount * -0.4D); - poseStack.mulPose(Vector3f.XP.rotationDegrees(swimAmount * 90.0F)); + poseStack.mulPose(Axis.XP.rotationDegrees(swimAmount * 90.0F)); } // render model super.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay, red, green, blue, alpha); diff --git a/src/main/java/greekfantasy/client/particle/GorgonParticle.java b/src/main/java/greekfantasy/client/particle/GorgonParticle.java index c18fcea9..7d89995e 100644 --- a/src/main/java/greekfantasy/client/particle/GorgonParticle.java +++ b/src/main/java/greekfantasy/client/particle/GorgonParticle.java @@ -3,7 +3,8 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Vector3f; +import org.joml.Vector3f; +import com.mojang.math.Axis; import greekfantasy.client.entity.GorgonRenderer; import greekfantasy.client.entity.model.GorgonModel; import greekfantasy.entity.monster.Gorgon; @@ -49,7 +50,7 @@ public void render(VertexConsumer buffer, Camera renderInfo, float partialTick) PoseStack poseStack = new PoseStack(); poseStack.mulPose(renderInfo.rotation()); - poseStack.mulPose(Vector3f.XP.rotationDegrees(180.0F)); + poseStack.mulPose(Axis.XP.rotationDegrees(180.0F)); poseStack.scale(-1.0F, 1.0F, -1.0F); poseStack.translate(0.0D, 0.31D, 2.15D + 0.75F * zOffset); diff --git a/src/main/java/greekfantasy/client/screen/InstrumentScreen.java b/src/main/java/greekfantasy/client/screen/InstrumentScreen.java index adecc99b..0adcffbc 100644 --- a/src/main/java/greekfantasy/client/screen/InstrumentScreen.java +++ b/src/main/java/greekfantasy/client/screen/InstrumentScreen.java @@ -1,7 +1,6 @@ package greekfantasy.client.screen; import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import greekfantasy.GreekFantasy; import greekfantasy.client.screen.radial.NoteRadialMenuItem; import greekfantasy.client.screen.radial.RadialMenuHelper; @@ -10,6 +9,7 @@ import greekfantasy.util.Song; import greekfantasy.util.SongManager; import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -23,7 +23,8 @@ public class InstrumentScreen extends Screen { - private static final ResourceLocation WIDGETS = new ResourceLocation(GreekFantasy.MODID, "textures/gui/song_widgets.png"); + private static final ResourceLocation WIDGETS = new ResourceLocation(GreekFantasy.MODID, + "textures/gui/song_widgets.png"); private static final String[] NOTE_NAMES = { "G", "G#", "A", "A#", "B", "C", "C#", "D", @@ -121,23 +122,26 @@ public void tick() { super.tick(); this.tickCount++; if (this.song != null) { - SongManager.playMusic(getMinecraft().player, instrument, song, tickCount, instrument.getVolume(), instrument.getVolume() * 0.5F); + SongManager.playMusic(getMinecraft().player, instrument, song, tickCount, instrument.getVolume(), + instrument.getVolume() * 0.5F); } } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { // draw radial menu background - helper.drawBackground(poseStack, x, y, 0); + helper.drawBackground(guiGraphics, x, y, 0); // draw other widgets - super.render(poseStack, mouseX, mouseY, partialTick); + super.render(guiGraphics, mouseX, mouseY, partialTick); // draw radial menu items - helper.drawItems(poseStack, (int) x, (int) y, 0, RADIAL_ITEM_WIDTH, RADIAL_ITEM_HEIGHT, this.font, this.itemRenderer); + helper.drawItems(guiGraphics, (int) x, (int) y, 0, RADIAL_ITEM_WIDTH, RADIAL_ITEM_HEIGHT, this.font); // draw other text float octaveX = x - font.width(octaveControlComponent) / 2.0f; - font.drawShadow(poseStack, octaveControlComponent, octaveX, y + RADIAL_HEIGHT + 4, 0xFFFFFF); + guiGraphics.drawString(font, octaveControlComponent, (int) octaveX, (int) (y + RADIAL_HEIGHT + 4), 0xFFFFFF, + true); float visibilityX = x - font.width(songVisibilityComponent) / 2.0f; - font.drawShadow(poseStack, songVisibilityComponent, visibilityX, y + RADIAL_HEIGHT + 4 + font.lineHeight + 1, 0xFFFFFF); + guiGraphics.drawString(font, songVisibilityComponent, (int) visibilityX, + (int) (y + RADIAL_HEIGHT + 4 + font.lineHeight + 1), 0xFFFFFF, true); } @Override @@ -149,9 +153,11 @@ public void mouseMoved(double mouseX, double mouseY) { public boolean mouseScrolled(double mouseX, double mouseY, double amount) { if (songsVisible && mouseX < this.x - RADIAL_WIDTH - SONG_RADIAL_MARGIN) { // attempt to scroll song menu - float scrollAmount = Mth.clamp(this.scrollAmount - (float) amount * (1.0F / Math.max(1, this.songs.size() - VISIBLE_SONG_COUNT)), 0.0F, 1.0F); - setSongScrollAmount(scrollAmount); - scrollButton.setScrollAmount(scrollAmount); + float newScrollAmount = Mth.clamp( + this.scrollAmount - (float) amount * (1.0F / Math.max(1, this.songs.size() - VISIBLE_SONG_COUNT)), + 0.0F, 1.0F); + setSongScrollAmount(newScrollAmount); + scrollButton.setScrollAmount(newScrollAmount); } else { // attempt to scroll radial menu setGroup((int) (this.group + amount)); @@ -220,14 +226,14 @@ private static class SongButton extends Button { private Component credits; public SongButton(final InstrumentScreen screen, final int x, final int y) { - super(x, y, SONG_WIDTH, SONG_HEIGHT, Component.empty(), b -> { - }); + super(Button.builder(Component.empty(), b -> { + }).bounds(x, y, SONG_WIDTH, SONG_HEIGHT)); this.screen = screen; this.visible = false; } @Override - public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (this.visible) { // draw button background int color = isSelected() ? BACKGROUND_HOVER_COLOR : BACKGROUND_COLOR; @@ -236,17 +242,17 @@ public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float part int b = (color >> 0) & 0xFF; int a = (color >> 24) & 0xFF; RenderSystem.enableBlend(); - RenderSystem.setShaderTexture(0, InstrumentScreen.WIDGETS); RenderSystem.setShaderColor(r / 255.0F, g / 255.0F, b / 255.0F, a / 255.0F); - screen.blit(poseStack, this.x, this.y, 0, 0, this.width, this.height); + guiGraphics.blit(InstrumentScreen.WIDGETS, this.getX(), this.getY(), 0, 0, this.width, this.height); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); // draw the song name and credits - screen.font.drawShadow(poseStack, name, this.x + 3, this.y + 4, 0); - screen.font.drawShadow(poseStack, credits, this.x + 3, this.y + 5 + screen.font.lineHeight, 0); + guiGraphics.drawString(screen.font, name, this.getX() + 3, this.getY() + 4, 0xFFFFFF, true); + guiGraphics.drawString(screen.font, credits, this.getX() + 3, this.getY() + 5 + screen.font.lineHeight, + 0xAAAAAA, true); } } - /** * @return whether this button should render as selected **/ @@ -268,7 +274,7 @@ public void onPress() { public void setSong(final ResourceLocation songId) { this.songId = songId; if (songId != null) { - this.x = (int) (screen.x) - RADIAL_WIDTH - SONG_RADIAL_MARGIN - SONG_WIDTH; + this.setX((int) (screen.x) - RADIAL_WIDTH - SONG_RADIAL_MARGIN - SONG_WIDTH); this.visible = true; Song song = GreekFantasy.SONG_MAP.getOrDefault(songId, Song.EMPTY); this.name = song.getName().copy().withStyle(ChatFormatting.WHITE); @@ -285,23 +291,26 @@ private static class ScrollButton extends Button { private int scrollY; public ScrollButton(final InstrumentScreen screen, int x, int y) { - super(x, y, SCROLL_WIDTH, VISIBLE_SONG_COUNT * SONG_HEIGHT, Component.empty(), b -> {}); + super(Button.builder(Component.empty(), b -> { + }).bounds(x, y, SCROLL_WIDTH, VISIBLE_SONG_COUNT * SONG_HEIGHT)); this.screen = screen; } @Override - public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { if (this.visible) { // draw button background - int color = isHoveredOrFocused() || screen.isDraggingScrollbar ? BACKGROUND_HOVER_COLOR : BACKGROUND_COLOR; + int color = isHoveredOrFocused() || screen.isDraggingScrollbar ? BACKGROUND_HOVER_COLOR + : BACKGROUND_COLOR; int r = (color >> 16) & 0xFF; int g = (color >> 8) & 0xFF; int b = (color >> 0) & 0xFF; int a = (color >> 24) & 0xFF; RenderSystem.enableBlend(); - RenderSystem.setShaderTexture(0, InstrumentScreen.WIDGETS); RenderSystem.setShaderColor(r / 255.0F, g / 255.0F, b / 255.0F, a / 255.0F); - screen.blit(poseStack, this.x, this.scrollY, 0, 26, SCROLL_WIDTH, SCROLL_HEIGHT); + guiGraphics.blit(InstrumentScreen.WIDGETS, this.getX(), this.scrollY, 0, 26, SCROLL_WIDTH, + SCROLL_HEIGHT); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); } } @@ -309,14 +318,14 @@ public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float part @Override public void onDrag(double mouseX, double mouseY, double dragX, double dragY) { screen.isDraggingScrollbar = true; - float scrollAmount = Mth.clamp((float) (mouseY - this.y) / (float) this.height, 0.0F, 1.0F); + float scrollAmount = Mth.clamp((float) (mouseY - this.getY()) / (float) this.height, 0.0F, 1.0F); screen.setSongScrollAmount(scrollAmount); this.setScrollAmount(scrollAmount); } public void setScrollAmount(final float scrollAmount) { - this.x = (int) screen.x - RADIAL_WIDTH - SONG_RADIAL_MARGIN - SONG_WIDTH - this.width - 2; - this.scrollY = this.y + (int) (scrollAmount * (float)(this.height - SCROLL_HEIGHT)); + this.setX((int) screen.x - RADIAL_WIDTH - SONG_RADIAL_MARGIN - SONG_WIDTH - this.width - 2); + this.scrollY = this.getY() + (int) (scrollAmount * (float) (this.height - SCROLL_HEIGHT)); } } } diff --git a/src/main/java/greekfantasy/client/screen/QuestScreen.java b/src/main/java/greekfantasy/client/screen/QuestScreen.java index d01161f1..213f3124 100644 --- a/src/main/java/greekfantasy/client/screen/QuestScreen.java +++ b/src/main/java/greekfantasy/client/screen/QuestScreen.java @@ -1,15 +1,13 @@ package greekfantasy.client.screen; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; import greekfantasy.item.QuestItem; import greekfantasy.util.Quest; import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.FormattedText; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; @@ -18,7 +16,8 @@ public class QuestScreen extends Screen { - private static final ResourceLocation BACKGROUND = new ResourceLocation(GreekFantasy.MODID, "textures/gui/quest.png"); + private static final ResourceLocation BACKGROUND = new ResourceLocation(GreekFantasy.MODID, + "textures/gui/quest.png"); private static final int IMAGE_WIDTH = 195; private static final int IMAGE_HEIGHT = 146; @@ -42,7 +41,8 @@ protected QuestScreen(int itemSlot, ItemStack itemStack) { super(Component.empty()); this.itemSlot = itemSlot; this.itemStack = itemStack; - if(itemStack.is(GFRegistry.ItemReg.QUEST.get()) && itemStack.hasTag() && itemStack.getTag().contains(QuestItem.KEY_QUEST)) { + if (itemStack.is(GFRegistry.ItemReg.QUEST.get()) && itemStack.hasTag() + && itemStack.getTag().contains(QuestItem.KEY_QUEST)) { this.questId = ResourceLocation.tryParse(itemStack.getTag().getString(QuestItem.KEY_QUEST)); this.quest = GreekFantasy.QUEST_MAP.getOrDefault(questId, Quest.EMPTY); } else { @@ -61,24 +61,23 @@ protected void init() { } @Override - public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTick) { + public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) { // draw background - RenderSystem.setShaderTexture(0, BACKGROUND); - this.blit(poseStack, this.x, this.y, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); + guiGraphics.blit(BACKGROUND, this.x, this.y, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT); // draw title int maxWidth = IMAGE_WIDTH - MARGIN_X * 2; - float startX = (this.width - this.font.width(title)) / 2.0F; - float startY = this.y + MARGIN_Y; - this.font.draw(poseStack, title, startX, startY, 0); + int startX = (this.width - this.font.width(title)) / 2; + int startY = this.y + MARGIN_Y; + guiGraphics.drawString(this.font, title, startX, startY, 0, false); // draw components startX = this.x + MARGIN_X; startY += this.font.lineHeight + 4; - for(MutableComponent text : components) { - this.font.drawWordWrap(FormattedText.of(text.getString()), (int) startX, (int) startY, maxWidth, 0); + for (MutableComponent text : components) { + guiGraphics.drawWordWrap(this.font, text, startX, startY, maxWidth, 0); startY += this.font.wordWrapHeight(text.getString(), maxWidth) + 2; } // draw other widgets - super.render(poseStack, mouseX, mouseY, partialTick); + super.render(guiGraphics, mouseX, mouseY, partialTick); } @Override diff --git a/src/main/java/greekfantasy/client/screen/ScreenLoader.java b/src/main/java/greekfantasy/client/screen/ScreenLoader.java index 4af45456..ea4c91bf 100644 --- a/src/main/java/greekfantasy/client/screen/ScreenLoader.java +++ b/src/main/java/greekfantasy/client/screen/ScreenLoader.java @@ -11,7 +11,7 @@ private ScreenLoader() { public static void openQuestScreen(final Player playerIn, final int itemSlot, final ItemStack itemstack) { // only load client-side, of course - if (!playerIn.level.isClientSide()) { + if (!playerIn.level().isClientSide()) { return; } // open the gui @@ -20,7 +20,7 @@ public static void openQuestScreen(final Player playerIn, final int itemSlot, fi public static void openInstrumentScreen(final Player playerIn, final int itemSlot, final ItemStack itemstack) { // only load client-side, of course - if (!playerIn.level.isClientSide()) { + if (!playerIn.level().isClientSide()) { return; } // open the gui diff --git a/src/main/java/greekfantasy/client/screen/radial/DrawingContext.java b/src/main/java/greekfantasy/client/screen/radial/DrawingContext.java index 675829d9..be89fe27 100644 --- a/src/main/java/greekfantasy/client/screen/radial/DrawingContext.java +++ b/src/main/java/greekfantasy/client/screen/radial/DrawingContext.java @@ -1,11 +1,11 @@ package greekfantasy.client.screen.radial; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.Font; -import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.gui.GuiGraphics; /** - * Adapted from https://github.com/gigaherz/ToolBelt under the following license: + * Adapted from https://github.com/gigaherz/ToolBelt under the following + * license: *

* Copyright (c) 2015, David Quintana * All rights reserved. @@ -21,7 +21,8 @@ * names of the contributors may be used to endorse or promote products * derived from this software without specific prior written permission. *

- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY @@ -39,24 +40,16 @@ public class DrawingContext { public final float y; public final float z; public final Font fontRenderer; - public final ItemRenderer itemRenderer; - public final PoseStack poseStack; - public final IDrawingHelper drawingHelper; + public final GuiGraphics guiGraphics; - public DrawingContext(PoseStack poseStack, int width, int height, float x, float y, float z, Font fontRenderer, ItemRenderer itemRenderer, IDrawingHelper drawingHelper) { - this.poseStack = poseStack; + public DrawingContext(GuiGraphics guiGraphics, int width, int height, float x, float y, float z, + Font fontRenderer) { + this.guiGraphics = guiGraphics; this.width = width; this.height = height; this.x = x; this.y = y; this.z = z; this.fontRenderer = fontRenderer; - this.itemRenderer = itemRenderer; - this.drawingHelper = drawingHelper; - } - - @FunctionalInterface - public interface IDrawingHelper { - void renderTooltip(PoseStack poseStack, int mouseX, int mouseY); } } diff --git a/src/main/java/greekfantasy/client/screen/radial/NoteRadialMenuItem.java b/src/main/java/greekfantasy/client/screen/radial/NoteRadialMenuItem.java index 3325fecb..6cc6df0f 100644 --- a/src/main/java/greekfantasy/client/screen/radial/NoteRadialMenuItem.java +++ b/src/main/java/greekfantasy/client/screen/radial/NoteRadialMenuItem.java @@ -5,7 +5,8 @@ import net.minecraft.util.Mth; /** - * Adapted from https://github.com/gigaherz/ToolBelt under the following license: + * Adapted from https://github.com/gigaherz/ToolBelt under the following + * license: *

* Copyright (c) 2015, David Quintana * All rights reserved. @@ -21,7 +22,8 @@ * names of the contributors may be used to endorse or promote products * derived from this software without specific prior written permission. *

- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY @@ -50,9 +52,12 @@ public NoteRadialMenuItem(InstrumentScreen owner, Component text, int note, int this.note = note; // calculate color using the equation found in NoteParticle double noteColorData = ((float) Math.pow(2.0D, (double) (note) / 24.0D)); - int noteColorR = (int) (255.0F * Math.max(0.0F, Mth.sin(((float) noteColorData + 0.0F) * ((float) Math.PI * 2F)) * 0.65F + 0.35F)); - int noteColorG = (int) (255.0F * Math.max(0.0F, Mth.sin(((float) noteColorData + 0.33333334F) * ((float) Math.PI * 2F)) * 0.65F + 0.35F)); - int noteColorB = (int) (255.0F * Math.max(0.0F, Mth.sin(((float) noteColorData + 0.6666667F) * ((float) Math.PI * 2F)) * 0.65F + 0.35F)); + int noteColorR = (int) (255.0F + * Math.max(0.0F, Mth.sin(((float) noteColorData + 0.0F) * ((float) Math.PI * 2F)) * 0.65F + 0.35F)); + int noteColorG = (int) (255.0F * Math.max(0.0F, + Mth.sin(((float) noteColorData + 0.33333334F) * ((float) Math.PI * 2F)) * 0.65F + 0.35F)); + int noteColorB = (int) (255.0F * Math.max(0.0F, + Mth.sin(((float) noteColorData + 0.6666667F) * ((float) Math.PI * 2F)) * 0.65F + 0.35F)); this.color = (0xff) << 24 | (noteColorR & 0xff) << 16 | (noteColorG & 0xff) << 8 | (noteColorB & 0xff); } @@ -70,7 +75,7 @@ public void draw(DrawingContext context) { String textString = text.getString(); float x = context.x - context.fontRenderer.width(textString) / 2.0f; float y = context.y - context.fontRenderer.lineHeight / 2.0F; - context.fontRenderer.drawShadow(context.poseStack, textString, x, y, color); + context.guiGraphics.drawString(context.fontRenderer, textString, (int) x, (int) y, color, true); } public void setHovered(boolean hovered) { diff --git a/src/main/java/greekfantasy/client/screen/radial/RadialMenuHelper.java b/src/main/java/greekfantasy/client/screen/radial/RadialMenuHelper.java index c8957875..36a8a567 100644 --- a/src/main/java/greekfantasy/client/screen/radial/RadialMenuHelper.java +++ b/src/main/java/greekfantasy/client/screen/radial/RadialMenuHelper.java @@ -3,20 +3,20 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.util.Mth; import org.apache.logging.log4j.util.TriConsumer; import java.util.List; /** - * Adapted from https://github.com/gigaherz/ToolBelt under the following license: + * Adapted from https://github.com/gigaherz/ToolBelt under the following + * license: *

* Copyright (c) 2015, David Quintana * All rights reserved. @@ -32,7 +32,8 @@ * names of the contributors may be used to endorse or promote products * derived from this software without specific prior written permission. *

- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY @@ -52,17 +53,15 @@ public final class RadialMenuHelper { public final int backgroundColorHover; private Screen screen; - private DrawingContext.IDrawingHelper drawingHelper; private List items; private float radiusIn; private float radiusOut; private float itemRadius; public RadialMenuHelper(final Screen screen, List items, - final float radiusIn, final float radiusOut, - final int backgroundColor, final int backgroundColorHover) { + final float radiusIn, final float radiusOut, + final int backgroundColor, final int backgroundColorHover) { this.screen = screen; - this.drawingHelper = (poseStack, mouseX, mouseY) -> {}; this.items = items; this.radiusIn = radiusIn; this.radiusOut = radiusOut; @@ -71,9 +70,8 @@ public RadialMenuHelper(final Screen screen, List items, this.backgroundColorHover = backgroundColorHover; } - public void drawBackground(PoseStack poseStack, float x, float y, float z) { + public void drawBackground(GuiGraphics guiGraphics, float x, float y, float z) { RenderSystem.enableBlend(); - RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); RenderSystem.setShader(GameRenderer::getPositionColorShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); @@ -86,18 +84,16 @@ public void drawBackground(PoseStack poseStack, float x, float y, float z) { drawPieArc(buffer, x, y, z, radiusIn, radiusOut, s, e, color); }); tessellator.end(); - RenderSystem.enableTexture(); RenderSystem.disableBlend(); } - public void drawItems(PoseStack poseStack, int x, int y, float z, int width, int height, Font font, ItemRenderer itemRenderer) - { + public void drawItems(GuiGraphics guiGraphics, int x, int y, float z, int width, int height, Font font) { iterateVisible((item, s, e) -> { float middle = (s + e) * 0.5f; float posX = x + itemRadius * (float) Math.cos(middle); float posY = y + itemRadius * (float) Math.sin(middle); - DrawingContext context = new DrawingContext(poseStack, width, height, posX, posY, z, font, itemRenderer, drawingHelper); + DrawingContext context = new DrawingContext(guiGraphics, width, height, posX, posY, z, font); item.draw(context); }); } @@ -113,7 +109,8 @@ private void iterateVisible(TriConsumer consumer) } } - private void drawPieArc(BufferBuilder buffer, float x, float y, float z, float radiusIn, float radiusOut, float startAngle, float endAngle, int color) { + private void drawPieArc(BufferBuilder buffer, float x, float y, float z, float radiusIn, float radiusOut, + float startAngle, float endAngle, int color) { float angle = endAngle - startAngle; int sections = Math.max(1, Mth.ceil(angle / PRECISION)); diff --git a/src/main/java/greekfantasy/enchantment/HuntingEnchantment.java b/src/main/java/greekfantasy/enchantment/HuntingEnchantment.java index 06e3f9bb..3ab15b6b 100644 --- a/src/main/java/greekfantasy/enchantment/HuntingEnchantment.java +++ b/src/main/java/greekfantasy/enchantment/HuntingEnchantment.java @@ -1,4 +1,5 @@ package greekfantasy.enchantment; +import net.minecraft.core.registries.Registries; import greekfantasy.GreekFantasy; import greekfantasy.item.KnifeItem; @@ -37,7 +38,7 @@ public void doPostAttack(LivingEntity user, Entity target, int level) { // determine damage amount float amount = Math.min(99.0F, (animal.getMaxHealth() + animal.getArmorValue()) * 1.25F); // apply damage - DamageSource source = DamageSource.mobAttack(user).bypassArmor().bypassMagic(); + DamageSource source = user.damageSources().mobAttack(user); target.hurt(source, amount); } } diff --git a/src/main/java/greekfantasy/enchantment/PoisoningEnchantment.java b/src/main/java/greekfantasy/enchantment/PoisoningEnchantment.java index 6036f8ee..ae3ecc0e 100644 --- a/src/main/java/greekfantasy/enchantment/PoisoningEnchantment.java +++ b/src/main/java/greekfantasy/enchantment/PoisoningEnchantment.java @@ -1,4 +1,5 @@ package greekfantasy.enchantment; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; diff --git a/src/main/java/greekfantasy/enchantment/SmashingEnchantment.java b/src/main/java/greekfantasy/enchantment/SmashingEnchantment.java index 0318b9c9..7008ceb8 100644 --- a/src/main/java/greekfantasy/enchantment/SmashingEnchantment.java +++ b/src/main/java/greekfantasy/enchantment/SmashingEnchantment.java @@ -1,4 +1,5 @@ package greekfantasy.enchantment; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -44,9 +45,9 @@ private static boolean isExemptFromSmashAttack(final Entity entity) { private static void useSmashAttack(final LivingEntity user, final Entity target, final int level) { // if entitiy is touching the ground, knock it into the air and apply stun - if (target.isOnGround() && !isExemptFromSmashAttack(target)) { + if (target.onGround() && !isExemptFromSmashAttack(target)) { target.push(0.0D, 0.35D + (0.05D * level), 0.0D); - target.hurt(DamageSource.mobAttack(user), 0.25F); + target.hurt(user.damageSources().mobAttack(user), 0.25F); // stun effect (for living entities) if (target instanceof LivingEntity) { final LivingEntity entity = (LivingEntity) target; @@ -76,7 +77,7 @@ private static void useSmashAttack(final LivingEntity user, final Entity target, final Vec3 facing = Vec3.directionFromRotation(user.getRotationVector()).normalize(); final AABB aabb = new AABB(target.blockPosition().above()).inflate(range, BASE_RANGE, range).move(facing.scale(range)); // smash attack entities within range - user.level.getEntities(user, aabb).forEach(e -> useSmashAttack(user, e, level)); + user.level().getEntities(user, aabb).forEach(e -> useSmashAttack(user, e, level)); }*/ @Override @@ -95,7 +96,7 @@ public void doPostAttack(LivingEntity user, Entity target, int level) { final Vec3 facing = Vec3.directionFromRotation(user.getRotationVector()).normalize(); final AABB aabb = new AABB(target.blockPosition().above()).inflate(range, BASE_RANGE, range).move(facing.scale(range)); // smash attack entities within range - user.level.getEntities(user, aabb).forEach(e -> useSmashAttack(user, e, level)); + user.level().getEntities(user, aabb).forEach(e -> useSmashAttack(user, e, level)); // apply cooldown if (user instanceof Player player) { player.getCooldowns().addCooldown(item.getItem(), Mth.ceil(player.getCurrentItemAttackStrengthDelay())); diff --git a/src/main/java/greekfantasy/entity/Arion.java b/src/main/java/greekfantasy/entity/Arion.java index a1e682f9..c2c17d98 100644 --- a/src/main/java/greekfantasy/entity/Arion.java +++ b/src/main/java/greekfantasy/entity/Arion.java @@ -1,4 +1,5 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -30,8 +31,10 @@ public class Arion extends Horse { - public static final TagKey FOOD = ForgeRegistries.ITEMS.tags().createTagKey(new ResourceLocation(GreekFantasy.MODID, "arion_food")); - public static final TagKey TRIGGER = ForgeRegistries.ITEMS.tags().createTagKey(new ResourceLocation(GreekFantasy.MODID, "arion_trigger")); + public static final TagKey FOOD = ForgeRegistries.ITEMS.tags() + .createTagKey(new ResourceLocation(GreekFantasy.MODID, "arion_food")); + public static final TagKey TRIGGER = ForgeRegistries.ITEMS.tags() + .createTagKey(new ResourceLocation(GreekFantasy.MODID, "arion_trigger")); public Arion(EntityType type, Level worldIn) { super(type, worldIn); @@ -62,7 +65,8 @@ public static Arion spawnArion(final ServerLevel level, final Player player, fin entity.setPortalCooldown(); entity.setAge(horse.getAge()); level.addFreshEntity(entity); - entity.finalizeSpawn(level, level.getCurrentDifficultyAt(horse.blockPosition()), MobSpawnType.CONVERSION, null, null); + entity.finalizeSpawn(level, level.getCurrentDifficultyAt(horse.blockPosition()), MobSpawnType.CONVERSION, null, + null); // copy inventory and remove the old horse entity.copyInventory(horse); horse.inventory.clearContent(); @@ -72,12 +76,13 @@ public static Arion spawnArion(final ServerLevel level, final Player player, fin entity.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 60)); entity.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 60)); // play sound - level.playLocalSound(entity.getX(), entity.getY(), entity.getZ(), SoundEvents.PLAYER_LEVELUP, entity.getSoundSource(), 1.0F, 1.0F, false); + level.playLocalSound(entity.getX(), entity.getY(), entity.getZ(), SoundEvents.PLAYER_LEVELUP, + entity.getSoundSource(), 1.0F, 1.0F, false); return entity; } public void copyInventory(final Horse horse) { - for(int i = 0, n = horse.inventory.getContainerSize(); i < n; i++) { + for (int i = 0, n = horse.inventory.getContainerSize(); i < n; i++) { this.inventory.setItem(i, horse.inventory.getItem(i).copy()); } } @@ -107,22 +112,8 @@ public int getMaxTemper() { return 200; } - // CALLED FROM ON INITIAL SPAWN // - - @Override - protected float generateRandomMaxHealth(RandomSource random) { - return super.generateRandomMaxHealth(random) + 30.0F; - } - - @Override - protected double generateRandomJumpStrength(RandomSource random) { - return super.generateRandomJumpStrength(random) + 0.25F; - } - - @Override - protected double generateRandomSpeed(RandomSource random) { - return super.generateRandomSpeed(random) + 0.21F; - } + // Horse stat methods are now static in 1.20.1, so we don't override them + // Stats are set via randomizeAttributes which is called during spawn // MISC // @@ -151,7 +142,7 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { if (!this.isBaby()) { if (this.isTamed() && player.isSecondaryUseActive()) { this.openCustomInventoryScreen(player); - return InteractionResult.sidedSuccess(this.level.isClientSide); + return InteractionResult.sidedSuccess(this.level().isClientSide); } if (this.isVehicle()) { @@ -171,20 +162,20 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { if (!this.isTamed()) { this.makeMad(); - return InteractionResult.sidedSuccess(this.level.isClientSide); + return InteractionResult.sidedSuccess(this.level().isClientSide); } boolean flag = !this.isBaby() && !this.isSaddled() && itemstack.is(Items.SADDLE); if (this.isArmor(itemstack) || flag) { this.openCustomInventoryScreen(player); - return InteractionResult.sidedSuccess(this.level.isClientSide); + return InteractionResult.sidedSuccess(this.level().isClientSide); } } // Only mount if already tame if (this.isTamed() && !this.isBaby()) { this.doPlayerRide(player); - return InteractionResult.sidedSuccess(this.level.isClientSide); + return InteractionResult.sidedSuccess(this.level().isClientSide); } // DO NOT CALL SUPER METHOD // return super.getEntityInteractionResult(player, hand); diff --git a/src/main/java/greekfantasy/entity/Automaton.java b/src/main/java/greekfantasy/entity/Automaton.java index db55cbce..d1291948 100644 --- a/src/main/java/greekfantasy/entity/Automaton.java +++ b/src/main/java/greekfantasy/entity/Automaton.java @@ -1,4 +1,5 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.entity.ai.CooldownMeleeAttackGoal; @@ -24,6 +25,7 @@ import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; @@ -235,17 +237,17 @@ public void tick() { super.tick(); // spawn particles - if (this.level.isClientSide() && this.getDeltaMovement().horizontalDistanceSqr() > (double) 2.5000003E-7F && this.random.nextInt(3) == 0) { + if (this.level().isClientSide() && this.getDeltaMovement().horizontalDistanceSqr() > (double) 2.5000003E-7F && this.random.nextInt(3) == 0) { int i = Mth.floor(this.getX()); int j = Mth.floor(this.getY() - (double) 0.2F); int k = Mth.floor(this.getZ()); - BlockPos pos = new BlockPos(i, j, k); - BlockState blockstate = this.level.getBlockState(pos); - if (!this.level.isEmptyBlock(pos)) { + BlockPos pos = BlockPos.containing(i, j, k); + BlockState blockstate = this.level().getBlockState(pos); + if (!this.level().isEmptyBlock(pos)) { final BlockParticleOption data = new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(pos); final double radius = this.getBbWidth() * 0.8F; final double motion = 4.0D; - this.level.addParticle(data, + this.level().addParticle(data, this.getX() + (this.random.nextDouble() - 0.5D) * radius * 2, this.getY() + 0.1D, this.getZ() + (this.random.nextDouble() - 0.5D) * radius * 2, @@ -258,15 +260,15 @@ public void tick() { public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if(this.getHealth() < this.getMaxHealth() && isHealItem(itemstack)) { - if(!this.level.isClientSide()) { + if(!this.level().isClientSide()) { this.heal(this.getMaxHealth() * 0.5F); if(!player.isCreative()) { itemstack.shrink(1); } this.playSound(SoundEvents.IRON_GOLEM_REPAIR, 1.0F, 1.0F); - ((ServerLevel)this.level).sendParticles(ParticleTypes.INSTANT_EFFECT, this.getX(), this.getEyeY(), this.getZ(), 8, 0.5D, 0.5D, 0.5D, 0.5D); + ((ServerLevel)this.level()).sendParticles(ParticleTypes.INSTANT_EFFECT, this.getX(), this.getEyeY(), this.getZ(), 8, 0.5D, 0.5D, 0.5D, 0.5D); } - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } return super.mobInteract(player,hand); } @@ -284,7 +286,7 @@ public boolean doHurtTarget(final Entity entityIn) { entityIn.hurtMarked = true; attackTimer = 1; this.playSound(SoundEvents.IRON_GOLEM_ATTACK, 1.0F, 0.6F + random.nextFloat() * 0.2F); - this.level.broadcastEntityEvent(this, ATTACK_EVENT); + this.level().broadcastEntityEvent(this, ATTACK_EVENT); return true; } return false; @@ -315,8 +317,8 @@ protected boolean canRide(Entity entityIn) { @Override public boolean isInvulnerableTo(final DamageSource source) { - return isSpawning() || source == DamageSource.DROWN || source == DamageSource.IN_WALL - || source == DamageSource.WITHER || super.isInvulnerableTo(source); + return isSpawning() || source.is(DamageTypes.DROWN) || source.is(DamageTypes.IN_WALL) + || source.is(DamageTypes.WITHER) || super.isInvulnerableTo(source); } @Override @@ -399,8 +401,8 @@ public boolean isShooting() { public void setSpawning(final boolean spawning) { spawnTime = spawning ? getMaxSpawnTime() : 0; setState(spawning ? SPAWNING : NONE); - if (spawning && !this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, SPAWN_EVENT); + if (spawning && !this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, SPAWN_EVENT); } } @@ -449,7 +451,7 @@ public float getAttackPercent(final float partialTick) { @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - if (this.level.isClientSide() || !this.isShooting() || shootTime < (getMaxShootTime() / 4)) { + if (this.level().isClientSide() || !this.isShooting() || shootTime < (getMaxShootTime() / 4)) { return; } ItemStack itemstack = new ItemStack(Items.ARROW); @@ -461,11 +463,11 @@ public void performRangedAttack(LivingEntity target, float distanceFactor) { double dy = target.getY(0.67D) - arrow.getY(); double dz = target.getZ() - arrow.getZ(); double dis = Math.sqrt(dx * dx + dz * dz); - arrow.shoot(dx, dy + dis * (double) 0.2F, dz, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); - arrow.setBaseDamage(1.0D + this.level.getDifficulty().getId() * 0.25D); + arrow.shoot(dx, dy + dis * (double) 0.2F, dz, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); + arrow.setBaseDamage(1.0D + this.level().getDifficulty().getId() * 0.25D); arrow.setOwner(this); this.playSound(SoundEvents.ARROW_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level.addFreshEntity(arrow); + this.level().addFreshEntity(arrow); } @Override @@ -515,7 +517,7 @@ public boolean canUse() { public void start() { super.start(); Automaton.this.setShooting(true); - Automaton.this.level.broadcastEntityEvent(Automaton.this, SHOOT_EVENT); + Automaton.this.level().broadcastEntityEvent(Automaton.this, SHOOT_EVENT); Automaton.this.shootTime = 1; } diff --git a/src/main/java/greekfantasy/entity/Centaur.java b/src/main/java/greekfantasy/entity/Centaur.java index b5953d24..3b1ebc49 100644 --- a/src/main/java/greekfantasy/entity/Centaur.java +++ b/src/main/java/greekfantasy/entity/Centaur.java @@ -136,8 +136,8 @@ public void aiStep() { this.moveTail(); } // anger timer - if (!this.level.isClientSide()) { - this.updatePersistentAnger((ServerLevel) this.level, true); + if (!this.level().isClientSide()) { + this.updatePersistentAnger((ServerLevel) this.level(), true); } } @@ -202,9 +202,9 @@ public void performRangedAttack(LivingEntity target, float distanceFactor) { double dy = target.getY(0.67D) - arrow.getY(); double dz = target.getZ() - arrow.getZ(); double dis = Math.sqrt(dx * dx + dz * dz); - arrow.shoot(dx, dy + dis * (double) 0.2F, dz, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); + arrow.shoot(dx, dy + dis * (double) 0.2F, dz, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); this.playSound(SoundEvents.ARROW_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level.addFreshEntity(arrow); + this.level().addFreshEntity(arrow); } // NBT Methods @@ -220,7 +220,7 @@ public void addAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); this.setVariant(Variant.byId(compound.getByte(KEY_VARIANT))); - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); } // NeutralMob methods @@ -342,7 +342,7 @@ public void makeRear() { public void setRearing(final boolean rearing) { this.isRearing = rearing; - this.level.broadcastEntityEvent(this, rearing ? START_REARING_EVENT : STOP_REARING_EVENT); + this.level().broadcastEntityEvent(this, rearing ? START_REARING_EVENT : STOP_REARING_EVENT); } @Override @@ -398,7 +398,7 @@ public void setTradingPlayer(@Nullable final Player player) { @Override public void trade(PathfinderMob self, @Nullable final Player player, final ItemStack tradeItem) { TradingMob.super.trade(self, player, tradeItem); - this.level.broadcastEntityEvent(this, FINISH_TRADE_EVENT); + this.level().broadcastEntityEvent(this, FINISH_TRADE_EVENT); } @Override diff --git a/src/main/java/greekfantasy/entity/Cerastes.java b/src/main/java/greekfantasy/entity/Cerastes.java index 95526128..eb3df9a0 100644 --- a/src/main/java/greekfantasy/entity/Cerastes.java +++ b/src/main/java/greekfantasy/entity/Cerastes.java @@ -1,4 +1,5 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -28,6 +29,7 @@ import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobSpawnType; import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.TamableAnimal; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; @@ -91,8 +93,8 @@ public class Cerastes extends TamableAnimal { public Cerastes(final EntityType type, final Level worldIn) { super(type, worldIn); this.hiddenSize = EntityDimensions.scalable(0.8F, 0.2F); - this.setPathfindingMalus(BlockPathTypes.DAMAGE_CACTUS, -0.5F); - this.setPathfindingMalus(BlockPathTypes.DANGER_CACTUS, -0.5F); + this.setPathfindingMalus(BlockPathTypes.DANGER_OTHER, -0.5F); + this.setPathfindingMalus(BlockPathTypes.DANGER_OTHER, -0.5F); this.setPathfindingMalus(BlockPathTypes.WATER, -1.0F); } @@ -233,10 +235,10 @@ public boolean hurt(final DamageSource source, final float amount) { this.setStanding(true); this.setOrderedToSit(false); this.setInSittingPose(false); - if (hurt && source.getDirectEntity() instanceof Curse && this.level instanceof ServerLevel) { + if (hurt && source.getDirectEntity() instanceof Curse && this.level() instanceof ServerLevel) { // cause explosion and summon hydra - level.explode(this, this.getX(), this.getY(), this.getZ(), 2.5F, Explosion.BlockInteraction.DESTROY); - Hydra.spawnHydra((ServerLevel) this.level, this); + level().explode(this, this.getX(), this.getY(), this.getZ(), 2.5F, Level.ExplosionInteraction.MOB); + Hydra.spawnHydra((ServerLevel) this.level(), this); } return hurt; } @@ -245,7 +247,7 @@ public boolean hurt(final DamageSource source, final float amount) { protected void doPush(final Entity entityIn) { if (entityIn instanceof LivingEntity) { // un-hide and stand up - if (!this.level.isClientSide() && random.nextInt(10) == 0) { + if (!this.level().isClientSide() && random.nextInt(10) == 0) { this.setHiding(false); this.setStanding(true); } @@ -324,7 +326,7 @@ protected float getStandingEyeHeight(Pose pose, EntityDimensions size) { @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { boolean consume = this.isOwnedBy(player) || this.isTame() || isFood(itemstack) && !this.isTame(); return consume ? InteractionResult.CONSUME : InteractionResult.PASS; } else { @@ -360,9 +362,9 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { this.navigation.stop(); this.setTarget(null); this.setOrderedToSit(true); - this.level.broadcastEntityEvent(this, (byte) 7); + this.level().broadcastEntityEvent(this, (byte) 7); } else { - this.level.broadcastEntityEvent(this, (byte) 6); + this.level().broadcastEntityEvent(this, (byte) 6); } return InteractionResult.SUCCESS; @@ -379,8 +381,8 @@ public void setStanding(final boolean standing) { if (standing) { this.isHiding = false; } - if (!level.isClientSide()) { - this.level.broadcastEntityEvent(this, standing ? STANDING_START_EVENT : STANDING_END_EVENT); + if (!level().isClientSide()) { + this.level().broadcastEntityEvent(this, standing ? STANDING_START_EVENT : STANDING_END_EVENT); } } @@ -401,7 +403,7 @@ public void setHiding(final boolean hiding) { if (hiding) { this.isStanding = false; } - this.level.broadcastEntityEvent(this, hiding ? HIDING_START_EVENT : HIDING_END_EVENT); + this.level().broadcastEntityEvent(this, hiding ? HIDING_START_EVENT : HIDING_END_EVENT); this.refreshDimensions(); } @@ -451,7 +453,7 @@ public void tick() { @Override protected boolean isValidTarget(LevelReader worldIn, BlockPos pos) { - if (!worldIn.getBlockState(pos).getMaterial().blocksMotion() && worldIn.getBlockState(pos.below()).is(BlockTags.SAND)) { + if (!worldIn.getBlockState(pos).blocksMotion() && worldIn.getBlockState(pos.below()).is(BlockTags.SAND)) { Cerastes.this.isGoingToSand = true; return true; } @@ -479,8 +481,8 @@ public boolean canUse() { } else if (this.entity.getTarget() != null || !this.entity.getNavigation().isDone() || this.entity.isHiding()) { return false; } else if (this.entity.getRandom().nextInt(10) == 0) { - BlockPos blockpos = (new BlockPos(this.entity.getX(), this.entity.getY() - 0.5D, this.entity.getZ())); - BlockState blockstate = this.entity.level.getBlockState(blockpos); + BlockPos blockpos = (BlockPos.containing(this.entity.getX(), this.entity.getY() - 0.5D, this.entity.getZ())); + BlockState blockstate = this.entity.level().getBlockState(blockpos); return blockstate.is(BlockTags.SAND); } return false; diff --git a/src/main/java/greekfantasy/entity/Dryad.java b/src/main/java/greekfantasy/entity/Dryad.java index 37ec7789..eddbad43 100644 --- a/src/main/java/greekfantasy/entity/Dryad.java +++ b/src/main/java/greekfantasy/entity/Dryad.java @@ -1,5 +1,7 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; + import com.google.common.collect.ImmutableMap; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -25,6 +27,7 @@ import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; @@ -71,12 +74,14 @@ public class Dryad extends PathfinderMob implements NeutralMob, TradingMob { - protected static final EntityDataAccessor DATA_VARIANT = SynchedEntityData.defineId(Dryad.class, EntityDataSerializers.STRING); + protected static final EntityDataAccessor DATA_VARIANT = SynchedEntityData.defineId(Dryad.class, + EntityDataSerializers.STRING); protected static final String KEY_VARIANT = "Variant"; protected static final String KEY_TREE_POS = "Tree"; protected static final String KEY_HIDING = "HidingTime"; - protected static final TagKey DRYAD_TRADE = ItemTags.create(new ResourceLocation(GreekFantasy.MODID, "dryad_trade")); + protected static final TagKey DRYAD_TRADE = ItemTags + .create(new ResourceLocation(GreekFantasy.MODID, "dryad_trade")); private static final byte FINISH_TRADE_EVENT = 9; @@ -113,12 +118,14 @@ protected void registerGoals() { this.goalSelector.addGoal(3, new Dryad.FindTreeGoal(8, 28)); this.goalSelector.addGoal(4, new Dryad.HideGoal(640)); this.goalSelector.addGoal(5, new Dryad.GoToTreeGoal(0.9F, 320)); - this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, Satyr.class, 10.0F, 1.2D, 1.1D, (entity) -> !this.isHiding() && !this.isGoingToTree && this.tradingPlayer != null)); + this.goalSelector.addGoal(7, new AvoidEntityGoal<>(this, Satyr.class, 10.0F, 1.2D, 1.1D, + (entity) -> !this.isHiding() && !this.isGoingToTree && this.tradingPlayer != null)); this.goalSelector.addGoal(8, new Dryad.RandomStrollWhenNotHidingGoal(0.8F, 140)); this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 6.0F)); this.goalSelector.addGoal(10, new RandomLookAroundGoal(this)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); - this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt)); + this.targetSelector.addGoal(2, + new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt)); this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true)); } @@ -132,7 +139,7 @@ protected void defineSynchedData() { public void aiStep() { super.aiStep(); // if entity has a tree position, check if it no longer exists - if (this.tickCount % 28 == 0 && treePos != null && !isTreeAt(level, treePos, getVariant().getLogs())) { + if (this.tickCount % 28 == 0 && treePos != null && !isTreeAt(level(), treePos, getVariant().getLogs())) { // if entity was hiding, exit the tree this.tryExitTree(); this.isGoingToTree = false; @@ -147,8 +154,8 @@ public void aiStep() { } // anger timer - if (!this.level.isClientSide()) { - this.updatePersistentAnger((ServerLevel) this.level, true); + if (!this.level().isClientSide()) { + this.updatePersistentAnger((ServerLevel) this.level(), true); } } @@ -181,7 +188,7 @@ public void tick() { @Override public boolean isInvulnerableTo(final DamageSource source) { // immune to suffocation while hiding - if (source == DamageSource.IN_WALL && this.isHiding()) { + if (source.is(DamageTypes.IN_WALL) && this.isHiding()) { return true; } return super.isInvulnerableTo(source); @@ -216,22 +223,24 @@ public void addAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); this.setVariant(getVariantByName(compound.getString(KEY_VARIANT))); - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); if (compound.contains(KEY_TREE_POS + ".x")) { final int x = compound.getInt(KEY_TREE_POS + ".x"); final int y = compound.getInt(KEY_TREE_POS + ".y"); final int z = compound.getInt(KEY_TREE_POS + ".z"); - this.setTreePos(new BlockPos(x, y, z)); + this.setTreePos(BlockPos.containing(x, y, z)); } this.hidingTime = compound.getInt(KEY_HIDING); } @Override - public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, MobSpawnType mobType, - @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficultyIn, + MobSpawnType mobType, + @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { SpawnGroupData data = super.finalizeSpawn(worldIn, difficultyIn, mobType, spawnDataIn, dataTag); final NymphVariant variant; - if (mobType == MobSpawnType.COMMAND || mobType == MobSpawnType.SPAWN_EGG || mobType == MobSpawnType.SPAWNER || mobType == MobSpawnType.DISPENSER) { + if (mobType == MobSpawnType.COMMAND || mobType == MobSpawnType.SPAWN_EGG || mobType == MobSpawnType.SPAWNER + || mobType == MobSpawnType.DISPENSER) { variant = getRandomVariant(getRandom()); } else { variant = getVariantForBiome(worldIn.getBiome(this.blockPosition())); @@ -319,7 +328,7 @@ public ResourceLocation getTradeLootTable() { @Override public void trade(PathfinderMob self, @Nullable final Player player, final ItemStack tradeItem) { TradingMob.super.trade(self, player, tradeItem); - this.level.broadcastEntityEvent(this, FINISH_TRADE_EVENT); + this.level().broadcastEntityEvent(this, FINISH_TRADE_EVENT); } @Override @@ -329,7 +338,10 @@ public void handleEntityEvent(byte id) { // swing arm and play sound this.swing(InteractionHand.MAIN_HAND, true); for (int i = 0; i < 4; i++) { - this.level.addParticle(ParticleTypes.HAPPY_VILLAGER, this.getX() + 0.5D * (random.nextDouble() - 0.5D), this.getEyeY() + 0.5D * (random.nextDouble() - 0.5D), this.getZ() + 0.5D * (random.nextDouble() - 0.5D), 0, 0, 0); + this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, + this.getX() + 0.5D * (random.nextDouble() - 0.5D), + this.getEyeY() + 0.5D * (random.nextDouble() - 0.5D), + this.getZ() + 0.5D * (random.nextDouble() - 0.5D), 0, 0, 0); } break; default: @@ -382,7 +394,8 @@ public Vec3 getTreeVec() { } public boolean isHiding() { - return hidingTime > 0 || this.level.getBlockState(this.blockPosition().above()).is(this.getVariant().getLogs()); + return hidingTime > 0 + || this.level().getBlockState(this.blockPosition().above()).is(this.getVariant().getLogs()); } public void setHiding(final boolean hiding) { @@ -408,9 +421,11 @@ public void setTreePos(@Nullable final BlockPos pos) { * @return if this block pos is supporting a likely tree **/ public static boolean isTreeAt(final BlockGetter level, final BlockPos pos, final TagKey logs) { - // a "tree" is considered two log blocks on top of a dirt block (or other plant-sustaining block) + // a "tree" is considered two log blocks on top of a dirt block (or other + // plant-sustaining block) final BlockState soil = level.getBlockState(pos); - return (soil.is(BlockTags.DIRT)) && level.getBlockState(pos.above(1)).is(logs) && level.getBlockState(pos.above(2)).is(logs); + return (soil.is(BlockTags.DIRT)) && level.getBlockState(pos.above(1)).is(logs) + && level.getBlockState(pos.above(2)).is(logs); } /** @@ -428,7 +443,7 @@ public boolean tryExitTree() { double y = this.getY() + random.nextInt(radius) - radius / 2.0D; double z = this.getZ() + random.nextInt(radius * 2) - radius; // try to path to the position - if (level.noCollision(this, this.getType().getAABB(x, y, z))) { + if (level().noCollision(this, this.getType().getAABB(x, y, z))) { this.getNavigation().moveTo(x, y, z, 1.0D); return true; } @@ -468,8 +483,9 @@ public HideGoal(final int maxHidingTimeIn) { public boolean canUse() { if (cooldown > 0) { cooldown--; - } else if (Dryad.this.treePos != null && Dryad.this.isWithinDistanceOfTree(1.5D) && Dryad.this.getTarget() == null) { - return isTreeAt(Dryad.this.level, Dryad.this.treePos, Dryad.this.getVariant().getLogs()); + } else if (Dryad.this.treePos != null && Dryad.this.isWithinDistanceOfTree(1.5D) + && Dryad.this.getTarget() == null) { + return isTreeAt(Dryad.this.level(), Dryad.this.treePos, Dryad.this.getVariant().getLogs()); } return false; } @@ -520,8 +536,8 @@ public boolean isTargetBlock(LevelReader worldIn, BlockPos pos) { return false; } // ensure the block is not claimed by nearby dryads - List dryads = Dryad.this.level.getEntitiesOfClass(Dryad.class, Dryad.this.getBoundingBox().inflate(10.0D), e -> - pos.equals(e.treePos)); + List dryads = Dryad.this.level().getEntitiesOfClass(Dryad.class, + Dryad.this.getBoundingBox().inflate(10.0D), e -> pos.equals(e.treePos)); // if any dryads were found with the given tree, reject this position return dryads.isEmpty(); } @@ -583,13 +599,20 @@ public boolean canUse() { } public static class Variant implements NymphVariant { - public static final Variant ACACIA = new Variant("acacia", new ResourceLocation("forge", "is_savanna"), () -> Blocks.ACACIA_SAPLING); - public static final Variant BIRCH = new Variant("birch", new ResourceLocation("forge", "is_birch"), () -> Blocks.BIRCH_SAPLING); - public static final Variant DARK_OAK = new Variant("dark_oak", new ResourceLocation("forge", "is_spooky"), () -> Blocks.DARK_OAK_SAPLING); - public static final Variant JUNGLE = new Variant("jungle", new ResourceLocation("minecraft", "is_jungle"), () -> Blocks.JUNGLE_SAPLING); - public static final Variant OAK = new Variant("oak", new ResourceLocation("forge", "is_plains"), () -> Blocks.OAK_SAPLING); - public static final Variant SPRUCE = new Variant("spruce", new ResourceLocation("minecraft", "is_taiga"), () -> Blocks.SPRUCE_SAPLING); - public static final Variant OLIVE = new Variant(GreekFantasy.MODID, "olive", new ResourceLocation("forge", "is_olive"), () -> GFRegistry.BlockReg.OLIVE_SAPLING.get()); + public static final Variant ACACIA = new Variant("acacia", new ResourceLocation("forge", "is_savanna"), + () -> Blocks.ACACIA_SAPLING); + public static final Variant BIRCH = new Variant("birch", new ResourceLocation("forge", "is_birch"), + () -> Blocks.BIRCH_SAPLING); + public static final Variant DARK_OAK = new Variant("dark_oak", new ResourceLocation("forge", "is_spooky"), + () -> Blocks.DARK_OAK_SAPLING); + public static final Variant JUNGLE = new Variant("jungle", new ResourceLocation("minecraft", "is_jungle"), + () -> Blocks.JUNGLE_SAPLING); + public static final Variant OAK = new Variant("oak", new ResourceLocation("forge", "is_plains"), + () -> Blocks.OAK_SAPLING); + public static final Variant SPRUCE = new Variant("spruce", new ResourceLocation("minecraft", "is_taiga"), + () -> Blocks.SPRUCE_SAPLING); + public static final Variant OLIVE = new Variant(GreekFantasy.MODID, "olive", + new ResourceLocation("forge", "is_olive"), () -> GFRegistry.BlockReg.OLIVE_SAPLING.get()); public static ImmutableMap OVERWORLD = ImmutableMap.builder() .put(ACACIA.name, ACACIA).put(BIRCH.name, BIRCH).put(DARK_OAK.name, DARK_OAK) @@ -608,13 +631,14 @@ protected Variant(final String nameIn, final ResourceLocation biomeTag, final Su this("minecraft", nameIn, ForgeRegistries.BIOMES.tags().createTagKey(biomeTag), "dryad", "logs", saplingIn); } - protected Variant(final String modid, final String nameIn, final ResourceLocation biomeTag, final Supplier saplingIn) { + protected Variant(final String modid, final String nameIn, final ResourceLocation biomeTag, + final Supplier saplingIn) { this(modid, nameIn, ForgeRegistries.BIOMES.tags().createTagKey(biomeTag), "dryad", "logs", saplingIn); } protected Variant(final String modid, final String nameIn, final TagKey biome, - final String entityIn, final String tagSuffixIn, - final Supplier saplingIn) { + final String entityIn, final String tagSuffixIn, + final Supplier saplingIn) { this.name = nameIn; this.biomeTag = biome; this.sapling = saplingIn; diff --git a/src/main/java/greekfantasy/entity/Elpis.java b/src/main/java/greekfantasy/entity/Elpis.java index df17611a..8faa74d7 100644 --- a/src/main/java/greekfantasy/entity/Elpis.java +++ b/src/main/java/greekfantasy/entity/Elpis.java @@ -1,4 +1,5 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -126,22 +127,22 @@ public void aiStep() { public void tick() { super.tick(); setNoGravity(true); - if (this.level.isClientSide() && random.nextInt(9) == 0) { + if (this.level().isClientSide() && random.nextInt(9) == 0) { // add particles final double radius = 0.25D; if (isTrading()) { // trading particles - level.addParticle(ParticleTypes.INSTANT_EFFECT, - this.getX() + (level.random.nextDouble() - 0.5D) * radius, - this.getEyeY() + (level.random.nextDouble() - 0.5D) * radius * 0.75D, - this.getZ() + (level.random.nextDouble() - 0.5D) * radius, + level().addParticle(ParticleTypes.INSTANT_EFFECT, + this.getX() + (level().random.nextDouble() - 0.5D) * radius, + this.getEyeY() + (level().random.nextDouble() - 0.5D) * radius * 0.75D, + this.getZ() + (level().random.nextDouble() - 0.5D) * radius, 0, 0, 0); } else { // ambient particles - level.addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, - this.getX() + (level.random.nextDouble() - 0.5D) * radius, - this.getEyeY() + (level.random.nextDouble() - 0.5D) * radius * 0.75D, - this.getZ() + (level.random.nextDouble() - 0.5D) * radius, + level().addParticle(ParticleTypes.AMBIENT_ENTITY_EFFECT, + this.getX() + (level().random.nextDouble() - 0.5D) * radius, + this.getEyeY() + (level().random.nextDouble() - 0.5D) * radius * 0.75D, + this.getZ() + (level().random.nextDouble() - 0.5D) * radius, 1.0F, 0.60F, 0.92F); } } @@ -167,7 +168,7 @@ protected InteractionResult mobInteract(final Player player, final InteractionHa @Override protected SoundEvent getAmbientSound() { - return SoundEvents.NOTE_BLOCK_CHIME; + return SoundEvents.NOTE_BLOCK_CHIME.value(); } @Override @@ -231,7 +232,7 @@ public void readAdditionalSaveData(CompoundTag compound) { final int x = compound.getInt(KEY_HOME + ".x"); final int y = compound.getInt(KEY_HOME + ".y"); final int z = compound.getInt(KEY_HOME + ".z"); - this.restrictTo(new BlockPos(x, y, z), wanderDistance); + this.restrictTo(BlockPos.containing(x, y, z), wanderDistance); } } @@ -255,8 +256,8 @@ public void setState(final byte state) { this.getEntityData().set(STATE, state); if (state == STATE_DESPAWNING) { despawnTime = 1; - if (!level.isClientSide()) { - level.broadcastEntityEvent(this, DESPAWN_EVENT); + if (!level().isClientSide()) { + this.level().broadcastEntityEvent(this, DESPAWN_EVENT); } } } @@ -316,7 +317,7 @@ public float getDespawnPercent(final float partialTick) { @Override public boolean isFlying() { - return level.getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).isAir(); + return level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).isAir(); } // Trading goal @@ -336,7 +337,7 @@ public TradeGoal(final Supplier resultStack, final int durationIn) { @Override public boolean canUse() { - player = Elpis.this.level.getNearestPlayer(Elpis.this, 8.0D); + player = Elpis.this.level().getNearestPlayer(Elpis.this, 8.0D); return player != null && Elpis.this.isTrading(); } @@ -361,7 +362,7 @@ public void tick() { Elpis.this.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY); // start despawning Elpis.this.setState(STATE_DESPAWNING); - level.broadcastEntityEvent(Elpis.this, DESPAWN_EVENT); + Elpis.this.level().broadcastEntityEvent(Elpis.this, DESPAWN_EVENT); } } @@ -434,7 +435,7 @@ public boolean canContinueToUse() { public void start() { Vec3 vec3 = this.findPos(); if (vec3 != null) { - Elpis.this.navigation.moveTo(Elpis.this.navigation.createPath(new BlockPos(vec3), 1), speed); + Elpis.this.navigation.moveTo(Elpis.this.navigation.createPath(BlockPos.containing(vec3), 1), speed); } } diff --git a/src/main/java/greekfantasy/entity/Gigante.java b/src/main/java/greekfantasy/entity/Gigante.java index c69398fe..3f23a648 100644 --- a/src/main/java/greekfantasy/entity/Gigante.java +++ b/src/main/java/greekfantasy/entity/Gigante.java @@ -102,19 +102,19 @@ public void aiStep() { attackCooldown = Math.max(attackCooldown - 1, 0); // particles - if (level.isClientSide() && this.getDeltaMovement().horizontalDistanceSqr() > (double) 2.5000003E-7F && this.random.nextInt(5) == 0) { + if (level().isClientSide() && this.getDeltaMovement().horizontalDistanceSqr() > (double) 2.5000003E-7F && this.random.nextInt(5) == 0) { int i = Mth.floor(this.getX()); int j = Mth.floor(this.getY() - (double) 0.2F); int k = Mth.floor(this.getZ()); - BlockPos pos = new BlockPos(i, j, k); - BlockState blockstate = this.level.getBlockState(pos); + BlockPos pos = BlockPos.containing(i, j, k); + BlockState blockstate = this.level().getBlockState(pos); if (!blockstate.isAir()) { - this.level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(pos), this.getX() + ((double) this.random.nextFloat() - 0.5D) * (double) this.getBbWidth(), this.getY() + 0.1D, this.getZ() + ((double) this.random.nextFloat() - 0.5D) * (double) this.getBbWidth(), 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D); + this.level().addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(pos), this.getX() + ((double) this.random.nextFloat() - 0.5D) * (double) this.getBbWidth(), this.getY() + 0.1D, this.getZ() + ((double) this.random.nextFloat() - 0.5D) * (double) this.getBbWidth(), 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D); } } - if (!this.level.isClientSide()) { - this.updatePersistentAnger((ServerLevel) this.level, true); + if (!this.level().isClientSide()) { + this.updatePersistentAnger((ServerLevel) this.level(), true); } } @@ -220,7 +220,7 @@ public void addAdditionalSaveData(CompoundTag compound) { @Override public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); } @Override diff --git a/src/main/java/greekfantasy/entity/GoldenRam.java b/src/main/java/greekfantasy/entity/GoldenRam.java index eb1decbd..cb32a941 100644 --- a/src/main/java/greekfantasy/entity/GoldenRam.java +++ b/src/main/java/greekfantasy/entity/GoldenRam.java @@ -1,4 +1,5 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -73,7 +74,7 @@ public static GoldenRam spawnGoldenRam(final ServerLevel level, final Player pla entity.setPersistenceRequired(); entity.setPortalCooldown(); entity.setAge(sheep.getAge()); - level.addFreshEntityWithPassengers(entity); + level.addFreshEntity(entity); entity.finalizeSpawn(level, level.getCurrentDifficultyAt(sheep.blockPosition()), MobSpawnType.CONVERSION, null, null); // remove the old entity sheep.discard(); @@ -99,19 +100,19 @@ protected void registerGoals() { public void aiStep() { super.aiStep(); // anger timer - if (!this.level.isClientSide()) { - this.updatePersistentAnger((ServerLevel) this.level, true); + if (!this.level().isClientSide()) { + this.updatePersistentAnger((ServerLevel) this.level(), true); } // when sheared, despawn and replace with regular sheep if (this.isSheared()) { - Sheep entity = EntityType.SHEEP.create(level); + Sheep entity = EntityType.SHEEP.create(level()); entity.copyPosition(this); entity.yBodyRot = this.yBodyRot; entity.setPortalCooldown(); entity.setColor(this.getColor()); entity.setSheared(true); entity.setAge(this.getAge()); - level.addFreshEntity(entity); + level().addFreshEntity(entity); // remove self this.discard(); } @@ -119,8 +120,8 @@ public void aiStep() { @Override public List onSheared(@Nullable Player player, @Nonnull ItemStack item, Level level, BlockPos pos, int fortune) { - level.playSound(null, this, SoundEvents.SHEEP_SHEAR, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, 1.0F, 0.8F); - if (!level.isClientSide()) { + level().playSound(null, this, SoundEvents.SHEEP_SHEAR, player == null ? SoundSource.BLOCKS : SoundSource.PLAYERS, 1.0F, 0.8F); + if (!level().isClientSide()) { this.setSheared(true); // create a list of items to return List items = new ArrayList<>(); @@ -176,7 +177,7 @@ public void addAdditionalSaveData(CompoundTag compound) { @Override public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); } // IAngerable methods diff --git a/src/main/java/greekfantasy/entity/Lampad.java b/src/main/java/greekfantasy/entity/Lampad.java index 5ad4d60b..8242ea5c 100644 --- a/src/main/java/greekfantasy/entity/Lampad.java +++ b/src/main/java/greekfantasy/entity/Lampad.java @@ -1,4 +1,5 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; import com.google.common.collect.ImmutableMap; import greekfantasy.GFRegistry; diff --git a/src/main/java/greekfantasy/entity/Makhai.java b/src/main/java/greekfantasy/entity/Makhai.java index 147d7dfd..f09b651c 100644 --- a/src/main/java/greekfantasy/entity/Makhai.java +++ b/src/main/java/greekfantasy/entity/Makhai.java @@ -124,7 +124,7 @@ public void aiStep() { } // determine when to despawn - if (!level.isClientSide() && !this.isNoAi() && (getTarget() == null || getNavigation().isDone()) && !isDespawning() && random.nextInt(280) == 0) { + if (!level().isClientSide() && !this.isNoAi() && (getTarget() == null || getNavigation().isDone()) && !isDespawning() && random.nextInt(280) == 0) { setDespawning(true); } @@ -135,20 +135,20 @@ public void tick() { super.tick(); // spawn particles - if (level.isClientSide() && (isSpawning() || isDespawning())) { + if (level().isClientSide() && (isSpawning() || isDespawning())) { final double x = this.getX(); final double y = this.getY() + 0.5D; final double z = this.getZ(); final double motion = 0.06D; final double radius = this.getBbWidth() * 1.15D; for (int i = 0; i < 4; i++) { - level.addParticle(ParticleTypes.LARGE_SMOKE, - x + (level.random.nextDouble() - 0.5D) * radius, - y + (level.random.nextDouble() - 0.5D) * radius, - z + (level.random.nextDouble() - 0.5D) * radius, - (level.random.nextDouble() - 0.5D) * motion, - (level.random.nextDouble() - 0.5D) * 0.07D, - (level.random.nextDouble() - 0.5D) * motion); + level().addParticle(ParticleTypes.LARGE_SMOKE, + x + (level().random.nextDouble() - 0.5D) * radius, + y + (level().random.nextDouble() - 0.5D) * radius, + z + (level().random.nextDouble() - 0.5D) * radius, + (level().random.nextDouble() - 0.5D) * motion, + (level().random.nextDouble() - 0.5D) * 0.07D, + (level().random.nextDouble() - 0.5D) * motion); } } } @@ -202,8 +202,8 @@ public void setSpawning(final boolean spawning) { if(spawning) { spawnTime = maxSpawnTime; setState(SPAWNING); - if(!this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, SPAWN_EVENT); + if(!this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, SPAWN_EVENT); } } else { spawnTime = 0; @@ -215,8 +215,8 @@ public void setDespawning(final boolean despawning) { if(despawning) { despawnTime = maxSpawnTime; setState(DESPAWNING); - if(!this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, DESPAWN_EVENT); + if(!this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, DESPAWN_EVENT); } } else { despawnTime = 0; diff --git a/src/main/java/greekfantasy/entity/Naiad.java b/src/main/java/greekfantasy/entity/Naiad.java index fcec5010..4c859581 100644 --- a/src/main/java/greekfantasy/entity/Naiad.java +++ b/src/main/java/greekfantasy/entity/Naiad.java @@ -1,4 +1,5 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; import com.google.common.collect.ImmutableMap; import greekfantasy.GFRegistry; @@ -145,7 +146,7 @@ public void tick() { this.setPose(Pose.STANDING); } // check potion effects - if (!level.isClientSide() && level instanceof ServerLevel serverLevel + if (!level().isClientSide() && level() instanceof ServerLevel serverLevel && this.getVariant() == Variant.OCEAN && this.getEffect(GFRegistry.MobEffectReg.CURSE_OF_CIRCE.get()) != null) { // spawn scylla @@ -242,7 +243,7 @@ public void addAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); this.setVariant(getVariantByName(compound.getString(KEY_VARIANT))); - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); } @Override @@ -336,7 +337,7 @@ public boolean isPushedByFluid() { @Override public void updateSwimming() { - if (!this.level.isClientSide) { + if (!this.level().isClientSide) { if (this.isEffectiveAi() && this.isInWater()) { this.navigation = this.waterNavigation; this.setSwimming(true); @@ -349,14 +350,14 @@ public void updateSwimming() { @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - ThrownTrident throwntrident = new ThrownTrident(this.level, this, new ItemStack(Items.TRIDENT)); + ThrownTrident throwntrident = new ThrownTrident(this.level(), this, new ItemStack(Items.TRIDENT)); double d0 = target.getX() - this.getX(); double d1 = target.getY(0.33D) - throwntrident.getY(); double d2 = target.getZ() - this.getZ(); double d3 = Math.sqrt(d0 * d0 + d2 * d2); - throwntrident.shoot(d0, d1 + d3 * (double) 0.2F, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); + throwntrident.shoot(d0, d1 + d3 * (double) 0.2F, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); this.playSound(SoundEvents.TRIDENT_THROW, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level.addFreshEntity(throwntrident); + this.level().addFreshEntity(throwntrident); } public static class Variant implements StringRepresentable { diff --git a/src/main/java/greekfantasy/entity/Orthus.java b/src/main/java/greekfantasy/entity/Orthus.java index 58cfe175..0ebe9775 100644 --- a/src/main/java/greekfantasy/entity/Orthus.java +++ b/src/main/java/greekfantasy/entity/Orthus.java @@ -1,4 +1,5 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -139,7 +140,7 @@ public void aiStep() { // update lifespan if (this.limitedLifespan && --this.limitedLifeTicks <= 0) { this.limitedLifeTicks = 40; - hurt(DamageSource.STARVE, 1.0F); + hurt(this.damageSources().starve(), 1.0F); } } @@ -156,7 +157,7 @@ public void tick() { } // spawn particles - if (level.isClientSide() && this.isFireAttack()) { + if (level().isClientSide() && this.isFireAttack()) { spawnFireParticles(); } } @@ -282,11 +283,11 @@ public void readAdditionalSaveData(CompoundTag compound) { if (compound.contains(KEY_LIFE_TICKS)) { setLimitedLife(compound.getInt(KEY_LIFE_TICKS)); } - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); } public void spawnFireParticles() { - if (!level.isClientSide()) { + if (!level().isClientSide()) { return; } Vec3 lookVec = this.getLookAngle(); @@ -295,10 +296,10 @@ public void spawnFireParticles() { final double radius = 0.75D; for (int i = 0; i < 5; i++) { - level.addParticle(ParticleTypes.FLAME, - pos.x + (level.random.nextDouble() - 0.5D) * radius, - pos.y + (level.random.nextDouble() - 0.5D) * radius, - pos.z + (level.random.nextDouble() - 0.5D) * radius, + level().addParticle(ParticleTypes.FLAME, + pos.x + (level().random.nextDouble() - 0.5D) * radius, + pos.y + (level().random.nextDouble() - 0.5D) * radius, + pos.z + (level().random.nextDouble() - 0.5D) * radius, lookVec.x * motion * FIRE_RANGE, lookVec.y * motion * 0.5D, lookVec.z * motion * FIRE_RANGE); @@ -364,7 +365,7 @@ public boolean canMate(Animal otherAnimal) { @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack heldItem = player.getItemInHand(hand); - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { boolean flag = this.isOwnedBy(player) || this.isTame() || heldItem.is(FOOD) && !this.isTame(); return flag ? InteractionResult.CONSUME : InteractionResult.PASS; @@ -412,9 +413,9 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { this.navigation.stop(); this.setTarget(null); this.setOrderedToSit(true); - this.level.broadcastEntityEvent(this, (byte) 7); + this.level().broadcastEntityEvent(this, (byte) 7); } else { - this.level.broadcastEntityEvent(this, (byte) 6); + this.level().broadcastEntityEvent(this, (byte) 6); } return InteractionResult.SUCCESS; @@ -454,13 +455,13 @@ public float getHeadRollAngle(float partialTick) { public void setFireAttack(final boolean shooting) { if(shooting) { this.fireTime = MAX_FIRE_TIME; - if(!level.isClientSide()) { - level.broadcastEntityEvent(this, CLIENT_START_FIRE_EVENT); + if(!level().isClientSide()) { + this.level().broadcastEntityEvent(this, CLIENT_START_FIRE_EVENT); } } else { this.fireTime = 0; - if(!level.isClientSide()) { - level.broadcastEntityEvent(this, CLIENT_STOP_FIRE_EVENT); + if(!level().isClientSide()) { + this.level().broadcastEntityEvent(this, CLIENT_STOP_FIRE_EVENT); } } } diff --git a/src/main/java/greekfantasy/entity/Palladium.java b/src/main/java/greekfantasy/entity/Palladium.java index 7ad0ab3d..b2741e62 100644 --- a/src/main/java/greekfantasy/entity/Palladium.java +++ b/src/main/java/greekfantasy/entity/Palladium.java @@ -12,6 +12,8 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.FluidTags; +import net.minecraft.world.damagesource.DamageTypes; +import net.minecraft.tags.DamageTypeTags; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -26,8 +28,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.LightBlock; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; +// Material removed in 1.20.1 public class Palladium extends LivingEntity { @@ -35,7 +38,7 @@ public class Palladium extends LivingEntity { public Palladium(final EntityType entityType, final Level world) { super(entityType, world); - this.maxUpStep = 0.0F; + this.setMaxUpStep(0.0F); } public static AttributeSupplier.Builder createAttributes() { @@ -97,16 +100,16 @@ public void kill() { @Override public boolean hurt(DamageSource source, float amount) { - if (!this.level.isClientSide && !this.isRemoved()) { - if (DamageSource.OUT_OF_WORLD.equals(source)) { + if (!this.level().isClientSide && !this.isRemoved()) { + if (source.is(DamageTypes.FELL_OUT_OF_WORLD)) { this.kill(); return false; } else if (!this.isInvulnerableTo(source)) { - if (source.isExplosion()) { + if (source.is(DamageTypeTags.IS_EXPLOSION)) { this.brokenByAnything(source); this.kill(); return false; - } else if (DamageSource.IN_FIRE.equals(source)) { + } else if (source.is(DamageTypes.IN_FIRE)) { if (this.isOnFire()) { this.causeDamage(source, 0.15F); } else { @@ -114,7 +117,7 @@ public boolean hurt(DamageSource source, float amount) { } return false; - } else if (DamageSource.ON_FIRE.equals(source) && this.getHealth() > 0.5F) { + } else if (source.is(DamageTypes.ON_FIRE) && this.getHealth() > 0.5F) { this.causeDamage(source, 4.0F); return false; } else { @@ -123,7 +126,8 @@ public boolean hurt(DamageSource source, float amount) { boolean flag2 = "player".equals(source.getMsgId()); if (!flag2 && !flag) { return false; - } else if (source.getEntity() instanceof Player && !((Player) source.getEntity()).getAbilities().mayBuild) { + } else if (source.getEntity() instanceof Player + && !((Player) source.getEntity()).getAbilities().mayBuild) { return false; } else if (source.isCreativePlayer()) { this.playBrokenSound(); @@ -131,9 +135,9 @@ public boolean hurt(DamageSource source, float amount) { this.kill(); return flag1; } else { - long i = this.level.getGameTime(); + long i = this.level().getGameTime(); if (i - this.lastHit > 5L && !flag) { - this.level.broadcastEntityEvent(this, (byte) 32); + this.level().broadcastEntityEvent(this, (byte) 32); this.lastHit = i; } else { this.brokenByPlayer(source); @@ -172,29 +176,32 @@ public void aiStep() { // parent tick super.aiStep(); // server-side tick logic - if (!level.isClientSide && tickCount % 4 == 1) { + if (!level().isClientSide && tickCount % 4 == 1) { // attempt to place light block BlockPos posIn = getOnPos().above(); - BlockState blockIn = level.getBlockState(posIn); + BlockState blockIn = level().getBlockState(posIn); // check if current block can be replaced - if ((blockIn.getMaterial() == Material.AIR || blockIn.getMaterial().isLiquid()) + if ((blockIn.isAir() || blockIn.getFluidState().isEmpty() == false) && !GFRegistry.BlockReg.LIGHT.get().defaultBlockState().is(blockIn.getBlock())) { // determine waterlog value boolean waterlogged = blockIn.getFluidState().isSource() && blockIn.getFluidState().is(FluidTags.WATER); // create light block BlockState lightBlock = GFRegistry.BlockReg.LIGHT.get() .defaultBlockState() - .setValue(PalladiumLightBlock.LEVEL, 11) + .setValue(LightBlock.LEVEL, 11) .setValue(PalladiumLightBlock.WATERLOGGED, waterlogged); // place light block - level.setBlock(posIn, lightBlock, Block.UPDATE_ALL); + level().setBlock(posIn, lightBlock, Block.UPDATE_ALL); } } } private void showBreakingParticles() { - if (this.level instanceof ServerLevel) { - ((ServerLevel) this.level).sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, Blocks.STONE.defaultBlockState()), this.getX(), this.getY(0.66D), this.getZ(), 10, (double) (this.getBbWidth() / 4.0F), (double) (this.getBbHeight() / 4.0F), (double) (this.getBbWidth() / 4.0F), 0.05D); + if (this.level() instanceof ServerLevel) { + ((ServerLevel) this.level()).sendParticles( + new BlockParticleOption(ParticleTypes.BLOCK, Blocks.STONE.defaultBlockState()), this.getX(), + this.getY(0.66D), this.getZ(), 10, (double) (this.getBbWidth() / 4.0F), + (double) (this.getBbHeight() / 4.0F), (double) (this.getBbWidth() / 4.0F), 0.05D); } } @@ -212,7 +219,7 @@ private void causeDamage(DamageSource source, float amount) { private void brokenByPlayer(DamageSource p_213815_1_) { // drop altar final ItemStack altarItem = new ItemStack(GFRegistry.ItemReg.PALLADIUM.get()); - Block.popResource(level, blockPosition().above(), altarItem); + Block.popResource(level(), blockPosition().above(), altarItem); // drop other this.brokenByAnything(p_213815_1_); } @@ -223,7 +230,8 @@ private void brokenByAnything(DamageSource source) { } private void playBrokenSound() { - this.level.playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.STONE_BREAK, this.getSoundSource(), 1.0F, 1.0F); + this.level().playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.STONE_BREAK, + this.getSoundSource(), 1.0F, 1.0F); } @Override diff --git a/src/main/java/greekfantasy/entity/Pegasus.java b/src/main/java/greekfantasy/entity/Pegasus.java index bcb0da52..31de54fd 100644 --- a/src/main/java/greekfantasy/entity/Pegasus.java +++ b/src/main/java/greekfantasy/entity/Pegasus.java @@ -1,5 +1,8 @@ package greekfantasy.entity; +import java.util.function.DoubleSupplier; +import java.util.function.IntUnaryOperator; + import greekfantasy.GFRegistry; import greekfantasy.entity.util.HasHorseVariant; import net.minecraft.Util; @@ -45,7 +48,8 @@ public class Pegasus extends AbstractHorse implements FlyingAnimal, HasHorseVariant { - private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(Pegasus.class, EntityDataSerializers.INT); + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(Pegasus.class, + EntityDataSerializers.INT); private static final String KEY_VARIANT = "Variant"; private static final int FLYING_INTERVAL = 8; @@ -89,9 +93,9 @@ public void registerGoals() { @Override public PathNavigation getNavigation() { if (this.isPassenger() && this.getVehicle() instanceof Mob) { - Mob mob = (Mob)this.getVehicle(); + Mob mob = (Mob) this.getVehicle(); return mob.getNavigation(); - } else if(this.isFlying()) { + } else if (this.isFlying()) { return this.flyingNavigation; } else { return this.groundNavigation; @@ -109,15 +113,15 @@ public void aiStep() { isFlying = false; } // setting this to true here allows smooth client-side motion - this.onGround = true; + this.setOnGround(true); // fall slowly when being ridden if (isVehicle() && this.getDeltaMovement().y < -0.1D) { this.setDeltaMovement(this.getDeltaMovement().multiply(1.0, 0.95D, 1.0)); } // take damage when too high - if (this.position().y > this.level.getHeight() + 16) { - this.hurt(DamageSource.OUT_OF_WORLD, 2.0F); + if (this.position().y > this.level().getHeight() + 16) { + this.hurt(this.damageSources().fellOutOfWorld(), 2.0F); } } @@ -126,35 +130,34 @@ public boolean requiresCustomPersistence() { return this.isTamed() || super.requiresCustomPersistence(); } - // CALLED FROM ON INITIAL SPAWN // @Override protected void randomizeAttributes(RandomSource random) { - this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.generateRandomMaxHealth(random)); - this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.generateRandomSpeed(random)); - this.getAttribute(Attributes.JUMP_STRENGTH).setBaseValue(this.generateRandomJumpStrength(random)); - this.getAttribute(Attributes.FLYING_SPEED).setBaseValue(this.getAttributeValue(Attributes.MOVEMENT_SPEED) + 1.15D); + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(generateMaxHealthBonus(random::nextInt)); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(generateSpeedValue(random::nextDouble)); + this.getAttribute(Attributes.JUMP_STRENGTH).setBaseValue(generateJumpStrengthBonus(random::nextDouble)); + this.getAttribute(Attributes.FLYING_SPEED) + .setBaseValue(this.getAttributeValue(Attributes.MOVEMENT_SPEED) + 1.15D); } - @Override - protected float generateRandomMaxHealth(RandomSource random) { - return super.generateRandomMaxHealth(random) + 10.0F; + private static float generateMaxHealthBonus(IntUnaryOperator random) { + return AbstractHorse.generateMaxHealth(random) + 10.0F; } - @Override - protected double generateRandomJumpStrength(RandomSource random) { - return super.generateRandomJumpStrength(random) + 0.20F; + private static double generateJumpStrengthBonus(DoubleSupplier random) { + return AbstractHorse.generateJumpStrength(random) + 0.20F; } - @Override - protected double generateRandomSpeed(RandomSource random) { - return super.generateRandomSpeed(random); + private static double generateSpeedValue(DoubleSupplier random) { + return AbstractHorse.generateSpeed(random); } @Nullable - public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficulty, MobSpawnType mobSpawnType, - @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { + @Override + public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInstance difficulty, + MobSpawnType mobSpawnType, + @Nullable SpawnGroupData spawnDataIn, @Nullable CompoundTag dataTag) { Variant color; if (spawnDataIn instanceof Horse.HorseGroupData) { color = ((Horse.HorseGroupData) spawnDataIn).variant; @@ -185,7 +188,7 @@ public void flyingJump() { float jumpMotion = (float) this.getCustomJump() + 0.82F; this.push(0, jumpMotion, 0); this.markHurt(); - this.onGround = true; + this.setOnGround(true); // reset flying time flyingTime = FLYING_INTERVAL; isFlying = true; @@ -194,8 +197,8 @@ public void flyingJump() { @Override public void handleStartJump(int jumpPower) { - //super.handleStartJump(jumpPower); - if (!this.onGround) { + // super.handleStartJump(jumpPower); + if (!this.onGround()) { this.setStanding(false); } } @@ -208,7 +211,7 @@ public boolean isJumping() { @Override public boolean isFlying() { final double flyingMotion = isBaby() ? 0.02D : 0.06D; - return !this.onGround || this.getDeltaMovement().lengthSqr() > flyingMotion; + return !this.onGround() || this.getDeltaMovement().lengthSqr() > flyingMotion; } @Override @@ -271,7 +274,7 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { if (!this.isBaby()) { if (this.isTamed() && player.isSecondaryUseActive()) { this.openCustomInventoryScreen(player); - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } if (this.isVehicle()) { @@ -280,7 +283,7 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { if ((itemstack.isEmpty() && this.isTamed()) || itemstack.is(GFRegistry.ItemReg.GOLDEN_BRIDLE.get())) { this.doPlayerRide(player); - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } } @@ -296,13 +299,13 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { if (!this.isTamed()) { this.makeMad(); - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } boolean isUsableSaddle = !this.isBaby() && !this.isSaddled() && itemstack.is(Items.SADDLE); if (this.isArmor(itemstack) || isUsableSaddle) { this.openCustomInventoryScreen(player); - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } } @@ -386,7 +389,8 @@ class AvoidPlayersGoal extends AvoidEntityGoal { public AvoidPlayersGoal(final Pegasus pegasus) { super(pegasus, Player.class, 16.0F, 1.2D, 1.1D, (entity) -> !entity.isDiscrete() && !pegasus.isVehicle() - && (!pegasus.isTamed() || pegasus.getOwnerUUID() == null || !entity.getUUID().equals(pegasus.getOwnerUUID()))); + && (!pegasus.isTamed() || pegasus.getOwnerUUID() == null + || !entity.getUUID().equals(pegasus.getOwnerUUID()))); } @Override diff --git a/src/main/java/greekfantasy/entity/Satyr.java b/src/main/java/greekfantasy/entity/Satyr.java index b2e388f2..de3bcf08 100644 --- a/src/main/java/greekfantasy/entity/Satyr.java +++ b/src/main/java/greekfantasy/entity/Satyr.java @@ -22,6 +22,7 @@ import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -162,16 +163,16 @@ public boolean canUse() { @Override public void aiStep() { super.aiStep(); - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { // play music if (isSummoning()) { SongManager.playMusic(this, GFRegistry.ItemReg.PANFLUTE.get(), SUMMONING_SONG, summonTime, 0.92F, 0.34F); } else if (isDancing()) { - SongManager.playMusic(this, GFRegistry.ItemReg.PANFLUTE.get(), GreekFantasy.CONFIG.getSatyrSong(), level.getGameTime(), 0.84F, 0.28F); + SongManager.playMusic(this, GFRegistry.ItemReg.PANFLUTE.get(), GreekFantasy.CONFIG.getSatyrSong(), level().getGameTime(), 0.84F, 0.28F); } } else { // anger timer - this.updatePersistentAnger((ServerLevel) this.level, true); + this.updatePersistentAnger((ServerLevel) this.level(), true); } // dancing timer @@ -212,7 +213,7 @@ public boolean isInvulnerableTo(final DamageSource source) { return true; } // immune to being in fires - return source == DamageSource.IN_FIRE; + return source.is(DamageTypes.IN_FIRE); } @Override @@ -262,7 +263,7 @@ public void onSyncedDataUpdated(final EntityDataAccessor key) { @Override public void handleEntityEvent(byte id) { if (id == PLAY_SUMMON_SOUND) { - this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.WOLF_HOWL, this.getSoundSource(), 1.1F, 0.9F + this.getRandom().nextFloat() * 0.2F, false); + this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.WOLF_HOWL, this.getSoundSource(), 1.1F, 0.9F + this.getRandom().nextFloat() * 0.2F, false); this.summonTime = 1; } else { super.handleEntityEvent(id); @@ -282,7 +283,7 @@ public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); this.setShaman(compound.getBoolean(KEY_SHAMAN)); this.setVariant(Variant.byId(compound.getByte(KEY_VARIANT))); - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); } // NeutralMob methods @@ -408,7 +409,7 @@ protected boolean wantsToDanceAround(@Nullable final BlockPos pos) { return false; } // ensure the block is a campfire - final BlockState target = level.getBlockState(pos); + final BlockState target = level().getBlockState(pos); if (!IS_CAMPFIRE.test(target, true)) { return false; } @@ -435,15 +436,15 @@ protected boolean wantsToDanceAround(@Nullable final BlockPos pos) { * @return true if the position is blocked or there is no solid surface */ protected boolean cannotStandAt(final BlockPos pos) { - BlockState state1 = level.getBlockState(pos); - BlockState state2 = level.getBlockState(pos.above()); + BlockState state1 = level().getBlockState(pos); + BlockState state2 = level().getBlockState(pos.above()); // check material and fluids at and above this position - if (state1.getMaterial().blocksMotion() || !state1.getFluidState().is(Fluids.EMPTY) - || state2.getMaterial().blocksMotion() || !state2.getFluidState().is(Fluids.EMPTY)) { + if (state1.blocksMotion() || !state1.getFluidState().is(Fluids.EMPTY) + || state2.blocksMotion() || !state2.getFluidState().is(Fluids.EMPTY)) { return true; } // check no solid surface below this position - if (!level.getBlockState(pos.below(1)).entityCanStandOn(level, pos.below(1), this)) { + if (!level().getBlockState(pos.below(1)).entityCanStandOn(level(), pos.below(1), this)) { return true; } // all conditions passed, entity can stand here @@ -469,7 +470,7 @@ protected void alertShamans() { // alert all nearby satyr shamans double range = Satyr.this.getAttributeValue(Attributes.FOLLOW_RANGE); final LivingEntity target = Satyr.this.getLastHurtByMob(); - final List shamans = Satyr.this.level.getEntitiesOfClass(Satyr.class, Satyr.this.getBoundingBox().inflate(range), e -> e.isShaman()); + final List shamans = Satyr.this.level().getEntitiesOfClass(Satyr.class, Satyr.this.getBoundingBox().inflate(range), e -> e.isShaman()); for (final Satyr shaman : shamans) { this.alertOther(shaman, target); } @@ -500,7 +501,7 @@ public void tick() { public void stop() { super.stop(); Satyr.this.setSummoning(false); - Satyr.this.level.broadcastEntityEvent(Satyr.this, PLAY_SUMMON_SOUND); + Satyr.this.level().broadcastEntityEvent(Satyr.this, PLAY_SUMMON_SOUND); } @Override @@ -607,7 +608,7 @@ public void tick() { // if we're close to the targetPos, update targetPos and path if (isNearTarget(1.26D)) { this.updateTarget(); - if (Satyr.this.isOnGround()) { + if (Satyr.this.onGround()) { Satyr.this.jumpFromGround(); } Satyr.this.getNavigation().moveTo(targetPos.x, targetPos.y, targetPos.z, moveSpeed); @@ -761,8 +762,8 @@ protected boolean isValidTarget(LevelReader level, BlockPos pos) { BlockPos p; for (final Direction d : Direction.Plane.HORIZONTAL) { p = pos.relative(d, 1); - if (IS_CAMPFIRE.test(level.getBlockState(p), false) - && !Satyr.this.level.isRainingAt(p)) { + if (IS_CAMPFIRE.test(level().getBlockState(p), false) + && !Satyr.this.level().isRainingAt(p)) { this.lightingFireAt = p; return true; } @@ -779,7 +780,7 @@ public double acceptedDistance() { public boolean canUse() { return Satyr.this.isIdleState() && Satyr.this.getTarget() == null - && Satyr.this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) + && Satyr.this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && super.canUse(); } @@ -824,11 +825,11 @@ public void stop() { } protected boolean lightCampfire(final BlockPos pos) { - if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(Satyr.this.level, Satyr.this)) { - final BlockState state = Satyr.this.level.getBlockState(pos); + if (net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(Satyr.this.level(), Satyr.this)) { + final BlockState state = Satyr.this.level().getBlockState(pos); if (IS_CAMPFIRE.test(state, false)) { Satyr.this.playSound(SoundEvents.FLINTANDSTEEL_USE, 1.0F, 1.0F); - Satyr.this.level.setBlock(pos, state.setValue(CampfireBlock.LIT, Boolean.TRUE), 2); + Satyr.this.level().setBlock(pos, state.setValue(CampfireBlock.LIT, Boolean.TRUE), 2); Satyr.this.swing(InteractionHand.MAIN_HAND, true); return true; } diff --git a/src/main/java/greekfantasy/entity/Sparti.java b/src/main/java/greekfantasy/entity/Sparti.java index b302caed..c4510b8c 100644 --- a/src/main/java/greekfantasy/entity/Sparti.java +++ b/src/main/java/greekfantasy/entity/Sparti.java @@ -104,7 +104,7 @@ public void aiStep() { // lifespan if (this.limitedLifespan && --this.limitedLifeTicks <= 0) { this.limitedLifeTicks = 20; - hurt(DamageSource.STARVE, 2.0F); + hurt(this.damageSources().starve(), 2.0F); } // update spawn time @@ -119,15 +119,15 @@ public void tick() { super.tick(); // particles when spawning - if (level.isClientSide() && isSpawning()) { + if (level().isClientSide() && isSpawning()) { int i = Mth.floor(this.getX()); int j = Mth.floor(this.getY() - (double) 0.2F); int k = Mth.floor(this.getZ()); - BlockPos pos = new BlockPos(i, j, k); - BlockState blockstate = level.getBlockState(pos); - if (!level.isEmptyBlock(pos)) { + BlockPos pos = BlockPos.containing(i, j, k); + BlockState blockstate = level().getBlockState(pos); + if (!level().isEmptyBlock(pos)) { for (int count = 0; count < 10; count++) { - this.level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(pos), + this.level().addParticle(new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(pos), this.getX() + ((double) this.random.nextFloat() - 0.5D) * (double) this.getBbWidth(), this.getY() + 0.1D, this.getZ() + ((double) this.random.nextFloat() - 0.5D) * (double) this.getBbWidth(), @@ -157,8 +157,8 @@ public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInsta public void setSpawning() { this.spawnTime = maxSpawnTime; this.refreshDimensions(); - if (!level.isClientSide()) { - this.level.broadcastEntityEvent(this, SPAWN_EVENT); + if (!level().isClientSide()) { + this.level().broadcastEntityEvent(this, SPAWN_EVENT); } } diff --git a/src/main/java/greekfantasy/entity/Triton.java b/src/main/java/greekfantasy/entity/Triton.java index ff1d02ff..3a414d64 100644 --- a/src/main/java/greekfantasy/entity/Triton.java +++ b/src/main/java/greekfantasy/entity/Triton.java @@ -70,7 +70,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.ServerLevelAccessor; -import net.minecraft.world.level.material.Material; +// Material removed in 1.20.1 import net.minecraft.world.level.pathfinder.BlockPathTypes; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; @@ -157,10 +157,10 @@ public void tick() { super.tick(); boolean inWater = this.isInWaterRainOrBubble(); // random motion when not in water - if (!inWater && this.onGround) { + if (!inWater && this.onGround()) { this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.2F, 0.5D, (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F)); this.setYRot(this.random.nextFloat() * 360.0F); - this.onGround = false; + this.setOnGround(false); this.hasImpulse = true; } // update pose @@ -214,14 +214,14 @@ public Optional trySpawnGuardian(ServerLevel level) { BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); for (int i = 0; i < 10; ++i) { pos.setWithOffset(blockpos, - level.random.nextInt(16) - 8, - level.random.nextInt(8) - 4, - level.random.nextInt(16) - 8); - if (level.getBlockState(pos).getMaterial() == Material.WATER) { - Guardian guardian = EntityType.GUARDIAN.create(level, null, null, null, pos, MobSpawnType.MOB_SUMMONED, false, false); + level().random.nextInt(16) - 8, + level().random.nextInt(8) - 4, + level().random.nextInt(16) - 8); + if (level().getFluidState(pos).is(net.minecraft.tags.FluidTags.WATER)) { + Guardian guardian = EntityType.GUARDIAN.create(level, null, null, pos, MobSpawnType.MOB_SUMMONED, false, false); if (guardian != null) { if (guardian.checkSpawnRules(level, MobSpawnType.MOB_SUMMONED) && guardian.checkSpawnObstruction(level)) { - level.addFreshEntityWithPassengers(guardian); + level().addFreshEntity(guardian); guardian.setPersistenceRequired(); guardian.getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP).ifPresent(c -> c.setEnabled(true)); return Optional.of(guardian); @@ -299,7 +299,7 @@ public ResourceLocation getTradeLootTable() { @Override public void trade(PathfinderMob self, @Nullable final Player player, final ItemStack tradeItem) { TradingMob.super.trade(self, player, tradeItem); - this.level.broadcastEntityEvent(this, FINISH_TRADE_EVENT); + this.level().broadcastEntityEvent(this, FINISH_TRADE_EVENT); } @Override @@ -323,7 +323,7 @@ public void handleEntityEvent(byte id) { // swing arm and play sound this.swing(InteractionHand.MAIN_HAND, true); for (int i = 0; i < 4; i++) { - this.level.addParticle(ParticleTypes.HAPPY_VILLAGER, this.getX() + 0.5D * (random.nextDouble() - 0.5D), this.getEyeY() + 0.5D * (random.nextDouble() - 0.5D), this.getZ() + 0.5D * (random.nextDouble() - 0.5D), 0, 0, 0); + this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getX() + 0.5D * (random.nextDouble() - 0.5D), this.getEyeY() + 0.5D * (random.nextDouble() - 0.5D), this.getZ() + 0.5D * (random.nextDouble() - 0.5D), 0, 0, 0); } break; default: @@ -338,17 +338,17 @@ public void handleEntityEvent(byte id) { public boolean hurt(final DamageSource source, final float amount) { // attempt to summon friendly guardian when hurt if (super.hurt(source, amount) && source.getEntity() instanceof Enemy) { - if (this.level instanceof ServerLevel serverLevel) { + if (this.level() instanceof ServerLevel serverLevel) { // determine if there are enough nearby tritons final AABB aabb = this.getBoundingBox().inflate(12.0D); - final long gameTime = level.getGameTime(); - List nearbyTriton = level.getEntitiesOfClass(Triton.class, aabb); + final long gameTime = level().getGameTime(); + List nearbyTriton = level().getEntitiesOfClass(Triton.class, aabb); List wantsToSpawnGuardian = nearbyTriton.stream() .filter(m -> m.wantsToSpawnGuardian(gameTime)) .limit(4L).toList(); if (wantsToSpawnGuardian.size() >= 2) { // determine if there are any guardians in range - List guardians = level.getEntitiesOfClass(Guardian.class, aabb, p -> p.getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP).orElse(FriendlyGuardian.EMPTY).isEnabled()); + List guardians = level().getEntitiesOfClass(Guardian.class, aabb, p -> p.getCapability(GreekFantasy.FRIENDLY_GUARDIAN_CAP).orElse(FriendlyGuardian.EMPTY).isEnabled()); if (guardians.isEmpty()) { // attempt to spawn guardian Optional oGuardian = trySpawnGuardian(serverLevel); @@ -376,7 +376,7 @@ public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); this.setSlim(compound.getBoolean(KEY_SLIM)); this.guardianTimestamp = compound.getLong(KEY_TIMESTAMP); - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); } @Override @@ -459,21 +459,21 @@ public boolean isPushedByFluid() { @Override public void updateSwimming() { - if (!this.level.isClientSide) { + if (!this.level().isClientSide) { this.setSwimming(true); } } @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - ThrownTrident throwntrident = new ThrownTrident(this.level, this, new ItemStack(Items.TRIDENT)); + ThrownTrident throwntrident = new ThrownTrident(this.level(), this, new ItemStack(Items.TRIDENT)); double d0 = target.getX() - this.getX(); double d1 = target.getY(0.33D) - throwntrident.getY(); double d2 = target.getZ() - this.getZ(); double d3 = Math.sqrt(d0 * d0 + d2 * d2); - throwntrident.shoot(d0, d1 + d3 * (double) 0.2F, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); + throwntrident.shoot(d0, d1 + d3 * (double) 0.2F, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); this.playSound(SoundEvents.TRIDENT_THROW, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level.addFreshEntity(throwntrident); + this.level().addFreshEntity(throwntrident); } static class TritonMoveControl extends WaterAnimalMoveControl { @@ -533,7 +533,7 @@ public boolean canUse() { return false; } // locate nearest dolphin - dolphin = entity.level.getNearestEntity(Dolphin.class, TargetingConditions.forNonCombat() + dolphin = entity.level().getNearestEntity(Dolphin.class, TargetingConditions.forNonCombat() .selector(e -> e.getAirSupply() > 200 && e.isInWaterOrBubble()), entity, entity.getX(), entity.getY(), entity.getZ(), entity.getBoundingBox().inflate(10.0D)); if (null == dolphin || dolphin.getTarget() != null) { @@ -590,7 +590,7 @@ public void tick() { if (duration >= maxDuration) { if (disSq < 6.25D) { dolphin.playSound(SoundEvents.DOLPHIN_EAT, 1.0F, 1.0F); - ((ServerLevel) entity.level).sendParticles(ParticleTypes.HEART, dolphin.getX(), dolphin.getY(), dolphin.getZ(), 2, 0.5D, 0.5D, 0.5D, 0.0D); + ((ServerLevel) entity.level()).sendParticles(ParticleTypes.HEART, dolphin.getX(), dolphin.getY(), dolphin.getZ(), 2, 0.5D, 0.5D, 0.5D, 0.0D); } stop(); } diff --git a/src/main/java/greekfantasy/entity/Unicorn.java b/src/main/java/greekfantasy/entity/Unicorn.java index efae6ef3..cc11320e 100644 --- a/src/main/java/greekfantasy/entity/Unicorn.java +++ b/src/main/java/greekfantasy/entity/Unicorn.java @@ -1,5 +1,8 @@ package greekfantasy.entity; +import net.minecraft.tags.DamageTypeTags; +import java.util.function.DoubleSupplier; +import java.util.function.IntUnaryOperator; import greekfantasy.GFRegistry; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.server.level.ServerLevel; @@ -55,24 +58,21 @@ public void registerGoals() { @Override protected void randomizeAttributes(RandomSource random) { - this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.generateRandomMaxHealth(random)); - this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.generateRandomSpeed(random)); - this.getAttribute(Attributes.JUMP_STRENGTH).setBaseValue(this.generateRandomJumpStrength(random)); + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.generateUnicornMaxHealth(random::nextInt)); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.generateUnicornSpeed(random::nextDouble)); + this.getAttribute(Attributes.JUMP_STRENGTH).setBaseValue(this.generateUnicornJumpStrength(random::nextDouble)); } - @Override - protected float generateRandomMaxHealth(RandomSource random) { - return super.generateRandomMaxHealth(random) + 28.0F; + protected float generateUnicornMaxHealth(IntUnaryOperator random) { + return AbstractHorse.generateMaxHealth(random) + 28.0F; } - @Override - protected double generateRandomJumpStrength(RandomSource random) { - return super.generateRandomJumpStrength(random) + 0.22F; + protected double generateUnicornJumpStrength(DoubleSupplier random) { + return AbstractHorse.generateJumpStrength(random) + 0.22F; } - @Override - protected double generateRandomSpeed(RandomSource random) { - return super.generateRandomSpeed(random) + 0.16F; + protected double generateUnicornSpeed(DoubleSupplier random) { + return AbstractHorse.generateSpeed(random) + 0.16F; } // MISC // @@ -82,13 +82,13 @@ protected double generateRandomSpeed(RandomSource random) { public void tick() { super.tick(); - if(level.isClientSide() && random.nextFloat() < 0.25F) { + if(level().isClientSide() && random.nextFloat() < 0.25F) { // spawn particles float radius = getBbWidth(); - level.addParticle(ParticleTypes.INSTANT_EFFECT, - this.getX() + (level.random.nextDouble() - 0.5D) * radius, - this.getY() + (level.random.nextDouble() - 0.5D) * radius * 0.75D, - this.getZ() + (level.random.nextDouble() - 0.5D) * radius, + level().addParticle(ParticleTypes.INSTANT_EFFECT, + this.getX() + (level().random.nextDouble() - 0.5D) * radius, + this.getY() + (level().random.nextDouble() - 0.5D) * radius * 0.75D, + this.getZ() + (level().random.nextDouble() - 0.5D) * radius, 0, 0, 0); } } @@ -106,7 +106,7 @@ public void die(DamageSource cause) { @Override protected void actuallyHurt(final DamageSource source, final float amountIn) { - super.actuallyHurt(source, source.isBypassMagic() || source.isBypassArmor() ? amountIn : amountIn * 0.5F); + super.actuallyHurt(source, source.is(DamageTypeTags.BYPASSES_EFFECTS) || source.is(DamageTypeTags.BYPASSES_ARMOR) ? amountIn : amountIn * 0.5F); } @Override @@ -134,7 +134,7 @@ protected void playGallopSound(SoundType sound) { ItemStack stack = this.inventory.getItem(1); if (isArmor(stack)) - stack.onHorseArmorTick(level, this); + stack.onHorseArmorTick(level(), this); } @Override @@ -172,7 +172,7 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { if (!this.isBaby()) { if (this.isTamed() && player.isSecondaryUseActive()) { this.openCustomInventoryScreen(player); - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } if (this.isVehicle()) { @@ -181,7 +181,7 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { if ((itemstack.isEmpty() && this.isTamed()) || itemstack.is(GFRegistry.ItemReg.GOLDEN_BRIDLE.get())) { this.doPlayerRide(player); - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } } @@ -197,13 +197,13 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { if (!this.isTamed()) { this.makeMad(); - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } boolean isUsableSaddle = !this.isBaby() && !this.isSaddled() && itemstack.is(Items.SADDLE); if (this.isArmor(itemstack) || isUsableSaddle) { this.openCustomInventoryScreen(player); - return InteractionResult.sidedSuccess(this.level.isClientSide()); + return InteractionResult.sidedSuccess(this.level().isClientSide()); } } diff --git a/src/main/java/greekfantasy/entity/Whirl.java b/src/main/java/greekfantasy/entity/Whirl.java index 511b8feb..2b7eb0d2 100644 --- a/src/main/java/greekfantasy/entity/Whirl.java +++ b/src/main/java/greekfantasy/entity/Whirl.java @@ -1,5 +1,7 @@ package greekfantasy.entity; +import net.minecraft.core.registries.Registries; +import net.minecraft.tags.DamageTypeTags; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; import greekfantasy.entity.boss.Charybdis; @@ -80,10 +82,10 @@ public void aiStep() { super.aiStep(); // remove if colliding with another whirl or a charybdis - final List waterMobList = this.level.getEntitiesOfClass(WaterAnimal.class, this.getBoundingBox().inflate(1.0D), + final List waterMobList = this.level().getEntitiesOfClass(WaterAnimal.class, this.getBoundingBox().inflate(1.0D), e -> e != this && e.isAlive() && (e.getType() == GFRegistry.EntityReg.CHARYBDIS.get() || e.getType() == GFRegistry.EntityReg.WHIRL.get())); if (!waterMobList.isEmpty() && this.isAlive()) { - this.hurt(DamageSource.STARVE, this.getMaxHealth() * 2.0F); + this.hurt(damageSources().starve(), this.getMaxHealth() * 2.0F); return; } @@ -94,11 +96,11 @@ public void aiStep() { } // remove nearby items - final List itemEntityList = this.level.getEntities(EntityType.ITEM, this.getBoundingBox().inflate(1.0D, 0.0F, 1.0D), e -> e.isInWaterOrBubble() && e.getY() < (this.getY() + this.getBbHeight())); + final List itemEntityList = this.level().getEntities(EntityType.ITEM, this.getBoundingBox().inflate(1.0D, 0.0F, 1.0D), e -> e.isInWaterOrBubble() && e.getY() < (this.getY() + this.getBbHeight())); for (final ItemEntity e : itemEntityList) { // check for trigger items - if (this.level instanceof ServerLevel && !e.getItem().isEmpty() && e.getItem().is(TRIGGER)) { - Charybdis.spawnCharybdis((ServerLevel) this.level, this); + if (this.level() instanceof ServerLevel && !e.getItem().isEmpty() && e.getItem().is(TRIGGER)) { + Charybdis.spawnCharybdis((ServerLevel) this.level(), this); e.discard(); } // start to remove items @@ -119,7 +121,7 @@ public void tick() { super.tick(); // spawn particles - if (this.level.isClientSide() && tickCount % 3 == 0 && this.isInWaterOrBubble()) { + if (this.level().isClientSide() && tickCount % 3 == 0 && this.isInWaterOrBubble()) { // spawn particles in spiral float maxY = this.getBbHeight() * 1.65F; float y = 0; @@ -134,7 +136,7 @@ public void tick() { float cosA = Mth.cos(a) * radius; float sinA = Mth.sin(a) * radius; //bubbles(posX + cosA, posY + y, posZ + sinA, 0.125D, 1); - level.addParticle(ParticleTypes.BUBBLE, posX + cosA, posY + y - (maxY * 0.4), posZ + sinA, 0.0D, 0.085D, 0.0D); + level().addParticle(ParticleTypes.BUBBLE, posX + cosA, posY + y - (maxY * 0.4), posZ + sinA, 0.0D, 0.085D, 0.0D); y += dY; } } @@ -169,13 +171,13 @@ protected boolean canRide(Entity entity) { @Override public boolean isInvulnerableTo(final DamageSource source) { - return source.isProjectile() || super.isInvulnerableTo(source); + return source.is(DamageTypeTags.IS_PROJECTILE) || super.isInvulnerableTo(source); } @Override protected void actuallyHurt(final DamageSource source, final float amountIn) { float amount = amountIn; - if (!source.isBypassMagic() && getAttractMobs()) { + if (!source.is(DamageTypeTags.BYPASSES_EFFECTS) && getAttractMobs()) { amount *= 0.25F; } super.actuallyHurt(source, amount); @@ -274,7 +276,7 @@ public SwirlGoal(final Whirl entity) { protected void onCollideWith(Entity e) { // attack living entities, if enabled if (whirl.getAttractMobs() && e instanceof LivingEntity) { - e.hurt(DamageSource.mobAttack(entity), 1.0F); + e.hurt(entity.damageSources().mobAttack(entity), 1.0F); } } } diff --git a/src/main/java/greekfantasy/entity/ai/DolphinTemptByTritonGoal.java b/src/main/java/greekfantasy/entity/ai/DolphinTemptByTritonGoal.java index 4502a58f..b543b25d 100644 --- a/src/main/java/greekfantasy/entity/ai/DolphinTemptByTritonGoal.java +++ b/src/main/java/greekfantasy/entity/ai/DolphinTemptByTritonGoal.java @@ -39,7 +39,7 @@ public boolean canUse() { return false; } // locate nearest triton - triton = entity.level.getNearestEntity(Triton.class, TargetingConditions.forNonCombat() + triton = entity.level().getNearestEntity(Triton.class, TargetingConditions.forNonCombat() .selector(t -> ingredient.test(t.getOffhandItem()) && t.isInWaterOrBubble()), entity, entity.getX(), entity.getY(), entity.getZ(), entity.getBoundingBox().inflate(10.0D)); if (null == triton || triton.getTarget() != null) { diff --git a/src/main/java/greekfantasy/entity/ai/FindBlockGoal.java b/src/main/java/greekfantasy/entity/ai/FindBlockGoal.java index ae51f2e6..83bb27c0 100644 --- a/src/main/java/greekfantasy/entity/ai/FindBlockGoal.java +++ b/src/main/java/greekfantasy/entity/ai/FindBlockGoal.java @@ -58,7 +58,7 @@ public boolean canContinueToUse() { @Override public void start() { this.cooldown = maxCooldown; - onFoundBlock(this.creature.level, this.targetPos); + onFoundBlock(this.creature.level(), this.targetPos); } /** @@ -82,7 +82,7 @@ public void start() { * @return whether the entity is already at the target position **/ protected boolean isOnBlock() { - return isTargetBlock(this.creature.level, this.creature.blockPosition()); + return isTargetBlock(this.creature.level(), this.creature.blockPosition()); } /** @@ -108,7 +108,7 @@ protected Optional findNearbyBlock() { rand.nextInt(searchRadiusXZ * 2) - searchRadiusXZ); // check the block to see if creature should move here if (this.isTargetBlock(this.creature.getCommandSenderWorld(), pos2)) { - return Optional.of(new BlockPos(pos2.getX(), pos2.getY(), pos2.getZ())); + return Optional.of(BlockPos.containing(pos2.getX(), pos2.getY(), pos2.getZ())); } } return Optional.empty(); diff --git a/src/main/java/greekfantasy/entity/ai/FollowWaterMobGoal.java b/src/main/java/greekfantasy/entity/ai/FollowWaterMobGoal.java index c0713e1e..068fdef9 100644 --- a/src/main/java/greekfantasy/entity/ai/FollowWaterMobGoal.java +++ b/src/main/java/greekfantasy/entity/ai/FollowWaterMobGoal.java @@ -37,7 +37,7 @@ public FollowWaterMobGoal(Mob mob, Class clazz, double speedMulti @Override public boolean canUse() { - List list = this.mob.level.getEntitiesOfClass(Mob.class, this.mob.getBoundingBox().inflate((double) this.areaSize), this.followPredicate); + List list = this.mob.level().getEntitiesOfClass(Mob.class, this.mob.getBoundingBox().inflate((double) this.areaSize), this.followPredicate); if (!list.isEmpty()) { this.followingMob = list.get(0); return true; diff --git a/src/main/java/greekfantasy/entity/ai/GFBegGoal.java b/src/main/java/greekfantasy/entity/ai/GFBegGoal.java index 8cd70f14..2d599aaa 100644 --- a/src/main/java/greekfantasy/entity/ai/GFBegGoal.java +++ b/src/main/java/greekfantasy/entity/ai/GFBegGoal.java @@ -40,7 +40,7 @@ protected GFBegGoal(final Mob mob, final double range, final int interval, final public boolean canUse() { if (mob.tickCount % interval == 0) { // find a player within range to cause begging - final List list = mob.level.getEntitiesOfClass(Player.class, mob.getBoundingBox().inflate(range), hasBegItem); + final List list = mob.level().getEntitiesOfClass(Player.class, mob.getBoundingBox().inflate(range), hasBegItem); if (!list.isEmpty()) { player = list.get(0); } else { diff --git a/src/main/java/greekfantasy/entity/ai/GoToWaterGoal.java b/src/main/java/greekfantasy/entity/ai/GoToWaterGoal.java index 888a53f1..fc5fe462 100644 --- a/src/main/java/greekfantasy/entity/ai/GoToWaterGoal.java +++ b/src/main/java/greekfantasy/entity/ai/GoToWaterGoal.java @@ -25,7 +25,7 @@ public GoToWaterGoal(PathfinderMob mob, double speed, boolean nightOnly) { this.mob = mob; this.speedModifier = speed; this.nightOnly = nightOnly; - this.level = mob.level; + this.level = mob.level(); this.setFlags(EnumSet.of(Goal.Flag.MOVE)); } @@ -60,8 +60,9 @@ private Vec3 getWaterPos() { RandomSource random = this.mob.getRandom(); BlockPos blockpos = this.mob.blockPosition(); - for(int i = 0; i < 10; ++i) { - BlockPos blockpos1 = blockpos.offset(random.nextInt(20) - 10, 2 - random.nextInt(8), random.nextInt(20) - 10); + for (int i = 0; i < 10; ++i) { + BlockPos blockpos1 = blockpos.offset(random.nextInt(20) - 10, 2 - random.nextInt(8), + random.nextInt(20) - 10); if (this.level.getBlockState(blockpos1).is(Blocks.WATER)) { return Vec3.atBottomCenterOf(blockpos1); } diff --git a/src/main/java/greekfantasy/entity/ai/MoveToStructureGoal.java b/src/main/java/greekfantasy/entity/ai/MoveToStructureGoal.java index 10f5b766..88b80102 100644 --- a/src/main/java/greekfantasy/entity/ai/MoveToStructureGoal.java +++ b/src/main/java/greekfantasy/entity/ai/MoveToStructureGoal.java @@ -1,4 +1,5 @@ package greekfantasy.entity.ai; +import net.minecraft.core.registries.Registries; import com.mojang.datafixers.util.Pair; import net.minecraft.core.BlockPos; @@ -52,7 +53,7 @@ public MoveToStructureGoal(PathfinderMob mob, double speedModifier, ResourceLocation structureId, RandomPosFactory posFactory) { this(mob, speedModifier, rangeInSections, distanceXZ, distanceY, - createHolder(mob.level.registryAccess(), structureId), + createHolder(mob.level().registryAccess(), structureId), posFactory); } @@ -84,7 +85,7 @@ public MoveToStructureGoal(PathfinderMob mob, double speedModifier, @Override public boolean canUse() { - ServerLevel level = (ServerLevel) this.mob.level; + ServerLevel level = (ServerLevel) this.mob.level(); BlockPos blockpos = this.mob.blockPosition(); if (isNearStructure(structureStart, blockpos, distanceXZ, distanceY)) { return false; @@ -122,15 +123,15 @@ protected Vec3 getPosition() { Vec3 vec = randomPosFactory.apply(this.mob, distanceXZ, distanceY); if (vec != null) { // if vec is within structure, use vec - BlockPos pos = new BlockPos(vec); + BlockPos pos = BlockPos.containing(vec); if (isInStructure(structureStart, pos)) { return vec; } // determine center position of nearest structure BlockPos center = structureStart.getBoundingBox().getCenter(); if(!(this.mob.getNavigation() instanceof WaterBoundPathNavigation)) { - int y = this.mob.level.getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, center.getX(), center.getZ()); - center = new BlockPos(center.getX(), y, center.getZ()); + int y = this.mob.level().getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, center.getX(), center.getZ()); + center = BlockPos.containing(center.getX(), y, center.getZ()); } // choose a random position towards the center of the structure Vec3 towardsVec = DefaultRandomPos.getPosTowards(mob, distanceXZ, distanceY, Vec3.atBottomCenterOf(center), Math.PI / 2.0D); @@ -173,7 +174,7 @@ protected static boolean isNearStructure(final StructureStart start, final Block } public static Holder createHolder(final RegistryAccess access, final ResourceLocation structureId) { - Structure csf = access.registryOrThrow(Registry.STRUCTURE_REGISTRY).get(structureId); + Structure csf = access.registryOrThrow(Registries.STRUCTURE).get(structureId); if (null == csf) { throw new IllegalArgumentException("Failed to create holder for unknown structure '" + structureId + "'"); } diff --git a/src/main/java/greekfantasy/entity/ai/ShootFireGoal.java b/src/main/java/greekfantasy/entity/ai/ShootFireGoal.java index 916d9164..1535cd06 100644 --- a/src/main/java/greekfantasy/entity/ai/ShootFireGoal.java +++ b/src/main/java/greekfantasy/entity/ai/ShootFireGoal.java @@ -109,7 +109,7 @@ private void setFireToIntersectingEntities(final Vec3 startPos, final Vec3 endPo scaled = startPos.add(vecDifference.scale(i)); // make a box at this position along the vector aabb = new AABB(scaled.x - radius, scaled.y - radius, scaled.z - radius, scaled.x + radius, scaled.y + radius, scaled.z + radius); - for (final Entity e : entity.level.getEntities(entity, aabb)) { + for (final Entity e : entity.level().getEntities(entity, aabb)) { // set fire to any entities inside the box e.setSecondsOnFire(randFireTime); } diff --git a/src/main/java/greekfantasy/entity/ai/SummonMobGoal.java b/src/main/java/greekfantasy/entity/ai/SummonMobGoal.java index 03f4c0d7..84eba91e 100644 --- a/src/main/java/greekfantasy/entity/ai/SummonMobGoal.java +++ b/src/main/java/greekfantasy/entity/ai/SummonMobGoal.java @@ -95,11 +95,11 @@ public void stop() { } protected T summonMob() { - final T mobEntity = mobEntityType.create(summoner.level); + final T mobEntity = mobEntityType.create(summoner.level()); mobEntity.copyPosition(summoner); mobEntity.setLastHurtByMob(summoner.getLastHurtByMob()); mobEntity.setTarget(summoner.getTarget()); - summoner.level.addFreshEntity(mobEntity); + summoner.level().addFreshEntity(mobEntity); return mobEntity; } diff --git a/src/main/java/greekfantasy/entity/ai/SwirlGoal.java b/src/main/java/greekfantasy/entity/ai/SwirlGoal.java index 76d07e4b..fcc35c2b 100644 --- a/src/main/java/greekfantasy/entity/ai/SwirlGoal.java +++ b/src/main/java/greekfantasy/entity/ai/SwirlGoal.java @@ -96,7 +96,7 @@ public void tick() { // try to break boats if (e instanceof Boat) { if (breakBoats && entity.getRandom().nextInt(8) == 0) { - e.hurt(DamageSource.mobAttack(entity), 3.0F); + e.hurt(entity.damageSources().mobAttack(entity), 3.0F); } continue; } @@ -131,7 +131,7 @@ public void stop() { protected static List getEntitiesInRange(final LivingEntity entity, final double range, final Predicate predicate) { - return entity.level.getEntities(entity, entity.getBoundingBox().inflate(range, range / 2, range), predicate); + return entity.level().getEntities(entity, entity.getBoundingBox().inflate(range, range / 2, range), predicate); } protected static void swirlEntity(final Entity entity, final double range, final float deltaAngle, final Entity target, final double disSq) { diff --git a/src/main/java/greekfantasy/entity/ai/WaterAnimalMoveControl.java b/src/main/java/greekfantasy/entity/ai/WaterAnimalMoveControl.java index de3250f4..1aafa93b 100644 --- a/src/main/java/greekfantasy/entity/ai/WaterAnimalMoveControl.java +++ b/src/main/java/greekfantasy/entity/ai/WaterAnimalMoveControl.java @@ -41,7 +41,7 @@ public void tick() { this.waterAnimal.setSpeed(f2); this.waterAnimal.setDeltaMovement(this.waterAnimal.getDeltaMovement().add((double) f2 * d0 * 0.03D, (double) f2 * d1 * 0.1D, (double) f2 * d2 * 0.03D)); } else { - if (!this.waterAnimal.isOnGround()) { + if (!this.waterAnimal.onGround()) { this.waterAnimal.setDeltaMovement(this.waterAnimal.getDeltaMovement().add(0.0D, -0.008D, 0.0D)); } diff --git a/src/main/java/greekfantasy/entity/boss/Arachne.java b/src/main/java/greekfantasy/entity/boss/Arachne.java index 2d60f32d..f2e97ae5 100644 --- a/src/main/java/greekfantasy/entity/boss/Arachne.java +++ b/src/main/java/greekfantasy/entity/boss/Arachne.java @@ -107,7 +107,7 @@ public void makeStuckInBlock(BlockState state, Vec3 motionMultiplierIn) { @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - WebBall web = WebBall.create(level, this); + WebBall web = WebBall.create(level(), this); // set the web type with sometimes web, always spider, and no item web.setWebType(getRandom().nextBoolean(), true, false); // this is copied from LlamaSpit code, it moves the arrow nearer to the centaur's human-body @@ -118,9 +118,9 @@ public void performRangedAttack(LivingEntity target, float distanceFactor) { double dy = target.getY(0.67D) - web.getY(); double dz = target.getZ() - web.getZ(); double dis = Math.sqrt(dx * dx + dz * dz); - web.shoot(dx, dy + dis * (double) 0.2F, dz, 1.14F, (float) (14 - this.level.getDifficulty().getId() * 4)); + web.shoot(dx, dy + dis * (double) 0.2F, dz, 1.14F, (float) (14 - this.level().getDifficulty().getId() * 4)); this.playSound(SoundEvents.LLAMA_SPIT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level.addFreshEntity(web); + this.level().addFreshEntity(web); } // Misc // diff --git a/src/main/java/greekfantasy/entity/boss/BronzeBull.java b/src/main/java/greekfantasy/entity/boss/BronzeBull.java index 7558e65f..27679a11 100644 --- a/src/main/java/greekfantasy/entity/boss/BronzeBull.java +++ b/src/main/java/greekfantasy/entity/boss/BronzeBull.java @@ -21,6 +21,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.BossEvent; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -139,7 +140,7 @@ public void aiStep() { // boss info this.bossInfo.setProgress(this.getHealth() / this.getMaxHealth()); - if(!level.isClientSide()) { + if(!level().isClientSide()) { this.tickCustomCooldown(); } @@ -175,24 +176,24 @@ public void aiStep() { } // spawn particles - if (level.isClientSide() && this.isFiring()) { + if (level().isClientSide() && this.isFiring()) { spawnFireParticles(); } // spawn particles - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { final double x = this.getX(); final double y = this.getY() + 1.25D; final double z = this.getZ(); final double motion = 0.06D; final double radius = this.getBbWidth() * 1.15D; - level.addParticle(ParticleTypes.LAVA, - x + (level.random.nextDouble() - 0.5D) * radius, - y + (level.random.nextDouble() - 0.5D) * radius, - z + (level.random.nextDouble() - 0.5D) * radius, - (level.random.nextDouble() - 0.5D) * motion, - (level.random.nextDouble() - 0.5D) * 0.07D, - (level.random.nextDouble() - 0.5D) * motion); + level().addParticle(ParticleTypes.LAVA, + x + (level().random.nextDouble() - 0.5D) * radius, + y + (level().random.nextDouble() - 0.5D) * radius, + z + (level().random.nextDouble() - 0.5D) * radius, + (level().random.nextDouble() - 0.5D) * motion, + (level().random.nextDouble() - 0.5D) * 0.07D, + (level().random.nextDouble() - 0.5D) * motion); } } @@ -256,7 +257,7 @@ protected boolean canRide(Entity entityIn) { @Override public boolean isInvulnerableTo(final DamageSource source) { - return isSpawning() || source.isMagic() || source == DamageSource.DROWN || source == DamageSource.IN_WALL || source == DamageSource.WITHER + return isSpawning() || (source.is(DamageTypes.MAGIC) || source.is(DamageTypes.INDIRECT_MAGIC)) || source.is(DamageTypes.DROWN) || source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) || source.getDirectEntity() instanceof AbstractArrow || super.isInvulnerableTo(source); } @@ -307,7 +308,7 @@ public void readAdditionalSaveData(CompoundTag compound) { } public void spawnFireParticles() { - if (!level.isClientSide()) { + if (!level().isClientSide()) { return; } Vec3 lookVec = this.getLookAngle(); @@ -316,10 +317,10 @@ public void spawnFireParticles() { final double radius = 0.75D; for (int i = 0; i < 5; i++) { - level.addParticle(ParticleTypes.FLAME, - pos.x + (level.random.nextDouble() - 0.5D) * radius, - pos.y + (level.random.nextDouble() - 0.5D) * radius, - pos.z + (level.random.nextDouble() - 0.5D) * radius, + level().addParticle(ParticleTypes.FLAME, + pos.x + (level().random.nextDouble() - 0.5D) * radius, + pos.y + (level().random.nextDouble() - 0.5D) * radius, + pos.z + (level().random.nextDouble() - 0.5D) * radius, lookVec.x * motion * FIRE_RANGE, lookVec.y * motion * 0.5D, lookVec.z * motion * FIRE_RANGE); @@ -353,16 +354,16 @@ public boolean isGoring() { public void setFiring(final boolean firing) { firingTime = firing ? MAX_FIRING_TIME : 0; setState(firing ? FIRING : NONE); - if (firing && !this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, FIRING_EVENT); + if (firing && !this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, FIRING_EVENT); } } public void setGoring(final boolean goring) { goringTime = goring ? MAX_GORING_TIME : 0; setState(goring ? GORING : NONE); - if (goring && !this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, GORING_EVENT); + if (goring && !this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, GORING_EVENT); // break intersecting blocks destroyIntersectingBlocks(1.45F + 0.75F * random.nextFloat(), 2.0D); } @@ -371,8 +372,8 @@ public void setGoring(final boolean goring) { public void setSpawning(final boolean spawning) { spawnTime = spawning ? MAX_SPAWN_TIME : 0; setState(spawning ? SPAWNING : NONE); - if (spawning && !this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, SPAWN_EVENT); + if (spawning && !this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, SPAWN_EVENT); } } @@ -427,15 +428,15 @@ public void stopSeenByPlayer(ServerPlayer player) { * @param offset the forward distance to offset the bounding box **/ private void destroyIntersectingBlocks(final float maxHardness, final double offset) { - if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (!level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { return; } final Vec3 facing = Vec3.directionFromRotation(this.getRotationVector()); final AABB box = this.getBoundingBox().move(facing.normalize().scale(offset)); BlockPos.betweenClosedStream(box).forEach(p -> { - BlockState b = this.level.getBlockState(p); - if ((b.canOcclude() || b.getMaterial().blocksMotion()) && b.getDestroySpeed(level, p) < maxHardness && !b.is(BlockTags.WITHER_IMMUNE)) { - this.level.destroyBlock(p, true); + BlockState b = this.level().getBlockState(p); + if ((b.canOcclude() || b.blocksMotion()) && b.getDestroySpeed(this.level(), p) < maxHardness && !b.is(BlockTags.WITHER_IMMUNE)) { + this.level().destroyBlock(p, true); } }); } diff --git a/src/main/java/greekfantasy/entity/boss/Cerberus.java b/src/main/java/greekfantasy/entity/boss/Cerberus.java index 2f4a1d05..77820389 100644 --- a/src/main/java/greekfantasy/entity/boss/Cerberus.java +++ b/src/main/java/greekfantasy/entity/boss/Cerberus.java @@ -20,6 +20,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.BossEvent; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -97,7 +98,7 @@ public static Cerberus spawnCerberus(final Level level, final Vec3 pos) { entity.yBodyRot = 0.0F; if (level instanceof ServerLevel serverLevel) { serverLevel.addFreshEntityWithPassengers(entity); - entity.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(new BlockPos(pos)), MobSpawnType.MOB_SUMMONED, null, null); + entity.finalizeSpawn(serverLevel, serverLevel.getCurrentDifficultyAt(BlockPos.containing(pos)), MobSpawnType.MOB_SUMMONED, null, null); // trigger spawn for nearby players for (ServerPlayer player : level.getEntitiesOfClass(ServerPlayer.class, entity.getBoundingBox().inflate(25.0D))) { CriteriaTriggers.SUMMONED_ENTITY.trigger(player, entity); @@ -165,7 +166,7 @@ public void aiStep() { } // spawn particles - if (level.isClientSide() && this.isFiring()) { + if (level().isClientSide() && this.isFiring()) { spawnFireParticles(); } } @@ -180,7 +181,7 @@ public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInsta @Override public boolean isInvulnerableTo(final DamageSource source) { - return isSpawning() || source == DamageSource.IN_WALL || source == DamageSource.WITHER || super.isInvulnerableTo(source); + return isSpawning() || source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) || super.isInvulnerableTo(source); } @Override @@ -283,8 +284,8 @@ public boolean isSummoning() { public void setSummoning(final boolean summoning) { setCerberusState(summoning ? SUMMONING : NONE); this.summonTime = summoning ? 1 : 0; - if (summoning && !level.isClientSide()) { - level.broadcastEntityEvent(this, SUMMON_CLIENT); + if (summoning && !level().isClientSide()) { + this.level().broadcastEntityEvent(this, SUMMON_CLIENT); } } @@ -295,8 +296,8 @@ public boolean isSpawning() { public void setSpawning(final boolean spawning) { spawnTime = spawning ? MAX_SPAWN_TIME : 0; setCerberusState(spawning ? SPAWNING : NONE); - if (spawning && !level.isClientSide()) { - level.broadcastEntityEvent(this, SPAWN_CLIENT); + if (spawning && !level().isClientSide()) { + this.level().broadcastEntityEvent(this, SPAWN_CLIENT); } } @@ -313,7 +314,7 @@ public float getSummonPercent(final float partialTick) { // Fire-breathing particles public void spawnFireParticles() { - if (!level.isClientSide()) { + if (!level().isClientSide()) { return; } Vec3 lookVec = this.getLookAngle(); @@ -322,10 +323,10 @@ public void spawnFireParticles() { final double radius = 0.75D; for (int i = 0; i < 5; i++) { - level.addParticle(ParticleTypes.FLAME, - pos.x + (level.random.nextDouble() - 0.5D) * radius, - pos.y + (level.random.nextDouble() - 0.5D) * radius, - pos.z + (level.random.nextDouble() - 0.5D) * radius, + level().addParticle(ParticleTypes.FLAME, + pos.x + (level().random.nextDouble() - 0.5D) * radius, + pos.y + (level().random.nextDouble() - 0.5D) * radius, + pos.z + (level().random.nextDouble() - 0.5D) * radius, lookVec.x * motion * FIRE_RANGE, lookVec.y * motion * 0.5D, lookVec.z * motion * FIRE_RANGE); @@ -333,7 +334,7 @@ public void spawnFireParticles() { } private void addSpawningParticles(final ParticleOptions particle, final int count) { - if (!this.level.isClientSide()) { + if (!this.level().isClientSide()) { return; } final double x = this.getX(); @@ -342,13 +343,13 @@ private void addSpawningParticles(final ParticleOptions particle, final int coun final double motion = 0.08D; final double radius = this.getBbWidth(); for (int i = 0; i < count; i++) { - level.addParticle(particle, - x + (level.random.nextDouble() - 0.5D) * radius, - y + (level.random.nextDouble() - 0.5D) * radius, - z + (level.random.nextDouble() - 0.5D) * radius, - (level.random.nextDouble() - 0.5D) * motion, + level().addParticle(particle, + x + (level().random.nextDouble() - 0.5D) * radius, + y + (level().random.nextDouble() - 0.5D) * radius, + z + (level().random.nextDouble() - 0.5D) * radius, + (level().random.nextDouble() - 0.5D) * motion, 0.15D, - (level.random.nextDouble() - 0.5D) * motion); + (level().random.nextDouble() - 0.5D) * motion); } } @@ -359,7 +360,7 @@ public void handleEntityEvent(byte id) { setSpawning(true); break; case SUMMON_CLIENT: - this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.WOLF_HOWL, this.getSoundSource(), 1.1F, 0.9F + this.getRandom().nextFloat() * 0.2F, false); + this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.WOLF_HOWL, this.getSoundSource(), 1.1F, 0.9F + this.getRandom().nextFloat() * 0.2F, false); break; default: super.handleEntityEvent(id); @@ -446,7 +447,7 @@ public void stop() { public void tick() { super.tick(); if (this.progressTimer == 8) { - Cerberus.this.level.broadcastEntityEvent(Cerberus.this, SUMMON_CLIENT); + Cerberus.this.level().broadcastEntityEvent(Cerberus.this, SUMMON_CLIENT); } } diff --git a/src/main/java/greekfantasy/entity/boss/Charybdis.java b/src/main/java/greekfantasy/entity/boss/Charybdis.java index eee1339e..0f436115 100644 --- a/src/main/java/greekfantasy/entity/boss/Charybdis.java +++ b/src/main/java/greekfantasy/entity/boss/Charybdis.java @@ -20,6 +20,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.BossEvent; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; @@ -125,7 +126,7 @@ public static Charybdis spawnCharybdis(final ServerLevel level, final Whirl whir protected Scylla spawnScylla(final ServerLevel level) { final Scylla entity = GFRegistry.EntityReg.SCYLLA.get().create(level); - final BlockPos entityPos = new BlockPos(position()); + final BlockPos entityPos = BlockPos.containing(position()); final BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos(); final int radius = Mth.ceil(getBbWidth() * 1.5F); AABB aabb; @@ -143,7 +144,7 @@ protected Scylla spawnScylla(final ServerLevel level) { entity.moveTo(blockPos.getX(), blockPos.getY(), blockPos.getZ(), 0, 0); entity.setPersistenceRequired(); entity.setPortalCooldown(); - level.addFreshEntityWithPassengers(entity); + level().addFreshEntity(entity); entity.finalizeSpawn(level, level.getCurrentDifficultyAt(blockPos), MobSpawnType.MOB_SUMMONED, null, null); // play sound entity.playSound(SoundEvents.GHAST_SCREAM, 1.2F, 1.0F); @@ -219,7 +220,7 @@ public void tick() { super.tick(); // spawn particles - if (this.level.isClientSide() && tickCount % 3 == 0 && this.isInWaterOrBubble()) { + if (this.level().isClientSide() && tickCount % 3 == 0 && this.isInWaterOrBubble()) { // spawn particles at targeted entities getEntitiesInRange(RANGE).forEach(e -> bubbles(e.getX(), e.getY(), e.getZ(), e.getBbWidth(), 5)); // spawn particles in spiral @@ -237,7 +238,7 @@ public void tick() { float cosA = Mth.cos(a) * radius; float sinA = Mth.sin(a) * radius; //bubbles(posX + cosA, posY + y, posZ + sinA, 0.125D, 1); - level.addParticle(ParticleTypes.BUBBLE, posX + cosA, posY + y - (maxY * 0.4), posZ + sinA, 0.0D, 0.085D, 0.0D); + level().addParticle(ParticleTypes.BUBBLE, posX + cosA, posY + y - (maxY * 0.4), posZ + sinA, 0.0D, 0.085D, 0.0D); y += dY; } } @@ -281,7 +282,7 @@ protected boolean canRide(Entity entityIn) { @Override public boolean isInvulnerableTo(final DamageSource source) { - return isSpawning() || source == DamageSource.IN_WALL || source == DamageSource.WITHER + return isSpawning() || source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) || source.getDirectEntity() instanceof AbstractArrow || source.getDirectEntity() instanceof WaterSpell || super.isInvulnerableTo(source); @@ -410,8 +411,8 @@ public void setState(final byte state) { clientFlag = THROW_CLIENT; break; } - if (!level.isClientSide()) { - level.broadcastEntityEvent(this, clientFlag); + if (!level().isClientSide()) { + this.level().broadcastEntityEvent(this, clientFlag); } } @@ -471,19 +472,19 @@ public void handleEntityEvent(byte id) { // Misc // public List getEntitiesInRange(final double range) { - return level.getEntities(this, getBoundingBox().inflate(range, range / 2, range), CAN_TARGET); + return level().getEntities(this, getBoundingBox().inflate(range, range / 2, range), CAN_TARGET); } public void bubbles(final double posX, final double posY, final double posZ, final double radius, final int count) { final double motion = 0.08D; for (int i = 0; i < count; i++) { - level.addParticle(ParticleTypes.BUBBLE, - posX + (level.random.nextDouble() - 0.5D) * radius, + level().addParticle(ParticleTypes.BUBBLE, + posX + (level().random.nextDouble() - 0.5D) * radius, posY, - posZ + (level.random.nextDouble() - 0.5D) * radius, - (level.random.nextDouble() - 0.5D) * motion, + posZ + (level().random.nextDouble() - 0.5D) * radius, + (level().random.nextDouble() - 0.5D) * motion, 0.5D, - (level.random.nextDouble() - 0.5D) * motion); + (level().random.nextDouble() - 0.5D) * motion); } } @@ -526,7 +527,7 @@ public void tick() { livingEntity.addEffect(new MobEffectInstance(GFRegistry.MobEffectReg.SLOW_SWIM.get(), 10, 0)); // periodically hurt living entities if (livingEntity.hurtTime == 0 && livingEntity.tickCount % 20 == 0) { - livingEntity.hurt(DamageSource.mobAttack(entity), attack); + livingEntity.hurt(entity.damageSources().mobAttack(entity), attack); } } } @@ -542,7 +543,7 @@ public void stop() { protected void onCollideWith(Entity e) { // attack the entity and steal some health final float attack = (float) entity.getAttribute(Attributes.ATTACK_DAMAGE).getValue(); - if (e.hurt(DamageSource.mobAttack(entity), attack)) { + if (e.hurt(entity.damageSources().mobAttack(entity), attack)) { entity.heal(Math.abs(attack * 0.25F)); } } @@ -621,7 +622,7 @@ public void tick() { target.hurtMarked = true; // damage boats and other rideable entities if (target instanceof Boat || !target.getPassengers().isEmpty()) { - target.hurt(DamageSource.mobAttack(entity), 6.0F); + target.hurt(entity.damageSources().mobAttack(entity), 6.0F); } } } diff --git a/src/main/java/greekfantasy/entity/boss/CretanMinotaur.java b/src/main/java/greekfantasy/entity/boss/CretanMinotaur.java index 38fdee20..f024140e 100644 --- a/src/main/java/greekfantasy/entity/boss/CretanMinotaur.java +++ b/src/main/java/greekfantasy/entity/boss/CretanMinotaur.java @@ -70,11 +70,11 @@ public void aiStep() { super.aiStep(); // boss info this.bossInfo.setProgress(this.getHealth() / this.getMaxHealth()); - if(!this.level.isClientSide() && this.tickCount % 60 == 1) { + if(!this.level().isClientSide() && this.tickCount % 60 == 1) { // clear player list this.bossInfo.removeAllPlayers(); // locate nearby players and add them to the boss event when in range - List serverPlayers = level.getEntitiesOfClass(ServerPlayer.class, this.getBoundingBox().inflate(24.0D)); + List serverPlayers = level().getEntitiesOfClass(ServerPlayer.class, this.getBoundingBox().inflate(24.0D)); for(ServerPlayer player : serverPlayers) { if(player != null && this.getSensing().hasLineOfSight(player)) { this.bossInfo.addPlayer(player); @@ -140,16 +140,16 @@ public int getAmbientSoundInterval() { @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - if (!level.isClientSide()) { + if (!level().isClientSide()) { ItemStack axe = this.getMainHandItem().copy(); - ThrowingAxe throwingAxe = new ThrowingAxe(level, this, axe, false); + ThrowingAxe throwingAxe = new ThrowingAxe(level(), this, axe, false); throwingAxe.setBaseDamage(throwingAxe.getBaseDamage() + this.getAttributeValue(Attributes.ATTACK_DAMAGE) * 0.5D); double dx = target.getX() - throwingAxe.getX(); double dy = target.getY(0.67D) - throwingAxe.getY(); double dz = target.getZ() - throwingAxe.getZ(); double dis = Math.sqrt(dx * dx + dz * dz); - throwingAxe.shoot(dx, dy + dis * (double) 0.08F, dz, 1.12F, (float) (8 - this.level.getDifficulty().getId())); - this.level.addFreshEntity(throwingAxe); + throwingAxe.shoot(dx, dy + dis * (double) 0.08F, dz, 1.12F, (float) (8 - this.level().getDifficulty().getId())); + this.level().addFreshEntity(throwingAxe); } this.swing(InteractionHand.MAIN_HAND); this.playSound(SoundEvents.TRIDENT_THROW, 1.2F, 1.2F + this.random.nextFloat() * 0.2F); diff --git a/src/main/java/greekfantasy/entity/boss/Geryon.java b/src/main/java/greekfantasy/entity/boss/Geryon.java index 249f4a0e..84a193a6 100644 --- a/src/main/java/greekfantasy/entity/boss/Geryon.java +++ b/src/main/java/greekfantasy/entity/boss/Geryon.java @@ -1,4 +1,5 @@ package greekfantasy.entity.boss; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -26,7 +27,9 @@ import net.minecraft.world.BossEvent; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; +import net.minecraftforge.registries.ForgeRegistries; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; @@ -171,7 +174,7 @@ public void aiStep() { this.bossInfo.setProgress(this.getHealth() / this.getMaxHealth()); // attack cooldown - if(!this.level.isClientSide()) { + if(!this.level().isClientSide()) { tickCustomCooldown(); } @@ -179,7 +182,7 @@ public void aiStep() { if (isSpawning() && --spawnTime <= 0) { // update timer setSpawning(false); - if (!level.isClientSide()) { + if (!level().isClientSide()) { destroyIntersectingBlocks(0); } } @@ -209,7 +212,7 @@ public void aiStep() { public void tick() { super.tick(); - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { // add motion particles if (this.getDeltaMovement().horizontalDistanceSqr() > (double) 2.5000003E-7F && this.random.nextInt(5) == 0) { addBlockParticles(2); @@ -287,7 +290,7 @@ public void stopSeenByPlayer(ServerPlayer player) { @Override public boolean isInvulnerableTo(final DamageSource source) { - return isSpawning() || source == DamageSource.IN_WALL || source == DamageSource.WITHER + return isSpawning() || source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) || source.getDirectEntity() instanceof AbstractArrow || super.isInvulnerableTo(source); } @@ -378,8 +381,8 @@ public boolean isSpawning() { public void setSpawning(final boolean spawning) { spawnTime = spawning ? MAX_SPAWN_TIME : 0; setGeryonState(spawning ? SPAWNING : NONE); - if (spawning && !this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, START_SPAWN_EVENT); + if (spawning && !this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, START_SPAWN_EVENT); } } @@ -391,20 +394,20 @@ public void handleEntityEvent(byte id) { break; case SMASH_EVENT: // spawn particles for all nearby entities - final List targets = this.level.getEntities(Geryon.this, Geryon.this.getBoundingBox().inflate(SMASH_RANGE, SMASH_RANGE / 2, SMASH_RANGE)); + final List targets = this.level().getEntities(Geryon.this, Geryon.this.getBoundingBox().inflate(SMASH_RANGE, SMASH_RANGE / 2, SMASH_RANGE)); for (final Entity e : targets) { addSmashParticlesAt(e); } // add sound and block particles here - level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.IRON_GOLEM_ATTACK, this.getSoundSource(), 2.0F, 0.4F, false); + level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.IRON_GOLEM_ATTACK, this.getSoundSource(), 2.0F, 0.4F, false); addBlockParticles(45); break; case SUMMON_EVENT: for (int i = 0; i < 4; i++) { - this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.NOTE_BLOCK_DIDGERIDOO, this.getSoundSource(), 2.0F, 0.2F, false); + this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.NOTE_BLOCK_DIDGERIDOO.value(), this.getSoundSource(), 2.0F, 0.2F, false); } for (int i = 0; i < 2; i++) { - this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.NOTE_BLOCK_DIDGERIDOO, this.getSoundSource(), 1.8F, 0.4F, false); + this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.NOTE_BLOCK_DIDGERIDOO.value(), this.getSoundSource(), 1.8F, 0.4F, false); } break; default: @@ -424,14 +427,14 @@ private void addBlockParticles(final int count) { int i = Mth.floor(this.getX()); int j = Mth.floor(this.getY() - (double) 0.2F); int k = Mth.floor(this.getZ()); - BlockPos pos = new BlockPos(i, j, k); - BlockState blockstate = this.level.getBlockState(pos); + BlockPos pos = BlockPos.containing(i, j, k); + BlockState blockstate = this.level().getBlockState(pos); if (!blockstate.isAir()) { final BlockParticleOption data = new BlockParticleOption(ParticleTypes.BLOCK, blockstate).setPos(pos); final double radius = this.getBbWidth(); final double motion = 4.0D; for (int c = 0; c < count; c++) { - this.level.addParticle(data, + this.level().addParticle(data, this.getX() + (this.random.nextDouble() - 0.5D) * radius * 2, this.getY() + 0.1D, this.getZ() + (this.random.nextDouble() - 0.5D) * radius * 2, @@ -447,13 +450,13 @@ private void addSmashParticlesAt(final Entity e) { final double motion = 0.08D; final double radius = e.getBbWidth(); for (int i = 0; i < 25; i++) { - level.addParticle(ParticleTypes.CRIT, - x + (level.random.nextDouble() - 0.5D) * radius, + level().addParticle(ParticleTypes.CRIT, + x + (level().random.nextDouble() - 0.5D) * radius, y, - z + (level.random.nextDouble() - 0.5D) * radius, - (level.random.nextDouble() - 0.5D) * motion, + z + (level().random.nextDouble() - 0.5D) * radius, + (level().random.nextDouble() - 0.5D) * motion, 0.5D, - (level.random.nextDouble() - 0.5D) * motion); + (level().random.nextDouble() - 0.5D) * motion); } } @@ -489,9 +492,9 @@ private boolean isExemptFromSmashAttack(final Entity entity) { **/ private void useSmashAttack(final Entity entity) { // if entitiy is touching the ground, knock it into the air and apply stun - if (entity.isOnGround() && !isExemptFromSmashAttack(entity)) { + if (entity.onGround() && !isExemptFromSmashAttack(entity)) { entity.push(0.0D, 0.65D, 0.0D); - entity.hurt(DamageSource.mobAttack(this), (float) this.getAttribute(Attributes.ATTACK_DAMAGE).getValue()); + entity.hurt(this.damageSources().mobAttack(this), (float) this.getAttribute(Attributes.ATTACK_DAMAGE).getValue()); // stun effect (for living entities) if (entity instanceof LivingEntity target) { if (GreekFantasy.CONFIG.STUNNED_NERF.get()) { @@ -510,15 +513,15 @@ private void useSmashAttack(final Entity entity) { * @param offset the forward distance to offset the bounding box **/ private void destroyIntersectingBlocks(final double offset) { - if (!level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + if (!level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { return; } final Vec3 facing = Vec3.directionFromRotation(this.getRotationVector()); final AABB box = this.getBoundingBox().move(facing.normalize().scale(offset)); BlockPos.betweenClosedStream(box).forEach(p -> { - BlockState b = this.level.getBlockState(p); - if ((b.canOcclude() || b.getMaterial().blocksMotion()) && !b.is(BlockTags.WITHER_IMMUNE)) { - this.level.destroyBlock(p, true); + BlockState b = this.level().getBlockState(p); + if ((b.canOcclude() || b.blocksMotion()) && !b.is(BlockTags.WITHER_IMMUNE)) { + this.level().destroyBlock(p, true); } }); } @@ -610,9 +613,9 @@ public void tick() { } if (Geryon.this.smashTime >= Geryon.MAX_SMASH_TIME) { // notify client (spawns particles around entities) - Geryon.this.level.broadcastEntityEvent(Geryon.this, Geryon.SMASH_EVENT); + Geryon.this.level().broadcastEntityEvent(Geryon.this, Geryon.SMASH_EVENT); // get a list of nearby entities and use smash attack on each one - Geryon.this.level.getEntities(Geryon.this, Geryon.this.getBoundingBox().inflate(range, range / 2, range)) + Geryon.this.level().getEntities(Geryon.this, Geryon.this.getBoundingBox().inflate(range, range / 2, range)) .forEach(e -> Geryon.this.useSmashAttack(e)); // destroy nearby blocks if (isBlockSmash) { @@ -660,7 +663,7 @@ public void start() { @Override protected void onSummonMob(final MadCow mobEntity) { - Geryon.this.level.broadcastEntityEvent(Geryon.this, SUMMON_EVENT); + Geryon.this.level().broadcastEntityEvent(Geryon.this, SUMMON_EVENT); } @Override diff --git a/src/main/java/greekfantasy/entity/boss/GiantBoar.java b/src/main/java/greekfantasy/entity/boss/GiantBoar.java index f85af528..e8dc3021 100644 --- a/src/main/java/greekfantasy/entity/boss/GiantBoar.java +++ b/src/main/java/greekfantasy/entity/boss/GiantBoar.java @@ -1,4 +1,5 @@ package greekfantasy.entity.boss; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -17,6 +18,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.BossEvent; import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -122,7 +124,7 @@ public void aiStep() { this.setTarget(null); // spawn particles final double width = this.getBbWidth(); - level.addParticle(ParticleTypes.ENTITY_EFFECT, + level().addParticle(ParticleTypes.ENTITY_EFFECT, this.getX() + (random.nextDouble() - 0.5D) * width, this.getY() + random.nextDouble(), this.getZ() + (random.nextDouble() - 0.5D) * width, 0.01D, 0.01D, 0.01D); @@ -162,7 +164,7 @@ public boolean isConverting() { // canBeZombified @Override public boolean isInvulnerableTo(final DamageSource source) { - return isSpawning() || source == DamageSource.IN_WALL || source == DamageSource.WITHER || super.isInvulnerableTo(source); + return isSpawning() || source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) || super.isInvulnerableTo(source); } @Override @@ -275,8 +277,8 @@ public void setSpawning(final boolean spawning) { if (spawning) { spawnTime = 1; // notify client - if (!level.isClientSide()) { - level.broadcastEntityEvent(this, SPAWN_CLIENT); + if (!level().isClientSide()) { + this.level().broadcastEntityEvent(this, SPAWN_CLIENT); } } else { spawnTime = 0; diff --git a/src/main/java/greekfantasy/entity/boss/Hydra.java b/src/main/java/greekfantasy/entity/boss/Hydra.java index 59d54ebf..a88e2c14 100644 --- a/src/main/java/greekfantasy/entity/boss/Hydra.java +++ b/src/main/java/greekfantasy/entity/boss/Hydra.java @@ -131,7 +131,7 @@ public void aiStep() { // boss info this.bossInfo.setProgress(this.getHealth() / this.getMaxHealth()); - if (!getPassengers().isEmpty() && !level.isClientSide()) { + if (!getPassengers().isEmpty() && !level().isClientSide()) { // determine if all heads are charred int charred = 0; HydraHead head; @@ -144,7 +144,7 @@ public void aiStep() { // if all heads are charred, kill the hydra; otherwise, heal the hydra if (charred == getHeads()) { DamageSource source = this.getLastDamageSource(); - hurt(source != null ? source : DamageSource.STARVE, getMaxHealth() * 2.0F); + hurt(source != null ? source : this.damageSources().starve(), getMaxHealth() * 2.0F); getPassengers().forEach(e -> e.discard()); } else if (getHealth() < getMaxHealth() && random.nextFloat() < 0.125F) { heal(1.25F * (getHeads() - charred)); @@ -217,8 +217,8 @@ public void setHeads(final int heads) { */ public HydraHead addHead(final int id) { // GreekFantasy.LOGGER.debug("Adding head with id " + id); - if (!level.isClientSide()) { - HydraHead head = GFRegistry.EntityReg.HYDRA_HEAD.get().create(level); + if (!level().isClientSide()) { + HydraHead head = GFRegistry.EntityReg.HYDRA_HEAD.get().create(level()); head.moveTo(getX(), getY(), getZ(), 0, 0); // add the entity to the world (commented out bc of errors: "trying to add entity with duplicated UUID ...") // world.addEntity(head); diff --git a/src/main/java/greekfantasy/entity/boss/HydraHead.java b/src/main/java/greekfantasy/entity/boss/HydraHead.java index 6613ddef..85e45d01 100644 --- a/src/main/java/greekfantasy/entity/boss/HydraHead.java +++ b/src/main/java/greekfantasy/entity/boss/HydraHead.java @@ -1,5 +1,6 @@ package greekfantasy.entity.boss; +import net.minecraft.tags.DamageTypeTags; import greekfantasy.GFRegistry; import greekfantasy.entity.util.GFMobType; import net.minecraft.core.particles.ParticleTypes; @@ -11,6 +12,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; @@ -110,12 +112,12 @@ public void aiStep() { super.aiStep(); // remove when not linked to a hydra - if (!hasHydra() && !level.isClientSide()) { + if (!hasHydra() && !level().isClientSide()) { discard(); return; } - if (!level.isClientSide() && getTarget() != null && null == getHydra().getTarget()) { + if (!level().isClientSide() && getTarget() != null && null == getHydra().getTarget()) { getHydra().setTarget(getTarget()); } @@ -137,13 +139,13 @@ public void aiStep() { public void tick() { super.tick(); // recalculate size - if (markForSizeChange || (this.level.isClientSide() && !this.isNormal())) { + if (markForSizeChange || (this.level().isClientSide() && !this.isNormal())) { refreshDimensions(); markForSizeChange = false; } - if (level.isClientSide() && isCharred() && random.nextInt(5) == 0) { - level.addParticle(ParticleTypes.SMOKE, + if (level().isClientSide() && isCharred() && random.nextInt(5) == 0) { + level().addParticle(ParticleTypes.SMOKE, getX() + (random.nextDouble() - 0.5D) * getBbWidth(), getY() + getBbHeight(), getZ() + (random.nextDouble() - 0.5D) * getBbWidth(), 0.0D, 0.0D, 0.0D); @@ -152,8 +154,8 @@ public void tick() { @Override public boolean isInvulnerableTo(final DamageSource source) { - return ((isSevered() || isGrowing()) && !source.isFire()) - || isCharred() || source == DamageSource.IN_WALL || source == DamageSource.WITHER + return ((isSevered() || isGrowing()) && !source.is(DamageTypeTags.IS_FIRE)) + || isCharred() || source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) || super.isInvulnerableTo(source); } @@ -170,14 +172,14 @@ public void die(DamageSource cause) { HydraHead head = getHydra().addHead(getHydra().getHeads()); if(!head.isRemoved()) { head.setSevered(); - level.addFreshEntity(head); + level().addFreshEntity(head); } } // reset health to prevent removal this.setHealth(1.0F); this.markForSizeChange = true; this.refreshDimensions(); - level.broadcastEntityEvent(this, CHANGE_SIZE_EVENT); + this.level().broadcastEntityEvent(this, CHANGE_SIZE_EVENT); } @Override @@ -186,11 +188,11 @@ protected InteractionResult mobInteract(final Player player, final InteractionHa // light this head on fire when flint and steel is used if (!itemstack.isEmpty() && itemstack.is(Items.FLINT_AND_STEEL)) { final Vec3 pos = this.position(); - this.level.playSound(player, pos.x, pos.y, pos.z, SoundEvents.FLINTANDSTEEL_USE, this.getSoundSource(), 1.0F, + this.level().playSound(player, pos.x, pos.y, pos.z, SoundEvents.FLINTANDSTEEL_USE, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F); player.swing(hand); - if (!this.level.isClientSide()) { + if (!this.level().isClientSide()) { this.setSecondsOnFire(4 + random.nextInt(3)); itemstack.hurtAndBreak(1, player, c -> c.broadcastBreakEvent(hand)); } @@ -291,8 +293,8 @@ public byte getHeadState() { public void setHeadState(final byte state) { this.getEntityData().set(STATE, state); this.markForSizeChange = true; - if (!level.isClientSide()) { - level.broadcastEntityEvent(this, CHANGE_SIZE_EVENT); + if (!level().isClientSide()) { + this.level().broadcastEntityEvent(this, CHANGE_SIZE_EVENT); } } @@ -328,8 +330,8 @@ public void setSevered() { public void setGrowing() { setHeadState(GROWING); growTime = 1; - if (!this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, GROWING_EVENT); + if (!this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, GROWING_EVENT); } } @@ -409,7 +411,7 @@ public BiteAttackGoal() { @Override public boolean canUse() { - long i = HydraHead.this.level.getGameTime(); + long i = HydraHead.this.level().getGameTime(); // do not execute if timer is too recent or head is severed/charred if (i - this.lastCheckTime < attackInterval || !HydraHead.this.isNormal()) { return false; @@ -468,7 +470,7 @@ protected void checkAndPerformAttack(LivingEntity enemy, double distToEnemySqr) if (distToEnemySqr <= d0 && this.swingCooldown <= 0) { this.swingCooldown = attackInterval; HydraHead.this.swing(InteractionHand.MAIN_HAND); - HydraHead.this.level.broadcastEntityEvent(HydraHead.this, ATTACK_EVENT); + HydraHead.this.level().broadcastEntityEvent(HydraHead.this, ATTACK_EVENT); HydraHead.this.doHurtTarget(enemy); } } diff --git a/src/main/java/greekfantasy/entity/boss/NemeanLion.java b/src/main/java/greekfantasy/entity/boss/NemeanLion.java index e1f22cd5..9e798d05 100644 --- a/src/main/java/greekfantasy/entity/boss/NemeanLion.java +++ b/src/main/java/greekfantasy/entity/boss/NemeanLion.java @@ -1,5 +1,7 @@ package greekfantasy.entity.boss; +import net.minecraft.core.registries.Registries; +import net.minecraft.tags.DamageTypeTags; import greekfantasy.GreekFantasy; import greekfantasy.entity.ai.CooldownMeleeAttackGoal; import greekfantasy.entity.ai.MoveToStructureGoal; @@ -16,6 +18,7 @@ import net.minecraft.world.BossEvent; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; @@ -154,7 +157,7 @@ public void aiStep() { } // randomly change sitting position when not attacking or wanting to attack - if (!this.level.isClientSide()) { + if (!this.level().isClientSide()) { if (sitting && (this.isAggressive() || this.getTarget() != null || !getPassengers().isEmpty())) { setSitting(false); } else if (random.nextFloat() < 0.0009F) { @@ -167,8 +170,8 @@ public void aiStep() { Player player = (Player) getPassengers().get(0); this.setRot(player.getYRot(), player.getXRot() * 0.5F); // strangling damage - if (this.hurtTime == 0 && !level.isClientSide()) { - this.hurt(DamageSource.playerAttack(player), 1.0F + random.nextFloat()); + if (this.hurtTime == 0 && !level().isClientSide()) { + this.hurt(player.damageSources().playerAttack(player), 1.0F + random.nextFloat()); // remove regen if (this.getEffect(MobEffects.REGENERATION) != null) { this.removeEffect(MobEffects.REGENERATION); @@ -192,11 +195,11 @@ public boolean doHurtTarget(final Entity entity) { protected void actuallyHurt(final DamageSource source, final float amountIn) { float damageAmount = amountIn; // cap damage at 2.0 (1 heart) - if (!source.isBypassMagic() && !source.isMagic() && !source.isBypassArmor()) { + if (!source.is(DamageTypeTags.BYPASSES_EFFECTS) && !source.is(DamageTypes.MAGIC) && !source.is(DamageTypeTags.BYPASSES_ARMOR)) { damageAmount = Math.min(2.0F, amountIn); } // stop sitting when hurt - if (!this.level.isClientSide() && this.isSitting()) { + if (!this.level().isClientSide() && this.isSitting()) { this.setSitting(false); } super.actuallyHurt(source, damageAmount); @@ -204,15 +207,15 @@ protected void actuallyHurt(final DamageSource source, final float amountIn) { @Override public boolean isInvulnerableTo(final DamageSource source) { - return source == DamageSource.IN_WALL || source == DamageSource.WITHER - || source == DamageSource.CACTUS || source == DamageSource.SWEET_BERRY_BUSH - || source.isProjectile() || super.isInvulnerableTo(source); + return source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) + || source.is(DamageTypes.CACTUS) || source.is(DamageTypes.SWEET_BERRY_BUSH) + || source.is(DamageTypeTags.IS_PROJECTILE) || super.isInvulnerableTo(source); } @Override protected void doPush(final Entity entityIn) { // stop sitting when collided with entity - if (entityIn instanceof LivingEntity && !this.level.isClientSide() && this.isSitting()) { + if (entityIn instanceof LivingEntity && !this.level().isClientSide() && this.isSitting()) { this.setSitting(false); } super.doPush(entityIn); @@ -233,7 +236,7 @@ public double getPassengersRidingOffset() { @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { if (!this.isVehicle() && !player.isSecondaryUseActive()) { - if (!this.level.isClientSide() && this.canAddPassenger(player)) { + if (!this.level().isClientSide() && this.canAddPassenger(player)) { // mount the player to the entity player.startRiding(this); // reset sitting @@ -241,7 +244,7 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) { setSitting(false); } } - return InteractionResult.sidedSuccess(this.level.isClientSide); + return InteractionResult.sidedSuccess(this.level().isClientSide); } return InteractionResult.FAIL; @@ -318,10 +321,10 @@ public boolean isSitting() { public void setSitting(final boolean sitting) { if (sitting) { setNemeanState(SITTING); - this.level.broadcastEntityEvent(this, SITTING_START_EVENT); + this.level().broadcastEntityEvent(this, SITTING_START_EVENT); } else { setNemeanState(NONE); - this.level.broadcastEntityEvent(this, SITTING_END_EVENT); + this.level().broadcastEntityEvent(this, SITTING_END_EVENT); } } diff --git a/src/main/java/greekfantasy/entity/boss/Python.java b/src/main/java/greekfantasy/entity/boss/Python.java index fb5c7efc..46e32a24 100644 --- a/src/main/java/greekfantasy/entity/boss/Python.java +++ b/src/main/java/greekfantasy/entity/boss/Python.java @@ -1,4 +1,5 @@ package greekfantasy.entity.boss; +import net.minecraft.core.registries.Registries; import greekfantasy.GreekFantasy; @@ -16,6 +17,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.TagKey; import net.minecraft.world.BossEvent; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; @@ -152,7 +154,7 @@ protected boolean canRide(Entity entityIn) { @Override public boolean isInvulnerableTo(final DamageSource source) { - return source == DamageSource.IN_WALL || source == DamageSource.WITHER || super.isInvulnerableTo(source); + return source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) || super.isInvulnerableTo(source); } @Override @@ -277,9 +279,9 @@ public void handleEntityEvent(byte id) { @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - if (!level.isClientSide()) { - PoisonSpit healingSpell = PoisonSpit.create(level, this); - level.addFreshEntity(healingSpell); + if (!level().isClientSide()) { + PoisonSpit healingSpell = PoisonSpit.create(level(), this); + level().addFreshEntity(healingSpell); } this.playSound(SoundEvents.LLAMA_SPIT, 1.2F, 1.0F); } @@ -302,7 +304,7 @@ public boolean canUse() { public void start() { super.start(); Python.this.setSpitAttack(true); - Python.this.level.broadcastEntityEvent(Python.this, SPIT_EVENT); + Python.this.level().broadcastEntityEvent(Python.this, SPIT_EVENT); Python.this.playSound(SoundEvents.CREEPER_PRIMED, 1.0F, 1.2F); } diff --git a/src/main/java/greekfantasy/entity/boss/Scylla.java b/src/main/java/greekfantasy/entity/boss/Scylla.java index e6c28274..1db6dc91 100644 --- a/src/main/java/greekfantasy/entity/boss/Scylla.java +++ b/src/main/java/greekfantasy/entity/boss/Scylla.java @@ -16,6 +16,7 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.BossEvent; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -107,7 +108,7 @@ public boolean canAttackType(EntityType type) { @Override public boolean isInvulnerableTo(DamageSource source) { - return source == DamageSource.IN_WALL || source == DamageSource.WITHER + return source.is(DamageTypes.IN_WALL) || source.is(DamageTypes.WITHER) || source.getEntity() instanceof Charybdis || super.isInvulnerableTo(source); } @@ -204,14 +205,14 @@ public float getVoicePitch() { @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - if (!level.isClientSide()) { - WaterSpell waterSpell = WaterSpell.create(level, this); + if (!level().isClientSide()) { + WaterSpell waterSpell = WaterSpell.create(level(), this); double dx = target.getX() - waterSpell.getX(); double dy = target.getY(0.5D) - waterSpell.getY(); double dz = target.getZ() - waterSpell.getZ(); double dis = Math.sqrt(dx * dx + dz * dz); waterSpell.shoot(dx, dy + dis * waterSpell.getGravity() * 4.0D, dz, 1.6F, 1.0F); - this.level.addFreshEntity(waterSpell); + this.level().addFreshEntity(waterSpell); } this.playSound(SoundEvents.LLAMA_SPIT, 1.2F, 1.2F + this.random.nextFloat() * 0.2F); } diff --git a/src/main/java/greekfantasy/entity/boss/Talos.java b/src/main/java/greekfantasy/entity/boss/Talos.java index ca676835..a41fbda8 100644 --- a/src/main/java/greekfantasy/entity/boss/Talos.java +++ b/src/main/java/greekfantasy/entity/boss/Talos.java @@ -12,6 +12,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.world.BossEvent; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobCategory; @@ -158,7 +159,7 @@ public boolean removeWhenFarAway(final double disToPlayer) { @Override public boolean isInvulnerableTo(final DamageSource source) { - return source.isMagic() || source.getDirectEntity() instanceof AbstractArrow || super.isInvulnerableTo(source); + return source.is(DamageTypes.MAGIC) || source.getDirectEntity() instanceof AbstractArrow || super.isInvulnerableTo(source); } @Override diff --git a/src/main/java/greekfantasy/entity/misc/BronzeFeather.java b/src/main/java/greekfantasy/entity/misc/BronzeFeather.java index 54e54246..aafc185c 100644 --- a/src/main/java/greekfantasy/entity/misc/BronzeFeather.java +++ b/src/main/java/greekfantasy/entity/misc/BronzeFeather.java @@ -2,8 +2,8 @@ import greekfantasy.GFRegistry; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -46,7 +46,7 @@ protected Item getDefaultItem() { protected void onHitEntity(EntityHitResult raytrace) { super.onHitEntity(raytrace); final float damage = 1.0F; - raytrace.getEntity().hurt(DamageSource.thrown(this, getOwner()).bypassArmor(), damage); + raytrace.getEntity().hurt(this.damageSources().thrown(this, getOwner()), damage); discard(); } @@ -58,14 +58,14 @@ protected void onHit(HitResult raytrace) { @Override public Entity changeDimension(ServerLevel serverWorld, ITeleporter iTeleporter) { Entity entity = getOwner(); - if (entity != null && entity.level.dimension() != serverWorld.dimension()) { + if (entity != null && entity.level().dimension() != serverWorld.dimension()) { setOwner(null); } return super.changeDimension(serverWorld, iTeleporter); } @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } diff --git a/src/main/java/greekfantasy/entity/misc/Discus.java b/src/main/java/greekfantasy/entity/misc/Discus.java index e8adeb5e..d0583606 100644 --- a/src/main/java/greekfantasy/entity/misc/Discus.java +++ b/src/main/java/greekfantasy/entity/misc/Discus.java @@ -3,9 +3,9 @@ import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -52,7 +52,7 @@ protected Item getDefaultItem() { protected void onHitEntity(EntityHitResult raytrace) { super.onHitEntity(raytrace); final float damage = (float) (this.getDeltaMovement().horizontalDistanceSqr() * 3.2D); - raytrace.getEntity().hurt(DamageSource.thrown(this, getOwner()), damage); + raytrace.getEntity().hurt(this.damageSources().thrown(this, getOwner()), damage); } @Override @@ -60,8 +60,9 @@ protected void onHit(HitResult raytrace) { super.onHit(raytrace); if (random.nextFloat() < 0.028F && !(getOwner() instanceof Player player && player.isCreative())) { final Vec3 vec = raytrace.getLocation(); - final ItemEntity item = new ItemEntity(this.level, vec.x, vec.y + 0.25D, vec.z, new ItemStack(getDefaultItem())); - this.level.addFreshEntity(item); + final ItemEntity item = new ItemEntity(this.level(), vec.x, vec.y + 0.25D, vec.z, + new ItemStack(getDefaultItem())); + this.level().addFreshEntity(item); } else { this.playSound(SoundEvents.ITEM_BREAK, 1.0F, 1.0F + random.nextFloat() * 0.2F); } @@ -89,14 +90,14 @@ protected float getGravity() { @Override public Entity changeDimension(ServerLevel serverLevel, ITeleporter iTeleporter) { Entity entity = this.getOwner(); - if (entity != null && entity.level.dimension() != serverLevel.dimension()) { + if (entity != null && entity.level().dimension() != serverLevel.dimension()) { setOwner(null); } return super.changeDimension(serverLevel, iTeleporter); } @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } diff --git a/src/main/java/greekfantasy/entity/misc/DragonTooth.java b/src/main/java/greekfantasy/entity/misc/DragonTooth.java index 759af2f8..4152bce2 100644 --- a/src/main/java/greekfantasy/entity/misc/DragonTooth.java +++ b/src/main/java/greekfantasy/entity/misc/DragonTooth.java @@ -5,9 +5,9 @@ import greekfantasy.entity.Sparti; import net.minecraft.core.BlockPos; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -53,26 +53,29 @@ protected Item getDefaultItem() { protected void onHitEntity(EntityHitResult raytrace) { super.onHitEntity(raytrace); final float damage = GreekFantasy.CONFIG.DRAGON_TOOTH_SPARTI_COUNT.get() > 0 ? 0.0F : 1.5F; - raytrace.getEntity().hurt(DamageSource.thrown(this, getOwner()), damage); + raytrace.getEntity().hurt(this.damageSources().thrown(this, getOwner()), damage); } @Override protected void onHit(HitResult raytrace) { super.onHit(raytrace); - if (!this.level.isClientSide() && this.isAlive()) { + if (!this.level().isClientSide() && this.isAlive()) { Entity thrower = getOwner(); // spawn a configurable number of sparti - for (int i = 0, n = GreekFantasy.CONFIG.DRAGON_TOOTH_SPARTI_COUNT.get(), life = 20 * GreekFantasy.CONFIG.DRAGON_TOOTH_SPARTI_LIFESPAN.get(); i < n; i++) { - final Sparti sparti = GFRegistry.EntityReg.SPARTI.get().create(level); + for (int i = 0, n = GreekFantasy.CONFIG.DRAGON_TOOTH_SPARTI_COUNT.get(), + life = 20 * GreekFantasy.CONFIG.DRAGON_TOOTH_SPARTI_LIFESPAN.get(); i < n; i++) { + final Sparti sparti = GFRegistry.EntityReg.SPARTI.get().create(level()); sparti.moveTo(raytrace.getLocation().x, raytrace.getLocation().y, raytrace.getLocation().z, 0, 0); - level.addFreshEntity(sparti); + level().addFreshEntity(sparti); if (thrower instanceof Player player) { sparti.yBodyRot = Mth.wrapDegrees(thrower.getYRot() + 180.0F); sparti.tame(player); } sparti.setSpawning(); sparti.setLimitedLife(life); - sparti.finalizeSpawn((ServerLevelAccessor) level, level.getCurrentDifficultyAt(new BlockPos(raytrace.getLocation())), MobSpawnType.MOB_SUMMONED, null, null); + sparti.finalizeSpawn((ServerLevelAccessor) level(), + level().getCurrentDifficultyAt(BlockPos.containing(raytrace.getLocation())), + MobSpawnType.MOB_SUMMONED, null, null); } discard(); } @@ -91,14 +94,14 @@ public void tick() { @Override public Entity changeDimension(ServerLevel serverWorld, ITeleporter iTeleporter) { Entity entity = getOwner(); - if (entity != null && entity.level.dimension() != serverWorld.dimension()) { + if (entity != null && entity.level().dimension() != serverWorld.dimension()) { setOwner(null); } return super.changeDimension(serverWorld, iTeleporter); } @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } diff --git a/src/main/java/greekfantasy/entity/misc/DragonToothHook.java b/src/main/java/greekfantasy/entity/misc/DragonToothHook.java index 3d3dbe4b..65745efa 100644 --- a/src/main/java/greekfantasy/entity/misc/DragonToothHook.java +++ b/src/main/java/greekfantasy/entity/misc/DragonToothHook.java @@ -56,7 +56,7 @@ protected void pullEntity(Entity hookedEntity) { // determine damage amount float damageAmount = 1.0F + (float) vec3.scale(0.25F).length(); // hurt the hooked entity - hookedEntity.hurt(DamageSource.indirectMobAttack(this, owner).bypassArmor(), damageAmount); + hookedEntity.hurt(level().damageSources().indirectMagic(this, owner), damageAmount); } } diff --git a/src/main/java/greekfantasy/entity/misc/GreekFire.java b/src/main/java/greekfantasy/entity/misc/GreekFire.java index 87240ec2..49b6c437 100644 --- a/src/main/java/greekfantasy/entity/misc/GreekFire.java +++ b/src/main/java/greekfantasy/entity/misc/GreekFire.java @@ -4,10 +4,10 @@ import greekfantasy.block.OliveOilBlock; import net.minecraft.core.BlockPos; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.FluidTags; import net.minecraft.util.Mth; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -60,7 +60,7 @@ protected void onHitEntity(EntityHitResult raytrace) { @Override protected void onHit(HitResult raytrace) { super.onHit(raytrace); - if (!this.level.isClientSide() && level instanceof ServerLevel && this.isAlive()) { + if (!this.level().isClientSide() && this.level() instanceof ServerLevel && this.isAlive()) { causeExplosion(raytrace.getLocation()); discard(); } @@ -70,28 +70,32 @@ protected Explosion causeExplosion(final Vec3 vec) { // cause explosion at this location final float size = 1.25F; final float size2 = size * 1.5F; - Explosion exp = this.level.explode(this.getOwner(), DamageSource.ON_FIRE, null, vec.x, vec.y, vec.z, size, false, Explosion.BlockInteraction.NONE); - final BlockState oilBlock = GFRegistry.BlockReg.OLIVE_OIL.get().defaultBlockState().setValue(OliveOilBlock.LIT, true); + Explosion exp = this.level().explode(this.getOwner(), this.damageSources().onFire(), null, vec.x, vec.y, vec.z, + size, false, Level.ExplosionInteraction.NONE); + final BlockState oilBlock = GFRegistry.BlockReg.OLIVE_OIL.get().defaultBlockState().setValue(OliveOilBlock.LIT, + true); final BlockState waterloggedOilBlock = oilBlock.setValue(OliveOilBlock.WATERLOGGED, true); // place oil fire around the area - BlockPos origin = new BlockPos(vec.x, vec.y, vec.z); + BlockPos origin = BlockPos.containing(vec.x, vec.y, vec.z); BlockPos.MutableBlockPos pos = origin.mutable(); BlockState state; - for(float x = -size2; x < size2; x++) { - for(float y = -size2; y < size2; y++) { - for(float z = -size2; z < size2; z++) { + for (float x = -size2; x < size2; x++) { + for (float y = -size2; y < size2; y++) { + for (float z = -size2; z < size2; z++) { // update position pos.setWithOffset(origin, Mth.floor(x), Mth.floor(y), Mth.floor(z)); // determine if block should be destroyed - if (level.random.nextInt(3) > 0) { - state = level.getBlockState(pos); - if ((state.getMaterial().isReplaceable() && level.getBlockState(pos.below()).isSolidRender(level, pos.below()))) { + if (level().random.nextInt(3) > 0) { + state = level().getBlockState(pos); + if ((state.canBeReplaced() + && level().getBlockState(pos.below()).isSolidRender(level(), pos.below()))) { // attempt to place lit oil - this.level.setBlockAndUpdate(pos, oilBlock); - } else if (level.getBlockState(pos).getFluidState().is(FluidTags.WATER) && level.isEmptyBlock(pos.above())) { + this.level().setBlockAndUpdate(pos, oilBlock); + } else if (level().getBlockState(pos).getFluidState().is(FluidTags.WATER) + && level().isEmptyBlock(pos.above())) { // attempt to place waterlogged lit oil and soul fire - this.level.setBlockAndUpdate(pos, waterloggedOilBlock); - this.level.setBlock(pos.above(), Blocks.SOUL_FIRE.defaultBlockState(), 2); + this.level().setBlockAndUpdate(pos, waterloggedOilBlock); + this.level().setBlock(pos.above(), Blocks.SOUL_FIRE.defaultBlockState(), 2); } } } @@ -104,7 +108,7 @@ protected Explosion causeExplosion(final Vec3 vec) { @Override public void tick() { // attempt to raytrace with fluids - HitResult raytraceresult = level.clip(new ClipContext( + HitResult raytraceresult = level().clip(new ClipContext( this.position().add(-0.1D, -0.1D, -0.1D), this.position().add(0.1D, 0.1D, 0.1D), ClipContext.Block.OUTLINE, ClipContext.Fluid.ANY, this)); if (raytraceresult.getType() == HitResult.Type.BLOCK) { @@ -125,14 +129,14 @@ protected float getGravity() { @Override public Entity changeDimension(ServerLevel serverWorld, ITeleporter iTeleporter) { Entity entity = this.getOwner(); - if (entity != null && entity.level.dimension() != serverWorld.dimension()) { + if (entity != null && entity.level().dimension() != serverWorld.dimension()) { setOwner(null); } return super.changeDimension(serverWorld, iTeleporter); } @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } diff --git a/src/main/java/greekfantasy/entity/misc/MobEffectProjectile.java b/src/main/java/greekfantasy/entity/misc/MobEffectProjectile.java index 0abeeff9..fd6594be 100644 --- a/src/main/java/greekfantasy/entity/misc/MobEffectProjectile.java +++ b/src/main/java/greekfantasy/entity/misc/MobEffectProjectile.java @@ -1,8 +1,8 @@ package greekfantasy.entity.misc; - import net.minecraft.core.particles.ParticleOptions; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; @@ -41,7 +41,7 @@ protected void onHitEntity(EntityHitResult raytrace) { // impact may inflict damage float damage = getImpactDamage(livingEntity); if (damage > 0 && thrower instanceof LivingEntity) { - livingEntity.hurt(DamageSource.indirectMobAttack(this, (LivingEntity) thrower), damage); + livingEntity.hurt(damageSources().mobProjectile(this, (LivingEntity) thrower), damage); } // add particle effect addParticles(getImpactParticle(livingEntity), 6 + random.nextInt(6)); @@ -69,8 +69,8 @@ public void tick() { return; } // check for impact - if (!this.level.isClientSide()) { - HitResult raytraceresult = ProjectileUtil.getHitResult(this, this::canHitEntity); + if (!this.level().isClientSide()) { + HitResult raytraceresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); if (raytraceresult.getType() != HitResult.Type.MISS && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { this.onHit(raytraceresult); @@ -96,14 +96,14 @@ public void tick() { @Override public Entity changeDimension(ServerLevel serverWorld, ITeleporter iTeleporter) { Entity entity = getOwner(); - if (entity != null && entity.level.dimension() != serverWorld.dimension()) { + if (entity != null && entity.level().dimension() != serverWorld.dimension()) { setOwner(null); } return super.changeDimension(serverWorld, iTeleporter); } @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @@ -120,7 +120,7 @@ protected void defineSynchedData() { abstract float getImpactDamage(final LivingEntity entity); protected void addParticles(final ParticleOptions type, final int count) { - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { final double x = getX(); final double y = getY() + 0.1D; final double z = getZ(); @@ -128,13 +128,13 @@ protected void addParticles(final ParticleOptions type, final int count) { final double width = getBbWidth() / 2; final double height = getBbHeight() / 2; for (int i = 0; i < count; i++) { - level.addParticle(type, - x + (level.random.nextDouble() - 0.5D) * width, + level().addParticle(type, + x + (level().random.nextDouble() - 0.5D) * width, y + height, - z + (level.random.nextDouble() - 0.5D) * width, - (level.random.nextDouble() - 0.5D) * motion, - (level.random.nextDouble() - 0.5D) * motion, - (level.random.nextDouble() - 0.5D) * motion); + z + (level().random.nextDouble() - 0.5D) * width, + (level().random.nextDouble() - 0.5D) * motion, + (level().random.nextDouble() - 0.5D) * motion, + (level().random.nextDouble() - 0.5D) * motion); } } } diff --git a/src/main/java/greekfantasy/entity/misc/OrthusHead.java b/src/main/java/greekfantasy/entity/misc/OrthusHead.java index a991522a..bf996713 100644 --- a/src/main/java/greekfantasy/entity/misc/OrthusHead.java +++ b/src/main/java/greekfantasy/entity/misc/OrthusHead.java @@ -14,7 +14,8 @@ public OrthusHead(EntityType entityType, Level world) { } public OrthusHead(Level level, double x, double y, double z, ItemStack itemStack) { - this(level, x, y, z, itemStack, level.random.nextDouble() * 0.2D - 0.1D, 0.2D, level.random.nextDouble() * 0.2D - 0.1D); + this(level, x, y, z, itemStack, level.random.nextDouble() * 0.2D - 0.1D, 0.2D, + level.random.nextDouble() * 0.2D - 0.1D); } public OrthusHead(Level level, double x, double y, double z, ItemStack itemStack, double dx, double dy, double dz) { @@ -31,8 +32,9 @@ public static OrthusHead create(Level level, double posX, double posY, double po @Override public void remove(Entity.RemovalReason reason) { - if (!this.level.isClientSide() && this.isOnFire()) { - SummonBossUtil.onOrthusHeadBurned(this.level, this.blockPosition(), this.getThrower()); + if (!this.level().isClientSide() && this.isOnFire()) { + SummonBossUtil.onOrthusHeadBurned(this.level(), this.blockPosition(), + this.getOwner() != null ? this.getOwner().getUUID() : null); } super.remove(reason); } diff --git a/src/main/java/greekfantasy/entity/misc/Spear.java b/src/main/java/greekfantasy/entity/misc/Spear.java index ec8cfc0c..61dbd605 100644 --- a/src/main/java/greekfantasy/entity/misc/Spear.java +++ b/src/main/java/greekfantasy/entity/misc/Spear.java @@ -1,9 +1,11 @@ package greekfantasy.entity.misc; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; import greekfantasy.item.SpearItem; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.protocol.Packet; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; @@ -69,7 +71,7 @@ public void tick() { Entity entity = this.getOwner(); if ((this.dealtDamage || this.isNoPhysics()) && entity != null) { if (loyaltyLevel > 0 && !this.shouldReturnToThrower()) { - if (!this.level.isClientSide && this.pickup == AbstractArrow.Pickup.ALLOWED) { + if (!this.level().isClientSide && this.pickup == AbstractArrow.Pickup.ALLOWED) { this.spawnAtLocation(this.getPickupItem(), 0.1F); } @@ -79,7 +81,7 @@ public void tick() { Vec3 vector3d = new Vec3(entity.getX() - this.getX(), entity.getEyeY() - this.getY(), entity.getZ() - this.getZ()); this.setPosRaw(this.getX(), this.getY() + vector3d.y * 0.015D * loyaltyLevel, this.getZ()); - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { this.yOld = this.getY(); } @@ -137,7 +139,7 @@ protected void onHitEntity(EntityHitResult raytrace) { } Entity thrower = getOwner(); - DamageSource source = DamageSource.thrown(this, (thrower == null) ? this : thrower); + DamageSource source = this.damageSources().thrown(this, (thrower == null) ? this : thrower); SoundEvent sound = SoundEvents.TRIDENT_HIT; // attempt to set entity on fire if(setFire > 0) { @@ -209,7 +211,7 @@ public void addAdditionalSaveData(CompoundTag tag) { } @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } diff --git a/src/main/java/greekfantasy/entity/misc/ThrowingAxe.java b/src/main/java/greekfantasy/entity/misc/ThrowingAxe.java index 1d49069a..d326e2d5 100644 --- a/src/main/java/greekfantasy/entity/misc/ThrowingAxe.java +++ b/src/main/java/greekfantasy/entity/misc/ThrowingAxe.java @@ -3,12 +3,12 @@ import greekfantasy.GFRegistry; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -26,7 +26,8 @@ public class ThrowingAxe extends ThrowableItemProjectile { - protected static final EntityDataAccessor PICKUP = SynchedEntityData.defineId(ThrowingAxe.class, EntityDataSerializers.BOOLEAN); + protected static final EntityDataAccessor PICKUP = SynchedEntityData.defineId(ThrowingAxe.class, + EntityDataSerializers.BOOLEAN); private static final String KEY_DAMAGE = "BaseDamage"; @@ -56,7 +57,7 @@ public void tick() { @Override public void setItem(ItemStack itemStack) { super.setItem(itemStack); - if(itemStack.getItem() instanceof DiggerItem diggerItem) { + if (itemStack.getItem() instanceof DiggerItem diggerItem) { setBaseDamage(diggerItem.getAttackDamage()); } } @@ -72,11 +73,12 @@ protected void onHitEntity(EntityHitResult raytrace) { if (entity instanceof LivingEntity) { LivingEntity living = (LivingEntity) entity; - this.setBaseDamage(this.getBaseDamage() + EnchantmentHelper.getDamageBonus(this.getItem(), living.getMobType())); + this.setBaseDamage( + this.getBaseDamage() + EnchantmentHelper.getDamageBonus(this.getItem(), living.getMobType())); } Entity thrower = getOwner(); - DamageSource source = DamageSource.thrown(this, (thrower == null) ? this : thrower); + var source = this.damageSources().thrown(this, (thrower == null) ? this : thrower); SoundEvent sound = SoundEvents.PLAYER_ATTACK_STRONG; if (entity.hurt(source, (float) this.getBaseDamage())) { @@ -101,13 +103,13 @@ protected void onHit(HitResult hitResult) { super.onHit(hitResult); // damage item ItemStack item = this.getItem(); - if(item.isDamageableItem()) { + if (item.isDamageableItem()) { item.setDamageValue(item.getDamageValue() + 1); } // drop as item - if(canPickup()) { - ItemEntity itemEntity = new ItemEntity(this.level, this.getX(), this.getY(), this.getZ(), item); - level.addFreshEntity(itemEntity); + if (canPickup()) { + ItemEntity itemEntity = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), item); + level().addFreshEntity(itemEntity); } discard(); } @@ -122,7 +124,7 @@ public void playerTouch(Player player) { } @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } diff --git a/src/main/java/greekfantasy/entity/misc/WaterSpell.java b/src/main/java/greekfantasy/entity/misc/WaterSpell.java index 5a0ba069..781f2d27 100644 --- a/src/main/java/greekfantasy/entity/misc/WaterSpell.java +++ b/src/main/java/greekfantasy/entity/misc/WaterSpell.java @@ -45,7 +45,7 @@ protected List getMobEffects(final LivingEntity entity) { // add slow swim to the list list.add(new MobEffectInstance(GFRegistry.MobEffectReg.SLOW_SWIM.get(), 180, 2)); // add poison to the list depending on random chance and difficulty - if(random.nextInt(15) < 1 + level.getDifficulty().getId() * 4) { + if(random.nextInt(15) < 1 + level().getDifficulty().getId() * 4) { list.add(new MobEffectInstance(MobEffects.POISON, 50, 0)); } return list; diff --git a/src/main/java/greekfantasy/entity/misc/WebBall.java b/src/main/java/greekfantasy/entity/misc/WebBall.java index c782b578..6d663570 100644 --- a/src/main/java/greekfantasy/entity/misc/WebBall.java +++ b/src/main/java/greekfantasy/entity/misc/WebBall.java @@ -5,11 +5,13 @@ import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -25,6 +27,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.BlockHitResult; @@ -36,7 +39,8 @@ public class WebBall extends ThrowableItemProjectile { - protected static final EntityDataAccessor TYPE = SynchedEntityData.defineId(WebBall.class, EntityDataSerializers.BYTE); + protected static final EntityDataAccessor TYPE = SynchedEntityData.defineId(WebBall.class, + EntityDataSerializers.BYTE); protected static final String KEY_TYPE = "WebType"; public static final byte WEB = 1; @@ -91,12 +95,12 @@ protected void onHitBlock(BlockHitResult hitResult) { @Override protected void onHit(HitResult hitResult) { // do not process when discarded - if (this.level.isClientSide() || !this.isAlive()) { + if (this.level().isClientSide() || !this.isAlive()) { return; } // do not collide with cobwebs if (hitResult.getType() == HitResult.Type.BLOCK && - level.getBlockState(new BlockPos(hitResult.getLocation())).is(Blocks.COBWEB)) { + level().getBlockState(BlockPos.containing(hitResult.getLocation())).is(Blocks.COBWEB)) { return; } super.onHit(hitResult); @@ -115,14 +119,14 @@ public void tick() { @Override public Entity changeDimension(ServerLevel serverWorld, ITeleporter iTeleporter) { Entity entity = getOwner(); - if (entity != null && entity.level.dimension() != serverWorld.dimension()) { + if (entity != null && entity.level().dimension() != serverWorld.dimension()) { setOwner(null); } return super.changeDimension(serverWorld, iTeleporter); } @Override - public Packet getAddEntityPacket() { + public Packet getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } @@ -133,7 +137,7 @@ protected float getGravity() { @Override public void makeStuckInBlock(BlockState blockState, Vec3 stuckSpeedMultiplier) { - if(!blockState.is(Blocks.COBWEB)) { + if (!blockState.is(Blocks.COBWEB)) { super.makeStuckInBlock(blockState, stuckSpeedMultiplier); } } @@ -151,10 +155,10 @@ public void addAdditionalSaveData(CompoundTag tag) { } protected void onWebImpact(final HitResult raytrace, final Vec3 webPos) { - if(level.isClientSide()) { + if (level().isClientSide()) { return; } - final BlockPos hitPos = new BlockPos(webPos); + final BlockPos hitPos = BlockPos.containing(webPos); final byte type = getWebType(); // nothing (drop string) if (type == 0) { @@ -162,29 +166,28 @@ protected void onWebImpact(final HitResult raytrace, final Vec3 webPos) { return; } // web - if (hasWeb(type) && level.isEmptyBlock(hitPos)) { - level.setBlockAndUpdate(hitPos, Blocks.COBWEB.defaultBlockState()); + if (hasWeb(type) && level().isEmptyBlock(hitPos)) { + level().setBlockAndUpdate(hitPos, Blocks.COBWEB.defaultBlockState()); } // spider if (hasSpider(type)) { - BabySpider spider = GFRegistry.EntityReg.BABY_SPIDER.get().create(level); + BabySpider spider = GFRegistry.EntityReg.BABY_SPIDER.get().create(level()); spider.copyPosition(this); spider.restrictTo(hitPos, 12); - level.addFreshEntity(spider); + level().addFreshEntity(spider); } // item - if (hasItem(type) && this.level instanceof ServerLevel serverLevel) { + if (hasItem(type) && this.level() instanceof ServerLevel serverLevel) { ResourceLocation resourcelocation = getType().getDefaultLootTable(); - LootTable loottable = serverLevel.getServer().getLootTables().get(resourcelocation); - LootContext.Builder lootcontext$builder = (new LootContext.Builder(serverLevel)) - .withRandom(this.random) + LootTable loottable = serverLevel.getServer().getLootData().getLootTable(resourcelocation); + LootParams.Builder lootparams$builder = new LootParams.Builder(serverLevel) .withParameter(LootContextParams.THIS_ENTITY, this) .withParameter(LootContextParams.ORIGIN, webPos) - .withParameter(LootContextParams.DAMAGE_SOURCE, DamageSource.FALL) + .withParameter(LootContextParams.DAMAGE_SOURCE, this.damageSources().fall()) .withOptionalParameter(LootContextParams.KILLER_ENTITY, getOwner()) .withOptionalParameter(LootContextParams.DIRECT_KILLER_ENTITY, null); - LootContext ctx = lootcontext$builder.create(LootContextParamSets.ENTITY); - loottable.getRandomItems(ctx).forEach(this::spawnAtLocation); + LootParams lootparams = lootparams$builder.create(LootContextParamSets.ENTITY); + loottable.getRandomItems(lootparams).forEach(this::spawnAtLocation); } } @@ -199,9 +202,12 @@ public byte getWebType() { public byte setWebType(final boolean web, final boolean spider, final boolean item) { // determine type bits byte type = 0; - if (web) type = (byte) (type | WEB); - if (spider) type = (byte) (type | SPIDER); - if (item) type = (byte) (type | ITEM); + if (web) + type = (byte) (type | WEB); + if (spider) + type = (byte) (type | SPIDER); + if (item) + type = (byte) (type | ITEM); // actually set the web type setWebType(type); // return the web type diff --git a/src/main/java/greekfantasy/entity/monster/Ara.java b/src/main/java/greekfantasy/entity/monster/Ara.java index 36195f6b..aa46963d 100644 --- a/src/main/java/greekfantasy/entity/monster/Ara.java +++ b/src/main/java/greekfantasy/entity/monster/Ara.java @@ -82,8 +82,8 @@ public boolean canUse() { public void aiStep() { super.aiStep(); // anger timer - if (!this.level.isClientSide()) { - this.updatePersistentAnger((ServerLevel) this.level, true); + if (!this.level().isClientSide()) { + this.updatePersistentAnger((ServerLevel) this.level(), true); } // when aggressive, equip a weapon if (this.isAggressive()) { @@ -144,7 +144,7 @@ public void addAdditionalSaveData(CompoundTag compound) { @Override public void readAdditionalSaveData(CompoundTag compound) { super.readAdditionalSaveData(compound); - this.readPersistentAngerSaveData(this.level, compound); + this.readPersistentAngerSaveData(this.level(), compound); } public boolean isHoldingWeapon() { diff --git a/src/main/java/greekfantasy/entity/monster/Circe.java b/src/main/java/greekfantasy/entity/monster/Circe.java index 176df7c4..39115333 100644 --- a/src/main/java/greekfantasy/entity/monster/Circe.java +++ b/src/main/java/greekfantasy/entity/monster/Circe.java @@ -1,5 +1,6 @@ package greekfantasy.entity.monster; +import net.minecraft.tags.DamageTypeTags; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; import greekfantasy.entity.ai.IntervalRangedAttackGoal; @@ -88,7 +89,7 @@ public void aiStep() { // boss info this.bossInfo.setProgress(this.getHealth() / this.getMaxHealth()); // apply potion effect to self - if (this.random.nextFloat() < 0.15F && (this.isOnFire() || this.getLastDamageSource() != null && this.getLastDamageSource().isFire()) && !this.hasEffect(MobEffects.FIRE_RESISTANCE)) { + if (this.random.nextFloat() < 0.15F && (this.isOnFire() || this.getLastDamageSource() != null && this.getLastDamageSource().is(DamageTypeTags.IS_FIRE)) && !this.hasEffect(MobEffects.FIRE_RESISTANCE)) { this.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 900)); } } @@ -113,9 +114,9 @@ public SpawnGroupData finalizeSpawn(ServerLevelAccessor worldIn, DifficultyInsta @Override public void performRangedAttack(LivingEntity arg0, float arg1) { - if (!level.isClientSide()) { - CurseOfCirce spell = CurseOfCirce.create(level, this); - level.addFreshEntity(spell); + if (!level().isClientSide()) { + CurseOfCirce spell = CurseOfCirce.create(level(), this); + level().addFreshEntity(spell); } this.playSound(SoundEvents.ILLUSIONER_CAST_SPELL, 1.2F, 1.0F); // swing arm diff --git a/src/main/java/greekfantasy/entity/monster/Drakaina.java b/src/main/java/greekfantasy/entity/monster/Drakaina.java index de6b3336..d5be5b49 100644 --- a/src/main/java/greekfantasy/entity/monster/Drakaina.java +++ b/src/main/java/greekfantasy/entity/monster/Drakaina.java @@ -1,4 +1,5 @@ package greekfantasy.entity.monster; +import net.minecraft.core.registries.Registries; import greekfantasy.GreekFantasy; import greekfantasy.entity.util.GFMobType; @@ -172,7 +173,7 @@ public boolean doHurtTarget(final Entity entity) { } } // light target on fire if burning - float f = this.level.getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty(); + float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty(); if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) { entity.setSecondsOnFire(2 * (int) f); } diff --git a/src/main/java/greekfantasy/entity/monster/Empusa.java b/src/main/java/greekfantasy/entity/monster/Empusa.java index f0add249..729e3a07 100644 --- a/src/main/java/greekfantasy/entity/monster/Empusa.java +++ b/src/main/java/greekfantasy/entity/monster/Empusa.java @@ -67,12 +67,12 @@ protected void registerGoals() { public void aiStep() { super.aiStep(); // hurt in daytime, then remove when at half health if not currently attacking - if (!this.level.isClientSide() && this.level.isDay() && this.hurtTime == 0 && this.tickCount % 24 == 0) { - this.hurt(DamageSource.STARVE, 2.0F); + if (!this.level().isClientSide() && this.level().isDay() && this.hurtTime == 0 && this.tickCount % 24 == 0) { + this.hurt(this.damageSources().starve(), 2.0F); } // spawn particles - if (level.isClientSide() && this.isDraining()) { + if (level().isClientSide() && this.isDraining()) { particleRay(); } } @@ -100,8 +100,8 @@ public float getLightLevelDependentMagicValue() { public void setDraining(final boolean draining) { this.isDraining = draining; - if (!this.level.isClientSide()) { - this.level.broadcastEntityEvent(this, draining ? DRAINING_START : DRAINING_END); + if (!this.level().isClientSide()) { + this.level().broadcastEntityEvent(this, draining ? DRAINING_START : DRAINING_END); } } @@ -122,10 +122,10 @@ public void particleRay() { final double y = pos.y + scaled.y; final double z = pos.z + scaled.z; final AABB aabb = new AABB(x - 0.1D, y - 0.1D, z - 0.1D, x + 0.1D, y + 0.1D, z + 0.1D); - if (!this.level.getEntities(this, aabb).isEmpty()) { + if (!this.level().getEntities(this, aabb).isEmpty()) { return; } - this.level.addParticle(ParticleTypes.CRIT, x, y, z, 0, 0, 0); + this.level().addParticle(ParticleTypes.CRIT, x, y, z, 0, 0, 0); } } @@ -164,7 +164,7 @@ public boolean canContinueToUse() { @Override public void start() { this.drainingTime = MAX_DRAIN_TIME; - if(entity.level.getCurrentDifficultyAt(entity.blockPosition()).isHard()) { + if(entity.level().getCurrentDifficultyAt(entity.blockPosition()).isHard()) { this.drainingTime += HARD_DELTA_DRAIN_TIME; } this.entity.setDraining(true); @@ -179,7 +179,7 @@ public void tick() { this.entity.lookAt(this.entity.getTarget(), 100.0F, 100.0F); // drain health from targetPos if (drainingTime > (MAX_DRAIN_TIME / 3) && this.entity.getTarget().hurtTime == 0) { - final DamageSource src = DamageSource.indirectMagic(this.entity, this.entity); + final DamageSource src = this.entity.damageSources().indirectMagic(this.entity, this.entity); float amount = (float) this.entity.getAttribute(Attributes.ATTACK_DAMAGE).getValue() * 0.5F; if (this.entity.getTarget().hurt(src, amount)) { this.entity.heal(amount * 1.5F); @@ -195,7 +195,7 @@ public void stop() { this.entity.setDraining(false); this.drainingTime = 0; this.cooldown = MAX_COOLDOWN; - if(entity.level.getCurrentDifficultyAt(entity.blockPosition()).isHard()) { + if(entity.level().getCurrentDifficultyAt(entity.blockPosition()).isHard()) { this.cooldown += HARD_DELTA_COOLDOWN; } } diff --git a/src/main/java/greekfantasy/entity/monster/Fury.java b/src/main/java/greekfantasy/entity/monster/Fury.java index 91e0fc92..b65b60f8 100644 --- a/src/main/java/greekfantasy/entity/monster/Fury.java +++ b/src/main/java/greekfantasy/entity/monster/Fury.java @@ -97,7 +97,7 @@ public void aiStep() { super.aiStep(); // update falling moveSpeed Vec3 m = getDeltaMovement(); - if (this.isEffectiveAi() && !this.onGround && m.y < 0.0D) { + if (this.isEffectiveAi() && !this.onGround() && m.y < 0.0D) { final double multY = this.getTarget() != null ? 0.9D : 0.6D; setDeltaMovement(m.multiply(1.0D, multY, 1.0D)); } @@ -106,7 +106,7 @@ public void aiStep() { @Override public void tick() { super.tick(); - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { // update flying counter flyingTime0 = flyingTime; if (this.isFlying()) { @@ -166,7 +166,7 @@ protected void checkFallDamage(double y, boolean onGroundIn, BlockState state, B @Override public boolean isFlying() { - return !this.onGround || this.getDeltaMovement().lengthSqr() > 0.06D; + return !this.onGround() || this.getDeltaMovement().lengthSqr() > 0.06D; } public float getFlyingTime(final float partialTick) { @@ -183,9 +183,9 @@ public float getAggroPercent(final float partialTick) { @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - if (!level.isClientSide()) { - Curse curse = Curse.create(level, this); - level.addFreshEntity(curse); + if (!level().isClientSide()) { + Curse curse = Curse.create(level(), this); + level().addFreshEntity(curse); } this.playSound(SoundEvents.LLAMA_SPIT, 1.2F, 1.0F); } diff --git a/src/main/java/greekfantasy/entity/monster/Gorgon.java b/src/main/java/greekfantasy/entity/monster/Gorgon.java index 43d0fba5..83aa7715 100644 --- a/src/main/java/greekfantasy/entity/monster/Gorgon.java +++ b/src/main/java/greekfantasy/entity/monster/Gorgon.java @@ -1,4 +1,5 @@ package greekfantasy.entity.monster; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -163,26 +164,26 @@ public void handleEntityEvent(byte id) { } public void spawnStareParticles() { - if (level.isClientSide()) { + if (level().isClientSide()) { final double motion = 0.08D; final double radius = 1.2D; for (int i = 0; i < 5; i++) { - level.addParticle(ParticleTypes.END_ROD, - this.getX() + (level.random.nextDouble() - 0.5D) * radius, - this.getEyeY() + (level.random.nextDouble() - 0.5D) * radius * 0.75D, - this.getZ() + (level.random.nextDouble() - 0.5D) * radius, - (level.random.nextDouble() - 0.5D) * motion, - (level.random.nextDouble() - 0.5D) * motion * 0.5D, - (level.random.nextDouble() - 0.5D) * motion); + level().addParticle(ParticleTypes.END_ROD, + this.getX() + (level().random.nextDouble() - 0.5D) * radius, + this.getEyeY() + (level().random.nextDouble() - 0.5D) * radius * 0.75D, + this.getZ() + (level().random.nextDouble() - 0.5D) * radius, + (level().random.nextDouble() - 0.5D) * motion, + (level().random.nextDouble() - 0.5D) * motion * 0.5D, + (level().random.nextDouble() - 0.5D) * motion); } final double distance = this.getAttribute(Attributes.FOLLOW_RANGE).getValue(); // get list of all nearby players who have been petrified - final List list = this.level.getEntitiesOfClass(Player.class, + final List list = this.level().getEntitiesOfClass(Player.class, this.getBoundingBox().inflate(distance), e -> e.getEffect(GFRegistry.MobEffectReg.PETRIFIED.get()) != null); // spawn gorgon particle for each player for (final Player p : list) { - level.addParticle(GFRegistry.ParticleReg.GORGON.get(), true, p.getX(), p.getY(), p.getZ(), 0D, 0D, 0D); + level().addParticle(GFRegistry.ParticleReg.GORGON.get(), true, p.getX(), p.getY(), p.getZ(), 0D, 0D, 0D); } } } @@ -231,9 +232,9 @@ public void performRangedAttack(LivingEntity target, float distanceFactor) { double dy = target.getY(0.67D) - arrow.getY(); double dz = target.getZ() - arrow.getZ(); double dis = Math.sqrt(dx * dx + dz * dz); - arrow.shoot(dx, dy + dis * (double) 0.2F, dz, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); + arrow.shoot(dx, dy + dis * (double) 0.2F, dz, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); this.playSound(SoundEvents.ARROW_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.level.addFreshEntity(arrow); + this.level().addFreshEntity(arrow); } // Stare Attack // @@ -295,7 +296,7 @@ protected void useStareAttack(final LivingEntity target) { } // update client-state if (this.isEffectiveAi()) { - this.level.broadcastEntityEvent(this, STARE_ATTACK); + this.level().broadcastEntityEvent(this, STARE_ATTACK); } } @@ -416,7 +417,7 @@ public boolean canUse() { cooldown--; } else { double range = Gorgon.this.getAttribute(Attributes.FOLLOW_RANGE).getValue(); - this.trackedPlayers = Gorgon.this.level.getEntitiesOfClass(Player.class, Gorgon.this.getBoundingBox().inflate(range), + this.trackedPlayers = Gorgon.this.level().getEntitiesOfClass(Player.class, Gorgon.this.getBoundingBox().inflate(range), e -> Gorgon.this.canAttack(e) && !Gorgon.this.isImmuneToStareAttack(e) && Gorgon.this.isPlayerStaring(e)); return !this.trackedPlayers.isEmpty(); } diff --git a/src/main/java/greekfantasy/entity/monster/Harpy.java b/src/main/java/greekfantasy/entity/monster/Harpy.java index 80a136d2..cdc6f092 100644 --- a/src/main/java/greekfantasy/entity/monster/Harpy.java +++ b/src/main/java/greekfantasy/entity/monster/Harpy.java @@ -110,7 +110,7 @@ public void aiStep() { super.aiStep(); // update falling moveSpeed Vec3 m = getDeltaMovement(); - if (this.isEffectiveAi() && !this.onGround && m.y < 0.0D) { + if (this.isEffectiveAi() && !this.onGround() && m.y < 0.0D) { final double multY = this.getTarget() != null ? 0.9D : 0.6D; setDeltaMovement(m.multiply(1.0D, multY, 1.0D)); } @@ -128,7 +128,7 @@ public void aiStep() { // check nest final Optional nestPos = Harpy.this.getNestPos(); // check if there is still a nest at the position - if (nestPos.isPresent() && !level.getBlockState(nestPos.get()).is(GFRegistry.BlockReg.NEST.get())) { + if (nestPos.isPresent() && !level().getBlockState(nestPos.get()).is(GFRegistry.BlockReg.NEST.get())) { this.setNestPos(Optional.empty()); } } @@ -177,7 +177,7 @@ public void readAdditionalSaveData(CompoundTag compound) { final int x = compound.getInt(KEY_NEST + ".x"); final int y = compound.getInt(KEY_NEST + ".y"); final int z = compound.getInt(KEY_NEST + ".z"); - this.setNestPos(Optional.of(new BlockPos(x, y, z))); + this.setNestPos(Optional.of(BlockPos.containing(x, y, z))); } } @@ -205,7 +205,7 @@ protected void onFlap() { @Override public boolean isFlying() { - return !this.onGround || this.getDeltaMovement().lengthSqr() > 0.06D; + return !this.onGround() || this.getDeltaMovement().lengthSqr() > 0.06D; } public float getFlyingTime(final float partialTick) { @@ -215,15 +215,15 @@ public float getFlyingTime(final float partialTick) { private void calculateFlapping() { this.oFlap = this.flap; this.oFlapSpeed = this.flapSpeed; - this.flapSpeed += (float) (!this.onGround && !this.isPassenger() ? 4 : -1) * 0.3F; + this.flapSpeed += (float) (!this.onGround() && !this.isPassenger() ? 4 : -1) * 0.3F; this.flapSpeed = Mth.clamp(this.flapSpeed, 0.0F, 1.0F); - if (!this.onGround && this.flapping < 1.0F) { + if (!this.onGround() && this.flapping < 1.0F) { this.flapping = 1.0F; } this.flapping *= 0.9F; Vec3 vec3 = this.getDeltaMovement(); - if (!this.onGround && vec3.y < 0.0D) { + if (!this.onGround() && vec3.y < 0.0D) { this.setDeltaMovement(vec3.multiply(1.0D, 0.6D, 1.0D)); } @@ -261,7 +261,7 @@ public boolean canUse() { @Override protected Optional findNearbyBlock() { final Optional nestPos = Harpy.this.getNestPos(); - if (nestPos.isPresent() && isTargetBlock(Harpy.this.level, nestPos.get())) { + if (nestPos.isPresent() && isTargetBlock(Harpy.this.level(), nestPos.get())) { return nestPos; } return super.findNearbyBlock(); @@ -269,7 +269,7 @@ protected Optional findNearbyBlock() { @Override public boolean isTargetBlock(LevelReader level, BlockPos pos) { - return level.getBlockState(pos).is(GFRegistry.BlockReg.NEST.get()); + return level().getBlockState(pos).is(GFRegistry.BlockReg.NEST.get()); } @Override diff --git a/src/main/java/greekfantasy/entity/monster/MadCow.java b/src/main/java/greekfantasy/entity/monster/MadCow.java index 7af66a00..a9a1b439 100644 --- a/src/main/java/greekfantasy/entity/monster/MadCow.java +++ b/src/main/java/greekfantasy/entity/monster/MadCow.java @@ -1,6 +1,5 @@ package greekfantasy.entity.monster; - import net.minecraft.sounds.SoundSource; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntityType; @@ -29,8 +28,8 @@ public class MadCow extends Cow implements Enemy { public MadCow(final EntityType type, final Level worldIn) { super(type, worldIn); // remove pathfinding malus to encourage dangerous movement - this.setPathfindingMalus(BlockPathTypes.DANGER_CACTUS, 0); - this.setPathfindingMalus(BlockPathTypes.DAMAGE_CACTUS, 0); + this.setPathfindingMalus(BlockPathTypes.DANGER_OTHER, 0); + this.setPathfindingMalus(BlockPathTypes.DAMAGE_OTHER, 0); this.setPathfindingMalus(BlockPathTypes.DANGER_FIRE, 0); this.setPathfindingMalus(BlockPathTypes.DAMAGE_FIRE, 0); this.setPathfindingMalus(BlockPathTypes.DANGER_OTHER, 0); @@ -58,7 +57,7 @@ public void aiStep() { super.aiStep(); // slowly lose health if (!this.isPersistenceRequired() && this.random.nextInt(400) == 0) { - this.hurt(DamageSource.STARVE, 1.0F); + this.hurt(this.damageSources().starve(), 1.0F); } } @@ -67,11 +66,6 @@ public MobCategory getClassification(boolean forSpawnCount) { return MobCategory.MONSTER; } - @Override - public boolean canCutCorner(BlockPathTypes pathType) { - return pathType != BlockPathTypes.WALKABLE_DOOR; - } - @Override public SoundSource getSoundSource() { return SoundSource.HOSTILE; diff --git a/src/main/java/greekfantasy/entity/monster/Minotaur.java b/src/main/java/greekfantasy/entity/monster/Minotaur.java index 2996a570..cc89ef8e 100644 --- a/src/main/java/greekfantasy/entity/monster/Minotaur.java +++ b/src/main/java/greekfantasy/entity/monster/Minotaur.java @@ -95,7 +95,7 @@ public void aiStep() { super.aiStep(); // spawn particles - if (level.isClientSide() && this.isStunned()) { + if (level().isClientSide() && this.isStunned()) { spawnStunnedParticles(); } } @@ -179,7 +179,7 @@ public boolean isStunned() { public void setCharging(final boolean charging) { setMinotaurState(charging ? CHARGING : NONE); - if (!this.level.isClientSide()) { + if (!this.level().isClientSide()) { // determine if knockback resistance modifier was added AttributeInstance knockbackResist = this.getAttribute(Attributes.KNOCKBACK_RESISTANCE); boolean hasModifier = knockbackResist.hasModifier(knockbackResistanceModifier); @@ -201,13 +201,13 @@ public void spawnStunnedParticles() { final double motion = 0.09D; final double radius = 0.7D; for (int i = 0; i < 2; i++) { - level.addParticle(ParticleTypes.INSTANT_EFFECT, - this.getX() + (level.random.nextDouble() - 0.5D) * radius, - this.getEyeY() + (level.random.nextDouble() - 0.5D) * radius * 0.75D, - this.getZ() + (level.random.nextDouble() - 0.5D) * radius, - (level.random.nextDouble() - 0.5D) * motion, - (level.random.nextDouble() - 0.5D) * motion * 0.5D, - (level.random.nextDouble() - 0.5D) * motion); + level().addParticle(ParticleTypes.INSTANT_EFFECT, + this.getX() + (level().random.nextDouble() - 0.5D) * radius, + this.getEyeY() + (level().random.nextDouble() - 0.5D) * radius * 0.75D, + this.getZ() + (level().random.nextDouble() - 0.5D) * radius, + (level().random.nextDouble() - 0.5D) * motion, + (level().random.nextDouble() - 0.5D) * motion * 0.5D, + (level().random.nextDouble() - 0.5D) * motion); } } @@ -391,7 +391,7 @@ private boolean hasDirectPath(final LivingEntity target) { **/ private boolean hasDirectPath(final Vec3 target) { Vec3 start = Minotaur.this.position().add(0, 0.1D, 0); - return Minotaur.this.level.clip(new ClipContext(start, target, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, Minotaur.this)).getType() == HitResult.Type.MISS; + return Minotaur.this.level().clip(new ClipContext(start, target, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, Minotaur.this)).getType() == HitResult.Type.MISS; } } } diff --git a/src/main/java/greekfantasy/entity/monster/Shade.java b/src/main/java/greekfantasy/entity/monster/Shade.java index f22ef3c7..f9bef8f4 100644 --- a/src/main/java/greekfantasy/entity/monster/Shade.java +++ b/src/main/java/greekfantasy/entity/monster/Shade.java @@ -83,17 +83,17 @@ protected void defineSynchedData() { public void tick() { super.tick(); // spawn particles - if (level.isClientSide()) { + if (level().isClientSide()) { final double motion = 0.08D; final double radius = 1.2D; for (int i = 0; i < 5; i++) { - level.addParticle(ParticleTypes.SMOKE, - this.getX() + (level.random.nextDouble() - 0.5D) * radius, - this.getY() + 0.75D + (level.random.nextDouble() - 0.5D) * radius * 0.75D, - this.getZ() + (level.random.nextDouble() - 0.5D) * radius, - (level.random.nextDouble() - 0.5D) * motion, - (level.random.nextDouble() - 0.5D) * motion * 0.5D, - (level.random.nextDouble() - 0.5D) * motion); + level().addParticle(ParticleTypes.SMOKE, + this.getX() + (level().random.nextDouble() - 0.5D) * radius, + this.getY() + 0.75D + (level().random.nextDouble() - 0.5D) * radius * 0.75D, + this.getZ() + (level().random.nextDouble() - 0.5D) * radius, + (level().random.nextDouble() - 0.5D) * motion, + (level().random.nextDouble() - 0.5D) * motion * 0.5D, + (level().random.nextDouble() - 0.5D) * motion); } } } @@ -133,7 +133,7 @@ public boolean isInvulnerableTo(final DamageSource source) { @Override protected SoundEvent getAmbientSound() { - return SoundEvents.AMBIENT_CAVE; + return SoundEvents.AMBIENT_CAVE.value(); } @Override diff --git a/src/main/java/greekfantasy/entity/monster/Siren.java b/src/main/java/greekfantasy/entity/monster/Siren.java index d8a71f01..01853ae8 100644 --- a/src/main/java/greekfantasy/entity/monster/Siren.java +++ b/src/main/java/greekfantasy/entity/monster/Siren.java @@ -83,7 +83,7 @@ public static boolean checkSirenSpawnRules(EntityType e return true; // do not allow if there are nearby sirens //AABB aabb = new AABB(pos).inflate(14.0D); - //return level.getEntitiesOfClass(Siren.class, aabb).isEmpty(); + //return level().getEntitiesOfClass(Siren.class, aabb).isEmpty(); } @Override @@ -118,8 +118,8 @@ public void aiStep() { // singing if (this.isCharming() && random.nextInt(8) == 0) { final float color = 0.065F + random.nextFloat() * 0.025F; - this.playSound(SoundEvents.NOTE_BLOCK_CHIME, 1.8F, color * 15); - level.addParticle(ParticleTypes.NOTE, this.getX(), this.getEyeY() + 0.15D, this.getZ(), color, 0.0D, 0.0D); + this.playSound(SoundEvents.NOTE_BLOCK_CHIME.value(), 1.8F, color * 15); + level().addParticle(ParticleTypes.NOTE, this.getX(), this.getEyeY() + 0.15D, this.getZ(), color, 0.0D, 0.0D); } } @@ -128,10 +128,10 @@ public void tick() { super.tick(); boolean inWater = this.isInWaterRainOrBubble(); // random motion when not in water - if (!inWater && this.onGround) { + if (!inWater && this.onGround()) { this.setDeltaMovement(this.getDeltaMovement().add((this.random.nextFloat() * 2.0F - 1.0F) * 0.2F, 0.5D, (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F)); this.setYRot(this.random.nextFloat() * 360.0F); - this.onGround = false; + this.setOnGround(false); this.hasImpulse = true; } // update pose @@ -154,7 +154,7 @@ public EntityDimensions getDimensions(Pose pose) { @Override public void updateSwimming() { - if (!this.level.isClientSide) { + if (!this.level().isClientSide) { this.setSwimming(true); } } diff --git a/src/main/java/greekfantasy/entity/monster/Stymphalian.java b/src/main/java/greekfantasy/entity/monster/Stymphalian.java index 78a5f311..51144a3d 100644 --- a/src/main/java/greekfantasy/entity/monster/Stymphalian.java +++ b/src/main/java/greekfantasy/entity/monster/Stymphalian.java @@ -1,5 +1,6 @@ package greekfantasy.entity.monster; +import net.minecraft.tags.DamageTypeTags; import greekfantasy.entity.misc.BronzeFeather; import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundEvent; @@ -96,7 +97,7 @@ public void aiStep() { super.aiStep(); // update falling moveSpeed Vec3 m = getDeltaMovement(); - if (this.isEffectiveAi() && !this.onGround && m.y() > 0) { + if (this.isEffectiveAi() && !this.onGround() && m.y() > 0) { setDeltaMovement(m.add(0.0D, -0.01D, 0.0D)); } } @@ -104,7 +105,7 @@ public void aiStep() { @Override public void tick() { super.tick(); - if (this.level.isClientSide()) { + if (this.level().isClientSide()) { // update flying counter flyingTime0 = flyingTime; if (this.isFlying()) { @@ -165,7 +166,7 @@ protected void checkFallDamage(double y, boolean onGroundIn, BlockState state, B @Override public boolean isFlying() { - return !isOnGround() || this.getDeltaMovement().lengthSqr() > 0.06D; + return !onGround() || this.getDeltaMovement().lengthSqr() > 0.06D; } public float getFlyingTime(final float partialTick) { @@ -176,21 +177,21 @@ public float getFlyingTime(final float partialTick) { @Override public void performRangedAttack(LivingEntity target, float distanceFactor) { - if (!level.isClientSide()) { - BronzeFeather bronzeFeather = BronzeFeather.create(level, this); + if (!level().isClientSide()) { + BronzeFeather bronzeFeather = BronzeFeather.create(level(), this); double dx = target.getX() - bronzeFeather.getX(); double dy = target.getY(0.67D) - bronzeFeather.getY(); double dz = target.getZ() - bronzeFeather.getZ(); double dis = Math.sqrt(dx * dx + dz * dz); - bronzeFeather.shoot(dx, dy + dis * (double) 0.02F, dz, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); - this.level.addFreshEntity(bronzeFeather); + bronzeFeather.shoot(dx, dy + dis * (double) 0.02F, dz, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); + this.level().addFreshEntity(bronzeFeather); } this.playSound(SoundEvents.TRIDENT_THROW, 1.2F, 1.2F + this.random.nextFloat() * 0.2F); } @Override public boolean isInvulnerableTo(DamageSource damageSource) { - if (damageSource.isProjectile() && damageSource.getDirectEntity() instanceof BronzeFeather) { + if (damageSource.is(DamageTypeTags.IS_PROJECTILE) && damageSource.getDirectEntity() instanceof BronzeFeather) { return true; } return super.isInvulnerableTo(damageSource); diff --git a/src/main/java/greekfantasy/entity/util/TradingMob.java b/src/main/java/greekfantasy/entity/util/TradingMob.java index 28e1851a..6ba3e605 100644 --- a/src/main/java/greekfantasy/entity/util/TradingMob.java +++ b/src/main/java/greekfantasy/entity/util/TradingMob.java @@ -14,6 +14,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; @@ -76,9 +77,8 @@ default boolean sendAngryParticlesOnFail() { * @return a list of result items */ default List getTradeResult(final PathfinderMob self, @Nullable final Player player, final ItemStack tradeItem) { - LootTable loottable = self.level.getServer().getLootTables().get(this.getTradeLootTable()); - return loottable.getRandomItems(new LootContext.Builder((ServerLevel) self.level) - .withRandom(self.level.random) + LootTable loottable = self.level().getServer().getLootData().getLootTable(this.getTradeLootTable()); + return loottable.getRandomItems(new LootParams.Builder((ServerLevel) self.level()) .withParameter(LootContextParams.THIS_ENTITY, self) .withParameter(LootContextParams.ORIGIN, self.position()) .withParameter(LootContextParams.TOOL, tradeItem) @@ -105,7 +105,7 @@ default void trade(final PathfinderMob self, @Nullable final Player player, fina } // spawn xp orb if (player != null && self.getRandom().nextInt(3) == 0) { - self.level.addFreshEntity(new ExperienceOrb(self.level, self.getX(), self.getY(), self.getZ(), 1 + self.getRandom().nextInt(2))); + self.level().addFreshEntity(new ExperienceOrb(self.level(), self.getX(), self.getY(), self.getZ(), 1 + self.getRandom().nextInt(2))); } } @@ -125,7 +125,7 @@ default InteractionResult startTrading(final PathfinderMob self, final Player pl } player.setItemInHand(hand, stack); return InteractionResult.SUCCESS; - } else if (sendAngryParticlesOnFail() && self.level instanceof ServerLevel serverLevel) { + } else if (sendAngryParticlesOnFail() && self.level() instanceof ServerLevel serverLevel) { serverLevel.sendParticles(ParticleTypes.ANGRY_VILLAGER, self.getX(), self.getEyeY(), self.getZ(), 4, 0, 0, 0, 0); } } diff --git a/src/main/java/greekfantasy/integration/JEICompat.java b/src/main/java/greekfantasy/integration/JEICompat.java index e11d7bb6..29e34b74 100644 --- a/src/main/java/greekfantasy/integration/JEICompat.java +++ b/src/main/java/greekfantasy/integration/JEICompat.java @@ -1,5 +1,7 @@ package greekfantasy.integration; +// TODO: Re-enable when JEI is ready for 1.20.1 +/* import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; import greekfantasy.item.QuestItem; @@ -30,3 +32,4 @@ public void registerItemSubtypes(ISubtypeRegistration registration) { }); } } +*/ \ No newline at end of file diff --git a/src/main/java/greekfantasy/integration/RGCompat.java b/src/main/java/greekfantasy/integration/RGCompat.java index 0b2fdb15..30c30e05 100644 --- a/src/main/java/greekfantasy/integration/RGCompat.java +++ b/src/main/java/greekfantasy/integration/RGCompat.java @@ -49,6 +49,8 @@ public boolean canRemovePrisonerEffect(final Player player) { } private boolean hasFavorRange(final Player player, final ResourceLocation deity, final int min, final int max) { + // TODO: Re-enable when RPGGods is available for 1.20.1 + /* if (!GreekFantasy.isRGLoaded()) { return false; } @@ -58,10 +60,13 @@ private boolean hasFavorRange(final Player player, final ResourceLocation deity, final int level = favor.getFavor(deity).getLevel(); return level >= min && level <= max; } + */ return false; } private boolean hasPatron(final Player player, final ResourceLocation deity) { + // TODO: Re-enable when RPGGods is available for 1.20.1 + /* if (!GreekFantasy.isRGLoaded()) { return false; } @@ -71,6 +76,7 @@ private boolean hasPatron(final Player player, final ResourceLocation deity) { Optional patron = favor.getPatron(); return patron.isPresent() && deity.equals(patron.get()); } + */ return false; } } diff --git a/src/main/java/greekfantasy/item/BidentItem.java b/src/main/java/greekfantasy/item/BidentItem.java index a90a4f20..3e729879 100644 --- a/src/main/java/greekfantasy/item/BidentItem.java +++ b/src/main/java/greekfantasy/item/BidentItem.java @@ -31,7 +31,7 @@ protected void throwSpear(final Level level, final Player thrower, final ItemSta && level instanceof ServerLevel && (!GreekFantasy.isRGLoaded() || RGCompat.getInstance().canUseRaising(thrower))) { // Attempt to spawn a Sparti where the player is looking - final HitResult raytrace = ThunderboltItem.raytraceFromEntity(thrower, (float) thrower.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue()); + final HitResult raytrace = ThunderboltItem.raytraceFromEntity(thrower, (float) thrower.getAttribute(ForgeMod.BLOCK_REACH.get()).getValue()); if (raytrace.getType() != HitResult.Type.MISS) { stack.hurtAndBreak(25, thrower, e -> e.broadcastBreakEvent(thrower.getUsedItemHand())); // spawn a sparti and set location @@ -44,7 +44,7 @@ protected void throwSpear(final Level level, final Player thrower, final ItemSta // entity data on spawn sparti.tame(thrower); sparti.setSpawning(); - sparti.finalizeSpawn((ServerLevel) level, level.getCurrentDifficultyAt(new BlockPos(raytrace.getLocation())), MobSpawnType.MOB_SUMMONED, null, null); + sparti.finalizeSpawn((ServerLevel) level, level.getCurrentDifficultyAt(BlockPos.containing(raytrace.getLocation())), MobSpawnType.MOB_SUMMONED, null, null); } } else { // Default behavior when not enchanted diff --git a/src/main/java/greekfantasy/item/CerberusHeadItem.java b/src/main/java/greekfantasy/item/CerberusHeadItem.java index 0f87935f..14720911 100644 --- a/src/main/java/greekfantasy/item/CerberusHeadItem.java +++ b/src/main/java/greekfantasy/item/CerberusHeadItem.java @@ -8,18 +8,18 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Wearable; +import net.minecraft.world.item.Equipable; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -public class CerberusHeadItem extends BlockItem implements Wearable { +public class CerberusHeadItem extends BlockItem implements Equipable { public CerberusHeadItem(Block block, Properties properties) { super(block, properties); } @Override - public EquipmentSlot getEquipmentSlot(ItemStack stack) { + public EquipmentSlot getEquipmentSlot() { return EquipmentSlot.HEAD; } diff --git a/src/main/java/greekfantasy/item/ConchItem.java b/src/main/java/greekfantasy/item/ConchItem.java index 1a97132a..1b745a72 100644 --- a/src/main/java/greekfantasy/item/ConchItem.java +++ b/src/main/java/greekfantasy/item/ConchItem.java @@ -34,7 +34,7 @@ public InteractionResultHolder use(Level level, Player player, Intera if (!level.isClientSide()) { // raytrace final BlockHitResult raytrace = ThunderboltItem.raytraceFromEntity(player, 32.0F, ClipContext.Fluid.SOURCE_ONLY); - BlockPos hitPos = new BlockPos(raytrace.getLocation()); + BlockPos hitPos = BlockPos.containing(raytrace.getLocation()); // attempt to place water at the hit position if (raytrace.getType() == HitResult.Type.BLOCK) { // locate block and fluid at this position @@ -95,7 +95,7 @@ private static boolean placeWater(Level level, BlockState hitBlock, FluidState h return true; } else { // destroy the block that's already here if it's replaceable - if (!level.isClientSide() && hitBlock.canBeReplaced(Fluids.WATER) && !hitBlock.getMaterial().isLiquid()) { + if (!level.isClientSide() && hitBlock.canBeReplaced(Fluids.WATER) && !hitBlock.getFluidState().isEmpty() == false) { level.destroyBlock(hitPos, true); } // finally, attempt to place water directly diff --git a/src/main/java/greekfantasy/item/DragonToothRodItem.java b/src/main/java/greekfantasy/item/DragonToothRodItem.java index b6da1818..93f69bb8 100644 --- a/src/main/java/greekfantasy/item/DragonToothRodItem.java +++ b/src/main/java/greekfantasy/item/DragonToothRodItem.java @@ -63,16 +63,6 @@ public void inventoryTick(final ItemStack stack, final Level level, final Entity } } - @Override - public void fillItemCategory(CreativeModeTab group, NonNullList items) { - // add the item to the group with enchantment already applied - if (this.allowedIn(group)) { - ItemStack stack = new ItemStack(this); - stack.enchant(FISHING_LUCK, FISHING_LUCK_LEVEL); - items.add(stack); - } - } - @Override public void onCraftedBy(ItemStack stack, Level level, Player playerIn) { if (stack.getEnchantmentLevel(FISHING_LUCK) < FISHING_LUCK_LEVEL) { diff --git a/src/main/java/greekfantasy/item/EnchantedBowItem.java b/src/main/java/greekfantasy/item/EnchantedBowItem.java index bbea33ed..2a7de367 100644 --- a/src/main/java/greekfantasy/item/EnchantedBowItem.java +++ b/src/main/java/greekfantasy/item/EnchantedBowItem.java @@ -147,16 +147,6 @@ protected int getDamageOnUse(final ItemStack stack) { return 1; } - @Override - public void fillItemCategory(CreativeModeTab group, NonNullList items) { - // add the item to the group with enchantment already applied - if (this.allowedIn(group)) { - ItemStack stack = new ItemStack(this); - checkAndApplyBaseEnchantments(stack); - items.add(stack); - } - } - @Override public void onCraftedBy(ItemStack stack, Level level, Player playerIn) { checkAndApplyBaseEnchantments(stack); @@ -246,7 +236,7 @@ public AbstractArrow customArrow(AbstractArrow arrow) { public void appendHoverText(ItemStack itemStack, @Nullable Level level, List list, TooltipFlag flag) { // add multishot tooltip list.add(Component.translatable(Enchantments.MULTISHOT.getDescriptionId()).withStyle(ChatFormatting.AQUA) - .append(" ").append(Component.translatable("enchantment.level.2").withStyle(ChatFormatting.AQUA))); + .append(" ").append(Component.translatable("enchantment.level().2").withStyle(ChatFormatting.AQUA))); } } @@ -292,7 +282,7 @@ public AbstractArrow customArrow(AbstractArrow arrow) { public void appendHoverText(ItemStack itemStack, @Nullable Level level, List list, TooltipFlag flag) { // add multishot tooltip list.add(Component.translatable(Enchantments.MULTISHOT.getDescriptionId()).withStyle(ChatFormatting.AQUA) - .append(" ").append(Component.translatable("enchantment.level.1").withStyle(ChatFormatting.AQUA))); + .append(" ").append(Component.translatable("enchantment.level().1").withStyle(ChatFormatting.AQUA))); } } } diff --git a/src/main/java/greekfantasy/item/GFArmorMaterials.java b/src/main/java/greekfantasy/item/GFArmorMaterials.java index 52e0a324..2c10071c 100644 --- a/src/main/java/greekfantasy/item/GFArmorMaterials.java +++ b/src/main/java/greekfantasy/item/GFArmorMaterials.java @@ -1,10 +1,12 @@ package greekfantasy.item; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; @@ -59,10 +61,20 @@ public int getDurabilityForSlot(EquipmentSlot equipmentSlot) { return HEALTH_PER_SLOT[equipmentSlot.getIndex()] * this.durabilityMultiplier; } + @Override + public int getDurabilityForType(ArmorItem.Type type) { + return HEALTH_PER_SLOT[type.getSlot().getIndex()] * this.durabilityMultiplier; + } + public int getDefenseForSlot(EquipmentSlot equipmentSlot) { return this.slotProtections[equipmentSlot.getIndex()]; } + @Override + public int getDefenseForType(ArmorItem.Type type) { + return this.slotProtections[type.getSlot().getIndex()]; + } + public int getEnchantmentValue() { return this.enchantmentValue; } diff --git a/src/main/java/greekfantasy/item/GiganteHeadItem.java b/src/main/java/greekfantasy/item/GiganteHeadItem.java index 1cf6e6c2..a87db4e3 100644 --- a/src/main/java/greekfantasy/item/GiganteHeadItem.java +++ b/src/main/java/greekfantasy/item/GiganteHeadItem.java @@ -9,11 +9,11 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Wearable; +import net.minecraft.world.item.Equipable; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -public class GiganteHeadItem extends BlockItem implements Wearable { +public class GiganteHeadItem extends BlockItem implements Equipable { public GiganteHeadItem(Block block, Properties properties) { super(block, properties); @@ -24,6 +24,11 @@ public EquipmentSlot getEquipmentSlot(ItemStack stack) { return EquipmentSlot.HEAD; } + @Override + public EquipmentSlot getEquipmentSlot() { + return EquipmentSlot.HEAD; + } + @Override public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); diff --git a/src/main/java/greekfantasy/item/GoldenBallItem.java b/src/main/java/greekfantasy/item/GoldenBallItem.java index 44d95f8b..8ddfe152 100644 --- a/src/main/java/greekfantasy/item/GoldenBallItem.java +++ b/src/main/java/greekfantasy/item/GoldenBallItem.java @@ -1,4 +1,5 @@ package greekfantasy.item; +import net.minecraft.world.level.material.Fluids; import greekfantasy.GFRegistry; import greekfantasy.block.GoldenStringBlock; @@ -39,7 +40,7 @@ public void inventoryTick(ItemStack itemStack, Level level, Entity entity, int i boolean isString = current.is(GFRegistry.BlockReg.GOLDEN_STRING.get()); if(isString && current.getValue(GoldenStringBlock.AGE) > 0) { level.setBlock(pos, Blocks.AIR.defaultBlockState(), Block.UPDATE_ALL); - } else if(!isString && current.getMaterial().isReplaceable() && string.canSurvive(level, pos)) { + } else if(!isString && current.canBeReplaced(Fluids.EMPTY) && string.canSurvive(level, pos)) { // place golden string level.setBlock(pos, string, Block.UPDATE_ALL); // damage item @@ -50,6 +51,6 @@ public void inventoryTick(ItemStack itemStack, Level level, Entity entity, int i @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { - return slotChanged || !ItemStack.isSameIgnoreDurability(oldStack, newStack); + return slotChanged || !ItemStack.isSameItemSameTags(oldStack, newStack); } } diff --git a/src/main/java/greekfantasy/item/HellenicArmorItem.java b/src/main/java/greekfantasy/item/HellenicArmorItem.java index b7247df9..bffa4b4f 100644 --- a/src/main/java/greekfantasy/item/HellenicArmorItem.java +++ b/src/main/java/greekfantasy/item/HellenicArmorItem.java @@ -1,4 +1,5 @@ package greekfantasy.item; +import net.minecraft.core.registries.Registries; import greekfantasy.GreekFantasy; import net.minecraft.ChatFormatting; @@ -25,6 +26,7 @@ public class HellenicArmorItem extends ArmorItem { + private final EquipmentSlot slot; private static final String TEXTURE_1 = new ResourceLocation(GreekFantasy.MODID, "textures/models/armor/hellenic_layer_1.png").toString(); private static final String TEXTURE_2 = new ResourceLocation(GreekFantasy.MODID, "textures/models/armor/hellenic_layer_2.png").toString(); private static final String TEXTURE_3 = new ResourceLocation(GreekFantasy.MODID, "textures/models/armor/hellenic_layer_3.png").toString(); @@ -32,7 +34,18 @@ public class HellenicArmorItem extends ArmorItem { private static final TagKey ACHILLES_ITEM = ForgeRegistries.ITEMS.tags().createTagKey(new ResourceLocation(GreekFantasy.MODID, "achilles_heel")); public HellenicArmorItem(final ArmorMaterial armorMaterial, EquipmentSlot slot, Properties properties) { - super(armorMaterial, slot, properties); + super(armorMaterial, typeFromSlot(slot), properties); + this.slot = slot; + } + + private static ArmorItem.Type typeFromSlot(EquipmentSlot slot) { + return switch (slot) { + case HEAD -> ArmorItem.Type.HELMET; + case CHEST -> ArmorItem.Type.CHESTPLATE; + case LEGS -> ArmorItem.Type.LEGGINGS; + case FEET -> ArmorItem.Type.BOOTS; + default -> throw new IllegalArgumentException("Invalid equipment slot: " + slot); + }; } /** diff --git a/src/main/java/greekfantasy/item/HelmOfDarknessItem.java b/src/main/java/greekfantasy/item/HelmOfDarknessItem.java index 5be8d8a3..b7e4adfe 100644 --- a/src/main/java/greekfantasy/item/HelmOfDarknessItem.java +++ b/src/main/java/greekfantasy/item/HelmOfDarknessItem.java @@ -23,7 +23,7 @@ public class HelmOfDarknessItem extends ArmorItem { private static final String TEXTURE = new ResourceLocation(GreekFantasy.MODID, "textures/models/armor/avernal_layer_1.png").toString(); public HelmOfDarknessItem(final ArmorMaterial armorMaterial, Properties builderIn) { - super(armorMaterial, EquipmentSlot.HEAD, builderIn); + super(armorMaterial, ArmorItem.Type.HELMET, builderIn); } @Override diff --git a/src/main/java/greekfantasy/item/HornOfPlentyItem.java b/src/main/java/greekfantasy/item/HornOfPlentyItem.java index c5560b84..796931fc 100644 --- a/src/main/java/greekfantasy/item/HornOfPlentyItem.java +++ b/src/main/java/greekfantasy/item/HornOfPlentyItem.java @@ -7,14 +7,13 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; -import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; @@ -25,7 +24,8 @@ public class HornOfPlentyItem extends HasCraftRemainderItem { - private static final ResourceLocation LOOT_TABLE_LOCATION = new ResourceLocation(GreekFantasy.MODID, "gameplay/horn_of_plenty"); + private static final ResourceLocation LOOT_TABLE_LOCATION = new ResourceLocation(GreekFantasy.MODID, + "gameplay/horn_of_plenty"); public HornOfPlentyItem(final Supplier craftRemainderSupplier, Properties properties) { super(craftRemainderSupplier, properties); @@ -34,7 +34,7 @@ public HornOfPlentyItem(final Supplier craftRemainderSupplier, Properties @Override public InteractionResultHolder use(final Level level, final Player player, final InteractionHand hand) { ItemStack itemStack = player.getItemInHand(hand); - if(level instanceof ServerLevel) { + if (level instanceof ServerLevel) { // create list of food items using loot table sampleLoot(player, itemStack).forEach(item -> { // spawn each food item at player location @@ -59,12 +59,12 @@ public void appendHoverText(ItemStack itemStack, @Nullable Level level, List sampleLoot(final Player player, final ItemStack itemStack) { - LootTable loottable = player.level.getServer().getLootTables().get(LOOT_TABLE_LOCATION); - return loottable.getRandomItems(new LootContext.Builder((ServerLevel) player.level) - .withRandom(player.level.random) + LootTable loottable = player.level().getServer().getLootData().getLootTable(LOOT_TABLE_LOCATION); + LootParams lootparams = new LootParams.Builder((ServerLevel) player.level()) .withParameter(LootContextParams.THIS_ENTITY, player) .withParameter(LootContextParams.ORIGIN, player.position()) .withParameter(LootContextParams.TOOL, itemStack) - .create(LootContextParamSets.GIFT)); + .create(LootContextParamSets.GIFT); + return loottable.getRandomItems(lootparams); } } diff --git a/src/main/java/greekfantasy/item/KnifeItem.java b/src/main/java/greekfantasy/item/KnifeItem.java index 4d58f048..749dbefc 100644 --- a/src/main/java/greekfantasy/item/KnifeItem.java +++ b/src/main/java/greekfantasy/item/KnifeItem.java @@ -42,7 +42,7 @@ public Multimap getAttributeModifiers(EquipmentSlo ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); builder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", this.getDamage(), AttributeModifier.Operation.ADDITION)); builder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", attackSpeed, AttributeModifier.Operation.ADDITION)); - builder.put(ForgeMod.ATTACK_RANGE.get(), new AttributeModifier(BASE_ATTACK_RANGE_UUID, "Weapon modifier", attackRange, AttributeModifier.Operation.ADDITION)); + builder.put(ForgeMod.ENTITY_REACH.get(), new AttributeModifier(BASE_ATTACK_RANGE_UUID, "Weapon modifier", attackRange, AttributeModifier.Operation.ADDITION)); this.defaultModifiers = builder.build(); } return slot == EquipmentSlot.MAINHAND ? this.defaultModifiers : super.getAttributeModifiers(slot, stack); diff --git a/src/main/java/greekfantasy/item/NemeanLionHideItem.java b/src/main/java/greekfantasy/item/NemeanLionHideItem.java index 717683ae..de475e41 100644 --- a/src/main/java/greekfantasy/item/NemeanLionHideItem.java +++ b/src/main/java/greekfantasy/item/NemeanLionHideItem.java @@ -22,7 +22,17 @@ public class NemeanLionHideItem extends ArmorItem { private static final String TEXTURE_1 = new ResourceLocation(GreekFantasy.MODID, "textures/models/armor/nemean_layer_1.png").toString(); public NemeanLionHideItem(final ArmorMaterial armorMaterial, final EquipmentSlot slot, Properties builderIn) { - super(armorMaterial, slot, builderIn); + super(armorMaterial, typeFromSlot(slot), builderIn); + } + + private static ArmorItem.Type typeFromSlot(EquipmentSlot slot) { + return switch (slot) { + case HEAD -> ArmorItem.Type.HELMET; + case CHEST -> ArmorItem.Type.CHESTPLATE; + case LEGS -> ArmorItem.Type.LEGGINGS; + case FEET -> ArmorItem.Type.BOOTS; + default -> throw new IllegalArgumentException("Invalid equipment slot: " + slot); + }; } public static boolean isImmune(final LivingEntity entity, final Projectile projectile, final double dotProduct) { diff --git a/src/main/java/greekfantasy/item/OrthusHeadItem.java b/src/main/java/greekfantasy/item/OrthusHeadItem.java index 4206af2c..f4417fcc 100644 --- a/src/main/java/greekfantasy/item/OrthusHeadItem.java +++ b/src/main/java/greekfantasy/item/OrthusHeadItem.java @@ -10,11 +10,11 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Wearable; +import net.minecraft.world.item.Equipable; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -public class OrthusHeadItem extends BlockItem implements Wearable { +public class OrthusHeadItem extends BlockItem implements Equipable { public OrthusHeadItem(Block block, Properties properties) { super(block, properties); @@ -25,6 +25,11 @@ public EquipmentSlot getEquipmentSlot(ItemStack stack) { return EquipmentSlot.HEAD; } + @Override + public EquipmentSlot getEquipmentSlot() { + return EquipmentSlot.HEAD; + } + @Override public InteractionResultHolder use(Level level, Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); diff --git a/src/main/java/greekfantasy/item/QuestItem.java b/src/main/java/greekfantasy/item/QuestItem.java index 31c9e1cf..b7b1b2e8 100644 --- a/src/main/java/greekfantasy/item/QuestItem.java +++ b/src/main/java/greekfantasy/item/QuestItem.java @@ -22,7 +22,6 @@ import java.util.Map; import java.util.Optional; - public class QuestItem extends Item { private static final String QUEST_NAME = "quest.name"; @@ -32,26 +31,8 @@ public QuestItem(Properties properties) { super(properties); } - @Override - public void fillItemCategory(CreativeModeTab group, NonNullList list) { - if (this.allowedIn(group)) { - List questIds = new ArrayList<>(); - // add each non-disabled quest to the list - for(Map.Entry entry : GreekFantasy.QUEST_MAP.entrySet()) { - if(!entry.getValue().isDisabled()) { - questIds.add(entry.getKey()); - } - } - // sort by namespace and path - questIds.sort(ResourceLocation::compareNamespaced); - // add itemstack for each quest - for(ResourceLocation questId : questIds) { - ItemStack itemStack = new ItemStack(this); - itemStack.getOrCreateTag().putString(KEY_QUEST, questId.toString()); - list.add(itemStack); - } - } - } + // In 1.20.1, fillItemCategory/allowedIn has been removed. + // Creative tab items should be added via BuildCreativeModeTabContentsEvent @Override public InteractionResultHolder use(Level worldIn, Player playerIn, InteractionHand handIn) { @@ -59,16 +40,17 @@ public InteractionResultHolder use(Level worldIn, Player playerIn, In // open GUI playerIn.startUsingItem(handIn); if (worldIn.isClientSide()) { - greekfantasy.client.screen.ScreenLoader.openQuestScreen(playerIn, playerIn.getInventory().selected, itemstack); + greekfantasy.client.screen.ScreenLoader.openQuestScreen(playerIn, playerIn.getInventory().selected, + itemstack); } return InteractionResultHolder.consume(itemstack); } @Override public String getDescriptionId(ItemStack itemStack) { - if(itemStack.hasTag() && itemStack.getTag().contains(KEY_QUEST)) { + if (itemStack.hasTag() && itemStack.getTag().contains(KEY_QUEST)) { ResourceLocation questId = ResourceLocation.tryParse(itemStack.getTag().getString(KEY_QUEST)); - if(questId != null) { + if (questId != null) { return Quest.getDescriptionFromKey(questId); } } diff --git a/src/main/java/greekfantasy/item/SnakeskinArmorItem.java b/src/main/java/greekfantasy/item/SnakeskinArmorItem.java index 9572d756..31a779f2 100644 --- a/src/main/java/greekfantasy/item/SnakeskinArmorItem.java +++ b/src/main/java/greekfantasy/item/SnakeskinArmorItem.java @@ -22,19 +22,17 @@ public class SnakeskinArmorItem extends ArmorItem { public SnakeskinArmorItem(final ArmorMaterial armorMaterial, final EquipmentSlot slot, Properties builderIn) { - super(armorMaterial, slot, builderIn); + super(armorMaterial, typeFromSlot(slot), builderIn); } - @Override - public void fillItemCategory(CreativeModeTab group, NonNullList items) { - // add the item to the group with enchantment already applied - if (this.allowedIn(group)) { - final ItemStack stack = new ItemStack(this); - if (GreekFantasy.CONFIG.isPoisoningEnabled()) { - stack.enchant(GFRegistry.EnchantmentReg.POISONING.get(), 1); - } - items.add(stack); - } + private static ArmorItem.Type typeFromSlot(EquipmentSlot slot) { + return switch (slot) { + case HEAD -> ArmorItem.Type.HELMET; + case CHEST -> ArmorItem.Type.CHESTPLATE; + case LEGS -> ArmorItem.Type.LEGGINGS; + case FEET -> ArmorItem.Type.BOOTS; + default -> throw new IllegalArgumentException("Invalid equipment slot: " + slot); + }; } @Override diff --git a/src/main/java/greekfantasy/item/SpearItem.java b/src/main/java/greekfantasy/item/SpearItem.java index 9a7dbe4f..eb2f65e9 100644 --- a/src/main/java/greekfantasy/item/SpearItem.java +++ b/src/main/java/greekfantasy/item/SpearItem.java @@ -1,4 +1,5 @@ package greekfantasy.item; +import net.minecraft.core.registries.Registries; import com.google.common.collect.ImmutableMultimap; import greekfantasy.entity.misc.Spear; @@ -157,7 +158,7 @@ public Multimap getAttributeModifiers(EquipmentSlo ImmutableMultimap.Builder mapBuilder = ImmutableMultimap.builder(); mapBuilder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Tool modifier", 5.0D + getTier().getAttackDamageBonus(), AttributeModifier.Operation.ADDITION)); mapBuilder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Tool modifier", -2.9D, AttributeModifier.Operation.ADDITION)); - mapBuilder.put(ForgeMod.ATTACK_RANGE.get(), new AttributeModifier(BASE_ATTACK_RANGE_UUID, "Weapon modifier", attackRange, AttributeModifier.Operation.ADDITION)); + mapBuilder.put(ForgeMod.ENTITY_REACH.get(), new AttributeModifier(BASE_ATTACK_RANGE_UUID, "Weapon modifier", attackRange, AttributeModifier.Operation.ADDITION)); this.spearAttributes = mapBuilder.build(); } return slot == EquipmentSlot.MAINHAND ? this.spearAttributes : super.getAttributeModifiers(slot, stack); @@ -181,7 +182,7 @@ public void appendHoverText(ItemStack stack, Level worldIn, List tool if(potion != null) { int level = 1 + nbt.getInt("Amplifier"); tooltip.add(Component.translatable(potion.getDescriptionId()).append(" ") - .append(Component.translatable("enchantment.level." + level)) + .append(Component.translatable("enchantment.level()." + level)) .withStyle(ChatFormatting.GREEN)); } } diff --git a/src/main/java/greekfantasy/item/ThunderboltItem.java b/src/main/java/greekfantasy/item/ThunderboltItem.java index ec29152d..8089b64f 100644 --- a/src/main/java/greekfantasy/item/ThunderboltItem.java +++ b/src/main/java/greekfantasy/item/ThunderboltItem.java @@ -57,7 +57,7 @@ public InteractionResultHolder use(final Level level, final Player pl // if enchanted with fireflash, cause an explosion if (fireflash) { damageAmount = GreekFantasy.CONFIG.THUNDERBOLT_DURABILITY_ON_FIREFLASH.get(); - final Explosion.BlockInteraction mode = GreekFantasy.CONFIG.FIREFLASH_DESTROYS_BLOCKS.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.NONE; + final Level.ExplosionInteraction mode = GreekFantasy.CONFIG.FIREFLASH_DESTROYS_BLOCKS.get() ? Level.ExplosionInteraction.MOB : Level.ExplosionInteraction.NONE; level.explode(player, raytrace.getLocation().x(), raytrace.getLocation().y(), raytrace.getLocation().z(), fireflashLevel * 1.64F, true, mode); } // cooldown and item damage @@ -94,6 +94,6 @@ public static BlockHitResult raytraceFromEntity(final LivingEntity player, final float cosPitch = -Mth.cos(pitch); float sinPitch = Mth.sin(pitch); final Vec3 endVec = startVec.add(sinYaw * cosPitch * range, sinPitch * range, cosYaw * cosPitch * range); - return player.level.clip(new ClipContext(startVec, endVec, ClipContext.Block.OUTLINE, fluidMode, player)); + return player.level().clip(new ClipContext(startVec, endVec, ClipContext.Block.OUTLINE, fluidMode, player)); } } diff --git a/src/main/java/greekfantasy/item/WingedSandalsItem.java b/src/main/java/greekfantasy/item/WingedSandalsItem.java index ddba8928..2c8f7e8d 100644 --- a/src/main/java/greekfantasy/item/WingedSandalsItem.java +++ b/src/main/java/greekfantasy/item/WingedSandalsItem.java @@ -39,7 +39,7 @@ public class WingedSandalsItem extends ArmorItem { protected Multimap attributeModifiers; public WingedSandalsItem(final ArmorMaterial armorMaterial, Properties builderIn) { - super(armorMaterial, EquipmentSlot.FEET, builderIn); + super(armorMaterial, ArmorItem.Type.BOOTS, builderIn); final double speedBonus = 1.5F; final double stepHeightBonus = 0.62F; ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); @@ -66,18 +66,6 @@ public void inventoryTick(final ItemStack stack, final Level level, final Entity } } - @Override - public void fillItemCategory(CreativeModeTab group, NonNullList items) { - // add the item to the group with enchantment already applied - if (this.allowedIn(group)) { - final ItemStack stack = new ItemStack(this); - if (GreekFantasy.CONFIG.isOverstepEnabled()) { - stack.enchant(GFRegistry.EnchantmentReg.OVERSTEP.get(), 1); - } - items.add(stack); - } - } - @Override public void onCraftedBy(ItemStack stack, Level level, Player player) { // add Overstep enchantment if not present @@ -111,7 +99,7 @@ public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List { // locate the server-side entity and play the sound at its location ServerPlayer player = context.getSender(); - ServerLevel level = player.getLevel(); + ServerLevel level = player.serverLevel(); Entity entity = level.getEntity(message.entity); if(null == entity) { entity = player; diff --git a/src/main/java/greekfantasy/network/SQuestPacket.java b/src/main/java/greekfantasy/network/SQuestPacket.java index 95d3171c..826785a5 100644 --- a/src/main/java/greekfantasy/network/SQuestPacket.java +++ b/src/main/java/greekfantasy/network/SQuestPacket.java @@ -3,6 +3,7 @@ import com.mojang.serialization.Codec; import greekfantasy.GreekFantasy; import greekfantasy.util.Quest; +import net.minecraft.nbt.NbtOps; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; @@ -43,7 +44,7 @@ public SQuestPacket(final Map data) { * @return a new instance of a SQuestPacket based on the PacketBuffer */ public static SQuestPacket fromBytes(final FriendlyByteBuf buf) { - final Map data = buf.readWithCodec(CODEC); + final Map data = buf.readWithCodec(NbtOps.INSTANCE, CODEC); return new SQuestPacket(data); } @@ -54,7 +55,7 @@ public static SQuestPacket fromBytes(final FriendlyByteBuf buf) { * @param buf the PacketBuffer */ public static void toBytes(final SQuestPacket msg, final FriendlyByteBuf buf) { - buf.writeWithCodec(CODEC, msg.data); + buf.writeWithCodec(NbtOps.INSTANCE, CODEC, msg.data); } /** diff --git a/src/main/java/greekfantasy/network/SSongPacket.java b/src/main/java/greekfantasy/network/SSongPacket.java index d3d49723..a6e88013 100644 --- a/src/main/java/greekfantasy/network/SSongPacket.java +++ b/src/main/java/greekfantasy/network/SSongPacket.java @@ -3,6 +3,7 @@ import com.mojang.serialization.Codec; import greekfantasy.GreekFantasy; import greekfantasy.util.Song; +import net.minecraft.nbt.NbtOps; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; @@ -43,7 +44,7 @@ public SSongPacket(final Map data) { * @return a new instance of a SSongPacket based on the PacketBuffer */ public static SSongPacket fromBytes(final FriendlyByteBuf buf) { - final Map data = buf.readWithCodec(CODEC); + final Map data = buf.readWithCodec(NbtOps.INSTANCE, CODEC); return new SSongPacket(data); } @@ -54,7 +55,7 @@ public static SSongPacket fromBytes(final FriendlyByteBuf buf) { * @param buf the PacketBuffer */ public static void toBytes(final SSongPacket msg, final FriendlyByteBuf buf) { - buf.writeWithCodec(CODEC, msg.data); + buf.writeWithCodec(NbtOps.INSTANCE, CODEC, msg.data); } /** diff --git a/src/main/java/greekfantasy/util/AddSpawnsStructureModifier.java b/src/main/java/greekfantasy/util/AddSpawnsStructureModifier.java index fb7f9bd2..cabc3642 100644 --- a/src/main/java/greekfantasy/util/AddSpawnsStructureModifier.java +++ b/src/main/java/greekfantasy/util/AddSpawnsStructureModifier.java @@ -1,4 +1,5 @@ package greekfantasy.util; +import net.minecraft.core.registries.Registries; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -16,7 +17,7 @@ public class AddSpawnsStructureModifier implements StructureModifier { public static final Codec CODEC = RecordCodecBuilder.create(builder -> builder.group( - RegistryCodecs.homogeneousList(Registry.STRUCTURE_REGISTRY, Structure.DIRECT_CODEC).fieldOf("structures").forGetter(AddSpawnsStructureModifier::getStructures), + RegistryCodecs.homogeneousList(Registries.STRUCTURE, Structure.DIRECT_CODEC).fieldOf("structures").forGetter(AddSpawnsStructureModifier::getStructures), MobCategory.CODEC.fieldOf("category").forGetter(AddSpawnsStructureModifier::getCategory), MobSpawnSettings.SpawnerData.CODEC.fieldOf("spawn").forGetter(AddSpawnsStructureModifier::getSpawn) ).apply(builder, AddSpawnsStructureModifier::new)); diff --git a/src/main/java/greekfantasy/util/BronzeScrapLootModifier.java b/src/main/java/greekfantasy/util/BronzeScrapLootModifier.java index 8380b04d..53692abd 100644 --- a/src/main/java/greekfantasy/util/BronzeScrapLootModifier.java +++ b/src/main/java/greekfantasy/util/BronzeScrapLootModifier.java @@ -1,4 +1,5 @@ package greekfantasy.util; +import net.minecraft.core.registries.Registries; import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; @@ -29,7 +30,7 @@ public class BronzeScrapLootModifier extends LootModifier { public static final Supplier> CODEC_SUPPLIER = Suppliers.memoize(() -> RecordCodecBuilder.create(inst -> codecStart(inst) .and(Codec.STRING.listOf().fieldOf("paths").forGetter(BronzeScrapLootModifier::getPaths)) - .and(TagKey.codec(Registry.ITEM_REGISTRY).fieldOf("item_tag").forGetter(BronzeScrapLootModifier::getItemTag)) + .and(TagKey.codec(Registries.ITEM).fieldOf("item_tag").forGetter(BronzeScrapLootModifier::getItemTag)) .and(IntProvider.CODEC.fieldOf("count").forGetter(BronzeScrapLootModifier::getCount)) .apply(inst, BronzeScrapLootModifier::new))); diff --git a/src/main/java/greekfantasy/util/SalveRecipe.java b/src/main/java/greekfantasy/util/SalveRecipe.java index 794d27d7..72dda1b1 100644 --- a/src/main/java/greekfantasy/util/SalveRecipe.java +++ b/src/main/java/greekfantasy/util/SalveRecipe.java @@ -13,6 +13,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingBookCategory; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapelessRecipe; @@ -30,7 +31,7 @@ public class SalveRecipe extends ShapelessRecipe { public SalveRecipe(ResourceLocation idIn, WeightedMobEffectInstance useEffect, List bonusEffects, int rolls, NonNullList recipeItemsIn) { - super(idIn, Serializer.CATEGORY, createSalve(useEffect, bonusEffects, rolls), recipeItemsIn); + super(idIn, "", CraftingBookCategory.MISC, createSalve(useEffect, bonusEffects, rolls), recipeItemsIn); this.useEffect = useEffect; this.bonusEffects = bonusEffects; this.bonusEffectCount = this.bonusEffects.size(); @@ -55,8 +56,8 @@ private static ItemStack createSalve(final WeightedMobEffectInstance useEffect, } @Override - public ItemStack assemble(CraftingContainer inv) { - final ItemStack result = super.assemble(inv); + public ItemStack assemble(CraftingContainer inv, net.minecraft.core.RegistryAccess registryAccess) { + final ItemStack result = super.assemble(inv, registryAccess); return result; } diff --git a/src/main/java/greekfantasy/util/SummonBossUtil.java b/src/main/java/greekfantasy/util/SummonBossUtil.java index 2d313317..5c4a5c50 100644 --- a/src/main/java/greekfantasy/util/SummonBossUtil.java +++ b/src/main/java/greekfantasy/util/SummonBossUtil.java @@ -1,4 +1,5 @@ package greekfantasy.util; +import net.minecraft.core.registries.Registries; import greekfantasy.GFRegistry; import greekfantasy.GreekFantasy; @@ -18,9 +19,9 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.block.state.pattern.BlockPattern; import net.minecraft.world.level.block.state.pattern.BlockPatternBuilder; -import net.minecraft.world.level.block.state.predicate.BlockMaterialPredicate; + import net.minecraft.world.level.block.state.predicate.BlockStatePredicate; -import net.minecraft.world.level.material.Material; + import net.minecraft.world.phys.Vec3; import net.minecraftforge.registries.ForgeRegistries; @@ -40,7 +41,7 @@ public final class SummonBossUtil { .aisle("~^~", "###", "###") .where('^', BlockInWorld.hasState(state -> state.is(BRONZE_BLOCK))) .where('#', BlockInWorld.hasState(state -> state.is(COPPER_BLOCK))) - .where('~', BlockInWorld.hasState(BlockMaterialPredicate.forMaterial(Material.AIR))).build(); + .where('~', BlockInWorld.hasState(BlockStatePredicate.forBlock(Blocks.AIR).or(BlockStatePredicate.forBlock(Blocks.CAVE_AIR)).or(BlockStatePredicate.forBlock(Blocks.VOID_AIR)))).build(); /** * BlockPattern for Bronze Bull boss @@ -50,7 +51,7 @@ public final class SummonBossUtil { .aisle("~##~", "~##~") .where('^', BlockInWorld.hasState(state -> state.is(BRONZE_BLOCK))) .where('#', BlockInWorld.hasState(state -> state.is(COPPER_BLOCK))) - .where('~', BlockInWorld.hasState(BlockMaterialPredicate.forMaterial(Material.AIR))).build(); + .where('~', BlockInWorld.hasState(BlockStatePredicate.forBlock(Blocks.AIR).or(BlockStatePredicate.forBlock(Blocks.CAVE_AIR)).or(BlockStatePredicate.forBlock(Blocks.VOID_AIR)))).build(); /** * BlockPattern for Cerberus boss @@ -62,7 +63,7 @@ public final class SummonBossUtil { .aisle("~##~", "~~~~", "~~~~") .where('#', BlockInWorld.hasState(state -> state.is(CERBERUS_FRAME))) .where('^', BlockInWorld.hasState(state -> state.is(Blocks.LAVA))) - .where('O', BlockInWorld.hasState(BlockMaterialPredicate.forMaterial(Material.AIR))) + .where('O', BlockInWorld.hasState(BlockStatePredicate.forBlock(Blocks.AIR).or(BlockStatePredicate.forBlock(Blocks.CAVE_AIR)).or(BlockStatePredicate.forBlock(Blocks.VOID_AIR)))) .where('~', BlockInWorld.hasState(state -> true)).build(); /** diff --git a/src/main/java/greekfantasy/util/WeightedMobEffectInstance.java b/src/main/java/greekfantasy/util/WeightedMobEffectInstance.java index 6272a5f2..94b8011a 100644 --- a/src/main/java/greekfantasy/util/WeightedMobEffectInstance.java +++ b/src/main/java/greekfantasy/util/WeightedMobEffectInstance.java @@ -1,4 +1,5 @@ package greekfantasy.util; +import net.minecraft.core.registries.Registries; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; diff --git a/src/main/java/greekfantasy/worldgen/GoldenTreeGrower.java b/src/main/java/greekfantasy/worldgen/GoldenTreeGrower.java index c7800342..2a920749 100644 --- a/src/main/java/greekfantasy/worldgen/GoldenTreeGrower.java +++ b/src/main/java/greekfantasy/worldgen/GoldenTreeGrower.java @@ -1,26 +1,20 @@ package greekfantasy.worldgen; +import net.minecraft.core.registries.Registries; import greekfantasy.GreekFantasy; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.data.BuiltinRegistries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.grower.AbstractTreeGrower; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraftforge.server.ServerLifecycleHooks; public class GoldenTreeGrower extends AbstractTreeGrower { - private static final ResourceLocation FEATURE_ID = new ResourceLocation(GreekFantasy.MODID, "golden_tree"); + private static final ResourceKey> FEATURE_KEY = + ResourceKey.create(Registries.CONFIGURED_FEATURE, new ResourceLocation(GreekFantasy.MODID, "golden_tree")); @Override - protected Holder> getConfiguredFeature(RandomSource random, boolean hasFlowers) { - ConfiguredFeature cf = ServerLifecycleHooks.getCurrentServer().registryAccess().registryOrThrow(Registry.CONFIGURED_FEATURE_REGISTRY).get(FEATURE_ID); - if (null == cf) { - throw new IllegalArgumentException("Failed to create holder for unknown configured feature '" + FEATURE_ID + "'"); - } - return Holder.direct(cf); + protected ResourceKey> getConfiguredFeature(RandomSource random, boolean hasFlowers) { + return FEATURE_KEY; } } \ No newline at end of file diff --git a/src/main/java/greekfantasy/worldgen/HarpyNestFeature.java b/src/main/java/greekfantasy/worldgen/HarpyNestFeature.java index bb1e2a03..4335ab1a 100644 --- a/src/main/java/greekfantasy/worldgen/HarpyNestFeature.java +++ b/src/main/java/greekfantasy/worldgen/HarpyNestFeature.java @@ -1,5 +1,8 @@ package greekfantasy.worldgen; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.material.Fluids; + import com.mojang.serialization.Codec; import greekfantasy.GFRegistry; import greekfantasy.entity.monster.Harpy; @@ -15,9 +18,6 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; -import net.minecraft.world.level.material.Material; - -import java.util.Random; public class HarpyNestFeature extends Feature { @@ -55,8 +55,10 @@ public boolean buildTallVariant(final FeaturePlaceContext con // prepare to place branch pos.setWithOffset(context.origin(), 0, dHeight, 0); // place branch - level.setBlock(rot(pos.move(Direction.UP, 4), 0, 1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); - level.setBlock(rot(pos.move(Direction.UP, 1), 0, 1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); + level.setBlock(rot(pos.move(Direction.UP, 4), 0, 1, rotation), config.trunkProvider.getState(rand, pos), + Block.UPDATE_CLIENTS); + level.setBlock(rot(pos.move(Direction.UP, 1), 0, 1, rotation), config.trunkProvider.getState(rand, pos), + Block.UPDATE_CLIENTS); level.setBlock(rot(pos, 0, 1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); // prepare to place canopy pos.setWithOffset(context.origin(), 0, 3 + dHeight, 0); @@ -73,7 +75,7 @@ public boolean buildTallVariant(final FeaturePlaceContext con generateLeavesAround(level, rand, pos.move(Direction.UP), config.foliageProvider, 2); generateLeavesAround(level, rand, pos.move(Direction.UP), config.foliageProvider, 2); generateLeavesAround(level, rand, pos.move(Direction.UP), config.foliageProvider, 1); - if(rand.nextBoolean()) { + if (rand.nextBoolean()) { level.setBlock(pos.move(Direction.UP), config.foliageProvider.getState(rand, pos), Block.UPDATE_CLIENTS); } // nest @@ -103,17 +105,21 @@ public boolean buildShortVariant(final FeaturePlaceContext co // -z branch pos.setWithOffset(context.origin(), 0, 4 + dHeight, 0); level.setBlock(rot(pos, 0, -1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); - level.setBlock(rot(pos.move(Direction.UP), 0, -1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); + level.setBlock(rot(pos.move(Direction.UP), 0, -1, rotation), config.trunkProvider.getState(rand, pos), + Block.UPDATE_CLIENTS); // +z branch pos.setWithOffset(context.origin(), 0, 4 + dHeight, 0); level.setBlock(rot(pos, 0, 1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); - level.setBlock(rot(pos.move(Direction.UP), 0, 1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); + level.setBlock(rot(pos.move(Direction.UP), 0, 1, rotation), config.trunkProvider.getState(rand, pos), + Block.UPDATE_CLIENTS); // -x branch pos.setWithOffset(context.origin(), 0, 4 + dHeight, 0); level.setBlock(rot(pos, -1, 0, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); - level.setBlock(rot(pos.move(Direction.UP), -1, 0, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); + level.setBlock(rot(pos.move(Direction.UP), -1, 0, rotation), config.trunkProvider.getState(rand, pos), + Block.UPDATE_CLIENTS); level.setBlock(rot(pos, 0, -1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); - level.setBlock(rot(pos.move(Direction.UP), -1, 1, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); + level.setBlock(rot(pos.move(Direction.UP), -1, 1, rotation), config.trunkProvider.getState(rand, pos), + Block.UPDATE_CLIENTS); // +x branch pos.setWithOffset(context.origin(), 0, 5 + dHeight, 0); level.setBlock(rot(pos, 1, 0, rotation), config.trunkProvider.getState(rand, pos), Block.UPDATE_CLIENTS); @@ -171,15 +177,16 @@ public boolean buildShortVariant(final FeaturePlaceContext co * @return the mutable block pos */ protected static BlockPos rot(final BlockPos.MutableBlockPos origin, final int x, final int z, final Rotation rot) { - return origin.move(new BlockPos(x, 0, z).rotate(rot)); + return origin.move(BlockPos.containing(x, 0, z).rotate(rot)); } protected static boolean isReplaceableAt(LevelAccessor level, BlockPos pos) { return level.isStateAtPosition(pos, state -> (state.isAir() - || state.getMaterial().isReplaceable() || state.getMaterial() == Material.LEAVES)); + || state.canBeReplaced(Fluids.EMPTY) || state.is(BlockTags.LEAVES))); } - protected static void generateLeavesAround(LevelAccessor level, RandomSource rand, BlockPos pos, BlockStateProvider leaf, int radius) { + protected static void generateLeavesAround(LevelAccessor level, RandomSource rand, BlockPos pos, + BlockStateProvider leaf, int radius) { BlockPos.MutableBlockPos p = pos.mutable(); for (int x = -radius; x <= radius; x++) { for (int z = -radius; z <= radius; z++) { diff --git a/src/main/java/greekfantasy/worldgen/LocStructureProcessor.java b/src/main/java/greekfantasy/worldgen/LocStructureProcessor.java index b5f406ed..21a82c91 100644 --- a/src/main/java/greekfantasy/worldgen/LocStructureProcessor.java +++ b/src/main/java/greekfantasy/worldgen/LocStructureProcessor.java @@ -36,8 +36,8 @@ public RuleTest getLocPredicate() { @Nullable @Override public StructureTemplate.StructureBlockInfo process(LevelReader level, BlockPos rawPos, BlockPos pos, StructureTemplate.StructureBlockInfo rawBlockInfo, StructureTemplate.StructureBlockInfo blockInfo, StructurePlaceSettings placementSettings, @Nullable StructureTemplate template) { - RandomSource random = placementSettings.getRandom(blockInfo.pos); - BlockState blockState = level.getBlockState(blockInfo.pos); + RandomSource random = placementSettings.getRandom(blockInfo.pos()); + BlockState blockState = level.getBlockState(blockInfo.pos()); // only process the block if the existing block at this location passes the rule test if (locPredicate.test(blockState, random)) { return blockInfo; diff --git a/src/main/java/greekfantasy/worldgen/OceanVillageStructure.java b/src/main/java/greekfantasy/worldgen/OceanVillageStructure.java index 9b637668..aff8d5de 100644 --- a/src/main/java/greekfantasy/worldgen/OceanVillageStructure.java +++ b/src/main/java/greekfantasy/worldgen/OceanVillageStructure.java @@ -56,7 +56,7 @@ public Optional findGenerationPoint(Structure.GenerationContext ChunkPos chunkpos = context.chunkPos(); int i = this.startHeight.sample(context.random(), new WorldGenerationContext(context.chunkGenerator(), context.heightAccessor())); - BlockPos blockpos = new BlockPos(chunkpos.getMinBlockX(), i, chunkpos.getMinBlockZ()); + BlockPos blockpos = BlockPos.containing(chunkpos.getMinBlockX(), i, chunkpos.getMinBlockZ()); if (!isBelowSeaLevel(context, blockpos, this.minDistanceBelowSeaLevel)) { return Optional.empty(); diff --git a/src/main/java/greekfantasy/worldgen/OceanVillageStructureProcessor.java b/src/main/java/greekfantasy/worldgen/OceanVillageStructureProcessor.java index 8fda720c..0b0e1ec2 100644 --- a/src/main/java/greekfantasy/worldgen/OceanVillageStructureProcessor.java +++ b/src/main/java/greekfantasy/worldgen/OceanVillageStructureProcessor.java @@ -48,16 +48,16 @@ protected StructureProcessorType getType() { @Override public StructureTemplate.StructureBlockInfo process(LevelReader level, BlockPos rawPos, BlockPos pos, StructureTemplate.StructureBlockInfo rawBlockInfo, StructureTemplate.StructureBlockInfo blockInfo, StructurePlaceSettings placementSettings, @Nullable StructureTemplate template) { // determine if the block is coral - if (CORAL_LIST.containsKey(blockInfo.state.getBlock())) { + if (CORAL_LIST.containsKey(blockInfo.state().getBlock())) { final long seed = placementSettings.getBoundingBox().hashCode(); RandomSource random = RandomSource.create(seed); random.nextInt(); // determine random index int index = random.nextInt(coralListSize); // determine blockstate - Block mappedBlock = CORAL_LIST.get(blockInfo.state.getBlock()).get(index); - BlockState replaced = copyMatchingProperties(blockInfo.state, mappedBlock.defaultBlockState()); - return new StructureTemplate.StructureBlockInfo(blockInfo.pos, replaced, blockInfo.nbt); + Block mappedBlock = CORAL_LIST.get(blockInfo.state().getBlock()).get(index); + BlockState replaced = copyMatchingProperties(blockInfo.state(), mappedBlock.defaultBlockState()); + return new StructureTemplate.StructureBlockInfo(blockInfo.pos(), replaced, blockInfo.nbt()); } return blockInfo; } diff --git a/src/main/java/greekfantasy/worldgen/OliveTreeFeature.java b/src/main/java/greekfantasy/worldgen/OliveTreeFeature.java index f49dc958..56020142 100644 --- a/src/main/java/greekfantasy/worldgen/OliveTreeFeature.java +++ b/src/main/java/greekfantasy/worldgen/OliveTreeFeature.java @@ -40,7 +40,7 @@ public boolean place(FeaturePlaceContext context) { final StructureTemplate template = manager.getOrCreate(Util.getRandom(OLIVE_TREES, context.random())); // position for tree - final BlockPos offset = new BlockPos(-3, 0, -3); + final BlockPos offset = BlockPos.containing(-3, 0, -3); BlockPos pos = context.origin().offset(offset.rotate(rotation)); // placement settings diff --git a/src/main/java/greekfantasy/worldgen/OliveTreeGrower.java b/src/main/java/greekfantasy/worldgen/OliveTreeGrower.java index c155ef9f..08ba95ca 100644 --- a/src/main/java/greekfantasy/worldgen/OliveTreeGrower.java +++ b/src/main/java/greekfantasy/worldgen/OliveTreeGrower.java @@ -1,24 +1,20 @@ package greekfantasy.worldgen; import greekfantasy.GreekFantasy; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.grower.AbstractTreeGrower; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraftforge.server.ServerLifecycleHooks; public class OliveTreeGrower extends AbstractTreeGrower { - private static final ResourceLocation FEATURE_ID = new ResourceLocation(GreekFantasy.MODID, "olive_tree"); + private static final ResourceKey> FEATURE_KEY = + ResourceKey.create(Registries.CONFIGURED_FEATURE, new ResourceLocation(GreekFantasy.MODID, "olive_tree")); @Override - protected Holder> getConfiguredFeature(RandomSource random, boolean hasFlowers) { - ConfiguredFeature cf = ServerLifecycleHooks.getCurrentServer().registryAccess().registryOrThrow(Registry.CONFIGURED_FEATURE_REGISTRY).get(FEATURE_ID); - if (null == cf) { - throw new IllegalArgumentException("Failed to create holder for unknown configured feature '" + FEATURE_ID + "'"); - } - return Holder.direct(cf); + protected ResourceKey> getConfiguredFeature(RandomSource random, boolean hasFlowers) { + return FEATURE_KEY; } } \ No newline at end of file diff --git a/src/main/java/greekfantasy/worldgen/PomegranateTreeGrower.java b/src/main/java/greekfantasy/worldgen/PomegranateTreeGrower.java index 49053283..1cdc7798 100644 --- a/src/main/java/greekfantasy/worldgen/PomegranateTreeGrower.java +++ b/src/main/java/greekfantasy/worldgen/PomegranateTreeGrower.java @@ -1,24 +1,20 @@ package greekfantasy.worldgen; import greekfantasy.GreekFantasy; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.grower.AbstractTreeGrower; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraftforge.server.ServerLifecycleHooks; public class PomegranateTreeGrower extends AbstractTreeGrower { - private static final ResourceLocation FEATURE_ID = new ResourceLocation(GreekFantasy.MODID, "pomegranate_tree"); + private static final ResourceKey> FEATURE_KEY = + ResourceKey.create(Registries.CONFIGURED_FEATURE, new ResourceLocation(GreekFantasy.MODID, "pomegranate_tree")); @Override - protected Holder> getConfiguredFeature(RandomSource random, boolean hasFlowers) { - ConfiguredFeature cf = ServerLifecycleHooks.getCurrentServer().registryAccess().registryOrThrow(Registry.CONFIGURED_FEATURE_REGISTRY).get(FEATURE_ID); - if (null == cf) { - throw new IllegalArgumentException("Failed to create holder for unknown configured feature '" + FEATURE_ID + "'"); - } - return Holder.direct(cf); + protected ResourceKey> getConfiguredFeature(RandomSource random, boolean hasFlowers) { + return FEATURE_KEY; } } \ No newline at end of file diff --git a/src/main/java/greekfantasy/worldgen/maze/MazePiece.java b/src/main/java/greekfantasy/worldgen/maze/MazePiece.java index 43a4c82e..a436ef9d 100644 --- a/src/main/java/greekfantasy/worldgen/maze/MazePiece.java +++ b/src/main/java/greekfantasy/worldgen/maze/MazePiece.java @@ -54,23 +54,23 @@ public class MazePiece extends StructurePiece { public static final int HEIGHT = 7; /** - * This structure processor replaces some cretan stone brick and polished cretan stone brick with their cracked counterparts. + * This structure processor replaces some cretan stone brick and polished cretan + * stone brick with their cracked counterparts. */ public static final StructureProcessor AGE_PROCESSOR = new RuleProcessor(List.of( new ProcessorRule(new RandomBlockMatchTest(GFRegistry.BlockReg.CRETAN_STONE_BRICK.get(), 0.44F), AlwaysTrueTest.INSTANCE, - GFRegistry.BlockReg.CRACKED_CRETAN_STONE_BRICK.get().defaultBlockState() - ), + GFRegistry.BlockReg.CRACKED_CRETAN_STONE_BRICK.get().defaultBlockState()), new ProcessorRule(new RandomBlockMatchTest(GFRegistry.BlockReg.POLISHED_CRETAN_STONE.get(), 0.38F), AlwaysTrueTest.INSTANCE, - GFRegistry.BlockReg.CRACKED_POLISHED_CRETAN_STONE.get().defaultBlockState() - ) - )); + GFRegistry.BlockReg.CRACKED_POLISHED_CRETAN_STONE.get().defaultBlockState()))); /** - * This structure processor prevents replacement of blocks in the FEATURES_CANNOT_REPLACE block tag. + * This structure processor prevents replacement of blocks in the + * FEATURES_CANNOT_REPLACE block tag. */ - public static final StructureProcessor PROTECTED_PROCESSOR = new ProtectedBlockProcessor(BlockTags.FEATURES_CANNOT_REPLACE); + public static final StructureProcessor PROTECTED_PROCESSOR = new ProtectedBlockProcessor( + BlockTags.FEATURES_CANNOT_REPLACE); /** * Contains the Variant and Direction for each configuration of openings. @@ -100,14 +100,16 @@ public class MazePiece extends StructurePiece { /** * Adds an entry to the openings map - * @param north true if there is an opening on the north - * @param east true if there is an opening on the east - * @param south true if there is an opening on the south - * @param west true if there is an opening on the west - * @param variant the variant for this configuration of openings + * + * @param north true if there is an opening on the north + * @param east true if there is an opening on the east + * @param south true if there is an opening on the south + * @param west true if there is an opening on the west + * @param variant the variant for this configuration of openings * @param direction the direction for this configuration of openings */ - private static void add(boolean north, boolean east, boolean south, boolean west, Variant variant, Direction direction) { + private static void add(boolean north, boolean east, boolean south, boolean west, Variant variant, + Direction direction) { Vector4i vec = new Vector4i(north, east, south, west); openingsMap.put(vec, ImmutablePair.of(variant, direction)); } @@ -117,13 +119,15 @@ private static void add(boolean north, boolean east, boolean south, boolean west private ResourceLocation template; /** - * @param openings the north, east, south, and west openings of the piece, in that order - * @param variant the piece variant - * @param direction the piece orientation - * @param depth the structure depth (not used) + * @param openings the north, east, south, and west openings of the piece, in + * that order + * @param variant the piece variant + * @param direction the piece orientation + * @param depth the structure depth (not used) * @param boundingBox the piece bounding box */ - public MazePiece(Vector4i openings, Variant variant, Direction direction, int depth, BoundingBox boundingBox) { + public MazePiece(Vector4i openings, Variant variant, Direction direction, int depth, + BoundingBox boundingBox) { super(GFRegistry.StructureReg.MAZE_ROOM.get(), depth, boundingBox); this.openings = openings; this.variant = variant; @@ -132,6 +136,7 @@ public MazePiece(Vector4i openings, Variant variant, Direction directio /** * Reads the piece from NBT + * * @param tag the compound tag */ public MazePiece(CompoundTag tag) { @@ -152,10 +157,12 @@ public MazePiece(CompoundTag tag) { /** * Creates a MazePiece with the given origin and indices + * * @param origin the origin block position - * @param x the x index, usually positive. Used to calculate bounding box. - * @param z the z index, usually positive. Used to calculate bounding box. - * @return the constructed MazePiece with no openings, variant of NONE, and facing north + * @param x the x index, usually positive. Used to calculate bounding box. + * @param z the z index, usually positive. Used to calculate bounding box. + * @return the constructed MazePiece with no openings, variant of NONE, and + * facing north */ public static MazePiece create(Vec3i origin, int x, int z) { return create(origin, x, 0, z); @@ -163,21 +170,25 @@ public static MazePiece create(Vec3i origin, int x, int z) { /** * Creates a MazePiece with the given origin and indices + * * @param origin the origin block position - * @param x the x index, usually positive. Used to calculate bounding box. - * @param y the y index, usually positive. Used to calculate bounding box. - * @param z the z index, usually positive. Used to calculate bounding box. - * @return the constructed MazePiece with no openings, variant of NONE, and facing north + * @param x the x index, usually positive. Used to calculate bounding box. + * @param y the y index, usually positive. Used to calculate bounding box. + * @param z the z index, usually positive. Used to calculate bounding box. + * @return the constructed MazePiece with no openings, variant of NONE, and + * facing north */ public static MazePiece create(Vec3i origin, int x, int y, int z) { Vector4i vec = new Vector4i<>(false, false, false, false); Vec3i from = new Vec3i(origin.getX() + x * WIDTH, origin.getY() + y * HEIGHT, origin.getZ() + z * WIDTH); - Vec3i to = new Vec3i(origin.getX() + (x + 1) * WIDTH - 1, origin.getY() + (y + 1) * HEIGHT, origin.getZ() + (z + 1) * WIDTH - 1); + Vec3i to = new Vec3i(origin.getX() + (x + 1) * WIDTH - 1, origin.getY() + (y + 1) * HEIGHT, + origin.getZ() + (z + 1) * WIDTH - 1); return new MazePiece(vec, Variant.NONE, Direction.NORTH, 0, BoundingBox.fromCorners(from, to)); } /** * Directly sets the piece variant without updating the openings vector + * * @param variant the variant of the piece * @return the modified instance for chaining methods */ @@ -197,6 +208,7 @@ public MazePiece withDirection(Direction direction) { /** * Unused. + * * @param template The structure template resource ID * @return the modified instance for chaining methods */ @@ -209,9 +221,9 @@ public MazePiece withTemplate(ResourceLocation template) { * Sets the openings and variant of this piece * * @param north true if there is an opening on the north side - * @param east true if there is an opening on the east side + * @param east true if there is an opening on the east side * @param south true if there is an opening on the south side - * @param west true if there is an opening on the west side + * @param west true if there is an opening on the west side * @return the modified instance for chaining methods * @see #withOpenings(Vector4i) */ @@ -235,7 +247,8 @@ public MazePiece withOpenings(final Vector4i vec) { } /** - * If this piece is a dead end, calling this method will give it a chance to become a room instead + * If this piece is a dead end, calling this method will give it a chance to + * become a room instead * * @param random the random source * @param roomChance the room chance @@ -259,16 +272,17 @@ protected void addAdditionalSaveData(StructurePieceSerializationContext context, /** * This method is responsible for placing blocks into the world. * - * @param level the world gen level - * @param manager the structure feature manager + * @param level the world gen level + * @param manager the structure feature manager * @param chunkGenerator the chunk generator - * @param random the random source - * @param boundingBox the structure bounding box - * @param chunkPos the structure chunk position - * @param blockPos the structure block position + * @param random the random source + * @param boundingBox the structure bounding box + * @param chunkPos the structure chunk position + * @param blockPos the structure block position */ @Override - public void postProcess(WorldGenLevel level, StructureManager manager, ChunkGenerator chunkGenerator, RandomSource random, BoundingBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) { + public void postProcess(WorldGenLevel level, StructureManager manager, ChunkGenerator chunkGenerator, + RandomSource random, BoundingBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) { // ensure server exists if (null == level.getServer()) { GreekFantasy.LOGGER.debug("[Maze] Failed to generate maze piece, server not found"); @@ -286,7 +300,7 @@ public void postProcess(WorldGenLevel level, StructureManager manager, ChunkGene GreekFantasy.LOGGER.debug("[Maze] Failed to create structure template from " + this.template); return; } - StructureTemplate structureTemplate = oTemplateStructure.get(); + StructureTemplate structureTemplate = oTemplateStructure.get(); // determine origin and pivot Direction adjustedOrientation = Optional.ofNullable(getOrientation()).orElse(Direction.NORTH); int offsetX = 0; @@ -302,12 +316,15 @@ public void postProcess(WorldGenLevel level, StructureManager manager, ChunkGene offsetX = -1; offsetZ = -1; break; - case WEST: default: + case WEST: + default: break; } - BlockPos origin = new BlockPos(getBoundingBox().minX() + offsetX + 1, getBoundingBox().minY(), getBoundingBox().minZ() + offsetZ + 1); - BlockPos pivot = new BlockPos(structureTemplate.getSize().getX() / 2 - 1, 0, structureTemplate.getSize().getZ() / 2 - 1); - // create placement settings + BlockPos origin = BlockPos.containing(getBoundingBox().minX() + offsetX + 1, getBoundingBox().minY(), + getBoundingBox().minZ() + offsetZ + 1); + BlockPos pivot = BlockPos.containing(structureTemplate.getSize().getX() / 2 - 1, 0, + structureTemplate.getSize().getZ() / 2 - 1); + // create placement settings StructurePlaceSettings placement = new StructurePlaceSettings() .setRotationPivot(pivot).setRotation(getRotation()).setMirror(getMirror()).setRandom(random) .setBoundingBox(getBoundingBox()).setFinalizeEntities(true).setKeepLiquids(false) @@ -319,7 +336,8 @@ public void postProcess(WorldGenLevel level, StructureManager manager, ChunkGene } /** - * @return the vector representing openings to the north, east, south, and west (in that order) + * @return the vector representing openings to the north, east, south, and west + * (in that order) */ public Vector4i getOpenings() { return openings; @@ -355,10 +373,14 @@ public MazePiece bake(RandomSource random) { } /** - * Custom implementation of setOrientation that uses all four rotations and ignores mirror. - * This is necessary for the NBT structure to be rotated and centered correctly in postProcess. - * Note that the NBT structures are all facing East instead of North as normally expected by this method, this + * Custom implementation of setOrientation that uses all four rotations and + * ignores mirror. + * This is necessary for the NBT structure to be rotated and centered correctly + * in postProcess. + * Note that the NBT structures are all facing East instead of North as normally + * expected by this method, this * is because they were built with respect to the positive x and z axes. + * * @param direction the piece orientation. */ @Override @@ -386,7 +408,8 @@ public void setOrientation(@Nullable Direction direction) { } /** - * The Maze Piece variant, used to determine the NBT structure template to use when generating the piece. + * The Maze Piece variant, used to determine the NBT structure template to use + * when generating the piece. */ public static enum Variant implements StringRepresentable { NONE("none"), @@ -415,7 +438,8 @@ private Variant(String name) { } /** - * @return the ResourceLocation ID of the {@link WeightedTemplateList} for this variant + * @return the ResourceLocation ID of the {@link WeightedTemplateList} for this + * variant */ public ResourceLocation getTemplatePool() { return templatePool; diff --git a/src/main/java/greekfantasy/worldgen/maze/MazeStructure.java b/src/main/java/greekfantasy/worldgen/maze/MazeStructure.java index 486a5dc7..e5ab9cc2 100644 --- a/src/main/java/greekfantasy/worldgen/maze/MazeStructure.java +++ b/src/main/java/greekfantasy/worldgen/maze/MazeStructure.java @@ -91,7 +91,7 @@ public double getRandomConnectionRatio() { public Optional findGenerationPoint(Structure.GenerationContext context) { context.random().nextDouble(); ChunkPos chunkpos = context.chunkPos(); - BlockPos blockpos = new BlockPos(chunkpos.getMiddleBlockX(), 50, chunkpos.getMinBlockZ()); + BlockPos blockpos = BlockPos.containing(chunkpos.getMiddleBlockX(), 50, chunkpos.getMinBlockZ()); StructurePiecesBuilder structurepiecesbuilder = new StructurePiecesBuilder(); int offsetY = this.generatePiecesAndAdjust(structurepiecesbuilder, context); return Optional.of(new Structure.GenerationStub(blockpos.offset(0, offsetY, 0), Either.right(structurepiecesbuilder))); diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 1dc68ff3..e359c74a 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,11 +1,11 @@ modLoader="javafml" -loaderVersion="[43,)" +loaderVersion="[47,)" license="GNU GPLv3" issueTrackerURL="https://github.com/skyjay1/GreekFantasy/issues" [[mods]] modId="greekfantasy" - version="19.2.6" + version="20.1.0" displayName="Greek Fantasy" credits="" authors="skyjay1" @@ -14,20 +14,20 @@ issueTrackerURL="https://github.com/skyjay1/GreekFantasy/issues" [[dependencies.greekfantasy]] modId="forge" mandatory=true - versionRange="[43.1,)" + versionRange="[47.2,)" ordering="NONE" side="BOTH" [[dependencies.greekfantasy]] modId="rpggods" mandatory=false - versionRange="[19.2,)" + versionRange="[20.1,)" ordering="AFTER" side="BOTH" [[dependencies.greekfantasy]] modId="bettercombat" mandatory=false - versionRange="[1.4.4,)" + versionRange="[1.8,)" ordering="AFTER" side="BOTH" diff --git a/src/main/resources/assets/greekfantasy/lang/ja_jp.json b/src/main/resources/assets/greekfantasy/lang/ja_jp.json new file mode 100644 index 00000000..9c610bbc --- /dev/null +++ b/src/main/resources/assets/greekfantasy/lang/ja_jp.json @@ -0,0 +1,449 @@ +{ + "itemGroup.greekfantasy": "ギリシャファンタジー", + "entity.greekfantasy.ara": "アラー", + "entity.greekfantasy.arachne": "アラクネ", + "entity.greekfantasy.arion": "アリオン", + "entity.greekfantasy.automaton": "オートマトン", + "entity.greekfantasy.baby_spider": "子グモ", + "entity.greekfantasy.bronze_bull": "青銅の雄牛", + "entity.greekfantasy.centaur": "ケンタウロス", + "entity.greekfantasy.cerastes": "ケラステス", + "entity.greekfantasy.cerberus": "ケルベロス", + "entity.greekfantasy.charybdis": "カリュブディス", + "entity.greekfantasy.circe": "キルケー", + "entity.greekfantasy.cretan_minotaur": "クレタのミノタウロス", + "entity.greekfantasy.curse": "呪い", + "entity.greekfantasy.cyclops": "キュクロプス", + "entity.greekfantasy.cyprian": "キプリアン", + "entity.greekfantasy.discus": "円盤", + "entity.greekfantasy.dragon_tooth": "竜の歯", + "entity.greekfantasy.drakaina": "ドラカイナ", + "entity.greekfantasy.dryad": "ドリュアス", + "entity.greekfantasy.elpis": "エルピス", + "entity.greekfantasy.empusa": "エンプーサ", + "entity.greekfantasy.fury": "復讐の女神", + "entity.greekfantasy.geryon": "ゲリュオン", + "entity.greekfantasy.giant_boar": "巨大イノシシ", + "entity.greekfantasy.gigante": "ギガンテス", + "entity.greekfantasy.golden_ram": "黄金の雄羊", + "entity.greekfantasy.gorgon": "ゴルゴン", + "entity.greekfantasy.gorgon.medusa": "メデューサ", + "entity.greekfantasy.harpy": "ハルピュイア", + "entity.greekfantasy.healing_spell": "治癒の呪文", + "entity.greekfantasy.hydra": "ヒュドラ", + "entity.greekfantasy.hydra_head": "ヒュドラ", + "entity.greekfantasy.lampad": "ランパス", + "entity.greekfantasy.mad_cow": "狂った牛", + "entity.greekfantasy.makhai": "マカイ", + "entity.greekfantasy.minotaur": "ミノタウロス", + "entity.greekfantasy.naiad": "ナイアス", + "entity.greekfantasy.nemean_lion": "ネメアの獅子", + "entity.greekfantasy.orthus": "オルトロス", + "entity.greekfantasy.palladium": "パラディウム", + "entity.greekfantasy.pegasus": "ペガサス", + "entity.greekfantasy.poison_spit": "毒の唾", + "entity.greekfantasy.python": "ピュトン", + "entity.greekfantasy.satyr": "サテュロス", + "entity.greekfantasy.scylla": "スキュラ", + "entity.greekfantasy.shade": "シェイド", + "entity.greekfantasy.siren": "セイレーン", + "entity.greekfantasy.sparti": "スパルトイ", + "entity.greekfantasy.stymphalian": "ステュムパロス", + "entity.greekfantasy.pig_spell": "豚の呪文", + "entity.greekfantasy.talos": "タロス", + "entity.greekfantasy.triton": "トリトン", + "entity.greekfantasy.triton.slim": "トリトネス", + "entity.greekfantasy.unicorn": "ユニコーン", + "entity.greekfantasy.water_spell": "水の呪文", + "entity.greekfantasy.web_ball": "クモの巣玉", + "entity.greekfantasy.whirl": "渦巻き", + "item.greekfantasy.ara_spawn_egg": "アラーのスポーンエッグ", + "item.greekfantasy.arachne_spawn_egg": "アラクネのスポーンエッグ", + "item.greekfantasy.arion_spawn_egg": "アリオンのスポーンエッグ", + "item.greekfantasy.centaur_spawn_egg": "ケンタウロスのスポーンエッグ", + "item.greekfantasy.cerastes_spawn_egg": "ケラステスのスポーンエッグ", + "item.greekfantasy.charybdis_spawn_egg": "カリュブディスのスポーンエッグ", + "item.greekfantasy.circe_spawn_egg": "キルケーのスポーンエッグ", + "item.greekfantasy.cretan_minotaur_spawn_egg": "クレタのミノタウロスのスポーンエッグ", + "item.greekfantasy.cyclops_spawn_egg": "キュクロプスのスポーンエッグ", + "item.greekfantasy.cyprian_spawn_egg": "キプリアンのスポーンエッグ", + "item.greekfantasy.drakaina_spawn_egg": "ドラカイナのスポーンエッグ", + "item.greekfantasy.dryad_spawn_egg": "ドリュアスのスポーンエッグ", + "item.greekfantasy.elpis_spawn_egg": "エルピスのスポーンエッグ", + "item.greekfantasy.empusa_spawn_egg": "エンプーサのスポーンエッグ", + "item.greekfantasy.fury_spawn_egg": "復讐の女神のスポーンエッグ", + "item.greekfantasy.giant_boar_spawn_egg": "巨大イノシシのスポーンエッグ", + "item.greekfantasy.gigante_spawn_egg": "ギガンテスのスポーンエッグ", + "item.greekfantasy.golden_ram_spawn_egg": "黄金の雄羊のスポーンエッグ", + "item.greekfantasy.gorgon_spawn_egg": "ゴルゴンのスポーンエッグ", + "item.greekfantasy.harpy_spawn_egg": "ハルピュイアのスポーンエッグ", + "item.greekfantasy.hydra_spawn_egg": "ヒュドラのスポーンエッグ", + "item.greekfantasy.lampad_spawn_egg": "ランパスのスポーンエッグ", + "item.greekfantasy.mad_cow_spawn_egg": "狂った牛のスポーンエッグ", + "item.greekfantasy.makhai_spawn_egg": "マカイのスポーンエッグ", + "item.greekfantasy.minotaur_spawn_egg": "ミノタウロスのスポーンエッグ", + "item.greekfantasy.naiad_spawn_egg": "ナイアスのスポーンエッグ", + "item.greekfantasy.nemean_lion_spawn_egg": "ネメアの獅子のスポーンエッグ", + "item.greekfantasy.orthus_spawn_egg": "オルトロスのスポーンエッグ", + "item.greekfantasy.pegasus_spawn_egg": "ペガサスのスポーンエッグ", + "item.greekfantasy.python_spawn_egg": "ピュトンのスポーンエッグ", + "item.greekfantasy.satyr_spawn_egg": "サテュロスのスポーンエッグ", + "item.greekfantasy.shade_spawn_egg": "シェイドのスポーンエッグ", + "item.greekfantasy.siren_spawn_egg": "セイレーンのスポーンエッグ", + "item.greekfantasy.stymphalian_spawn_egg": "ステュムパロスのスポーンエッグ", + "item.greekfantasy.triton_spawn_egg": "トリトンのスポーンエッグ", + "item.greekfantasy.unicorn_spawn_egg": "ユニコーンのスポーンエッグ", + "item.greekfantasy.whirl_spawn_egg": "渦巻きのスポーンエッグ", + "item.greekfantasy.ambrosia": "アンブロシア", + "item.greekfantasy.apollo_bow": "アポロンの弓", + "item.greekfantasy.artemis_bow": "アルテミスの弓", + "item.greekfantasy.avernal_bow": "冥府の弓", + "item.greekfantasy.avernal_claw": "冥府の爪", + "item.greekfantasy.avernal_feather": "冥府の羽", + "item.greekfantasy.avernal_hair": "冥府の毛", + "item.greekfantasy.avernal_hide": "冥府の皮", + "item.greekfantasy.avernal_shard": "冥府の破片", + "item.greekfantasy.avernal_wing": "冥府の翼", + "item.greekfantasy.bag_of_wind": "風の袋", + "item.greekfantasy.bident": "ビデント", + "item.greekfantasy.boar_ear": "イノシシの耳", + "item.greekfantasy.boar_tusk": "イノシシの牙", + "item.greekfantasy.bronze_bowl": "青銅の鉢", + "item.greekfantasy.bronze_coins": "青銅のコイン", + "item.greekfantasy.bronze_cuirass": "青銅の胸当て", + "item.greekfantasy.bronze_feather": "青銅の羽", + "item.greekfantasy.bronze_feather.tooltip": "使用して投げる", + "item.greekfantasy.bronze_figurine": "青銅の彫像", + "item.greekfantasy.bronze_goblet": "青銅のゴブレット", + "item.greekfantasy.bronze_helmet": "青銅の兜", + "item.greekfantasy.bronze_ingot": "青銅インゴット", + "item.greekfantasy.bronze_nugget": "青銅の塊", + "item.greekfantasy.bronze_shield": "青銅の盾", + "item.greekfantasy.bronze_vase": "青銅の壺", + "item.greekfantasy.bronze_scrap.tooltip": "古代の青銅の欠片", + "item.greekfantasy.conch": "巻貝", + "item.greekfantasy.deadly_fang": "致命的な牙", + "item.greekfantasy.diamond_spear": "ダイヤモンドの槍", + "item.greekfantasy.discus": "円盤", + "item.greekfantasy.discus.tooltip": "使用して投げる", + "item.greekfantasy.dragon_tooth": "竜の歯", + "item.greekfantasy.dragon_tooth.tooltip": "投げてスパルトイを召喚する", + "item.greekfantasy.dragon_tooth_rod": "竜の歯の杖", + "item.greekfantasy.flint_knife": "火打石のナイフ", + "item.greekfantasy.flint_spear": "火打石の槍", + "item.greekfantasy.golden_ball": "黄金の糸玉", + "item.greekfantasy.golden_bridle": "黄金の手綱", + "item.greekfantasy.golden_fleece": "黄金の羊毛", + "item.greekfantasy.golden_lyre": "黄金の竪琴", + "item.greekfantasy.golden_spear": "黄金の槍", + "item.greekfantasy.golden_string": "黄金の糸", + "item.greekfantasy.gorgon_blood": "ゴルゴンの血", + "item.greekfantasy.gorgon_blood.tooltip.heal": "50%の確率で治癒", + "item.greekfantasy.gorgon_blood.tooltip.poison": "50%の確率で毒", + "item.greekfantasy.greek_fire": "ギリシャの火", + "item.greekfantasy.heart_of_talos": "タロスの心臓", + "item.greekfantasy.hellenic_helmet": "ヘレニックヘルメット", + "item.greekfantasy.hellenic_chestplate": "ヘレニックチェストプレート", + "item.greekfantasy.hellenic_leggings": "ヘレニックレギンス", + "item.greekfantasy.hellenic_boots": "ヘレニックブーツ", + "item.greekfantasy.hellenic_armor.tooltip.resist": "前方からの矢を防ぐ", + "item.greekfantasy.hellenic_armor.tooltip.weak": "アキレス腱 - 後方からの矢に弱い", + "item.greekfantasy.helm_of_darkness": "冥府の兜", + "item.greekfantasy.helm_of_darkness.tooltip": "完全な透明化を付与", + "item.greekfantasy.horn": "角", + "item.greekfantasy.horn_of_plenty": "豊穣の角", + "item.greekfantasy.horn_of_plenty.tooltip": "使用してランダムな食料を入手", + "item.greekfantasy.ichor": "イコル", + "item.greekfantasy.ichor_infused_gear": "イコルが注入された歯車", + "item.greekfantasy.iron_club": "鉄の棍棒", + "item.greekfantasy.iron_spear": "鉄の槍", + "item.greekfantasy.ivory_sword": "象牙の剣", + "item.greekfantasy.mirror": "鏡", + "item.greekfantasy.nemean_lion_hide": "ネメアの獅子の毛皮", + "item.greekfantasy.nemean_lion_hide.tooltip": "後方からの矢に無敵", + "item.greekfantasy.netherite_spear": "ネザライトの槍", + "item.greekfantasy.olives": "オリーブ", + "item.greekfantasy.olive_oil": "オリーブオイル", + "item.greekfantasy.olive_salve": "オリーブ軟膏", + "item.greekfantasy.olive_salve.tooltip": "%1$s . . . ?", + "item.greekfantasy.palladium": "パラディウム", + "item.greekfantasy.panflute": "パンフルート", + "item.greekfantasy.pinecone": "松ぼっくり", + "item.greekfantasy.pomegranate": "ザクロ", + "item.greekfantasy.quest": "クエスト", + "item.greekfantasy.quest.tooltip": "使用して読む", + "item.greekfantasy.reeds": "葦", + "item.greekfantasy.scylla_bone": "スキュラの骨", + "item.greekfantasy.snakeskin": "蛇の皮", + "item.greekfantasy.snakeskin_helmet": "蛇の皮のヘルメット", + "item.greekfantasy.snakeskin_chestplate": "蛇の皮のチェストプレート", + "item.greekfantasy.snakeskin_leggings": "蛇の皮のレギンス", + "item.greekfantasy.snakeskin_boots": "蛇の皮のブーツ", + "item.greekfantasy.spider_banner_pattern": "旗の模様", + "item.greekfantasy.spider_banner_pattern.desc": "蜘蛛", + "item.greekfantasy.staff_of_healing": "治癒の杖", + "item.greekfantasy.stone_club": "石の棍棒", + "item.greekfantasy.stone_spear": "石の槍", + "item.greekfantasy.throwing_axe": "投げ斧", + "item.greekfantasy.thunderbolt": "雷電", + "item.greekfantasy.thunderbolt.use.deny.rain": "このアイテムは雨が降っている時に使用してください", + "item.greekfantasy.thyrsus": "テュルソス", + "item.greekfantasy.thyrsus.tooltip": "バケツにミルク、瓶に水を満たす", + "item.greekfantasy.tough_snakeskin": "強靭な蛇の皮", + "item.greekfantasy.unicorn_horn": "ユニコーンの角", + "item.greekfantasy.wand_of_circe": "キルケーの杖", + "item.greekfantasy.web_ball": "クモの巣玉", + "item.greekfantasy.winged_sandals": "翼のサンダル", + "item.greekfantasy.wooden_club": "木の棍棒", + "item.greekfantasy.wooden_lyre": "木の竪琴", + "item.greekfantasy.wooden_spear": "木の槍", + "item.minecraft.potion.effect.mirroring": "鏡映のポーション", + "item.minecraft.potion.effect.long_mirroring": "鏡映のポーション", + "item.minecraft.potion.effect.curse_of_circe": "キルケーの呪いのポーション", + "item.minecraft.potion.effect.long_curse_of_circe": "キルケーの呪いのポーション", + "item.minecraft.potion.effect.slow_swim": "遅泳のポーション", + "item.minecraft.potion.effect.long_slow_swim": "遅泳のポーション", + "item.minecraft.splash_potion.effect.mirroring": "鏡映のスプラッシュポーション", + "item.minecraft.splash_potion.effect.long_mirroring": "鏡映のスプラッシュポーション", + "item.minecraft.splash_potion.effect.curse_of_circe": "キルケーの呪いのスプラッシュポーション", + "item.minecraft.splash_potion.effect.long_curse_of_circe": "キルケーの呪いのスプラッシュポーション", + "item.minecraft.splash_potion.effect.slow_swim": "遅泳のスプラッシュポーション", + "item.minecraft.splash_potion.effect.long_slow_swim": "遅泳のスプラッシュポーション", + "item.minecraft.lingering_potion.effect.mirroring": "鏡映の残留ポーション", + "item.minecraft.lingering_potion.effect.long_mirroring": "鏡映の残留ポーション", + "item.minecraft.lingering_potion.effect.curse_of_circe": "キルケーの呪いの残留ポーション", + "item.minecraft.lingering_potion.effect.long_curse_of_circe": "キルケーの呪いの残留ポーション", + "item.minecraft.lingering_potion.effect.slow_swim": "遅泳の残留ポーション", + "item.minecraft.lingering_potion.effect.long_slow_swim": "遅泳の残留ポーション", + "item.minecraft.tipped_arrow.effect.mirroring": "鏡映の矢", + "item.minecraft.tipped_arrow.effect.long_mirroring": "鏡映の矢", + "item.minecraft.tipped_arrow.effect.curse_of_circe": "キルケーの呪いの矢", + "item.minecraft.tipped_arrow.effect.long_curse_of_circe": "キルケーの呪いの矢", + "item.minecraft.tipped_arrow.effect.slow_swim": "遅泳の矢", + "item.minecraft.tipped_arrow.effect.long_slow_swim": "遅泳の矢", + "item.tooltip.broken": "壊れた", + "item.tooltip.right_click_instrument": "使用して演奏する", + "block.greekfantasy.bronze_block": "青銅ブロック", + "block.greekfantasy.cretan_stone": "クレタの石", + "block.greekfantasy.chiseled_cretan_stone": "模様入りクレタの石", + "block.greekfantasy.cretan_stone_brick": "クレタの石レンガ", + "block.greekfantasy.chiseled_cretan_stone_brick": "模様入りクレタの石レンガ", + "block.greekfantasy.cracked_cretan_stone_brick": "ひび割れたクレタの石レンガ", + "block.greekfantasy.polished_cretan_stone": "磨かれたクレタの石", + "block.greekfantasy.cracked_polished_cretan_stone": "ひび割れた磨かれたクレタの石", + "block.greekfantasy.nest": "ハルピュイアの巣", + "block.greekfantasy.olive_door": "オリーブのドア", + "block.greekfantasy.olive_log": "オリーブの原木", + "block.greekfantasy.olive_leaves": "オリーブの葉", + "block.greekfantasy.olive_oil": "オリーブオイル", + "block.greekfantasy.olive_planks": "オリーブの板材", + "block.greekfantasy.olive_sapling": "オリーブの苗木", + "block.greekfantasy.olive_slab": "オリーブのハーフブロック", + "block.greekfantasy.olive_stairs": "オリーブの階段", + "block.greekfantasy.olive_trapdoor": "オリーブのトラップドア", + "block.greekfantasy.olive_wood": "オリーブの木", + "block.greekfantasy.pomegranate_log": "ザクロの原木", + "block.greekfantasy.pomegranate_wood": "ザクロの木", + "block.greekfantasy.pomegranate_planks": "ザクロの板材", + "block.greekfantasy.pomegranate_slab": "ザクロのハーフブロック", + "block.greekfantasy.pomegranate_stairs": "ザクロの階段", + "block.greekfantasy.pomegranate_door": "ザクロのドア", + "block.greekfantasy.pomegranate_trapdoor": "ザクロのトラップドア", + "block.greekfantasy.pomegranate_leaves": "ザクロの葉", + "block.greekfantasy.pomegranate_sapling": "ザクロの苗木", + "block.greekfantasy.golden_leaves": "黄金の葉", + "block.greekfantasy.golden_sapling": "黄金の苗木", + "block.greekfantasy.golden_string": "黄金の糸", + "block.greekfantasy.ichor_infused_gearbox": "イコルが注入された歯車箱", + "block.greekfantasy.limestone_statue": "石灰岩の像", + "block.greekfantasy.marble_statue": "大理石の像", + "block.greekfantasy.limestone": "石灰岩", + "block.greekfantasy.limestone_slab": "石灰岩のハーフブロック", + "block.greekfantasy.limestone_stairs": "石灰岩の階段", + "block.greekfantasy.polished_limestone": "磨かれた石灰岩", + "block.greekfantasy.polished_limestone_slab": "磨かれた石灰岩のハーフブロック", + "block.greekfantasy.polished_limestone_stairs": "磨かれた石灰岩の階段", + "block.greekfantasy.limestone_pillar": "石灰岩の柱", + "block.greekfantasy.marble": "大理石", + "block.greekfantasy.marble_slab": "大理石のハーフブロック", + "block.greekfantasy.marble_stairs": "大理石の階段", + "block.greekfantasy.polished_marble": "磨かれた大理石", + "block.greekfantasy.polished_marble_slab": "磨かれた大理石のハーフブロック", + "block.greekfantasy.polished_marble_stairs": "磨かれた大理石の階段", + "block.greekfantasy.marble_pillar": "大理石の柱", + "block.greekfantasy.stripped_olive_log": "樹皮を剥いだオリーブの原木", + "block.greekfantasy.stripped_olive_wood": "樹皮を剥いだオリーブの木", + "block.greekfantasy.stripped_pomegranate_log": "樹皮を剥いだザクロの原木", + "block.greekfantasy.stripped_pomegranate_wood": "樹皮を剥いだザクロの木", + "block.greekfantasy.terracotta_vase": "テラコッタの壺", + "block.greekfantasy.white_terracotta_vase": "白色のテラコッタの壺", + "block.greekfantasy.orange_terracotta_vase": "橙色のテラコッタの壺", + "block.greekfantasy.magenta_terracotta_vase": "赤紫色のテラコッタの壺", + "block.greekfantasy.light_blue_terracotta_vase": "空色のテラコッタの壺", + "block.greekfantasy.yellow_terracotta_vase": "黄色のテラコッタの壺", + "block.greekfantasy.lime_terracotta_vase": "黄緑色のテラコッタの壺", + "block.greekfantasy.pink_terracotta_vase": "桃色のテラコッタの壺", + "block.greekfantasy.gray_terracotta_vase": "灰色のテラコッタの壺", + "block.greekfantasy.light_gray_terracotta_vase": "薄灰色のテラコッタの壺", + "block.greekfantasy.cyan_terracotta_vase": "青緑色のテラコッタの壺", + "block.greekfantasy.purple_terracotta_vase": "紫色のテラコッタの壺", + "block.greekfantasy.blue_terracotta_vase": "青色のテラコッタの壺", + "block.greekfantasy.brown_terracotta_vase": "茶色のテラコッタの壺", + "block.greekfantasy.green_terracotta_vase": "緑色のテラコッタの壺", + "block.greekfantasy.red_terracotta_vase": "赤色のテラコッタの壺", + "block.greekfantasy.black_terracotta_vase": "黒色のテラコッタの壺", + "block.greekfantasy.mysterious_box": "謎の箱", + "block.greekfantasy.mysterious_box.tooltip": "Nescitur Ignescitur", + "block.greekfantasy.oil_lamp": "オイルランプ", + "block.greekfantasy.reeds": "葦", + "block.greekfantasy.gigante_head": "ギガンテスの頭", + "block.greekfantasy.orthus_head": "オルトロスの頭", + "block.greekfantasy.cerberus_head": "ケルベロスの頭", + "block.greekfantasy.wild_rose": "野生のバラ", + "block.minecraft.banner.greekfantasy.spider.white": "白色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.orange": "橙色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.magenta": "赤紫色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.light_blue": "空色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.yellow": "黄色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.lime": "黄緑色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.pink": "桃色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.gray": "灰色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.light_gray": "薄灰色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.cyan": "青緑色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.purple": "紫色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.blue": "青色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.brown": "茶色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.green": "緑色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.red": "赤色の蜘蛛", + "block.minecraft.banner.greekfantasy.spider.black": "黒色の蜘蛛", + "effect.greekfantasy.stunned": "スタン", + "effect.greekfantasy.petrified": "石化", + "effect.greekfantasy.mirroring": "鏡映", + "effect.greekfantasy.slow_swim": "遅泳", + "effect.greekfantasy.curse_of_circe": "キルケーの呪い", + "effect.greekfantasy.prisoner_of_hades": "ハデスの囚人", + "enchantment.greekfantasy.bane_of_serpents": "蛇特効", + "enchantment.greekfantasy.bane_of_serpents.description": "蛇のようなクリーチャーへのダメージを増加させます。", + "enchantment.greekfantasy.hunting": "狩猟", + "enchantment.greekfantasy.hunting.description": "ほとんどの動物を即座に倒す確率があります。", + "enchantment.greekfantasy.overstep": "踏み越え", + "enchantment.greekfantasy.overstep.description": "ジャンプの代わりにブロックの上に即座に乗ります。", + "enchantment.greekfantasy.smashing": "強打", + "enchantment.greekfantasy.smashing.description": "各攻撃で複数のモブをスタンさせます。", + "enchantment.greekfantasy.mirroring": "鏡映", + "enchantment.greekfantasy.mirroring.description": "ゴルゴンの石化の視線から保護します。", + "enchantment.greekfantasy.poisoning": "毒化", + "enchantment.greekfantasy.poisoning.description": "攻撃されたときに攻撃者を毒化する確率があります。", + "enchantment.greekfantasy.flying": "飛行", + "enchantment.greekfantasy.flying.description": "高い好感度を持つプレイヤーに飛行を許可します。", + "enchantment.greekfantasy.lord_of_the_sea": "海の主", + "enchantment.greekfantasy.lord_of_the_sea.description": "トライデントが強力な渦巻きを召喚します", + "enchantment.greekfantasy.fireflash": "火閃", + "enchantment.greekfantasy.fireflash.description": "雷電が爆発を起こします", + "enchantment.greekfantasy.daybreak": "夜明け", + "enchantment.greekfantasy.daybreak.description": "時計が夜を昼に変えます", + "enchantment.greekfantasy.raising": "召喚", + "enchantment.greekfantasy.raising.description": "ビデントがスパルトイを召喚します", + "enchantment.greekfantasy.silkstep": "絹歩き", + "enchantment.greekfantasy.silkstep.description": "クモの巣を通り抜けることを許可します", + "enchantment.level.infinity": "\u221E", + "advancements.greekfantasy.root.title": "ギリシャファンタジー", + "advancements.greekfantasy.root.description": "ギリシャファンタジーModを探索しよう :)", + "container.vase": "壺", + "screen.greekfantasy.controls.octave": "[スクロールホイール] オクターブ変更", + "screen.greekfantasy.controls.songs": "[スペース] 曲の切り替え", + "song.augustin.name": "おお愛しのアウグスティン", + "song.augustin.credits": "オーストリア伝統曲", + "song.greensleeves.name": "グリーンスリーブス", + "song.greensleeves.credits": "イギリス伝統曲", + "song.korobeiniki.name": "コロブチカ", + "song.korobeiniki.credits": "1861年 ニコライ・ネクラーソフ", + "song.lotr.name": "ロード・オブ・ザ・リング", + "song.lotr.credits": "2001年 ハワード・ショア", + "song.sarias_song.name": "サリアの歌", + "song.sarias_song.credits": "1998年 近藤浩治", + "song.sound_of_silence.name": "サウンド・オブ・サイレンス", + "song.sound_of_silence.credits": "1964年 ポール・サイモン", + "song.waltzing_matilda.name": "ワルツィング・マチルダ", + "song.waltzing_matilda.credits": "オーストラリア伝統曲", + "quest.greekfantasy.craft_bronze_ingot": "クエスト:青銅インゴットを作成する", + "quest.greekfantasy.craft_bronze_ingot.line1": "青銅は貴重な材料ですが、私たちには生産する資源がありません。", + "quest.greekfantasy.craft_bronze_ingot.line2": "古代の遺物を溶かすことによってのみ入手できます。", + "quest.greekfantasy.kill_arachne": "クエスト:アラクネを倒す", + "quest.greekfantasy.kill_arachne.line1": "蜘蛛の女王がどこかの地下に潜んでいます。", + "quest.greekfantasy.kill_arachne.line2": "彼女を倒せば、隠された宝物があなたのものになります。", + "quest.greekfantasy.kill_cretan_minotaur": "クエスト:クレタのミノタウロスを倒す", + "quest.greekfantasy.kill_cretan_minotaur.line1": "遠い昔、牛のような獣が迷宮に封印されました。それ以来、数え切れないほどの冒険者がその深部で迷子になっています。", + "quest.greekfantasy.kill_cretan_minotaur.line2": "クレタのミノタウロスを見つけて倒し、大地に平和をもたらしましょう!", + "quest.greekfantasy.kill_cretan_minotaur.line3": "迷宮は危険ですが、黄金の糸玉があなたを助けてくれるという噂があります。", + "quest.greekfantasy.kill_hydra": "クエスト:ヒュドラを倒す", + "quest.greekfantasy.kill_hydra.line1": "この任務は不可能に見えます...1つの頭を取り除くと、さらに2つの頭が生えてきます!", + "quest.greekfantasy.kill_hydra.line2": "しかし、頭を取り除く前に燃やせば傷口を塞げると言われています...", + "quest.greekfantasy.kill_circe": "クエスト:キルケーを倒す", + "quest.greekfantasy.kill_circe.line1": "魔女キルケーが人々を豚に変えています。彼女を止めなければなりません!", + "quest.greekfantasy.kill_circe.line2": "彼女の杖が力の源のようです。", + "quest.greekfantasy.kill_medusa": "クエスト:メデューサを倒す", + "quest.greekfantasy.kill_medusa.line1": "メデューサは最も恐ろしいゴルゴンです。", + "quest.greekfantasy.kill_medusa.line2": "彼女の視線を避ける唯一の方法は、鏡を持つか、もしかしたら魔法のかかった盾でしょうか?", + "quest.greekfantasy.summon_automaton": "クエスト:オートマトンを召喚する", + "quest.greekfantasy.summon_automaton.line1": "忠実な守護者は近づくすべてのモンスターを倒します。", + "quest.greekfantasy.summon_automaton.line2": "イコルが注入された歯車箱の上に青銅ブロックを置くことで作成できます。", + "quest.greekfantasy.summon_arion": "クエスト:アリオンを召喚する", + "quest.greekfantasy.summon_arion.line1": "黄金の馬は太陽と同じくらい速いと噂されています!", + "quest.greekfantasy.summon_arion.line2": "馬にエンチャントされた金のリンゴを与えることで召喚できます。", + "quest.greekfantasy.summon_bronze_bull": "クエスト:青銅の雄牛を破壊する", + "quest.greekfantasy.summon_bronze_bull.line1": "巨大な時計仕掛けの雄牛が暴走しています!", + "quest.greekfantasy.summon_bronze_bull.line2": "2x2x2の銅ブロックの立方体を作り、上段の両側に青銅ブロックを2つ置くことで召喚できます。", + "quest.greekfantasy.summon_bronze_bull.line3": "その金属の体は、あらゆる種類の矢から守ります。", + "quest.greekfantasy.summon_cerberus": "クエスト:ケルベロスを召喚して倒す", + "quest.greekfantasy.summon_cerberus.line1": "冥界の番犬を倒さなければなりません。", + "quest.greekfantasy.summon_cerberus.line2": "ブラックストーンで4x4の枠を作り、中央に溶岩を置いて獣を召喚します。", + "quest.greekfantasy.summon_cerberus.line3": "最後に、オルトロスの頭を溶岩に投げ込みます。", + "quest.greekfantasy.summon_cerberus.line4": "生き残れば、その冥府の皮が役に立つかもしれません。", + "quest.greekfantasy.summon_charybdis": "クエスト:カリュブディスを召喚して倒す", + "quest.greekfantasy.summon_charybdis.line1": "海の怪物があまりにも多くの命を奪いました。", + "quest.greekfantasy.summon_charybdis.line2": "渦巻きの見えない口にハート・オブ・ザ・シーを落とすことで召喚できます。", + "quest.greekfantasy.summon_charybdis.line3": "その腹の中の巻貝は多くの用途があります。", + "quest.greekfantasy.summon_geryon": "クエスト:ゲリュオンを召喚して倒す", + "quest.greekfantasy.summon_geryon.line1": "3つの頭を持つ巨人を止めなければなりません!", + "quest.greekfantasy.summon_geryon.line2": "彼を呼び出すには、3つのギガンテスの頭を置き、近くで牛を倒します。", + "quest.greekfantasy.summon_geryon.line3": "彼の狂った牛の群れに注意してください...", + "quest.greekfantasy.summon_giant_boar": "クエスト:巨大イノシシを召喚して倒す", + "quest.greekfantasy.summon_giant_boar.line1": "この危険なモンスターは英雄にしか倒せません。", + "quest.greekfantasy.summon_giant_boar.line2": "ホグリンをオーバーワールドに誘い込み、毒のジャガイモを与えることで召喚できます。", + "quest.greekfantasy.summon_golden_ram": "クエスト:黄金の雄羊を召喚する", + "quest.greekfantasy.summon_golden_ram.line1": "この素晴らしい生き物は純金の羊毛を持っています!", + "quest.greekfantasy.summon_golden_ram.line2": "黄色い羊にドラゴンブレスを与えることで召喚できます。", + "quest.greekfantasy.summon_golden_ram.line3": "その羊毛はトロフィーとして集めることができます。もしかしたら他の用途もあるかもしれません?", + "quest.greekfantasy.summon_nemean_lion": "クエスト:ネメアの獅子を召喚して倒す", + "quest.greekfantasy.summon_nemean_lion.line1": "この人食いモンスターに注意してください!どんな矢もその毛皮を貫くことはできません。", + "quest.greekfantasy.summon_nemean_lion.line2": "その巣で見つけることができます。またはオセロットに力のポーションを与え、稲妻で打つことで召喚できます。", + "quest.greekfantasy.summon_nemean_lion.line3": "熟練したレスラーなら獣を倒せるかもしれません。", + "quest.greekfantasy.summon_scylla": "クエスト:スキュラを召喚して倒す", + "quest.greekfantasy.summon_scylla.line1": "かつては美しい海のニンフでしたが、今はキルケーに呪われて恐ろしいモンスターになっています。", + "quest.greekfantasy.summon_scylla.line2": "彼女の竜のような頭は稲妻のように襲いかかり、水の魔法は危険です。", + "quest.greekfantasy.summon_scylla.line3": "彼女の恐怖から海を解放しましょう!", + "quest.greekfantasy.summon_talos": "クエスト:暴走するタロスを止める", + "quest.greekfantasy.summon_talos.line1": "イコルが注入された守護者が狂ってしまいました。", + "quest.greekfantasy.summon_talos.line2": "銅ブロックを一列に3つ、その上に3つ配置し、上段の中央に青銅ブロックを置くことで召喚できます。", + "quest.greekfantasy.summon_talos.line3": "その心臓を回収してください - 後で役立つかもしれません。", + "quest.greekfantasy.tame_pegasus": "クエスト:ペガサスを手なずける", + "quest.greekfantasy.tame_pegasus.line1": "この雄大な生き物は雲の上を飛ぶことができます。", + "quest.greekfantasy.tame_pegasus.line2": "黄金の手綱を持っている時にのみ手なずけることができます。", + "quest.greekfantasy.tame_unicorn": "クエスト:ユニコーンを手なずける", + "quest.greekfantasy.tame_unicorn.line1": "ユニコーンの角はどんな病気も治すことができるため、多くの人が容赦なく狩っています。", + "quest.greekfantasy.tame_unicorn.line2": "黄金の手綱を持っている時にのみ手なずけることができます。", + "quest.greekfantasy.trade_with_centaur": "クエスト:ケンタウロスと交易する", + "quest.greekfantasy.trade_with_centaur.line1": "予備の紙はありますか?", + "quest.greekfantasy.trade_with_centaur.line2": "ケンタウロスに渡せば、あなたのためにクエストを書いてくれるかもしれません。", + "quest.greekfantasy.trade_with_elpis": "クエスト:エルピスと交易する", + "quest.greekfantasy.trade_with_elpis.line1": "謎の箱を開けると、希望の精霊エルピスが現れるかもしれません。", + "quest.greekfantasy.trade_with_elpis.line2": "彼女にダイヤモンドを渡せば、何かお返しをもらえるかもしれません。", + "quest.greekfantasy.trade_with_nymph": "クエスト:ニンフと交易する", + "quest.greekfantasy.trade_with_nymph.line1": "森のドリュアスは新しい種や植物が大好きです。", + "quest.greekfantasy.trade_with_nymph.line2": "アイテムを提供すれば、素敵なものをお返しにもらえるかもしれません!", + "quest.greekfantasy.trade_with_nymph.line3": "冥界のランパスも取引を楽しんでいます。", + "quest.greekfantasy.trade_with_triton": "クエスト:トリトンと交易する", + "quest.greekfantasy.trade_with_triton.line1": "トリトンとトリトネスはアメジストの欠片と引き換えに取引をしてくれます。", + "quest.greekfantasy.trade_with_triton.line2": "海の村で友好的な人々を探してください。" +} diff --git a/src/main/resources/assets/greekfantasy/lang/zh_cn.json b/src/main/resources/assets/greekfantasy/lang/zh_cn.json index e8fa39dd..7592bb0e 100644 --- a/src/main/resources/assets/greekfantasy/lang/zh_cn.json +++ b/src/main/resources/assets/greekfantasy/lang/zh_cn.json @@ -1,186 +1,247 @@ { - "itemGroup.greekfantasy": "希腊幻想", - "entity.greekfantasy.ara": "「燧石之心」阿拉", - "entity.greekfantasy.arachne": "「蜘蛛女」阿拉克涅", - "entity.greekfantasy.arion": "「神马」阿里翁", + "itemGroup.greekfantasy": "希腊幻想", + "entity.greekfantasy.ara": "「燧石之心」阿拉", + "entity.greekfantasy.arachne": "「蜘蛛女」阿拉克涅", + "entity.greekfantasy.arion": "「神马」阿里翁", + "entity.greekfantasy.automaton": "自动机", "entity.greekfantasy.baby_spider": "小蜘蛛", - "entity.greekfantasy.bronze_bull": "铜牛", - "entity.greekfantasy.centaur": "半人马", - "entity.greekfantasy.cerastes": "角蝰", - "entity.greekfantasy.cerberus": "「地狱三头犬」刻耳柏洛斯", - "entity.greekfantasy.charybdis": "「旋涡海怪」卡律布狄斯", - "entity.greekfantasy.circe": "「巫术女神」喀耳刻", - "entity.greekfantasy.cretan_minotaur": "克里特的米诺陶诺斯", - "entity.greekfantasy.curse": "诅咒", - "entity.greekfantasy.cyclops": "「独眼巨人」库克洛普斯", - "entity.greekfantasy.cyprian": "塞浦路斯半人马", - "entity.greekfantasy.discus": "铁饼", - "entity.greekfantasy.dragon_tooth": "龙牙", - "entity.greekfantasy.drakaina": "龙女", - "entity.greekfantasy.dryad": "树妖", - "entity.greekfantasy.elpis": "「希望女神」厄尔庇斯", - "entity.greekfantasy.empusa": "「吸血恶魔」恩浦萨", - "entity.greekfantasy.fury": "「复仇女神」厄里倪厄斯", - "entity.greekfantasy.geryon": "「三头巨人」革律翁", - "entity.greekfantasy.giant_boar": "巨型野猪", - "entity.greekfantasy.gigante": "巨人", - "entity.greekfantasy.golden_ram": "金羊", - "entity.greekfantasy.gorgon": "「蛇发女妖」戈耳工", - "entity.greekfantasy.gorgon.medusa": "美杜莎", - "entity.greekfantasy.harpy": "鹰身女妖", - "entity.greekfantasy.healing_spell": "治疗术", + "entity.greekfantasy.bronze_bull": "铜牛", + "entity.greekfantasy.centaur": "半人马", + "entity.greekfantasy.cerastes": "角蝰", + "entity.greekfantasy.cerberus": "「地狱三头犬」刻耳柏洛斯", + "entity.greekfantasy.charybdis": "「旋涡海怪」卡律布狄斯", + "entity.greekfantasy.circe": "「巫术女神」喀耳刻", + "entity.greekfantasy.cretan_minotaur": "克里特的米诺陶诺斯", + "entity.greekfantasy.curse": "诅咒", + "entity.greekfantasy.cyclops": "「独眼巨人」库克洛普斯", + "entity.greekfantasy.cyprian": "塞浦路斯半人马", + "entity.greekfantasy.discus": "铁饼", + "entity.greekfantasy.dragon_tooth": "龙牙", + "entity.greekfantasy.drakaina": "龙女", + "entity.greekfantasy.dryad": "树妖", + "entity.greekfantasy.elpis": "「希望女神」厄尔庇斯", + "entity.greekfantasy.empusa": "「吸血恶魔」恩浦萨", + "entity.greekfantasy.fury": "「复仇女神」厄里倪厄斯", + "entity.greekfantasy.geryon": "「三头巨人」革律翁", + "entity.greekfantasy.giant_boar": "巨型野猪", + "entity.greekfantasy.gigante": "巨人", + "entity.greekfantasy.golden_ram": "金羊", + "entity.greekfantasy.gorgon": "「蛇发女妖」戈耳工", + "entity.greekfantasy.gorgon.medusa": "美杜莎", + "entity.greekfantasy.harpy": "鹰身女妖", + "entity.greekfantasy.healing_spell": "治疗术", "entity.greekfantasy.hydra": "九头蛇", "entity.greekfantasy.hydra_head": "九头蛇", "entity.greekfantasy.lampad": "「幽冥仙女」拉姆帕德斯", - "entity.greekfantasy.mad_cow": "疯牛", - "entity.greekfantasy.makhai": "「战争半神」玛科海", - "entity.greekfantasy.minotaur": "「牛头怪」米诺陶洛斯", - "entity.greekfantasy.naiad": "「水泽仙女」那伊阿得斯", - "entity.greekfantasy.nemean_lion": "涅墨亚狮子", - "entity.greekfantasy.orthus": "「双头犬」奥特休斯", - "entity.greekfantasy.pegasus": "「天马」珀伽索斯", - "entity.greekfantasy.poison_spit": "毒液", - "entity.greekfantasy.python": "毒蟒", - "entity.greekfantasy.satyr": "「森林之神」萨蒂尔", - "entity.greekfantasy.shade": "暗影", - "entity.greekfantasy.siren": "塞壬", - "entity.greekfantasy.sparti": "地生人", - "entity.greekfantasy.pig_spell": "变猪魔法", - "entity.greekfantasy.talos": "「机械巨人」塔罗斯", - "entity.greekfantasy.unicorn": "独角兽", + "entity.greekfantasy.mad_cow": "疯牛", + "entity.greekfantasy.makhai": "「战争半神」玛科海", + "entity.greekfantasy.minotaur": "「牛头怪」米诺陶洛斯", + "entity.greekfantasy.naiad": "「水泽仙女」那伊阿得斯", + "entity.greekfantasy.nemean_lion": "涅墨亚狮子", + "entity.greekfantasy.orthus": "「双头犬」奥特休斯", + "entity.greekfantasy.palladium": "守护神像", + "entity.greekfantasy.pegasus": "「天马」珀伽索斯", + "entity.greekfantasy.poison_spit": "毒液", + "entity.greekfantasy.python": "毒蟒", + "entity.greekfantasy.satyr": "「森林之神」萨蒂尔", + "entity.greekfantasy.scylla": "「海怪」斯库拉", + "entity.greekfantasy.shade": "暗影", + "entity.greekfantasy.siren": "「海妖」塞壬", + "entity.greekfantasy.sparti": "地生人", + "entity.greekfantasy.stymphalian": "斯廷法罗斯湖怪鸟", + "entity.greekfantasy.pig_spell": "变猪魔法", + "entity.greekfantasy.talos": "「机械巨人」塔罗斯", + "entity.greekfantasy.triton": "人鱼", + "entity.greekfantasy.triton.slim": "人鱼", + "entity.greekfantasy.unicorn": "独角兽", + "entity.greekfantasy.water_spell": "水之魔法", "entity.greekfantasy.web_ball": "蜘蛛网团", - "entity.greekfantasy.whirl": "旋涡", - "item.greekfantasy.ara_spawn_egg": "生成阿拉", - "item.greekfantasy.arachne_spawn_egg": "生成阿拉克涅", - "item.greekfantasy.arion_spawn_egg": "生成阿里翁", - "item.greekfantasy.centaur_spawn_egg": "生成半人马", - "item.greekfantasy.cerastes_spawn_egg": "生成角蝰", - "item.greekfantasy.charybdis_spawn_egg": "生成卡律布狄斯", - "item.greekfantasy.circe_spawn_egg": "生成喀耳刻", - "item.greekfantasy.cretan_minotaur_spawn_egg": "生成克里特的米诺陶诺斯", - "item.greekfantasy.cyclops_spawn_egg": "生成独眼巨人", - "item.greekfantasy.cyprian_spawn_egg": "生成塞浦路斯半人马", - "item.greekfantasy.drakaina_spawn_egg": "生成龙女", - "item.greekfantasy.dryad_spawn_egg": "生成树妖", - "item.greekfantasy.elpis_spawn_egg": "生成厄尔庇斯", - "item.greekfantasy.empusa_spawn_egg": "生成恩浦萨", - "item.greekfantasy.fury_spawn_egg": "生成厄里倪厄斯", - "item.greekfantasy.giant_boar_spawn_egg": "生成巨型野猪", - "item.greekfantasy.gigante_spawn_egg": "生成巨人", - "item.greekfantasy.golden_ram_spawn_egg": "生成金羊", - "item.greekfantasy.gorgon_spawn_egg": "生成戈耳工", - "item.greekfantasy.harpy_spawn_egg": "生成鹰身女妖", + "entity.greekfantasy.whirl": "旋涡", + "item.greekfantasy.ara_spawn_egg": "生成阿拉", + "item.greekfantasy.arachne_spawn_egg": "生成阿拉克涅", + "item.greekfantasy.arion_spawn_egg": "生成阿里翁", + "item.greekfantasy.centaur_spawn_egg": "生成半人马", + "item.greekfantasy.cerastes_spawn_egg": "生成角蝰", + "item.greekfantasy.charybdis_spawn_egg": "生成卡律布狄斯", + "item.greekfantasy.circe_spawn_egg": "生成喀耳刻", + "item.greekfantasy.cretan_minotaur_spawn_egg": "生成克里特的米诺陶诺斯", + "item.greekfantasy.cyclops_spawn_egg": "生成独眼巨人", + "item.greekfantasy.cyprian_spawn_egg": "生成塞浦路斯半人马", + "item.greekfantasy.drakaina_spawn_egg": "生成龙女", + "item.greekfantasy.dryad_spawn_egg": "生成树妖", + "item.greekfantasy.elpis_spawn_egg": "生成厄尔庇斯", + "item.greekfantasy.empusa_spawn_egg": "生成恩浦萨", + "item.greekfantasy.fury_spawn_egg": "生成厄里倪厄斯", + "item.greekfantasy.giant_boar_spawn_egg": "生成巨型野猪", + "item.greekfantasy.gigante_spawn_egg": "生成巨人", + "item.greekfantasy.golden_ram_spawn_egg": "生成金羊", + "item.greekfantasy.gorgon_spawn_egg": "生成戈耳工", + "item.greekfantasy.harpy_spawn_egg": "生成鹰身女妖", "item.greekfantasy.hydra_spawn_egg": "生成九头蛇", "item.greekfantasy.lampad_spawn_egg": "生成拉姆帕德斯", - "item.greekfantasy.mad_cow_spawn_egg": "生成疯牛", - "item.greekfantasy.makhai_spawn_egg": "生成玛科海", - "item.greekfantasy.minotaur_spawn_egg": "生成米诺陶诺斯", - "item.greekfantasy.naiad_spawn_egg": "生成那伊阿得斯", - "item.greekfantasy.nemean_lion_spawn_egg": "生成涅墨亚狮子", - "item.greekfantasy.orthus_spawn_egg": "生成奥特休斯", - "item.greekfantasy.pegasus_spawn_egg": "生成珀伽索斯", - "item.greekfantasy.python_spawn_egg": "生成毒蟒", - "item.greekfantasy.satyr_spawn_egg": "生成萨蒂尔", - "item.greekfantasy.shade_spawn_egg": "生成暗影", - "item.greekfantasy.siren_spawn_egg": "生成塞壬", - "item.greekfantasy.unicorn_spawn_egg": "生成独角兽", - "item.greekfantasy.whirl_spawn_egg": "生成旋涡", - "item.greekfantasy.achilles_helmet": "阿喀琉斯头盔", - "item.greekfantasy.achilles_chestplate": "阿喀琉斯胸甲", - "item.greekfantasy.achilles_leggings": "阿喀琉斯护腿", - "item.greekfantasy.achilles_boots": "阿喀琉斯靴子", - "item.greekfantasy.achilles_armor.tooltip": "阿喀琉斯之踵 +%1$s", - "item.greekfantasy.ambrosia": "仙馔密酒", - "item.greekfantasy.apollo_bow": "阿波罗之弓", - "item.greekfantasy.artemis_bow": "阿尔忒弥斯之弓", - "item.greekfantasy.bident": "双叉戟", - "item.greekfantasy.boar_ear": "野猪耳", - "item.greekfantasy.boar_tusk": "野猪獠牙", - "item.greekfantasy.bag_of_wind": "风之袋", - "item.greekfantasy.conch": "海螺", - "item.greekfantasy.avernal_hair": "诅咒之发", - "item.greekfantasy.avernal_bow": "诅咒之弓", - "item.greekfantasy.avernal_claw": "狗爪", - "item.greekfantasy.discus": "铁饼", - "item.greekfantasy.dragon_tooth": "龙牙", - "item.greekfantasy.avernal_wing": "烈焰蝙蝠翅膀", - "item.greekfantasy.ichor_infused_gear": "烈焰齿轮", - "item.greekfantasy.avernal_hide": "烈焰皮革", - "item.greekfantasy.flint_knife": "燧石小刀", - "item.greekfantasy.golden_ball": "金线球", - "item.greekfantasy.golden_bridle": "金拴绳", - "item.greekfantasy.golden_fleece": "金羊皮", - "item.greekfantasy.golden_string": "金线", - "item.greekfantasy.golden_lyre": "金里尔琴", - "item.greekfantasy.gorgon_blood": "蛇发女妖之血", - "item.greekfantasy.gorgon_blood.tooltip.heal": "有50%的几率治疗", - "item.greekfantasy.gorgon_blood.tooltip.poison": "有50%的几率中毒", + "item.greekfantasy.mad_cow_spawn_egg": "生成疯牛", + "item.greekfantasy.makhai_spawn_egg": "生成玛科海", + "item.greekfantasy.minotaur_spawn_egg": "生成米诺陶诺斯", + "item.greekfantasy.naiad_spawn_egg": "生成那伊阿得斯", + "item.greekfantasy.nemean_lion_spawn_egg": "生成涅墨亚狮子", + "item.greekfantasy.orthus_spawn_egg": "生成奥特休斯", + "item.greekfantasy.pegasus_spawn_egg": "生成珀伽索斯", + "item.greekfantasy.python_spawn_egg": "生成毒蟒", + "item.greekfantasy.satyr_spawn_egg": "生成萨蒂尔", + "item.greekfantasy.shade_spawn_egg": "生成暗影", + "item.greekfantasy.siren_spawn_egg": "生成塞壬", + "item.greekfantasy.stymphalian_spawn_egg": "生成斯廷法罗斯湖怪鸟", + "item.greekfantasy.triton_spawn_egg": "生成人鱼", + "item.greekfantasy.unicorn_spawn_egg": "生成独角兽", + "item.greekfantasy.whirl_spawn_egg": "生成旋涡", + "item.greekfantasy.ambrosia": "仙馔密酒", + "item.greekfantasy.apollo_bow": "阿波罗之弓", + "item.greekfantasy.artemis_bow": "阿尔忒弥斯之弓", + "item.greekfantasy.avernal_bow": "诅咒之弓", + "item.greekfantasy.avernal_claw": "狱焰之爪", + "item.greekfantasy.avernal_feather": "狱焰羽毛", + "item.greekfantasy.avernal_hair": "狱焰之发", + "item.greekfantasy.avernal_hide": "狱焰皮革", + "item.greekfantasy.avernal_shard": "狱焰碎片", + "item.greekfantasy.avernal_wing": "狱焰翅膀", + "item.greekfantasy.bag_of_wind": "风之袋", + "item.greekfantasy.bident": "双叉戟", + "item.greekfantasy.boar_ear": "野猪耳", + "item.greekfantasy.boar_tusk": "野猪獠牙", + "item.greekfantasy.bronze_bowl": "青铜碗", + "item.greekfantasy.bronze_coins": "青铜币", + "item.greekfantasy.bronze_cuirass": "青铜胸甲", + "item.greekfantasy.bronze_feather": "青铜羽毛", + "item.greekfantasy.bronze_feather.tooltip": "使用可投掷", + "item.greekfantasy.bronze_figurine": "青铜雕像", + "item.greekfantasy.bronze_goblet": "青铜酒杯", + "item.greekfantasy.bronze_helmet": "青铜头盔", + "item.greekfantasy.bronze_ingot": "青铜锭", + "item.greekfantasy.bronze_nugget": "青铜粒", + "item.greekfantasy.bronze_shield": "青铜盾牌", + "item.greekfantasy.bronze_vase": "青铜花瓶", + "item.greekfantasy.bronze_scrap.tooltip": "古代青铜碎片", + "item.greekfantasy.conch": "海螺", + "item.greekfantasy.deadly_fang": "致命毒牙", + "item.greekfantasy.diamond_spear": "钻石矛", + "item.greekfantasy.discus": "铁饼", + "item.greekfantasy.discus.tooltip": "使用可投掷", + "item.greekfantasy.dragon_tooth": "龙牙", + "item.greekfantasy.dragon_tooth.tooltip": "投掷以召唤地生人", + "item.greekfantasy.dragon_tooth_rod": "龙牙法杖", + "item.greekfantasy.flint_knife": "燧石小刀", + "item.greekfantasy.flint_spear": "燧石矛", + "item.greekfantasy.golden_ball": "金线球", + "item.greekfantasy.golden_bridle": "金拴绳", + "item.greekfantasy.golden_fleece": "金羊毛", + "item.greekfantasy.golden_lyre": "金七弦琴", + "item.greekfantasy.golden_spear": "金矛", + "item.greekfantasy.golden_string": "金线", + "item.greekfantasy.gorgon_blood": "蛇发女妖之血", + "item.greekfantasy.gorgon_blood.tooltip.heal": "50%几率治疗", + "item.greekfantasy.gorgon_blood.tooltip.poison": "50%几率中毒", "item.greekfantasy.greek_fire": "希腊火", - "item.greekfantasy.staff_of_healing": "治疗棒", - "item.greekfantasy.helm_of_darkness": "黑暗头盔", - "item.greekfantasy.horn": "号角", - "item.greekfantasy.horn_of_plenty": "丰盈号角", - "item.greekfantasy.ichor": "灵液", - "item.greekfantasy.iron_club": "铁棒", - "item.greekfantasy.iron_spear": "铁矛", - "item.greekfantasy.ivory_sword": "牙剑", - "item.greekfantasy.avernal_feather": "魔法羽毛", - "item.greekfantasy.mirror": "魔镜", - "item.greekfantasy.nemean_lion_hide": "涅墨亚狮子皮", + "item.greekfantasy.heart_of_talos": "塔罗斯之心", + "item.greekfantasy.hellenic_helmet": "希腊头盔", + "item.greekfantasy.hellenic_chestplate": "希腊胸甲", + "item.greekfantasy.hellenic_leggings": "希腊护腿", + "item.greekfantasy.hellenic_boots": "希腊靴子", + "item.greekfantasy.hellenic_armor.tooltip.resist": "抵抗来自正面的箭", + "item.greekfantasy.hellenic_armor.tooltip.weak": "阿喀琉斯之踵 - 背部箭矢易受伤", + "item.greekfantasy.helm_of_darkness": "黑暗头盔", + "item.greekfantasy.helm_of_darkness.tooltip": "授予完全隐身", + "item.greekfantasy.horn": "号角", + "item.greekfantasy.horn_of_plenty": "丰盈号角", + "item.greekfantasy.horn_of_plenty.tooltip": "使用以获得随机食物", + "item.greekfantasy.ichor": "灵液", + "item.greekfantasy.ichor_infused_gear": "灵液浸润齿轮", + "item.greekfantasy.iron_club": "铁棒", + "item.greekfantasy.iron_spear": "铁矛", + "item.greekfantasy.ivory_sword": "象牙剑", + "item.greekfantasy.mirror": "镜子", + "item.greekfantasy.nemean_lion_hide": "涅墨亚狮子皮", + "item.greekfantasy.nemean_lion_hide.tooltip": "免疫来自背后的箭", + "item.greekfantasy.netherite_spear": "下界合金矛", "item.greekfantasy.olives": "橄榄", "item.greekfantasy.olive_oil": "橄榄油", - "item.greekfantasy.panflute": "排笛", + "item.greekfantasy.olive_salve": "橄榄药膏", + "item.greekfantasy.olive_salve.tooltip": "%1$s . . . ?", + "item.greekfantasy.palladium": "守护神像", + "item.greekfantasy.panflute": "排笛", + "item.greekfantasy.pinecone": "松果", "item.greekfantasy.pomegranate": "石榴", - "item.greekfantasy.reeds": "芦苇", - "item.greekfantasy.olive_salve": "药膏", - "item.greekfantasy.deadly_fang": "蛇牙", - "item.greekfantasy.snakeskin": "蛇皮", - "item.greekfantasy.snakeskin_helmet": "蛇皮头盔", - "item.greekfantasy.snakeskin_chestplate": "蛇皮胸甲", - "item.greekfantasy.snakeskin_leggings": "蛇皮护腿", - "item.greekfantasy.snakeskin_boots": "蛇皮鞋子", + "item.greekfantasy.quest": "任务卷", + "item.greekfantasy.quest.tooltip": "使用可阅读", + "item.greekfantasy.reeds": "芦苇", + "item.greekfantasy.scylla_bone": "斯库拉之骨", + "item.greekfantasy.snakeskin": "蛇皮", + "item.greekfantasy.snakeskin_helmet": "蛇皮头盔", + "item.greekfantasy.snakeskin_chestplate": "蛇皮胸甲", + "item.greekfantasy.snakeskin_leggings": "蛇皮护腿", + "item.greekfantasy.snakeskin_boots": "蛇皮靴子", "item.greekfantasy.spider_banner_pattern": "旗帜图案", "item.greekfantasy.spider_banner_pattern.desc": "蜘蛛", - "item.greekfantasy.stone_club": "石棒", - "item.greekfantasy.stone_spear": "石矛", - "item.greekfantasy.avernal_shard": "幽暗碎片", - "item.greekfantasy.wand_of_circe": "变猪魔杖", - "item.greekfantasy.heart_of_talos": "塔罗斯之心", - "item.greekfantasy.thunderbolt": "雷电", - "item.greekfantasy.tough_snakeskin": "硬蛇皮", - "item.greekfantasy.unicorn_horn": "独角兽的角", + "item.greekfantasy.staff_of_healing": "治疗法杖", + "item.greekfantasy.stone_club": "石棒", + "item.greekfantasy.stone_spear": "石矛", + "item.greekfantasy.throwing_axe": "投掷斧", + "item.greekfantasy.thunderbolt": "雷霆", + "item.greekfantasy.thunderbolt.use.deny.rain": "必须在下雨时使用此物品", + "item.greekfantasy.thyrsus": "酒神杖", + "item.greekfantasy.thyrsus.tooltip": "用桶装满牛奶,用瓶子装满水", + "item.greekfantasy.tough_snakeskin": "坚韧蛇皮", + "item.greekfantasy.unicorn_horn": "独角兽角", + "item.greekfantasy.wand_of_circe": "喀耳刻魔杖", "item.greekfantasy.web_ball": "蜘蛛网团", - "item.greekfantasy.winged_sandals": "飞鞋", - "item.greekfantasy.wooden_club": "木棒", - "item.greekfantasy.wooden_lyre": "木里尔琴", - "item.greekfantasy.wooden_spear": "木矛", - "item.minecraft.potion.effect.mirroring": "镜像药水", - "item.minecraft.potion.effect.curse_of_circe": "变猪药水", - "item.minecraft.splash_potion.effect.mirror": "喷溅型镜像药水", - "item.minecraft.splash_potion.effect.curse_of_circe": "喷溅型变猪药水", - "item.minecraft.lingering_potion.effect.mirror": "滞留型镜像药水", - "item.minecraft.lingering_potion.effect.curse_of_circe": "滞留型变猪药水", - "item.minecraft.tipped_arrow.effect.mirror": "镜像之箭", - "item.minecraft.tipped_arrow.effect.curse_of_circe": "变猪之箭", - "item.tooltip.broken": "已损坏", - "item.tooltip.right_click_instrument": "右击选择歌曲", - "block.greekfantasy.cretan_stone": "克里特石头", - "block.greekfantasy.chiseled_cretan_stone": "錾制克里特石头", - "block.greekfantasy.cretan_stone_brick": "克里特石砖", - "block.greekfantasy.chiseled_cretan_stone_brick": "錾制克里特石砖", - "block.greekfantasy.cracked_cretan_stone_brick": "裂纹克里特石砖", - "block.greekfantasy.polished_cretan_stone": "磨制克里特石头", - "block.greekfantasy.cracked_polished_cretan_stone": "裂纹磨制克里特石头", - "block.greekfantasy.nest": "鹰身女妖巢穴", - "block.greekfantasy.olive_log": "橄榄原木", - "block.greekfantasy.olive_wood": "橄榄木", - "block.greekfantasy.olive_planks": "橄榄木板", - "block.greekfantasy.olive_slab": "橄榄木台阶", - "block.greekfantasy.olive_stairs": "橄榄木楼梯", + "item.greekfantasy.winged_sandals": "飞行鞋", + "item.greekfantasy.wooden_club": "木棒", + "item.greekfantasy.wooden_lyre": "木七弦琴", + "item.greekfantasy.wooden_spear": "木矛", + "item.minecraft.potion.effect.mirroring": "镜像药水", + "item.minecraft.potion.effect.long_mirroring": "镜像药水", + "item.minecraft.potion.effect.curse_of_circe": "喀耳刻诅咒药水", + "item.minecraft.potion.effect.long_curse_of_circe": "喀耳刻诅咒药水", + "item.minecraft.potion.effect.slow_swim": "缓慢游泳药水", + "item.minecraft.potion.effect.long_slow_swim": "缓慢游泳药水", + "item.minecraft.splash_potion.effect.mirroring": "喷溅型镜像药水", + "item.minecraft.splash_potion.effect.long_mirroring": "喷溅型镜像药水", + "item.minecraft.splash_potion.effect.curse_of_circe": "喷溅型喀耳刻诅咒药水", + "item.minecraft.splash_potion.effect.long_curse_of_circe": "喷溅型喀耳刻诅咒药水", + "item.minecraft.splash_potion.effect.slow_swim": "喷溅型缓慢游泳药水", + "item.minecraft.splash_potion.effect.long_slow_swim": "喷溅型缓慢游泳药水", + "item.minecraft.lingering_potion.effect.mirroring": "滞留型镜像药水", + "item.minecraft.lingering_potion.effect.long_mirroring": "滞留型镜像药水", + "item.minecraft.lingering_potion.effect.curse_of_circe": "滞留型喀耳刻诅咒药水", + "item.minecraft.lingering_potion.effect.long_curse_of_circe": "滞留型喀耳刻诅咒药水", + "item.minecraft.lingering_potion.effect.slow_swim": "滞留型缓慢游泳药水", + "item.minecraft.lingering_potion.effect.long_slow_swim": "滞留型缓慢游泳药水", + "item.minecraft.tipped_arrow.effect.mirroring": "镜像之箭", + "item.minecraft.tipped_arrow.effect.long_mirroring": "镜像之箭", + "item.minecraft.tipped_arrow.effect.curse_of_circe": "喀耳刻诅咒之箭", + "item.minecraft.tipped_arrow.effect.long_curse_of_circe": "喀耳刻诅咒之箭", + "item.minecraft.tipped_arrow.effect.slow_swim": "缓慢游泳之箭", + "item.minecraft.tipped_arrow.effect.long_slow_swim": "缓慢游泳之箭", + "item.tooltip.broken": "已损坏", + "item.tooltip.right_click_instrument": "使用可演奏", + "block.greekfantasy.bronze_block": "青铜块", + "block.greekfantasy.cretan_stone": "克里特石", + "block.greekfantasy.chiseled_cretan_stone": "錾制克里特石", + "block.greekfantasy.cretan_stone_brick": "克里特石砖", + "block.greekfantasy.chiseled_cretan_stone_brick": "錾制克里特石砖", + "block.greekfantasy.cracked_cretan_stone_brick": "裂纹克里特石砖", + "block.greekfantasy.polished_cretan_stone": "磨制克里特石", + "block.greekfantasy.cracked_polished_cretan_stone": "裂纹磨制克里特石", + "block.greekfantasy.nest": "鹰身女妖巢", "block.greekfantasy.olive_door": "橄榄木门", + "block.greekfantasy.olive_log": "橄榄原木", + "block.greekfantasy.olive_leaves": "橄榄树叶", + "block.greekfantasy.olive_oil": "橄榄油", + "block.greekfantasy.olive_planks": "橄榄木板", + "block.greekfantasy.olive_sapling": "橄榄树苗", + "block.greekfantasy.olive_slab": "橄榄木台阶", + "block.greekfantasy.olive_stairs": "橄榄木楼梯", "block.greekfantasy.olive_trapdoor": "橄榄木活板门", - "block.greekfantasy.olive_leaves": "橄榄树叶", - "block.greekfantasy.olive_sapling": "橄榄树苗", + "block.greekfantasy.olive_wood": "橄榄木", "block.greekfantasy.pomegranate_log": "石榴原木", "block.greekfantasy.pomegranate_wood": "石榴木", "block.greekfantasy.pomegranate_planks": "石榴木板", @@ -190,53 +251,55 @@ "block.greekfantasy.pomegranate_trapdoor": "石榴木活板门", "block.greekfantasy.pomegranate_leaves": "石榴树叶", "block.greekfantasy.pomegranate_sapling": "石榴树苗", - "block.greekfantasy.golden_leaves": "金苹果树树叶", - "block.greekfantasy.golden_sapling": "金苹果树树苗", - "block.greekfantasy.limestone_statue": "石灰石雕像", - "block.greekfantasy.marble_statue": "大理石雕像", - "block.greekfantasy.limestone": "石灰石", - "block.greekfantasy.limestone_slab": "石灰石台阶", - "block.greekfantasy.limestone_stairs": "石灰石楼梯", - "block.greekfantasy.polished_limestone": "磨制石灰石", - "block.greekfantasy.polished_limestone_slab": "磨制石灰石台阶", - "block.greekfantasy.polished_limestone_stairs": "磨制石灰石楼梯", - "block.greekfantasy.limestone_pillar": "石灰石柱", - "block.greekfantasy.marble": "大理石", - "block.greekfantasy.marble_slab": "大理石台阶", - "block.greekfantasy.marble_stairs": "大理石楼梯", - "block.greekfantasy.polished_marble": "磨制大理石", - "block.greekfantasy.polished_marble_slab": "磨制大理石台阶", - "block.greekfantasy.polished_marble_stairs": "磨制大理石楼梯", - "block.greekfantasy.marble_pillar": "大理石柱", - "block.greekfantasy.stripped_olive_log": "去皮橄榄木原木", - "block.greekfantasy.stripped_olive_wood": "去皮橄榄木", + "block.greekfantasy.golden_leaves": "金树叶", + "block.greekfantasy.golden_sapling": "金树苗", + "block.greekfantasy.golden_string": "金线", + "block.greekfantasy.ichor_infused_gearbox": "灵液浸润齿轮箱", + "block.greekfantasy.limestone_statue": "石灰石雕像", + "block.greekfantasy.marble_statue": "大理石雕像", + "block.greekfantasy.limestone": "石灰石", + "block.greekfantasy.limestone_slab": "石灰石台阶", + "block.greekfantasy.limestone_stairs": "石灰石楼梯", + "block.greekfantasy.polished_limestone": "磨制石灰石", + "block.greekfantasy.polished_limestone_slab": "磨制石灰石台阶", + "block.greekfantasy.polished_limestone_stairs": "磨制石灰石楼梯", + "block.greekfantasy.limestone_pillar": "石灰石柱", + "block.greekfantasy.marble": "大理石", + "block.greekfantasy.marble_slab": "大理石台阶", + "block.greekfantasy.marble_stairs": "大理石楼梯", + "block.greekfantasy.polished_marble": "磨制大理石", + "block.greekfantasy.polished_marble_slab": "磨制大理石台阶", + "block.greekfantasy.polished_marble_stairs": "磨制大理石楼梯", + "block.greekfantasy.marble_pillar": "大理石柱", + "block.greekfantasy.stripped_olive_log": "去皮橄榄原木", + "block.greekfantasy.stripped_olive_wood": "去皮橄榄木", "block.greekfantasy.stripped_pomegranate_log": "去皮石榴原木", "block.greekfantasy.stripped_pomegranate_wood": "去皮石榴木", - "block.greekfantasy.terracotta_vase": "陶瓦花瓶", - "block.greekfantasy.white_terracotta_vase": "白色陶瓦花瓶", - "block.greekfantasy.orange_terracotta_vase": "橙色陶瓦花瓶", - "block.greekfantasy.magenta_terracotta_vase": "品红色陶瓦花瓶", - "block.greekfantasy.light_blue_terracotta_vase": "淡蓝色陶瓦花瓶", - "block.greekfantasy.yellow_terracotta_vase": "黄色陶瓦花瓶", - "block.greekfantasy.lime_terracotta_vase": "黄绿色陶瓦花瓶", - "block.greekfantasy.pink_terracotta_vase": "粉红色陶瓦花瓶", - "block.greekfantasy.gray_terracotta_vase": "灰色陶瓦花瓶", - "block.greekfantasy.light_gray_terracotta_vase": "淡灰色陶瓦花瓶", - "block.greekfantasy.cyan_terracotta_vase": "青色陶瓦花瓶", - "block.greekfantasy.purple_terracotta_vase": "紫色陶瓦花瓶", - "block.greekfantasy.blue_terracotta_vase": "蓝色陶瓦花瓶", - "block.greekfantasy.brown_terracotta_vase": "棕色陶瓦花瓶", - "block.greekfantasy.green_terracotta_vase": "绿色陶瓦花瓶", - "block.greekfantasy.red_terracotta_vase": "红色陶瓦花瓶", - "block.greekfantasy.black_terracotta_vase": "黑色陶瓦花瓶", - "block.greekfantasy.mysterious_box": "神秘魔盒", - "block.greekfantasy.mysterious_box.tooltip": "Nescitur Ignescitur|未知即灾厄之源", + "block.greekfantasy.terracotta_vase": "陶瓦花瓶", + "block.greekfantasy.white_terracotta_vase": "白色陶瓦花瓶", + "block.greekfantasy.orange_terracotta_vase": "橙色陶瓦花瓶", + "block.greekfantasy.magenta_terracotta_vase": "品红色陶瓦花瓶", + "block.greekfantasy.light_blue_terracotta_vase": "淡蓝色陶瓦花瓶", + "block.greekfantasy.yellow_terracotta_vase": "黄色陶瓦花瓶", + "block.greekfantasy.lime_terracotta_vase": "黄绿色陶瓦花瓶", + "block.greekfantasy.pink_terracotta_vase": "粉红色陶瓦花瓶", + "block.greekfantasy.gray_terracotta_vase": "灰色陶瓦花瓶", + "block.greekfantasy.light_gray_terracotta_vase": "淡灰色陶瓦花瓶", + "block.greekfantasy.cyan_terracotta_vase": "青色陶瓦花瓶", + "block.greekfantasy.purple_terracotta_vase": "紫色陶瓦花瓶", + "block.greekfantasy.blue_terracotta_vase": "蓝色陶瓦花瓶", + "block.greekfantasy.brown_terracotta_vase": "棕色陶瓦花瓶", + "block.greekfantasy.green_terracotta_vase": "绿色陶瓦花瓶", + "block.greekfantasy.red_terracotta_vase": "红色陶瓦花瓶", + "block.greekfantasy.black_terracotta_vase": "黑色陶瓦花瓶", + "block.greekfantasy.mysterious_box": "神秘盒子", + "block.greekfantasy.mysterious_box.tooltip": "未知即灾厄之源", "block.greekfantasy.oil_lamp": "油灯", - "block.greekfantasy.reeds": "芦苇", - "block.greekfantasy.gigante_head": "巨人头颅", - "block.greekfantasy.orthus_head": "奥特休斯头颅", - "block.greekfantasy.cerberus_head": "刻耳柏洛斯头颅", - "block.greekfantasy.wild_rose": "野玫瑰", + "block.greekfantasy.reeds": "芦苇", + "block.greekfantasy.gigante_head": "巨人头颅", + "block.greekfantasy.orthus_head": "奥特休斯头颅", + "block.greekfantasy.cerberus_head": "刻耳柏洛斯头颅", + "block.greekfantasy.wild_rose": "野玫瑰", "block.minecraft.banner.greekfantasy.spider.white": "白色蜘蛛", "block.minecraft.banner.greekfantasy.spider.orange": "橙色蜘蛛", "block.minecraft.banner.greekfantasy.spider.magenta": "品红色蜘蛛", @@ -253,82 +316,134 @@ "block.minecraft.banner.greekfantasy.spider.green": "绿色蜘蛛", "block.minecraft.banner.greekfantasy.spider.red": "红色蜘蛛", "block.minecraft.banner.greekfantasy.spider.black": "黑色蜘蛛", - "effect.greekfantasy.stunned": "眩晕", - "effect.greekfantasy.petrified": "石化", - "effect.greekfantasy.mirroring": "镜像", - "effect.greekfantasy.curse_of_circe": "变猪诅咒", - "effect.greekfantasy.prisoner_of_hades": "地狱囚徒", - "enchantment.greekfantasy.hunting": "狩猎", - "enchantment.greekfantasy.hunting.description": "有几率秒杀大多数动物。", - "enchantment.greekfantasy.overstep": "逾越", - "enchantment.greekfantasy.overstep.description": "无需跳跃,立即踏上较高格方块。", - "enchantment.greekfantasy.smashing": "重击", - "enchantment.greekfantasy.smashing.description": "击晕攻击范围内的怪物。", - "enchantment.greekfantasy.mirroring": "镜像", - "enchantment.greekfantasy.mirroring.description": "免疫蛇发女妖的石化凝视。", - "enchantment.greekfantasy.poisoning": "剧毒", - "enchantment.greekfantasy.poisoning.description": "受伤时有几率给予攻击者中毒效果。", - "enchantment.greekfantasy.flying": "飞行", - "enchantment.greekfantasy.flying.description": "拥有高恩赐值的玩家可以飞行", - "enchantment.greekfantasy.lord_of_the_sea": "海洋霸主", - "enchantment.greekfantasy.lord_of_the_sea.description": "三叉戟可发出强力旋风", - "enchantment.greekfantasy.fireflash": "火花", - "enchantment.greekfantasy.fireflash.description": "雷电可产生爆炸", - "enchantment.greekfantasy.daybreak": "破晓", - "enchantment.greekfantasy.daybreak.description": "时钟可以将黑夜化为白昼", - "enchantment.greekfantasy.raising": "崛起", - "enchantment.greekfantasy.raising.description": "双叉戟可召唤出地生人", - "enchantment.greekfantasy.silkstep": "丝滑", - "enchantment.greekfantasy.silkstep.description": "可快速穿过蜘蛛网", - "enchantment.level.infinity": "\u221E", - "advancements.greekfantasy.root.title": "希腊幻想", - "advancements.greekfantasy.root.description": "探索希腊幻想模组 :)", - "advancements.greekfantasy.effect_petrified.title": "恐惧令我石化", - "advancements.greekfantasy.effect_petrified.description": "凝视戈耳工的可怕面容", - "advancements.greekfantasy.effect_pig.title": "哼", - "advancements.greekfantasy.effect_pig.description": "受到变猪诅咒", - "advancements.greekfantasy.attacked_by_cerastes.title": "流沙埋伏", - "advancements.greekfantasy.attacked_by_cerastes.description": "遇到从沙子里钻出来的角蝰", - "advancements.greekfantasy.summon_cerberus.title": "好多头", - "advancements.greekfantasy.summon_cerberus.description": "召唤会喷火的刻耳柏洛斯", - "advancements.greekfantasy.kill_cerberus.title": "「冥王哈迪斯」的猎犬", - "advancements.greekfantasy.kill_cerberus.description": "打败刻耳柏洛斯", - "advancements.greekfantasy.kill_harpy.title": "没有安全的巢穴", - "advancements.greekfantasy.kill_harpy.description": "杀死鹰身女妖", - "advancements.greekfantasy.summon_geryon.title": "三重麻烦", - "advancements.greekfantasy.summon_geryon.description": "召唤三头革律翁", - "advancements.greekfantasy.kill_geryon.title": "碎颅重击!", - "advancements.greekfantasy.kill_geryon.description": "打败革律翁", - "advancements.greekfantasy.summon_talos.title": "重金属", - "advancements.greekfantasy.summon_talos.description": "召唤厚颜无耻的塔罗斯", - "advancements.greekfantasy.kill_talos.title": "拔下铁钉", - "advancements.greekfantasy.kill_talos.description": "打败塔罗斯", - "advancements.greekfantasy.kill_charybdis.title": "好大的旋涡!", - "advancements.greekfantasy.kill_charybdis.description": "打败卡律布狄斯", - "advancements.greekfantasy.kill_shade.title": "我想你", - "advancements.greekfantasy.kill_shade.description": "打败暗影并取回你丢失的经验", - "advancements.greekfantasy.tame_unicorn.title": "没有彩虹", - "advancements.greekfantasy.tame_unicorn.description": "用黄金拴绳驯服独角兽", - "advancements.greekfantasy.obtain_winged_sandals.title": "飞一样的感觉!", - "advancements.greekfantasy.obtain_winged_sandals.description": "穿上飞鞋", - "advancements.greekfantasy.obtain_mysterious_box.title": "不要打开", - "advancements.greekfantasy.obtain_mysterious_box.description": "???", - "advancements.greekfantasy.place_pomegranate_sapling.title": "定时炸弹", - "advancements.greekfantasy.place_pomegranate_sapling.description": "在主世界种植石榴树", - "item.greekfantasy.thunderbolt.use.deny.rain": "只能在下雨时使用", - "gui.songs.title": "歌曲", - "song.augustin.name": "O du lieber Augustin", - "song.augustin.credits": "Traditional Austrian", - "song.greensleeves.name": "Greensleeves|绿袖子", - "song.greensleeves.credits": "Traditional English", - "song.korobeiniki.name": "Korobeiniki|货郎", - "song.korobeiniki.credits": "1861 Nikolay Nekrasov", - "song.lotr.name": "Lord of the Rings|指环王", - "song.lotr.credits": "2001 Howard Shore", - "song.sarias_song.name": "Saria's Song|莎莉亚之歌", - "song.sarias_song.credits": "1998 Koji Kondo", - "song.sound_of_silence.name": "The Sound of Silence|寂静之声", - "song.sound_of_silence.credits": "1964 Paul Simon", - "song.waltzing_matilda.name": "Waltzing Matilda|丛林流浪", - "song.waltzing_matilda.credits": "Traditional Australian" - } + "effect.greekfantasy.stunned": "眩晕", + "effect.greekfantasy.petrified": "石化", + "effect.greekfantasy.mirroring": "镜像", + "effect.greekfantasy.slow_swim": "缓慢游泳", + "effect.greekfantasy.curse_of_circe": "喀耳刻诅咒", + "effect.greekfantasy.prisoner_of_hades": "哈迪斯囚徒", + "enchantment.greekfantasy.bane_of_serpents": "蛇类克星", + "enchantment.greekfantasy.bane_of_serpents.description": "增加对蛇类生物的伤害。", + "enchantment.greekfantasy.hunting": "狩猎", + "enchantment.greekfantasy.hunting.description": "有几率秒杀大多数动物。", + "enchantment.greekfantasy.overstep": "逾越", + "enchantment.greekfantasy.overstep.description": "无需跳跃即可踏上方块。", + "enchantment.greekfantasy.smashing": "重击", + "enchantment.greekfantasy.smashing.description": "每次攻击眩晕成群怪物。", + "enchantment.greekfantasy.mirroring": "镜像", + "enchantment.greekfantasy.mirroring.description": "防御戈耳工的石化凝视。", + "enchantment.greekfantasy.poisoning": "剧毒", + "enchantment.greekfantasy.poisoning.description": "被击中时有几率毒化攻击者。", + "enchantment.greekfantasy.flying": "飞行", + "enchantment.greekfantasy.flying.description": "高恩赐值玩家可以飞行。", + "enchantment.greekfantasy.lord_of_the_sea": "海之主宰", + "enchantment.greekfantasy.lord_of_the_sea.description": "三叉戟召唤强大旋涡", + "enchantment.greekfantasy.fireflash": "焰闪", + "enchantment.greekfantasy.fireflash.description": "雷霆产生爆炸", + "enchantment.greekfantasy.daybreak": "破晓", + "enchantment.greekfantasy.daybreak.description": "时钟将夜晚变为白昼", + "enchantment.greekfantasy.raising": "复活", + "enchantment.greekfantasy.raising.description": "双叉戟召唤地生人", + "enchantment.greekfantasy.silkstep": "丝步", + "enchantment.greekfantasy.silkstep.description": "可穿行蜘蛛网", + "enchantment.level.infinity": "\u221E", + "advancements.greekfantasy.root.title": "希腊幻想", + "advancements.greekfantasy.root.description": "探索希腊幻想模组 :)", + "container.vase": "花瓶", + "screen.greekfantasy.controls.octave": "[滚轮] 改变八度", + "screen.greekfantasy.controls.songs": "[空格] 切换歌曲", + "song.augustin.name": "O du lieber Augustin", + "song.augustin.credits": "奥地利传统", + "song.greensleeves.name": "绿袖子", + "song.greensleeves.credits": "英国传统", + "song.korobeiniki.name": "货郎", + "song.korobeiniki.credits": "1861 尼古拉·涅克拉索夫", + "song.lotr.name": "指环王", + "song.lotr.credits": "2001 霍华德·肖", + "song.sarias_song.name": "莎莉亚之歌", + "song.sarias_song.credits": "1998 近藤浩治", + "song.sound_of_silence.name": "寂静之声", + "song.sound_of_silence.credits": "1964 保罗·西蒙", + "song.waltzing_matilda.name": "丛林流浪", + "song.waltzing_matilda.credits": "澳大利亚传统", + "quest.greekfantasy.craft_bronze_ingot": "任务:打造青铜锭", + "quest.greekfantasy.craft_bronze_ingot.line1": "青铜是珍贵的材料,但我们缺乏生产资源。", + "quest.greekfantasy.craft_bronze_ingot.line2": "只能通过熔炼古代遗物获得。", + "quest.greekfantasy.kill_arachne": "任务:击杀阿拉克涅", + "quest.greekfantasy.kill_arachne.line1": "蜘蛛女王躲藏在地下某处。", + "quest.greekfantasy.kill_arachne.line2": "击败她,隐藏的宝藏将属于你。", + "quest.greekfantasy.kill_cretan_minotaur": "任务:击杀克里特米诺陶诺斯", + "quest.greekfantasy.kill_cretan_minotaur.line1": "很久以前,一只牛形怪兽被封印在迷宫中。无数冒险者迷失其中。", + "quest.greekfantasy.kill_cretan_minotaur.line2": "找到并击杀克里特米诺陶诺斯,为大地带来和平!", + "quest.greekfantasy.kill_cretan_minotaur.line3": "迷宫危险重重,但据说金线球可以帮助你。", + "quest.greekfantasy.kill_hydra": "任务:击杀九头蛇", + "quest.greekfantasy.kill_hydra.line1": "任务似乎不可能...砍掉1个头会长出2个!", + "quest.greekfantasy.kill_hydra.line2": "然而,据说在砍掉头颅前烧灼可以封住伤口...", + "quest.greekfantasy.kill_circe": "任务:击杀喀耳刻", + "quest.greekfantasy.kill_circe.line1": "女巫喀耳刻把人变成猪。必须阻止她!", + "quest.greekfantasy.kill_circe.line2": "她的魔杖似乎是力量之源。", + "quest.greekfantasy.kill_medusa": "任务:击杀美杜莎", + "quest.greekfantasy.kill_medusa.line1": "美杜莎是最可怕的戈耳工。", + "quest.greekfantasy.kill_medusa.line2": "避免她凝视的唯一方法是持有镜子,或者附魔盾牌?", + "quest.greekfantasy.summon_automaton": "任务:召唤自动机", + "quest.greekfantasy.summon_automaton.line1": "忠诚守卫会杀死靠近的任何怪物。", + "quest.greekfantasy.summon_automaton.line2": "将青铜块放在灵液浸润齿轮箱上即可创造。", + "quest.greekfantasy.summon_arion": "任务:召唤阿里翁", + "quest.greekfantasy.summon_arion.line1": "传说金马速度如太阳!", + "quest.greekfantasy.summon_arion.line2": "给马喂食附魔金苹果即可召唤。", + "quest.greekfantasy.summon_bronze_bull": "任务:摧毁青铜牛", + "quest.greekfantasy.summon_bronze_bull.line1": "巨大发条牛正在狂暴!", + "quest.greekfantasy.summon_bronze_bull.line2": "放置2x2x2铜块立方体,顶层两侧各放一个青铜块即可召唤。", + "quest.greekfantasy.summon_bronze_bull.line3": "金属身躯保护它免受任何箭矢。", + "quest.greekfantasy.summon_cerberus": "任务:召唤并击杀刻耳柏洛斯", + "quest.greekfantasy.summon_cerberus.line1": "冥界猎犬必须被击败。", + "quest.greekfantasy.summon_cerberus.line2": "用黑石建造4x4框架,中心放岩浆,召唤怪兽。", + "quest.greekfantasy.summon_cerberus.line3": "最后,将奥特休斯头颅扔进岩浆。", + "quest.greekfantasy.summon_cerberus.line4": "如果你活下来,可能会找到狱焰皮革的用途。", + "quest.greekfantasy.summon_charybdis": "任务:召唤并击杀卡律布狄斯", + "quest.greekfantasy.summon_charybdis.line1": "海怪夺走了太多生命。", + "quest.greekfantasy.summon_charybdis.line2": "将海洋之心投入旋涡的隐形大口即可召唤。", + "quest.greekfantasy.summon_charybdis.line3": "腹中的海螺有很多用途。", + "quest.greekfantasy.summon_geryon": "任务:召唤并击杀革律翁", + "quest.greekfantasy.summon_geryon.line1": "三头巨人必须被阻止!", + "quest.greekfantasy.summon_geryon.line2": "放置3个巨人头颅,在附近杀死一头牛召唤他。", + "quest.greekfantasy.summon_geryon.line3": "小心他的疯牛群...", + "quest.greekfantasy.summon_giant_boar": "任务:召唤并击杀巨型野猪", + "quest.greekfantasy.summon_giant_boar.line1": "这只危险怪物只能被英雄击杀。", + "quest.greekfantasy.summon_giant_boar.line2": "引诱疣猪到主世界并喂食毒马铃薯即可召唤。", + "quest.greekfantasy.summon_golden_ram": "任务:召唤金羊", + "quest.greekfantasy.summon_golden_ram.line1": "奇妙生物有纯金羊毛!", + "quest.greekfantasy.summon_golden_ram.line2": "给黄色羊喂食龙息即可召唤。", + "quest.greekfantasy.summon_golden_ram.line3": "羊毛可作为战利品收集,或许有其他用途?", + "quest.greekfantasy.summon_nemean_lion": "任务:召唤并击杀涅墨亚狮子", + "quest.greekfantasy.summon_nemean_lion.line1": "小心这只食人怪兽!箭矢无法穿透其皮毛。", + "quest.greekfantasy.summon_nemean_lion.line2": "在洞穴中找到,或给豹猫喝力量药水并用闪电击中召唤。", + "quest.greekfantasy.summon_nemean_lion.line3": "据说专业摔跤手可以击败野兽。", + "quest.greekfantasy.summon_scylla": "任务:召唤并击杀斯库拉", + "quest.greekfantasy.summon_scylla.line1": "曾是美丽海洋仙女,被喀耳刻诅咒成可怕怪物。", + "quest.greekfantasy.summon_scylla.line2": "龙首攻击如闪电,水魔法危险。", + "quest.greekfantasy.summon_scylla.line3": "解放大海,消灭她的恐惧!", + "quest.greekfantasy.summon_talos": "任务:阻止暴走塔罗斯", + "quest.greekfantasy.summon_talos.line1": "灵液浸润守卫已疯狂。", + "quest.greekfantasy.summon_talos.line2": "排成一线放置3个铜块,上方再放3个,顶部中间放青铜块即可召唤。", + "quest.greekfantasy.summon_talos.line3": "回收它的心脏 - 以后可能有用。", + "quest.greekfantasy.tame_pegasus": "任务:驯服珀伽索斯", + "quest.greekfantasy.tame_pegasus.line1": "这只雄伟生物可以翱翔云端。", + "quest.greekfantasy.tame_pegasus.line2": "只能在持有金拴绳时驯服。", + "quest.greekfantasy.tame_unicorn": "任务:驯服独角兽", + "quest.greekfantasy.tame_unicorn.line1": "独角兽角可治愈任何疾病,许多人无情猎杀它。", + "quest.greekfantasy.tame_unicorn.line2": "只能在持有金拴绳时驯服。", + "quest.greekfantasy.trade_with_centaur": "任务:与半人马交易", + "quest.greekfantasy.trade_with_centaur.line1": "有多余的纸吗?", + "quest.greekfantasy.trade_with_centaur.line2": "给半人马,他可能会为你写一个任务。", + "quest.greekfantasy.trade_with_elpis": "任务:与厄尔庇斯交易", + "quest.greekfantasy.trade_with_elpis.line1": "打开神秘盒子可能会出现希望之灵厄尔庇斯。", + "quest.greekfantasy.trade_with_elpis.line2": "给她钻石,她可能会回礼。", + "quest.greekfantasy.trade_with_nymph": "任务:与仙女交易", + "quest.greekfantasy.trade_with_nymph.line1": "森林树妖喜爱新种子和植物。", + "quest.greekfantasy.trade_with_nymph.line2": "提供物品,可能会收到好东西!", + "quest.greekfantasy.trade_with_nymph.line3": "冥界拉姆帕德斯也喜欢交易。", + "quest.greekfantasy.trade_with_triton": "任务:与人鱼交易", + "quest.greekfantasy.trade_with_triton.line1": "人鱼愿意用紫水晶碎片交易。", + "quest.greekfantasy.trade_with_triton.line2": "在海洋村庄寻找友好的民众。" +} diff --git a/src/main/resources/data/greekfantasy/forge/structure_modifier/modify_shipwreck.json b/src/main/resources/data/greekfantasy/forge/structure_modifier/modify_shipwreck.json index e93c88c7..9497b2e7 100644 --- a/src/main/resources/data/greekfantasy/forge/structure_modifier/modify_shipwreck.json +++ b/src/main/resources/data/greekfantasy/forge/structure_modifier/modify_shipwreck.json @@ -3,9 +3,9 @@ "category": "monster", "spawn": { "type": "greekfantasy:siren", - "minCount": -2, + "minCount": 1, "maxCount": 1, "weight": 10 }, "structures": "minecraft:shipwreck" -} \ No newline at end of file +}