Skip to content

Commit

Permalink
Updated to Minecraft 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Adubbz committed Dec 17, 2023
1 parent d0365ff commit 22ffc2d
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 29 deletions.
27 changes: 11 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "net.minecraftforge.gradle" version "6.0.+"
id "net.minecraftforge.gradle" version "6.+"
id "org.spongepowered.mixin" version "0.7-SNAPSHOT"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
Expand Down Expand Up @@ -53,33 +53,18 @@ minecraft {
args "-mixin.config=${mod_id}.mixins.json"
ideaModule "${project.name}.main"
taskName 'Client'
mods {
modClientRun {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
args "-mixin.config=${mod_id}.mixins.json"
ideaModule "${project.name}.main"
taskName 'Server'
mods {
modServerRun {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
ideaModule "${project.name}.main"
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), "-mixin.config=${mod_id}.mixins.json"
taskName 'Data'
mods {
modDataRun {
source sourceSets.main
}
}
}
}
}
Expand All @@ -99,6 +84,16 @@ sourceSets {
}
}

// Merge the resources and classes into the same directory.
// This is done because java expects modules to be in a single directory.
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
sourceSets.each {
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
}

dependencies {
minecraft 'net.minecraftforge:forge:' + minecraft_version + '-' + forge_version
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ mod_curseforge_id=291874
mod_modrinth_id=serene-seasons

# Dependencies
minecraft_version=1.20.2
forge_version=48.0.1
minecraft_version=1.20.4
forge_version=49.0.3
8 changes: 8 additions & 0 deletions src/main/java/sereneseasons/block/SeasonSensorBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
******************************************************************************/
package sereneseasons.block;

import com.mojang.serialization.MapCodec;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.*;
Expand Down Expand Up @@ -32,6 +33,7 @@

public class SeasonSensorBlock extends BaseEntityBlock
{
public static final MapCodec<SeasonSensorBlock> CODEC = simpleCodec(SeasonSensorBlock::new);
public static final IntegerProperty POWER = BlockStateProperties.POWER;
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D);
public static final IntegerProperty SEASON = IntegerProperty.create("season", 0, 3);
Expand All @@ -42,6 +44,12 @@ public SeasonSensorBlock(Properties properties)
this.registerDefaultState(this.stateDefinition.any().setValue(POWER, 0).setValue(SEASON, 0));
}

@Override
protected MapCodec<? extends BaseEntityBlock> codec()
{
return CODEC;
}

@Override
public VoxelShape getShape(BlockState state, BlockGetter reader, BlockPos pos, CollisionContext selectionContext)
{
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/sereneseasons/command/CommandGetSeason.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package sereneseasons.command;

import com.mojang.brigadier.builder.ArgumentBuilder;
import net.minecraft.commands.CommandRuntimeException;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
Expand All @@ -28,7 +27,7 @@ public class CommandGetSeason
});
}

private static int getSeason(CommandSourceStack cs, Level world) throws CommandRuntimeException
private static int getSeason(CommandSourceStack cs, Level world)
{
SeasonSavedData seasonData = SeasonHandler.getSeasonSavedData(world);
SeasonTime time = new SeasonTime(seasonData.seasonCycleTicks);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/sereneseasons/command/CommandSetSeason.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package sereneseasons.command;

import com.mojang.brigadier.builder.ArgumentBuilder;
import net.minecraft.commands.CommandRuntimeException;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
Expand All @@ -30,7 +29,7 @@ public class CommandSetSeason
}));
}

private static int setSeason(CommandSourceStack cs, Level world, Season.SubSeason season) throws CommandRuntimeException
private static int setSeason(CommandSourceStack cs, Level world, Season.SubSeason season)
{
if (season != null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sereneseasons/mixin/MixinServerLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@Mixin(ServerLevel.class)
public class MixinServerLevel
{
@Redirect(method="tickIceAndSnow", at=@At(value = "INVOKE", target = "Lnet/minecraft/world/level/biome/Biome;getPrecipitationAt(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/biome/Biome$Precipitation;"))
@Redirect(method="tickPrecipitation", at=@At(value = "INVOKE", target = "Lnet/minecraft/world/level/biome/Biome;getPrecipitationAt(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/biome/Biome$Precipitation;"))
public Biome.Precipitation tickIceAndSnow_getPrecipitationAt(Biome biome, BlockPos pos)
{
return SeasonHooks.getPrecipitationAtTickIceAndSnowHook((LevelReader)this, biome, pos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"minecraft:grass_block",
"minecraft:moss_block",
"minecraft:rooted_dirt",
"minecraft:grass",
"minecraft:short_grass",
"minecraft:fern",
"minecraft:wheat",
"minecraft:pumpkin_stem",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"minecraft:grass_block",
"minecraft:moss_block",
"minecraft:rooted_dirt",
"minecraft:grass",
"minecraft:short_grass",
"minecraft:fern",
"minecraft:bamboo",
"minecraft:bamboo_sapling",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"minecraft:grass_block",
"minecraft:moss_block",
"minecraft:rooted_dirt",
"minecraft:grass",
"minecraft:short_grass",
"minecraft:fern",
"minecraft:bamboo",
"minecraft:bamboo_sapling",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"minecraft:grass_block",
"minecraft:moss_block",
"minecraft:rooted_dirt",
"minecraft:grass",
"minecraft:short_grass",
"minecraft:fern",
"minecraft:wheat_seeds",
"minecraft:pumpkin_seeds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"minecraft:grass_block",
"minecraft:moss_block",
"minecraft:rooted_dirt",
"minecraft:grass",
"minecraft:short_grass",
"minecraft:fern",
"minecraft:bamboo",
"minecraft:carrot",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"minecraft:grass_block",
"minecraft:moss_block",
"minecraft:rooted_dirt",
"minecraft:grass",
"minecraft:short_grass",
"minecraft:fern",
"minecraft:bamboo",
"minecraft:cactus",
Expand Down

0 comments on commit 22ffc2d

Please sign in to comment.