Skip to content

Commit

Permalink
Merge pull request #163 from lanAnderson/1.20.2
Browse files Browse the repository at this point in the history
Port to 1.20.2
  • Loading branch information
lucaargolo authored Sep 27, 2024
2 parents b039f40 + 887ae39 commit e7acc28
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ modrinth_version=2.8.7
github_api_version=1.314

# Mod Properties
mod_version=2.4-BETA+1.20
mod_version=2.4-BETA+1.20.2
maven_group=io.github.lucaargolo

# Fabric Properties
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.16.5

# Fabric API
fabric_version=0.92.2+1.20.1
fabric_version=0.91.6+1.20.2

#Libraries
modmenu_version=7.2.2
rei_version=12.1.780
modmenu_version=8.0.1
rei_version=13.1.773

#Publishing
curseforge_id=413523
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/github/lucaargolo/seasons/FabricSeasons.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ public static boolean isMeltable(BlockPos blockPos) {
}

public static PlacedMeltablesState getPlacedMeltablesState(ServerWorld world) {
return world.getPersistentStateManager().getOrCreate(PlacedMeltablesState::createFromNbt, PlacedMeltablesState::new, "seasons_placed_meltables");
return world.getPersistentStateManager().getOrCreate(PlacedMeltablesState.type, "seasons_placed_meltables");
}

public static ReplacedMeltablesState getReplacedMeltablesState(ServerWorld world) {
return world.getPersistentStateManager().getOrCreate(ReplacedMeltablesState::createFromNbt, ReplacedMeltablesState::new, "seasons_replaced_meltables");
return world.getPersistentStateManager().getOrCreate(ReplacedMeltablesState.type, "seasons_replaced_meltables");
}

public static long getTimeToNextSeason(World world) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,25 @@ protected ServerWorldMixin(MutableWorldProperties properties, RegistryKey<World>
super(properties, registryRef, registryManager, dimensionEntry, profiler, isClient, debugWorld, biomeAccess, maxChainedNeighborUpdates);
}

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z", ordinal = 0), method = "tickChunk", locals = LocalCapture.CAPTURE_FAILSOFT)
public void setMeltableIce(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci, ChunkPos chunkPos, boolean bl, int i, int j, Profiler profiler, BlockPos blockPos, BlockPos blockPos2, Biome biome) {
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z", ordinal = 0), method = "tickIceAndSnow", locals = LocalCapture.CAPTURE_FAILSOFT)
public void setMeltableIce(boolean raining, BlockPos pos, CallbackInfo ci, BlockPos blockPos, BlockPos blockPos2, Biome biome) {
FabricSeasons.setMeltable(blockPos2);
}

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z", ordinal = 1), method = "tickChunk", locals = LocalCapture.CAPTURE_FAILSOFT)
public void setMeltableLayeredSnow(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci, ChunkPos chunkPos, boolean bl, int i, int j, Profiler profiler, BlockPos blockPos, BlockPos blockPos2, Biome biome) {
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z", ordinal = 1), method = "tickIceAndSnow", locals = LocalCapture.CAPTURE_FAILSOFT)
public void setMeltableLayeredSnow(boolean raining, BlockPos pos, CallbackInfo ci, BlockPos blockPos, BlockPos blockPos2, Biome biome) {
FabricSeasons.setMeltable(blockPos);
}

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z", ordinal = 2), method = "tickChunk", locals = LocalCapture.CAPTURE_FAILSOFT)
public void setMeltableSnow(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci, ChunkPos chunkPos, boolean bl, int i, int j, Profiler profiler, BlockPos blockPos, BlockPos blockPos2, Biome biome) {
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z", ordinal = 2), method = "tickIceAndSnow", locals = LocalCapture.CAPTURE_FAILSOFT)
public void setMeltableSnow(boolean raining, BlockPos pos, CallbackInfo ci, BlockPos blockPos, BlockPos blockPos2, Biome biome) {
FabricSeasons.setMeltable(blockPos);
}

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;precipitationTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/biome/Biome$Precipitation;)V"), method = "tickChunk", locals = LocalCapture.CAPTURE_FAILSOFT)
public void setReplacedMeltable(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci, ChunkPos chunkPos, boolean bl, int i, int j, Profiler profiler, BlockPos blockPos, BlockPos blockPos2, Biome biome, int k, Biome.Precipitation precipitation, BlockState blockState3) {
if (FabricSeasons.CONFIG.shouldSnowReplaceVegetation())

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;precipitationTick(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/biome/Biome$Precipitation;)V"), method = "tickIceAndSnow", locals = LocalCapture.CAPTURE_FAILSOFT)
public void setReplacedMeltable(boolean raining, BlockPos pos, CallbackInfo ci, BlockPos blockPos, BlockPos blockPos2, Biome biome, int k, Biome.Precipitation precipitation, BlockState blockState3) {
if (FabricSeasons.CONFIG.shouldSnowReplaceVegetation())
Meltable.replaceBlockOnSnow((ServerWorld) (Object) this, blockPos, biome);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,10 @@ public static PlacedMeltablesState createFromNbt(NbtCompound nbt) {
});
return state;
}

public static Type<PlacedMeltablesState> type = new Type<>(
PlacedMeltablesState::new,
PlacedMeltablesState::createFromNbt,
null
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,10 @@ public static ReplacedMeltablesState createFromNbt(NbtCompound nbt) {
});
return state;
}

public static Type<ReplacedMeltablesState> type = new Type<>(
ReplacedMeltablesState::new,
ReplacedMeltablesState::createFromNbt,
null
);
}

0 comments on commit e7acc28

Please sign in to comment.