Skip to content

Commit

Permalink
Fix mixin error with the holder and apply env annotations that were b…
Browse files Browse the repository at this point in the history
…reaking servers while missing
  • Loading branch information
Bennyboy1695 committed Jun 28, 2024
1 parent 56bd0ca commit d963403
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.3.7 - 2024-06-28

### Fixed

- Fixed crash issue on servers related to BlockColors

## 1.3.6 - 2024-06-27

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.simibubi.create.content.decoration.copycat.CopycatBlock;
import com.simibubi.create.content.decoration.copycat.CopycatModel;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
import net.minecraft.client.color.block.BlockColor;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -252,10 +254,12 @@ default boolean shouldFaceAlwaysRender(BlockState state, Direction face) {
return false;
}

@Environment(EnvType.CLIENT)
static BlockColor wrappedColor() {
return new WrappedBlockColor();
}

@Environment(EnvType.CLIENT)
static class WrappedBlockColor implements BlockColor {

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


import com.copycatsplus.copycats.CCCatVariants;
import com.copycatsplus.copycats.fabric.mixin.HolderReferenceInvoker;
import com.copycatsplus.copycats.fabric.mixin_interfaces.HolderReferenceAccessor;
import com.simibubi.create.foundation.utility.Pair;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
Expand All @@ -15,7 +15,7 @@ public static void register() {
for (Pair<Holder.Reference<CatVariant>, ResourceLocation> entry : ENTRIES) {
CatVariant value = new CatVariant(entry.getSecond());
Registry.register(BuiltInRegistries.CAT_VARIANT, entry.getFirst().key().location().toString(), value);
((HolderReferenceInvoker) entry.getFirst()).callBindValue(value);
((HolderReferenceAccessor) entry.getFirst()).copycats$bindValue(value);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.copycatsplus.copycats.fabric.mixin;

import com.copycatsplus.copycats.fabric.mixin_interfaces.HolderReferenceAccessor;
import net.minecraft.core.Holder;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Mixin(Holder.Reference.class)
public abstract class HolderReferenceMixin implements HolderReferenceAccessor {

@Shadow abstract <T> void bindValue(T value);

@Override
public <T> void copycats$bindValue(T value) {
this.bindValue(value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.copycatsplus.copycats.fabric.mixin_interfaces;

public interface HolderReferenceAccessor {

<T> void copycats$bindValue(T value);
}
2 changes: 1 addition & 1 deletion fabric/src/main/resources/copycats-fabric.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"plugin": "com.copycatsplus.copycats.mixin.MixinPlugin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"HolderReferenceInvoker",
"HolderReferenceMixin",
"compat.registrate.CreateRegistrateMixin",
"copycat.base.functional.FunctionalCopycatBlockMixin",
"copycat.base.multistate.MultiStateCopycatBlockCombinerMixin"
Expand Down
6 changes: 3 additions & 3 deletions update.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"homepage": "https://github.com/copycats-plus/copycats/",
"promos": {
"1.20.1-recommended": "1.20.1-1.3.6",
"1.19.2-recommended": "1.19.2-1.3.6",
"1.18.2-recommended": "1.18.2-1.3.6"
"1.20.1-recommended": "1.20.1-1.3.7",
"1.19.2-recommended": "1.19.2-1.3.7",
"1.18.2-recommended": "1.18.2-1.3.7"
}
}

0 comments on commit d963403

Please sign in to comment.