From 922a26dd9541d16b8a02ad28f6d54dd442053281 Mon Sep 17 00:00:00 2001 From: gnembon Date: Tue, 7 Jun 2022 18:19:46 +0200 Subject: [PATCH] 1.19 --- gradle.properties | 12 ++++++------ .../behaviors/MusicDiscDispenserBehavior.java | 2 +- .../java/carpetextra/helpers/CustomSpawnLists.java | 6 +++--- .../mixins/CactusBlock_fertilizerMixin.java | 6 +++--- .../mixins/DispenserBlock_fallingBlockMixin.java | 7 +++---- .../java/carpetextra/mixins/FallingBlockMixin.java | 4 ++-- .../mixins/LilyPadBlock_fertilizerMixin.java | 6 +++--- .../java/carpetextra/mixins/StrayEntityMixin.java | 10 ++++++++-- .../mixins/SugarCaneBlock_fertilizerMixin.java | 6 +++--- 9 files changed, 32 insertions(+), 27 deletions(-) diff --git a/gradle.properties b/gradle.properties index 187a8490..6bf6e38b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use or https://modmuss50.me/fabric.html - minecraft_version=22w19a - yarn_mappings=22w19a+build.1 - loader_version=0.14.5 + minecraft_version=1.19 + yarn_mappings=1.19+build.1 + loader_version=0.14.6 # check available versions on maven for the given minecraft version you are using - carpet_core_version=1.4.75+v220513 + carpet_core_version=1.4.79+v220607 # Mod Properties - mod_version = 1.4.75 + mod_version = 1.4.79 maven_group = carpet-extra archives_base_name = carpet-extra @@ -22,7 +22,7 @@ org.gradle.jvmargs=-Xmx1G # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # This is needed because CF uses too vague names for prereleases and release candidates # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] - release-curse-versions = Minecraft 1.19:1.19-Snapshot + release-curse-versions = Minecraft 1.19:1.19 # Whether or not to build another branch on release release-extra-branch = false # The name of the second branch to release diff --git a/src/main/java/carpetextra/dispenser/behaviors/MusicDiscDispenserBehavior.java b/src/main/java/carpetextra/dispenser/behaviors/MusicDiscDispenserBehavior.java index a7b24726..c2f198bf 100644 --- a/src/main/java/carpetextra/dispenser/behaviors/MusicDiscDispenserBehavior.java +++ b/src/main/java/carpetextra/dispenser/behaviors/MusicDiscDispenserBehavior.java @@ -29,7 +29,7 @@ protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) { ItemStack jukeboxItem = ((JukeboxBlockEntity) frontBlockEntity).getRecord(); // set record - ((JukeboxBlock) frontBlock).setRecord(world, frontBlockPos, frontBlockState, stack); + ((JukeboxBlock) frontBlock).setRecord(null, world, frontBlockPos, frontBlockState, stack); // play music world.syncWorldEvent(1010, frontBlockPos, Item.getRawId(stack.getItem())); diff --git a/src/main/java/carpetextra/helpers/CustomSpawnLists.java b/src/main/java/carpetextra/helpers/CustomSpawnLists.java index df6bd96f..5e5ddadd 100644 --- a/src/main/java/carpetextra/helpers/CustomSpawnLists.java +++ b/src/main/java/carpetextra/helpers/CustomSpawnLists.java @@ -7,15 +7,15 @@ import net.minecraft.util.collection.Pool; import net.minecraft.world.StructureSpawns; import net.minecraft.world.biome.SpawnSettings; -import net.minecraft.world.gen.structure.StructureTypeKeys; +import net.minecraft.world.gen.structure.StructureKeys; public class CustomSpawnLists { public static void addExtraSpawnRules() { - SpawnOverrides.addOverride(() -> CarpetExtraSettings.straySpawningInIgloos, SpawnGroup.MONSTER, StructureTypeKeys.IGLOO, + SpawnOverrides.addOverride(() -> CarpetExtraSettings.straySpawningInIgloos, SpawnGroup.MONSTER, StructureKeys.IGLOO, StructureSpawns.BoundingBox.STRUCTURE, Pool.of(new SpawnSettings.SpawnEntry(EntityType.STRAY, 1, 1, 1))); - SpawnOverrides.addOverride(() -> CarpetExtraSettings.creeperSpawningInJungleTemples, SpawnGroup.MONSTER, StructureTypeKeys.JUNGLE_PYRAMID, + SpawnOverrides.addOverride(() -> CarpetExtraSettings.creeperSpawningInJungleTemples, SpawnGroup.MONSTER, StructureKeys.JUNGLE_PYRAMID, StructureSpawns.BoundingBox.STRUCTURE, Pool.of(new SpawnSettings.SpawnEntry(EntityType.CREEPER, 1, 1, 1))); } } diff --git a/src/main/java/carpetextra/mixins/CactusBlock_fertilizerMixin.java b/src/main/java/carpetextra/mixins/CactusBlock_fertilizerMixin.java index cfe5b8b1..d31a106e 100644 --- a/src/main/java/carpetextra/mixins/CactusBlock_fertilizerMixin.java +++ b/src/main/java/carpetextra/mixins/CactusBlock_fertilizerMixin.java @@ -7,9 +7,9 @@ import net.minecraft.block.Fertilizable; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockView; import net.minecraft.world.World; -import net.minecraft.util.math.random.AbstractRandom; import org.spongepowered.asm.mixin.Mixin; @Mixin(CactusBlock.class) @@ -24,13 +24,13 @@ public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, b } @Override - public boolean canGrow(World world, AbstractRandom random, BlockPos pos, BlockState state) + public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { return true; } @Override - public void grow(ServerWorld world, AbstractRandom random, BlockPos pos, BlockState state) + public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { int i = this.countCactusAbove(world, pos); BlockPos growPos = pos.up(i + 1); diff --git a/src/main/java/carpetextra/mixins/DispenserBlock_fallingBlockMixin.java b/src/main/java/carpetextra/mixins/DispenserBlock_fallingBlockMixin.java index 837766bc..e10238f3 100644 --- a/src/main/java/carpetextra/mixins/DispenserBlock_fallingBlockMixin.java +++ b/src/main/java/carpetextra/mixins/DispenserBlock_fallingBlockMixin.java @@ -12,7 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.AbstractRandom; +import net.minecraft.util.math.random.Random; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -43,12 +43,11 @@ private void createFallingBlockWithVelocity(World world, BlockPos pos, BlockStat } @Inject( - method = "scheduledTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/server/world/ServerWorld;" + - "Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/AbstractRandom;)V", + method = "scheduledTick", at = @At("HEAD"), cancellable = true ) - public void onScheduledTick(BlockState state, ServerWorld world, BlockPos pos, AbstractRandom rand, CallbackInfo ci) { + public void onScheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random rand, CallbackInfo ci) { if (CarpetExtraSettings.fallingBlockDispensers) { Direction direction = state.get(DispenserBlock.FACING); BlockPos facingPos = pos.offset(direction); diff --git a/src/main/java/carpetextra/mixins/FallingBlockMixin.java b/src/main/java/carpetextra/mixins/FallingBlockMixin.java index 13be39cb..87c406bc 100644 --- a/src/main/java/carpetextra/mixins/FallingBlockMixin.java +++ b/src/main/java/carpetextra/mixins/FallingBlockMixin.java @@ -9,7 +9,7 @@ import net.minecraft.entity.FallingBlockEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.AbstractRandom; +import net.minecraft.util.math.random.Random; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -34,7 +34,7 @@ public FallingBlockMixin(Settings block$Settings_1) @SuppressWarnings("ConstantConditions") @Inject(method = "scheduledTick", at = @At("HEAD"), cancellable = true) - private void onTryStartFalling(BlockState blockState_1, ServerWorld serverWorld_1, BlockPos blockPos_1, AbstractRandom random_1, CallbackInfo ci) + private void onTryStartFalling(BlockState state, ServerWorld serverWorld_1, BlockPos blockPos_1, Random random, CallbackInfo ci) { if (CarpetExtraSettings.dragonEggBedrockBreaking && (FallingBlock)(Object)this instanceof DragonEggBlock) { diff --git a/src/main/java/carpetextra/mixins/LilyPadBlock_fertilizerMixin.java b/src/main/java/carpetextra/mixins/LilyPadBlock_fertilizerMixin.java index c29bd1cd..105f197f 100644 --- a/src/main/java/carpetextra/mixins/LilyPadBlock_fertilizerMixin.java +++ b/src/main/java/carpetextra/mixins/LilyPadBlock_fertilizerMixin.java @@ -7,9 +7,9 @@ import net.minecraft.block.LilyPadBlock; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockView; import net.minecraft.world.World; -import net.minecraft.util.math.random.AbstractRandom; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -23,13 +23,13 @@ public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, b } @Override - public boolean canGrow(World world, AbstractRandom random, BlockPos pos, BlockState state) + public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { return true; } @Override - public void grow(ServerWorld world, AbstractRandom random, BlockPos pos, BlockState state) + public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { if(!CarpetExtraSettings.betterBonemeal) return; BlockState blockState = Blocks.LILY_PAD.getDefaultState(); diff --git a/src/main/java/carpetextra/mixins/StrayEntityMixin.java b/src/main/java/carpetextra/mixins/StrayEntityMixin.java index fdda9f83..80ad35c0 100644 --- a/src/main/java/carpetextra/mixins/StrayEntityMixin.java +++ b/src/main/java/carpetextra/mixins/StrayEntityMixin.java @@ -4,8 +4,10 @@ import net.minecraft.entity.mob.StrayEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.Registry; import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.gen.structure.StructureTypes; +import net.minecraft.world.gen.structure.Structure; +import net.minecraft.world.gen.structure.StructureKeys; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -17,7 +19,11 @@ public abstract class StrayEntityMixin @Redirect(method = "canSpawn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/ServerWorldAccess;isSkyVisible(Lnet/minecraft/util/math/BlockPos;)Z")) private static boolean isSkylightOrIglooVisible(ServerWorldAccess serverWorldAccess, BlockPos pos) { + if (!CarpetExtraSettings.straySpawningInIgloos) { + return serverWorldAccess.isSkyVisible(pos); + } + Structure structure = serverWorldAccess.getRegistryManager().get(Registry.STRUCTURE_KEY).get(StructureKeys.IGLOO); return serverWorldAccess.isSkyVisible(pos) || - (CarpetExtraSettings.straySpawningInIgloos && (((ServerWorld)serverWorldAccess).getStructureAccessor().getStructureAt(pos, StructureTypes.IGLOO.value()).hasChildren())); + ((ServerWorld)serverWorldAccess).getStructureAccessor().getStructureAt(pos,structure).hasChildren(); } } diff --git a/src/main/java/carpetextra/mixins/SugarCaneBlock_fertilizerMixin.java b/src/main/java/carpetextra/mixins/SugarCaneBlock_fertilizerMixin.java index f78a6666..b1cdc419 100644 --- a/src/main/java/carpetextra/mixins/SugarCaneBlock_fertilizerMixin.java +++ b/src/main/java/carpetextra/mixins/SugarCaneBlock_fertilizerMixin.java @@ -4,9 +4,9 @@ import net.minecraft.block.*; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockView; import net.minecraft.world.World; -import net.minecraft.util.math.random.AbstractRandom; import org.spongepowered.asm.mixin.Mixin; @Mixin(SugarCaneBlock.class) @@ -21,13 +21,13 @@ public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, b } @Override - public boolean canGrow(World world, AbstractRandom random, BlockPos pos, BlockState state) + public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { return true; } @Override - public void grow(ServerWorld world, AbstractRandom random, BlockPos pos, BlockState state) + public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { int i = this.countSugarCaneAbove(world, pos); world.setBlockState(pos.up(i + 1), Blocks.SUGAR_CANE.getDefaultState());