1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 08:42:17 +00:00

Refactor: Begin consolidating fabric only classes.

Made a top-level fabric package so mixins and their ancillary classes
can be grouped together. Also removed a stub duck interface that got
left behind somewhere along the line (MixedFirstPersonRenderer).
This commit is contained in:
ToadDev
2021-05-27 23:23:05 -07:00
parent 1f117b7c47
commit 135a3f56a5
30 changed files with 43 additions and 71 deletions

View File

@@ -30,7 +30,7 @@ import dan200.computercraft.core.apis.ApiFactories;
import dan200.computercraft.core.asm.GenericMethod; import dan200.computercraft.core.asm.GenericMethod;
import dan200.computercraft.core.filesystem.FileMount; import dan200.computercraft.core.filesystem.FileMount;
import dan200.computercraft.core.filesystem.ResourceMount; import dan200.computercraft.core.filesystem.ResourceMount;
import dan200.computercraft.mixin.MinecraftServerAccess; import dan200.computercraft.fabric.mixin.MinecraftServerAccess;
import dan200.computercraft.shared.BundledRedstone; import dan200.computercraft.shared.BundledRedstone;
import dan200.computercraft.shared.MediaProviders; import dan200.computercraft.shared.MediaProviders;
import dan200.computercraft.shared.Peripherals; import dan200.computercraft.shared.Peripherals;

View File

@@ -10,7 +10,7 @@ import java.util.Objects;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import dan200.computercraft.mixin.AffineTransformationAccess; import dan200.computercraft.fabric.mixin.AffineTransformationAccess;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedModel;

View File

@@ -8,7 +8,7 @@ package dan200.computercraft.client;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import dan200.computercraft.mixin.ChatHudAccess; import dan200.computercraft.fabric.mixin.ChatHudAccess;
import dan200.computercraft.shared.command.text.ChatHelpers; import dan200.computercraft.shared.command.text.ChatHelpers;
import dan200.computercraft.shared.command.text.TableBuilder; import dan200.computercraft.shared.command.text.TableBuilder;
import dan200.computercraft.shared.command.text.TableFormatter; import dan200.computercraft.shared.command.text.TableFormatter;

View File

@@ -20,7 +20,7 @@ import dan200.computercraft.client.render.TileEntityMonitorRenderer;
import dan200.computercraft.client.render.TileEntityTurtleRenderer; import dan200.computercraft.client.render.TileEntityTurtleRenderer;
import dan200.computercraft.client.render.TurtleModelLoader; import dan200.computercraft.client.render.TurtleModelLoader;
import dan200.computercraft.client.render.TurtlePlayerRenderer; import dan200.computercraft.client.render.TurtlePlayerRenderer;
import dan200.computercraft.events.ClientUnloadWorldEvent; import dan200.computercraft.fabric.events.ClientUnloadWorldEvent;
import dan200.computercraft.shared.ComputerCraftRegistry; import dan200.computercraft.shared.ComputerCraftRegistry;
import dan200.computercraft.shared.common.ContainerHeldItem; import dan200.computercraft.shared.common.ContainerHeldItem;
import dan200.computercraft.shared.common.IColouredItem; import dan200.computercraft.shared.common.IColouredItem;

View File

@@ -6,7 +6,7 @@
package dan200.computercraft.client.render; package dan200.computercraft.client.render;
import dan200.computercraft.mixin.HeldItemRendererAccess; import dan200.computercraft.fabric.mixin.HeldItemRendererAccess;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;

View File

@@ -8,7 +8,7 @@ package dan200.computercraft.client.render;
import java.util.List; import java.util.List;
import dan200.computercraft.mixin.BakedQuadAccess; import dan200.computercraft.fabric.mixin.BakedQuadAccess;
import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormatElement; import net.minecraft.client.render.VertexFormatElement;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.events; package dan200.computercraft.fabric.events;
import net.fabricmc.fabric.api.event.Event; import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory; import net.fabricmc.fabric.api.event.EventFactory;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Accessor;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Accessor;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.gen.Invoker;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.gen.Invoker;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Accessor;

View File

@@ -4,7 +4,7 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.util.DropConsumer; import dan200.computercraft.shared.util.DropConsumer;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;

View File

@@ -4,7 +4,7 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.util.DropConsumer; import dan200.computercraft.shared.util.DropConsumer;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;

View File

