Skip to content

Commit

Permalink
Chore: Merge dev/1.21.0 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kd8lvt committed Nov 5, 2024
1 parent 7ae83ca commit 4e76838
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 61 deletions.
17 changes: 16 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GrUnresolvedAccess
plugins { //Incredibly annoying I can't offload this block to a non-build.gradle file :(
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
//Required for versioning.gradle - not loaded if not needed
id 'org.ajoberstar.grgit' version '5.3.0' apply false
}

sourceSets {
loom.mixin.add(main, "exclusionzone.refmap.json")
}

repositories {
maven { url 'https://maven.fallenbreath.me/releases' }
}

dependencies {
modImplementation 'me.fallenbreath:conditional-mixin-fabric:0.6.3'

// Suggested, to bundle it into your mod jar. Choose a method your build system provides
include 'me.fallenbreath:conditional-mixin-fabric:0.6.3'
}

//Feel free to download these .gradle files and inspect them :)

//Preset to build for Java 21 using Yarn, and output a sources jar on build.
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21
yarn_mappings=1.21+build.9
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.9

# Fabric API
fabric_version=0.102.0+1.21
fabric_version=0.107.0+1.21.1

# Mod Properties
mod_version=1.0.7
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class Enderweed extends CropBlock {
public Enderweed() {
super(Block.Settings.create().mapColor(MapColor.DARK_GREEN).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP).pistonBehavior(PistonBehavior.DESTROY).notSolid().nonOpaque());
super(Settings.create().mapColor(MapColor.DARK_GREEN).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP).pistonBehavior(PistonBehavior.DESTROY).notSolid().nonOpaque());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class DispenserCloneBase extends DispenserBlock implements BlockEntityPro
@SuppressWarnings("unused")
Identifier id;
public DispenserCloneBase(Identifier id, Text interfaceName) {
super(Block.Settings.copy(Blocks.DISPENSER));
super(Settings.copy(Blocks.DISPENSER));
displayName=interfaceName;
this.id = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
public class Artifact extends Item implements IHasResearchNotes {
public final List<Text> tt = new ArrayList<>();
public Artifact() {
this(new net.minecraft.item.Item.Settings());
this(new Settings());
}
public Artifact(Item.Settings settings) {super(settings);}
public Artifact(Settings settings) {super(settings);}

@Override
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class BlockItemArtifact extends AliasedBlockItem implements IHasResearchNotes {
public final List<Text> tt = new ArrayList<>();
public BlockItemArtifact(Block block) {
super(block,new net.minecraft.item.Item.Settings());
super(block,new Settings());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

public class EdibleArtifact extends Artifact {
public EdibleArtifact(FoodComponent foodComponent) {
super(new net.minecraft.item.Item.Settings().food(foodComponent));
super(new Settings().food(foodComponent));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class PersonaMonosword extends PersonaWeapon {
public PersonaMonosword() {
super(new PersonaMonoswordMaterial(), new net.minecraft.item.Item.Settings().attributeModifiers(SwordItem.createAttributeModifiers(new PersonaMonoswordMaterial(),2,-2.2f)));
super(new PersonaMonoswordMaterial(), new Settings().attributeModifiers(SwordItem.createAttributeModifiers(new PersonaMonoswordMaterial(),2,-2.2f)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
public class PersonaWeapon extends SwordItem {
boolean isHeld = false;
@SuppressWarnings("unchecked")
private static final ComponentType<List<Identifier>> TRAITS_COMPONENT = (net.minecraft.component.ComponentType<List<Identifier>>) ModDataComponents.get("persona_weapon_traits");
private static final ComponentType<List<Identifier>> TRAITS_COMPONENT = (ComponentType<List<Identifier>>) ModDataComponents.get("persona_weapon_traits");
@Nullable
final Integer prevDamage = this.getComponents().get(DataComponentTypes.DAMAGE);
public PersonaWeapon(ToolMaterial toolMaterial, net.minecraft.item.Item.Settings settings) {
public PersonaWeapon(ToolMaterial toolMaterial, Settings settings) {
super(toolMaterial, settings);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Ingredient getRepairIngredient() {
}
};

private static final net.minecraft.item.Item.Settings settings = new net.minecraft.item.Item.Settings();
private static final Settings settings = new Settings();
public Glasscutter() {
super(material, settings);
settings.recipeRemainder(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class LoggingAxe extends AxeItem implements IHasResearchNotes {
public LoggingAxe() {
super(
Glasscutter.material,
new net.minecraft.item.Item.Settings()
new Settings()
.rarity(Rarity.UNCOMMON)
.component(DataComponentTypes.TOOL,new ToolComponent(BREAK_RULES,2,1))
.customDamage((stack, amount, entity, slot, breakCallback) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Magnet extends Artifact {
@SuppressWarnings("unchecked")
private static final ComponentType<? super Boolean> ENABLED_COMPONENT = (ComponentType<? super Boolean>) ModDataComponents.get("enabled");
public Magnet(int range) {
super(new net.minecraft.item.Item.Settings().rarity(Rarity.UNCOMMON).component(ENABLED_COMPONENT,false).maxCount(1));
super(new Settings().rarity(Rarity.UNCOMMON).component(ENABLED_COMPONENT,false).maxCount(1));
this.range = range;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class VoidTear extends Item implements IHasResearchNotes {
Text.literal("Shift-right click to enable/disable auto-absorb.")
);
public VoidTear() {
super(new net.minecraft.item.Item.Settings().component(STORED_ITEMS_COMPONENT,NbtComponent.of(DEFAULT_STORED_ITEMS)).component(ENABLED_COMPONENT,false));
super(new Settings().component(STORED_ITEMS_COMPONENT,NbtComponent.of(DEFAULT_STORED_ITEMS)).component(ENABLED_COMPONENT,false));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.kd8lvt.exclusionzone.mixin;

import me.fallenbreath.conditionalmixin.api.annotation.Condition;
import me.fallenbreath.conditionalmixin.api.annotation.Restriction;
import net.minecraft.block.BlockState;
import net.minecraft.block.BrushableBlock;
import net.minecraft.block.entity.BlockEntity;
Expand All @@ -10,6 +12,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(BlockEntity.class)
@Restriction(conflict={@Condition(type= Condition.Type.MOD,value="minecraft",versionPredicates = {"1.21"})})
public abstract class BlockEntityMixin {
@Inject(at=@At("HEAD"),method="supports",cancellable = true)
private void exclusionzone$supports(BlockState state, CallbackInfoReturnable<Boolean> cir) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
package com.kd8lvt.exclusionzone.mixin;

import net.minecraft.MinecraftVersion;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
import me.fallenbreath.conditionalmixin.api.mixin.RestrictiveMixinConfigPlugin;

import java.util.List;
import java.util.Set;

public class MixinConfigPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {}

public class MixinConfigPlugin extends RestrictiveMixinConfigPlugin {
@Override
public String getRefMapperConfig() {
return "";
}

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
if (mixinClassName.equals("com.kd8lvt.exclusionzone.mixin.BlockEntityMixin") && MinecraftVersion.CURRENT.getName().equals("1.21")) return false;
return true;
}

@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {

Expand All @@ -32,14 +20,4 @@ public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
public List<String> getMixins() {
return List.of();
}

@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}

@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}
}
3 changes: 2 additions & 1 deletion src/main/resources/exclusionzone.mixins.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"required": true,
"package": "com.kd8lvt.exclusionzone.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"plugin": "com.kd8lvt.exclusionzone.mixin.MixinConfigPlugin",
"refmap": "exclusionzone.refmap.json",
"mixins": [
"BlockEntityMixin",
"LivingEntityMixin",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
],
"depends": {
"fabricloader": ">=0.14.24",
"minecraft": ">=1.21 <=1.21",
"minecraft": ">=1.21 <=1.21.1",
"java": ">=17",
"fabric-api": "*"
},
Expand Down

0 comments on commit 4e76838

Please sign in to comment.