-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compatibility with new beta Lithium 0.14.x. Old releases of lithi…
…um should work as is
- Loading branch information
Showing
8 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
polymer-core/src/main/java/eu/pb4/polymer/core/mixin/compat/lithium14_BlockPaletteMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package eu.pb4.polymer.core.mixin.compat; | ||
|
||
import eu.pb4.polymer.core.api.block.PolymerBlockUtils; | ||
import eu.pb4.polymer.core.api.utils.PolymerUtils; | ||
import eu.pb4.polymer.core.impl.client.InternalClientRegistry; | ||
import net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.util.collection.IndexedIterable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Pseudo | ||
@Mixin(value = LithiumHashPalette.class, priority = 500) | ||
public class lithium14_BlockPaletteMixin { | ||
@ModifyArg(method = {"writePacket", "getPacketSize" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/util/collection/IndexedIterable;getRawId(Ljava/lang/Object;)I")) | ||
public Object polymer$getIdRedirect(Object object) { | ||
if (object instanceof BlockState blockState) { | ||
return PolymerBlockUtils.getPolymerBlockState(blockState, PolymerUtils.getPlayerContext()); | ||
} | ||
return object; | ||
} | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Redirect(method = "readPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/collection/IndexedIterable;get(I)Ljava/lang/Object;"), require = 0) | ||
private Object polymer$replaceState(IndexedIterable<?> instance, int index) { | ||
return InternalClientRegistry.decodeRegistry(instance, index); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters