mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-10-31 21:52:59 +00:00 
			
		
		
		
	fix: mixins
This commit is contained in:
		| @@ -6,7 +6,6 @@ | ||||
|  | ||||
| package dan200.computercraft.api.client; | ||||
|  | ||||
| import dan200.computercraft.fabric.mixin.AffineTransformationAccess; | ||||
| import net.fabricmc.api.EnvType; | ||||
| import net.fabricmc.api.Environment; | ||||
| import net.minecraft.client.MinecraftClient; | ||||
| @@ -16,6 +15,7 @@ import net.minecraft.client.util.ModelIdentifier; | ||||
| import net.minecraft.util.math.AffineTransformation; | ||||
| import net.minecraft.client.util.math.MatrixStack; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.util.math.Vec3f; | ||||
|  | ||||
| import javax.annotation.Nonnull; | ||||
| import java.util.Objects; | ||||
| @@ -73,22 +73,14 @@ public final class TransformedModel | ||||
|     { | ||||
|         matrixStack.push(); | ||||
|  | ||||
|         AffineTransformationAccess access = (AffineTransformationAccess) (Object) matrix; | ||||
|         if( access.getTranslation() != null ) | ||||
|         { | ||||
|             matrixStack.translate( access.getTranslation().getX(), access.getTranslation().getY(), access.getTranslation().getZ() ); | ||||
|         } | ||||
|         Vec3f translation = matrix.getTranslation(); | ||||
|         matrixStack.translate( translation.getX(), translation.getY(), translation.getZ() ); | ||||
|  | ||||
|         matrixStack.multiply( matrix.getRotation2() ); | ||||
|  | ||||
|         if( access.getScale() != null ) | ||||
|         { | ||||
|             matrixStack.scale( access.getScale().getX(), access.getScale().getY(), access.getScale().getZ() ); | ||||
|         } | ||||
|         Vec3f scale = matrix.getScale(); | ||||
|         matrixStack.scale( scale.getX(), scale.getY(), scale.getZ() ); | ||||
|  | ||||
|         if( access.getRotation1() != null ) | ||||
|         { | ||||
|             matrixStack.multiply( access.getRotation1() ); | ||||
|         } | ||||
|         matrixStack.multiply( matrix.getRotation1() ); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,25 +0,0 @@ | ||||
| /* | ||||
|  * This file is part of ComputerCraft - http://www.computercraft.info | ||||
|  * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. | ||||
|  * Send enquiries to dratcliffe@gmail.com | ||||
|  */ | ||||
| package dan200.computercraft.fabric.mixin; | ||||
|  | ||||
| import net.minecraft.util.math.AffineTransformation; | ||||
| import net.minecraft.util.math.Vec3f; | ||||
| import net.minecraft.util.math.Quaternion; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
| import org.spongepowered.asm.mixin.gen.Accessor; | ||||
|  | ||||
| @Mixin( AffineTransformation.class ) | ||||
| public interface AffineTransformationAccess | ||||
| { | ||||
|     @Accessor | ||||
|     Vec3f getTranslation(); | ||||
|  | ||||
|     @Accessor | ||||
|     Vec3f getScale(); | ||||
|  | ||||
|     @Accessor | ||||
|     Quaternion getRotation1(); | ||||
| } | ||||
| @@ -1,28 +0,0 @@ | ||||
| /* | ||||
|  * This file is part of ComputerCraft - http://www.computercraft.info | ||||
|  * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. | ||||
|  * Send enquiries to dratcliffe@gmail.com | ||||
|  */ | ||||
| package dan200.computercraft.fabric.mixin; | ||||
|  | ||||
| import org.spongepowered.asm.mixin.Final; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
| import org.spongepowered.asm.mixin.Mutable; | ||||
| import org.spongepowered.asm.mixin.Shadow; | ||||
|  | ||||
| import net.minecraft.block.entity.BlockEntity; | ||||
| import net.minecraft.util.math.BlockPos; | ||||
|  | ||||
| @Mixin( BlockEntity.class ) | ||||
| public class MixinBlockEntity | ||||
| { | ||||
|     @Final | ||||
|     @Mutable | ||||
|     @Shadow | ||||
|     protected BlockPos pos; | ||||
|  | ||||
|     public void setBlockPos( BlockPos pos ) | ||||
|     { | ||||
|         this.pos = pos; | ||||
|     } | ||||
| } | ||||
| @@ -24,9 +24,8 @@ import java.util.List; | ||||
| import java.util.function.Consumer; | ||||
| 
 | ||||
| @Mixin( GameRenderer.class ) | ||||
| public class GameRendererMixin | ||||
| public class MixinGameRenderer | ||||
| { | ||||
|     @SuppressWarnings( "UnresolvedMixinReference" ) | ||||
|     @Inject( method = "loadShaders", at = @At( value = "INVOKE_ASSIGN", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 53 ), locals = LocalCapture.CAPTURE_FAILSOFT ) | ||||
|     private void loadShaders( ResourceManager manager, CallbackInfo info, List<Program> list, List<Pair<Shader, Consumer<Shader>>> list2 ) throws IOException | ||||
|     { | ||||
| @@ -1,18 +0,0 @@ | ||||
| /* | ||||
|  * This file is part of ComputerCraft - http://www.computercraft.info | ||||
|  * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. | ||||
|  * Send enquiries to dratcliffe@gmail.com | ||||
|  */ | ||||
| package dan200.computercraft.fabric.mixin; | ||||
|  | ||||
| import net.minecraft.item.MusicDiscItem; | ||||
| import net.minecraft.sound.SoundEvent; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
| import org.spongepowered.asm.mixin.gen.Accessor; | ||||
|  | ||||
| @Mixin( MusicDiscItem.class ) | ||||
| public interface MusicDiscItemAccessor | ||||
| { | ||||
|     @Accessor | ||||
|     SoundEvent getSound(); | ||||
| } | ||||
| @@ -1,18 +0,0 @@ | ||||
| /* | ||||
|  * This file is part of ComputerCraft - http://www.computercraft.info | ||||
|  * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. | ||||
|  * Send enquiries to dratcliffe@gmail.com | ||||
|  */ | ||||
| package dan200.computercraft.fabric.mixin; | ||||
|  | ||||
| import net.minecraft.sound.SoundEvent; | ||||
| import net.minecraft.util.Identifier; | ||||
| import org.spongepowered.asm.mixin.Mixin; | ||||
| import org.spongepowered.asm.mixin.gen.Accessor; | ||||
|  | ||||
| @Mixin( SoundEvent.class ) | ||||
| public interface SoundEventAccess | ||||
| { | ||||
|     @Accessor | ||||
|     Identifier getId(); | ||||
| } | ||||
| @@ -3,11 +3,9 @@ | ||||
|  * Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission. | ||||
|  * Send enquiries to dratcliffe@gmail.com | ||||
|  */ | ||||
|  | ||||
| package dan200.computercraft.shared.media.items; | ||||
|  | ||||
| import dan200.computercraft.api.media.IMedia; | ||||
| import dan200.computercraft.fabric.mixin.MusicDiscItemAccessor; | ||||
| import net.minecraft.item.Item; | ||||
| import net.minecraft.item.ItemStack; | ||||
| import net.minecraft.item.MusicDiscItem; | ||||
| @@ -53,6 +51,6 @@ public final class RecordMedia implements IMedia | ||||
|         { | ||||
|             return null; | ||||
|         } | ||||
|         return ((MusicDiscItemAccessor) item).getSound(); | ||||
|         return ((MusicDiscItem) item).getSound(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -152,10 +152,9 @@ public final class NetworkHandler | ||||
|  | ||||
|     public static void sendToAllTracking( NetworkMessage packet, WorldChunk chunk ) | ||||
|     { | ||||
|         // maybe bug with worlds | ||||
|         for( PlayerEntity player : chunk.getWorld().getPlayers() ) | ||||
|         { | ||||
|             if ( player.getChunkPos().equals( chunk.getPos() ) ) | ||||
|             if ( chunk.getWorld().getRegistryKey().getValue() == player.getEntityWorld().getRegistryKey().getValue() && player.getChunkPos().equals( chunk.getPos() ) ) | ||||
|             { | ||||
|                 ((ServerPlayerEntity) player).networkHandler.sendPacket( new CustomPayloadS2CPacket( ID, encode( packet ) ) ); | ||||
|             } | ||||
|   | ||||
| @@ -6,7 +6,6 @@ | ||||
|  | ||||
| package dan200.computercraft.shared.network.client; | ||||
|  | ||||
| import dan200.computercraft.fabric.mixin.SoundEventAccess; | ||||
| import dan200.computercraft.shared.network.NetworkMessage; | ||||
| import net.fabricmc.api.EnvType; | ||||
| import net.fabricmc.api.Environment; | ||||
| @@ -74,7 +73,7 @@ public class PlayRecordClientMessage implements NetworkMessage | ||||
|         { | ||||
|             buf.writeBoolean( true ); | ||||
|             buf.writeString( name ); | ||||
|             buf.writeIdentifier( ((SoundEventAccess) soundEvent).getId() ); | ||||
|             buf.writeIdentifier( soundEvent.getId() ); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -11,7 +11,6 @@ import dan200.computercraft.api.lua.ILuaContext; | ||||
| import dan200.computercraft.api.lua.LuaException; | ||||
| import dan200.computercraft.api.lua.LuaFunction; | ||||
| import dan200.computercraft.api.peripheral.IPeripheral; | ||||
| import dan200.computercraft.fabric.mixin.SoundEventAccess; | ||||
| import dan200.computercraft.shared.network.NetworkHandler; | ||||
| import dan200.computercraft.shared.network.client.SpeakerMoveClientMessage; | ||||
| import dan200.computercraft.shared.network.client.SpeakerPlayClientMessage; | ||||
| @@ -206,7 +205,7 @@ public abstract class SpeakerPeripheral implements IPeripheral | ||||
|  | ||||
|         // If the resource location for note block notes changes, this method call will need to be updated | ||||
|         boolean success = playSound( context, | ||||
|             ((SoundEventAccess) instrument.getSound()).getId(), | ||||
|             instrument.getSound().getId(), | ||||
|             volume, | ||||
|             (float) Math.pow( 2.0, (pitch - 12.0) / 12.0 ), | ||||
|             true ); | ||||
|   | ||||
| @@ -6,25 +6,21 @@ | ||||
|         "MinecraftServerAccess", | ||||
|         "MixinBlock", | ||||
|         "MixinEntity", | ||||
|         "MixinBlockEntity", | ||||
|         "MixinServerWorld", | ||||
|         "MixinWorld", | ||||
|         "SignBlockEntityAccess", | ||||
|         "SoundEventAccess", | ||||
|         "WorldSavePathAccess", | ||||
|         "MixinServerPlayerInteractionManager", | ||||
|         "MusicDiscItemAccessor", | ||||
|         "GameRendererMixin", | ||||
|         "MixinMatrix4f" | ||||
|     ], | ||||
|     "client": [ | ||||
|         "AffineTransformationAccess", | ||||
|         "ChatHudAccess", | ||||
|         "HeldItemRendererAccess", | ||||
|         "MixinHeldItemRenderer", | ||||
|         "MixinItemFrameEntityRenderer", | ||||
|         "MixinMinecraftClient", | ||||
|         "MixinScreen", | ||||
|         "MixinGameRenderer", | ||||
|         "MixinWorldRenderer" | ||||
|     ], | ||||
|     "server": [ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Nikita Savyolov
					Nikita Savyolov