mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-29 00:32:18 +00:00
fix: mixins
This commit is contained in:
parent
a7a9f4fa13
commit
86aecd945e
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
package dan200.computercraft.api.client;
|
package dan200.computercraft.api.client;
|
||||||
|
|
||||||
import dan200.computercraft.fabric.mixin.AffineTransformationAccess;
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
@ -16,6 +15,7 @@ import net.minecraft.client.util.ModelIdentifier;
|
|||||||
import net.minecraft.util.math.AffineTransformation;
|
import net.minecraft.util.math.AffineTransformation;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.Vec3f;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -73,22 +73,14 @@ public final class TransformedModel
|
|||||||
{
|
{
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
|
|
||||||
AffineTransformationAccess access = (AffineTransformationAccess) (Object) matrix;
|
Vec3f translation = matrix.getTranslation();
|
||||||
if( access.getTranslation() != null )
|
matrixStack.translate( translation.getX(), translation.getY(), translation.getZ() );
|
||||||
{
|
|
||||||
matrixStack.translate( access.getTranslation().getX(), access.getTranslation().getY(), access.getTranslation().getZ() );
|
|
||||||
}
|
|
||||||
|
|
||||||
matrixStack.multiply( matrix.getRotation2() );
|
matrixStack.multiply( matrix.getRotation2() );
|
||||||
|
|
||||||
if( access.getScale() != null )
|
Vec3f scale = matrix.getScale();
|
||||||
{
|
matrixStack.scale( scale.getX(), scale.getY(), scale.getZ() );
|
||||||
matrixStack.scale( access.getScale().getX(), access.getScale().getY(), access.getScale().getZ() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( access.getRotation1() != null )
|
matrixStack.multiply( matrix.getRotation1() );
|
||||||
{
|
|
||||||
matrixStack.multiply( access.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;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@Mixin( GameRenderer.class )
|
@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 )
|
@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
|
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.
|
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
|
||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.media.items;
|
package dan200.computercraft.shared.media.items;
|
||||||
|
|
||||||
import dan200.computercraft.api.media.IMedia;
|
import dan200.computercraft.api.media.IMedia;
|
||||||
import dan200.computercraft.fabric.mixin.MusicDiscItemAccessor;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.MusicDiscItem;
|
import net.minecraft.item.MusicDiscItem;
|
||||||
@ -53,6 +51,6 @@ public final class RecordMedia implements IMedia
|
|||||||
{
|
{
|
||||||
return null;
|
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 )
|
public static void sendToAllTracking( NetworkMessage packet, WorldChunk chunk )
|
||||||
{
|
{
|
||||||
// maybe bug with worlds
|
|
||||||
for( PlayerEntity player : chunk.getWorld().getPlayers() )
|
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 ) ) );
|
((ServerPlayerEntity) player).networkHandler.sendPacket( new CustomPayloadS2CPacket( ID, encode( packet ) ) );
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
package dan200.computercraft.shared.network.client;
|
package dan200.computercraft.shared.network.client;
|
||||||
|
|
||||||
import dan200.computercraft.fabric.mixin.SoundEventAccess;
|
|
||||||
import dan200.computercraft.shared.network.NetworkMessage;
|
import dan200.computercraft.shared.network.NetworkMessage;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
@ -74,7 +73,7 @@ public class PlayRecordClientMessage implements NetworkMessage
|
|||||||
{
|
{
|
||||||
buf.writeBoolean( true );
|
buf.writeBoolean( true );
|
||||||
buf.writeString( name );
|
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.LuaException;
|
||||||
import dan200.computercraft.api.lua.LuaFunction;
|
import dan200.computercraft.api.lua.LuaFunction;
|
||||||
import dan200.computercraft.api.peripheral.IPeripheral;
|
import dan200.computercraft.api.peripheral.IPeripheral;
|
||||||
import dan200.computercraft.fabric.mixin.SoundEventAccess;
|
|
||||||
import dan200.computercraft.shared.network.NetworkHandler;
|
import dan200.computercraft.shared.network.NetworkHandler;
|
||||||
import dan200.computercraft.shared.network.client.SpeakerMoveClientMessage;
|
import dan200.computercraft.shared.network.client.SpeakerMoveClientMessage;
|
||||||
import dan200.computercraft.shared.network.client.SpeakerPlayClientMessage;
|
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
|
// If the resource location for note block notes changes, this method call will need to be updated
|
||||||
boolean success = playSound( context,
|
boolean success = playSound( context,
|
||||||
((SoundEventAccess) instrument.getSound()).getId(),
|
instrument.getSound().getId(),
|
||||||
volume,
|
volume,
|
||||||
(float) Math.pow( 2.0, (pitch - 12.0) / 12.0 ),
|
(float) Math.pow( 2.0, (pitch - 12.0) / 12.0 ),
|
||||||
true );
|
true );
|
||||||
|
@ -6,25 +6,21 @@
|
|||||||
"MinecraftServerAccess",
|
"MinecraftServerAccess",
|
||||||
"MixinBlock",
|
"MixinBlock",
|
||||||
"MixinEntity",
|
"MixinEntity",
|
||||||
"MixinBlockEntity",
|
|
||||||
"MixinServerWorld",
|
"MixinServerWorld",
|
||||||
"MixinWorld",
|
"MixinWorld",
|
||||||
"SignBlockEntityAccess",
|
"SignBlockEntityAccess",
|
||||||
"SoundEventAccess",
|
|
||||||
"WorldSavePathAccess",
|
"WorldSavePathAccess",
|
||||||
"MixinServerPlayerInteractionManager",
|
"MixinServerPlayerInteractionManager",
|
||||||
"MusicDiscItemAccessor",
|
|
||||||
"GameRendererMixin",
|
|
||||||
"MixinMatrix4f"
|
"MixinMatrix4f"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"AffineTransformationAccess",
|
|
||||||
"ChatHudAccess",
|
"ChatHudAccess",
|
||||||
"HeldItemRendererAccess",
|
"HeldItemRendererAccess",
|
||||||
"MixinHeldItemRenderer",
|
"MixinHeldItemRenderer",
|
||||||
"MixinItemFrameEntityRenderer",
|
"MixinItemFrameEntityRenderer",
|
||||||
"MixinMinecraftClient",
|
"MixinMinecraftClient",
|
||||||
"MixinScreen",
|
"MixinScreen",
|
||||||
|
"MixinGameRenderer",
|
||||||
"MixinWorldRenderer"
|
"MixinWorldRenderer"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user