@@ -4,12 +4,11 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.client.render.ItemPocketRenderer; import dan200.computercraft.client.render.ItemPocketRenderer;
import dan200.computercraft.client.render.ItemPrintoutRenderer; import dan200.computercraft.client.render.ItemPrintoutRenderer;
import dan200.computercraft.shared.media.items.ItemPrintout; import dan200.computercraft.shared.media.items.ItemPrintout;
import dan200.computercraft.shared.mixed.MixedFirstPersonRenderer;
import dan200.computercraft.shared.pocket.items.ItemPocketComputer; import dan200.computercraft.shared.pocket.items.ItemPocketComputer;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@@ -30,22 +29,12 @@ import net.fabricmc.api.Environment;
@Mixin (HeldItemRenderer.class) @Mixin (HeldItemRenderer.class)
@Environment (EnvType.CLIENT) @Environment (EnvType.CLIENT)
public class MixinHeldItemRenderer implements MixedFirstPersonRenderer { public class MixinHeldItemRenderer {
@Override
public void renderArmFirstPerson_CC(MatrixStack stack, VertexConsumerProvider consumerProvider, int light, float equip, float swing, Arm hand) {
this.renderArmHoldingItem(stack, consumerProvider, light, equip, swing, hand);
}
@Shadow @Shadow
private void renderArmHoldingItem(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, float equipProgress, float swingProgress, private void renderArmHoldingItem(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, float equipProgress, float swingProgress,
Arm arm) { Arm arm) {
} }
@Override
public float getMapAngleFromPitch_CC(float pitch) {
return this.getMapAngle(pitch);
}
@Shadow @Shadow
private float getMapAngle(float pitch) { private float getMapAngle(float pitch) {
return 0; return 0;

View File

@@ -4,7 +4,7 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.client.render.ItemPrintoutRenderer; import dan200.computercraft.client.render.ItemPrintoutRenderer;
import dan200.computercraft.shared.media.items.ItemPrintout; import dan200.computercraft.shared.media.items.ItemPrintout;

View File

@@ -4,10 +4,10 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.client.FrameInfo; import dan200.computercraft.client.FrameInfo;
import dan200.computercraft.events.ClientUnloadWorldEvent; import dan200.computercraft.fabric.events.ClientUnloadWorldEvent;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.world.ClientWorld; import net.minecraft.client.world.ClientWorld;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;

View File

@@ -4,7 +4,7 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.command.ClientCommands; import dan200.computercraft.shared.command.ClientCommands;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;

View File

@@ -4,7 +4,7 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.shared.util.DropConsumer; import dan200.computercraft.shared.util.DropConsumer;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;

View File

@@ -4,7 +4,7 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import java.util.Collection; import java.util.Collection;

View File

@@ -4,7 +4,7 @@
* Send enquiries to dratcliffe@gmail.com * Send enquiries to dratcliffe@gmail.com
*/ */
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import dan200.computercraft.client.render.CableHighlightRenderer; import dan200.computercraft.client.render.CableHighlightRenderer;
import dan200.computercraft.client.render.MonitorHighlightRenderer; import dan200.computercraft.client.render.MonitorHighlightRenderer;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Accessor;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Accessor;

View File

@@ -1,4 +1,4 @@
package dan200.computercraft.mixin; package dan200.computercraft.fabric.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.gen.Invoker;

View File

@@ -1,17 +0,0 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2019. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.shared.mixed;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Arm;
public interface MixedFirstPersonRenderer {
void renderArmFirstPerson_CC(MatrixStack stack, VertexConsumerProvider consumerProvider, int light, float equip, float swing, Arm hand);
float getMapAngleFromPitch_CC(float pitch);
}

View File

@@ -8,7 +8,7 @@ package dan200.computercraft.shared.network.client;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import dan200.computercraft.mixin.SoundEventAccess; import dan200.computercraft.fabric.mixin.SoundEventAccess;
import dan200.computercraft.shared.network.NetworkMessage; import dan200.computercraft.shared.network.NetworkMessage;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;

View File

@@ -18,7 +18,7 @@ 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.mixin.SoundEventAccess; import dan200.computercraft.fabric.mixin.SoundEventAccess;
import net.minecraft.block.enums.Instrument; import net.minecraft.block.enums.Instrument;
import net.minecraft.network.packet.s2c.play.PlaySoundIdS2CPacket; import net.minecraft.network.packet.s2c.play.PlaySoundIdS2CPacket;

View File

@@ -6,7 +6,7 @@ import java.util.Map;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import dan200.computercraft.api.turtle.event.TurtleBlockEvent; import dan200.computercraft.api.turtle.event.TurtleBlockEvent;
import dan200.computercraft.mixin.SignBlockEntityAccess; import dan200.computercraft.fabric.mixin.SignBlockEntityAccess;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.SignBlockEntity; import net.minecraft.block.entity.SignBlockEntity;

View File

@@ -21,7 +21,7 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import dan200.computercraft.ComputerCraft; import dan200.computercraft.ComputerCraft;
import dan200.computercraft.mixin.WorldSavePathAccess; import dan200.computercraft.fabric.mixin.WorldSavePathAccess;
import me.shedaniel.cloth.api.utils.v1.GameInstanceUtils; import me.shedaniel.cloth.api.utils.v1.GameInstanceUtils;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;

View File

@@ -1,6 +1,6 @@
{ {
"required": true, "required": true,
"package": "dan200.computercraft.mixin", "package": "dan200.computercraft.fabric.mixin",
"compatibilityLevel": "JAVA_8", "compatibilityLevel": "JAVA_8",
"mixins": [ "mixins": [
"MinecraftServerAccess", "MinecraftServerAccess",