mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-09-01 10:07:56 +00:00
remove all filthy access wideners
This commit is contained in:
@@ -19,10 +19,6 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
|
||||||
accessWidener = file("src/main/resources/computercraft.accesswidener")
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
compile.extendsFrom shade
|
compile.extendsFrom shade
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ import dan200.computercraft.api.turtle.ITurtleUpgrade;
|
|||||||
import dan200.computercraft.core.apis.ApiFactories;
|
import dan200.computercraft.core.apis.ApiFactories;
|
||||||
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.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;
|
||||||
@@ -62,7 +63,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI {
|
|||||||
public static InputStream getResourceFile(String domain, String subPath) {
|
public static InputStream getResourceFile(String domain, String subPath) {
|
||||||
MinecraftServer server = GameInstanceUtils.getServer();
|
MinecraftServer server = GameInstanceUtils.getServer();
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
ReloadableResourceManager manager = (ReloadableResourceManager) server.serverResourceManager.getResourceManager();
|
ReloadableResourceManager manager = (ReloadableResourceManager) ((MinecraftServerAccess)server).getServerResourceManager().getResourceManager();
|
||||||
try {
|
try {
|
||||||
return manager.getResource(new Identifier(domain, subPath))
|
return manager.getResource(new Identifier(domain, subPath))
|
||||||
.getInputStream();
|
.getInputStream();
|
||||||
@@ -105,7 +106,7 @@ public final class ComputerCraftAPIImpl implements IComputerCraftAPI {
|
|||||||
public IMount createResourceMount(@Nonnull String domain, @Nonnull String subPath) {
|
public IMount createResourceMount(@Nonnull String domain, @Nonnull String subPath) {
|
||||||
MinecraftServer server = GameInstanceUtils.getServer();
|
MinecraftServer server = GameInstanceUtils.getServer();
|
||||||
if (server != null) {
|
if (server != null) {
|
||||||
ReloadableResourceManager manager = (ReloadableResourceManager) server.serverResourceManager.getResourceManager();
|
ReloadableResourceManager manager = (ReloadableResourceManager) ((MinecraftServerAccess)server).getServerResourceManager().getResourceManager();
|
||||||
ResourceMount mount = ResourceMount.get(domain, subPath, manager);
|
ResourceMount mount = ResourceMount.get(domain, subPath, manager);
|
||||||
return mount.exists("") ? mount : null;
|
return mount.exists("") ? mount : null;
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,8 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import dan200.computercraft.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;
|
||||||
import net.minecraft.client.render.model.BakedModelManager;
|
import net.minecraft.client.render.model.BakedModelManager;
|
||||||
@@ -66,15 +68,16 @@ public final class TransformedModel {
|
|||||||
public void push(MatrixStack matrixStack) {
|
public void push(MatrixStack matrixStack) {
|
||||||
matrixStack.push();
|
matrixStack.push();
|
||||||
|
|
||||||
if (matrix.translation != null)
|
AffineTransformationAccess access = (AffineTransformationAccess) (Object) this.matrix;
|
||||||
matrixStack.translate(this.matrix.translation.getX(), this.matrix.translation.getY(), this.matrix.translation.getZ());
|
if (access.getTranslation() != null)
|
||||||
|
matrixStack.translate(access.getTranslation().getX(), access.getTranslation().getY(), access.getTranslation().getZ());
|
||||||
|
|
||||||
matrixStack.multiply(this.matrix.getRotation2());
|
matrixStack.multiply(this.matrix.getRotation2());
|
||||||
|
|
||||||
if (matrix.scale != null)
|
if (access.getScale() != null)
|
||||||
matrixStack.scale(this.matrix.scale.getX(), this.matrix.scale.getY(), this.matrix.scale.getZ());
|
matrixStack.scale(access.getScale().getX(), access.getScale().getY(), access.getScale().getZ());
|
||||||
|
|
||||||
if (matrix.rotation1 != null)
|
if (access.getRotation1() != null)
|
||||||
matrixStack.multiply(this.matrix.rotation1);
|
matrixStack.multiply(access.getRotation1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ package dan200.computercraft.client;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import dan200.computercraft.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;
|
||||||
@@ -21,6 +22,10 @@ import net.minecraft.text.Text;
|
|||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
@SuppressWarnings ({
|
||||||
|
"MethodCallSideOnly",
|
||||||
|
"LocalVariableDeclarationSideOnly"
|
||||||
|
})
|
||||||
public class ClientTableFormatter implements TableFormatter {
|
public class ClientTableFormatter implements TableFormatter {
|
||||||
public static final ClientTableFormatter INSTANCE = new ClientTableFormatter();
|
public static final ClientTableFormatter INSTANCE = new ClientTableFormatter();
|
||||||
|
|
||||||
@@ -66,7 +71,7 @@ public class ClientTableFormatter implements TableFormatter {
|
|||||||
// int maxWidth = MathHelper.floor( chat.getChatWidth() / chat.getScale() );
|
// int maxWidth = MathHelper.floor( chat.getChatWidth() / chat.getScale() );
|
||||||
// List<ITextProperties> list = RenderComponentsUtil.func_238505_a_( component, maxWidth, mc.fontRenderer );
|
// List<ITextProperties> list = RenderComponentsUtil.func_238505_a_( component, maxWidth, mc.fontRenderer );
|
||||||
// if( !list.isEmpty() ) chat.printChatMessageWithOptionalDeletion( list.get( 0 ), id );
|
// if( !list.isEmpty() ) chat.printChatMessageWithOptionalDeletion( list.get( 0 ), id );
|
||||||
chat.addMessage(component, id);
|
((ChatHudAccess)chat).callAddMessage(component, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,7 +84,7 @@ public class ClientTableFormatter implements TableFormatter {
|
|||||||
lastHeights.put(table.getId(), height);
|
lastHeights.put(table.getId(), height);
|
||||||
|
|
||||||
for (int i = height; i < lastHeight; i++) {
|
for (int i = height; i < lastHeight; i++) {
|
||||||
chat.removeMessage(i + table.getId());
|
((ChatHudAccess)chat).callRemoveMessage(i + table.getId());
|
||||||
}
|
}
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
|
import dan200.computercraft.mixin.HeldItemRendererAccess;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.item.HeldItemRenderer;
|
import net.minecraft.client.render.item.HeldItemRenderer;
|
||||||
@@ -66,14 +68,15 @@ public abstract class ItemMapLikeRenderer {
|
|||||||
float tZ = -0.4f * MathHelper.sin(swingRt * (float) Math.PI);
|
float tZ = -0.4f * MathHelper.sin(swingRt * (float) Math.PI);
|
||||||
transform.translate(0, -tX / 2, tZ);
|
transform.translate(0, -tX / 2, tZ);
|
||||||
|
|
||||||
float pitchAngle = renderer.getMapAngle(pitch);
|
HeldItemRendererAccess access = (HeldItemRendererAccess) render;
|
||||||
|
float pitchAngle = access.callGetMapAngle(pitch);
|
||||||
transform.translate(0, 0.04F + equipProgress * -1.2f + pitchAngle * -0.5f, -0.72f);
|
transform.translate(0, 0.04F + equipProgress * -1.2f + pitchAngle * -0.5f, -0.72f);
|
||||||
transform.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(pitchAngle * -85.0f));
|
transform.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(pitchAngle * -85.0f));
|
||||||
if (!minecraft.player.isInvisible()) {
|
if (!minecraft.player.isInvisible()) {
|
||||||
transform.push();
|
transform.push();
|
||||||
transform.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90.0F));
|
transform.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(90.0F));
|
||||||
renderer.renderArm(transform, render, combinedLight, Arm.RIGHT);
|
access.callRenderArm(transform, render, combinedLight, Arm.RIGHT);
|
||||||
renderer.renderArm(transform, render, combinedLight, Arm.LEFT);
|
access.callRenderArm(transform, render, combinedLight, Arm.LEFT);
|
||||||
transform.pop();
|
transform.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,8 +108,8 @@ public abstract class ItemMapLikeRenderer {
|
|||||||
if (!minecraft.player.isInvisible()) {
|
if (!minecraft.player.isInvisible()) {
|
||||||
transform.push();
|
transform.push();
|
||||||
transform.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(offset * 10f));
|
transform.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(offset * 10f));
|
||||||
minecraft.getHeldItemRenderer()
|
((HeldItemRendererAccess)minecraft.getHeldItemRenderer())
|
||||||
.renderArmHoldingItem(transform, render, combinedLight, equipProgress, swingProgress, side);
|
.callRenderArmHoldingItem(transform, render, combinedLight, equipProgress, swingProgress, side);
|
||||||
transform.pop();
|
transform.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,6 +8,8 @@ package dan200.computercraft.client.render;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import dan200.computercraft.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;
|
||||||
import net.minecraft.client.render.VertexFormats;
|
import net.minecraft.client.render.VertexFormats;
|
||||||
@@ -51,7 +53,7 @@ public final class ModelTransformer {
|
|||||||
int[] vertexData = quad.getVertexData()
|
int[] vertexData = quad.getVertexData()
|
||||||
.clone();
|
.clone();
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
BakedQuad copy = new BakedQuad(vertexData, -1, quad.getFace(), quad.sprite, true);
|
BakedQuad copy = new BakedQuad(vertexData, -1, quad.getFace(), ((BakedQuadAccess)quad).getSprite(), true);
|
||||||
for (int i = 0; i < format.getElements()
|
for (int i = 0; i < format.getElements()
|
||||||
.size(); ++i) // For each vertex element
|
.size(); ++i) // For each vertex element
|
||||||
{
|
{
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -64,7 +65,8 @@ public class TurtleSmartItemModel implements BakedModel {
|
|||||||
this.familyModel = familyModel;
|
this.familyModel = familyModel;
|
||||||
this.colourModel = colourModel;
|
this.colourModel = colourModel;
|
||||||
|
|
||||||
this.m_overrides = new ModelOverrideList() {
|
// this actually works I think, trust me
|
||||||
|
this.m_overrides = new ModelOverrideList(null, null, null, Collections.emptyList()) {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public BakedModel apply(@Nonnull BakedModel originalModel, @Nonnull ItemStack stack, @Nullable ClientWorld world,
|
public BakedModel apply(@Nonnull BakedModel originalModel, @Nonnull ItemStack stack, @Nullable ClientWorld world,
|
||||||
|
@@ -0,0 +1,20 @@
|
|||||||
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import net.minecraft.client.util.math.AffineTransformation;
|
||||||
|
import net.minecraft.client.util.math.Vector3f;
|
||||||
|
import net.minecraft.util.math.Quaternion;
|
||||||
|
|
||||||
|
@Mixin (AffineTransformation.class)
|
||||||
|
public interface AffineTransformationAccess {
|
||||||
|
@Accessor
|
||||||
|
Vector3f getTranslation();
|
||||||
|
|
||||||
|
@Accessor
|
||||||
|
Vector3f getScale();
|
||||||
|
|
||||||
|
@Accessor
|
||||||
|
Quaternion getRotation1();
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.model.BakedQuad;
|
||||||
|
import net.minecraft.client.texture.Sprite;
|
||||||
|
|
||||||
|
@Mixin (BakedQuad.class)
|
||||||
|
public interface BakedQuadAccess {
|
||||||
|
@Accessor
|
||||||
|
Sprite getSprite();
|
||||||
|
}
|
16
src/main/java/dan200/computercraft/mixin/ChatHudAccess.java
Normal file
16
src/main/java/dan200/computercraft/mixin/ChatHudAccess.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.hud.ChatHud;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
@Mixin (ChatHud.class)
|
||||||
|
public interface ChatHudAccess {
|
||||||
|
@Invoker
|
||||||
|
void callAddMessage(Text text, int messageId);
|
||||||
|
|
||||||
|
@Invoker
|
||||||
|
void callRemoveMessage(int messageId);
|
||||||
|
}
|
@@ -0,0 +1,21 @@
|
|||||||
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
import net.minecraft.client.render.item.HeldItemRenderer;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.util.Arm;
|
||||||
|
|
||||||
|
@Mixin (HeldItemRenderer.class)
|
||||||
|
public interface HeldItemRendererAccess {
|
||||||
|
@Invoker
|
||||||
|
float callGetMapAngle(float tickDelta);
|
||||||
|
|
||||||
|
@Invoker
|
||||||
|
void callRenderArm(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, Arm arm);
|
||||||
|
|
||||||
|
@Invoker
|
||||||
|
void callRenderArmHoldingItem(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, float equipProgress, float swingProgress, Arm arm);
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import net.minecraft.resource.ServerResourceManager;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
|
@Mixin (MinecraftServer.class)
|
||||||
|
public interface MinecraftServerAccess {
|
||||||
|
@Accessor
|
||||||
|
ServerResourceManager getServerResourceManager();
|
||||||
|
}
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.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;
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.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;
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.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;
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.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;
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
import dan200.computercraft.client.FrameInfo;
|
import dan200.computercraft.client.FrameInfo;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
import dan200.computercraft.shared.command.CommandCopy;
|
import dan200.computercraft.shared.command.CommandCopy;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.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;
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
@@ -4,7 +4,7 @@
|
|||||||
* Send enquiries to dratcliffe@gmail.com
|
* Send enquiries to dratcliffe@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package dan200.computercraft.shared.mixin;
|
package dan200.computercraft.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;
|
@@ -0,0 +1,13 @@
|
|||||||
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import net.minecraft.block.entity.SignBlockEntity;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
@Mixin (SignBlockEntity.class)
|
||||||
|
public interface SignBlockEntityAccess {
|
||||||
|
@Accessor
|
||||||
|
Text[] getText();
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import net.minecraft.sound.SoundEvent;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
@Mixin (SoundEvent.class)
|
||||||
|
public interface SoundEventAccess {
|
||||||
|
@Accessor
|
||||||
|
Identifier getId();
|
||||||
|
}
|
@@ -0,0 +1,12 @@
|
|||||||
|
package dan200.computercraft.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
import net.minecraft.util.WorldSavePath;
|
||||||
|
|
||||||
|
@Mixin (WorldSavePath.class)
|
||||||
|
public interface WorldSavePathAccess {
|
||||||
|
@Invoker
|
||||||
|
static WorldSavePath createWorldSavePath(String relativePath) { throw new UnsupportedOperationException(); }
|
||||||
|
}
|
@@ -8,6 +8,7 @@ package dan200.computercraft.shared.network.client;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import dan200.computercraft.mixin.SoundEventAccess;
|
||||||
import dan200.computercraft.shared.network.NetworkMessage;
|
import dan200.computercraft.shared.network.NetworkMessage;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
@@ -64,7 +65,7 @@ public class PlayRecordClientMessage implements NetworkMessage {
|
|||||||
} else {
|
} else {
|
||||||
buf.writeBoolean(true);
|
buf.writeBoolean(true);
|
||||||
buf.writeString(this.name);
|
buf.writeString(this.name);
|
||||||
buf.writeIdentifier(this.soundEvent.id);
|
buf.writeIdentifier(((SoundEventAccess)this.soundEvent).getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +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 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;
|
||||||
@@ -153,7 +154,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 = this.playSound(context,
|
boolean success = this.playSound(context,
|
||||||
instrument.getSound().id,
|
((SoundEventAccess)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,6 +6,8 @@ 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 net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.block.entity.SignBlockEntity;
|
import net.minecraft.block.entity.SignBlockEntity;
|
||||||
|
|
||||||
@@ -17,7 +19,7 @@ public class SignInspectHandler {
|
|||||||
SignBlockEntity sbe = (SignBlockEntity)be;
|
SignBlockEntity sbe = (SignBlockEntity)be;
|
||||||
Map<Integer, String> textTable = new HashMap<>();
|
Map<Integer, String> textTable = new HashMap<>();
|
||||||
for(int k = 0; k < 4; k++) {
|
for(int k = 0; k < 4; k++) {
|
||||||
textTable.put(k+1, sbe.text[k].asString());
|
textTable.put(k+1, ((SignBlockEntityAccess)sbe).getText()[k].asString());
|
||||||
}
|
}
|
||||||
event.getData().put("text", textTable);
|
event.getData().put("text", textTable);
|
||||||
}
|
}
|
||||||
|
@@ -26,11 +26,8 @@ import dan200.computercraft.shared.TurtlePermissions;
|
|||||||
import dan200.computercraft.shared.turtle.core.TurtlePlaceCommand;
|
import dan200.computercraft.shared.turtle.core.TurtlePlaceCommand;
|
||||||
import dan200.computercraft.shared.turtle.core.TurtlePlayer;
|
import dan200.computercraft.shared.turtle.core.TurtlePlayer;
|
||||||
import dan200.computercraft.shared.util.DropConsumer;
|
import dan200.computercraft.shared.util.DropConsumer;
|
||||||
import dan200.computercraft.shared.util.FillableMatrix4f;
|
|
||||||
import dan200.computercraft.shared.util.InventoryUtil;
|
import dan200.computercraft.shared.util.InventoryUtil;
|
||||||
import dan200.computercraft.shared.util.WorldUtil;
|
import dan200.computercraft.shared.util.WorldUtil;
|
||||||
import net.minecraft.client.util.math.Vector3f;
|
|
||||||
import net.minecraft.util.math.*;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -38,6 +35,7 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.client.util.math.AffineTransformation;
|
import net.minecraft.client.util.math.AffineTransformation;
|
||||||
|
import net.minecraft.client.util.math.Vector3f;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
import net.minecraft.entity.damage.DamageSource;
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
@@ -48,12 +46,14 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
|
import net.fabricmc.fabric.api.event.player.AttackEntityCallback;
|
||||||
import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents;
|
|
||||||
|
|
||||||
public class TurtleTool extends AbstractTurtleUpgrade {
|
public class TurtleTool extends AbstractTurtleUpgrade {
|
||||||
protected final ItemStack item;
|
protected final ItemStack item;
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
package dan200.computercraft.shared.util;
|
|
||||||
|
|
||||||
import net.minecraft.util.math.Matrix4f;
|
|
||||||
|
|
||||||
public class FillableMatrix4f extends Matrix4f {
|
|
||||||
public FillableMatrix4f(float[] input) {
|
|
||||||
this.a00 = input[0];
|
|
||||||
this.a01 = input[1];
|
|
||||||
this.a02 = input[2];
|
|
||||||
this.a03 = input[3];
|
|
||||||
this.a10 = input[4];
|
|
||||||
this.a11 = input[5];
|
|
||||||
this.a12 = input[6];
|
|
||||||
this.a13 = input[7];
|
|
||||||
this.a20 = input[8];
|
|
||||||
this.a21 = input[9];
|
|
||||||
this.a22 = input[10];
|
|
||||||
this.a23 = input[11];
|
|
||||||
this.a30 = input[12];
|
|
||||||
this.a31 = input[13];
|
|
||||||
this.a32 = input[14];
|
|
||||||
this.a33 = input[15];
|
|
||||||
}
|
|
||||||
}
|
|
@@ -21,13 +21,14 @@ 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 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;
|
||||||
import net.minecraft.util.WorldSavePath;
|
import net.minecraft.util.WorldSavePath;
|
||||||
|
|
||||||
public final class IDAssigner {
|
public final class IDAssigner {
|
||||||
private static final WorldSavePath FOLDER = new WorldSavePath(ComputerCraft.MOD_ID);
|
private static final WorldSavePath FOLDER = WorldSavePathAccess.createWorldSavePath(ComputerCraft.MOD_ID);
|
||||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting()
|
private static final Gson GSON = new GsonBuilder().setPrettyPrinting()
|
||||||
.create();
|
.create();
|
||||||
private static final Type ID_TOKEN = new TypeToken<Map<String, Integer>>() {}.getType();
|
private static final Type ID_TOKEN = new TypeToken<Map<String, Integer>>() {}.getType();
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
accessWidener v1 named
|
|
||||||
|
|
||||||
accessible method net/minecraft/client/gui/hud/ChatHud addMessage (Lnet/minecraft/text/Text;I)V
|
|
||||||
accessible method net/minecraft/client/gui/hud/ChatHud removeMessage (I)V
|
|
||||||
accessible field net/minecraft/block/entity/BlockEntity invalid Z
|
|
||||||
accessible method net/minecraft/world/World isValid (Lnet/minecraft/util/math/BlockPos;)Z
|
|
||||||
accessible method net/minecraft/client/render/item/HeldItemRenderer renderArmHoldingItem (Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IFFLnet/minecraft/util/Arm;)V
|
|
||||||
accessible method net/minecraft/client/render/item/HeldItemRenderer renderArm (Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/util/Arm;)V
|
|
||||||
accessible method net/minecraft/client/render/item/HeldItemRenderer getMapAngle (F)F
|
|
||||||
accessible method net/minecraft/client/texture/TextureManager bindTextureInner (Lnet/minecraft/util/Identifier;)V
|
|
||||||
accessible field net/minecraft/entity/Entity pos Lnet/minecraft/util/math/Vec3d;
|
|
||||||
extendable method net/minecraft/entity/Entity getCameraPosVec (F)Lnet/minecraft/util/math/Vec3d;
|
|
||||||
accessible method net/minecraft/screen/ScreenHandlerType <init> (Lnet/minecraft/screen/ScreenHandlerType$Factory;)V
|
|
||||||
accessible class net/minecraft/screen/ScreenHandlerType$Factory
|
|
||||||
accessible method net/minecraft/client/render/model/json/ModelOverrideList <init> ()V
|
|
||||||
extendable class net/minecraft/util/math/Matrix4f
|
|
||||||
accessible method net/minecraft/util/WorldSavePath <init> (Ljava/lang/String;)V
|
|
||||||
accessible field net/minecraft/server/MinecraftServer serverResourceManager Lnet/minecraft/resource/ServerResourceManager;
|
|
||||||
accessible field net/minecraft/client/render/model/BakedQuad sprite Lnet/minecraft/client/texture/Sprite;
|
|
||||||
accessible field net/minecraft/client/util/math/AffineTransformation translation Lnet/minecraft/client/util/math/Vector3f;
|
|
||||||
accessible field net/minecraft/client/util/math/AffineTransformation scale Lnet/minecraft/client/util/math/Vector3f;
|
|
||||||
accessible field net/minecraft/client/util/math/AffineTransformation rotation1 Lnet/minecraft/util/math/Quaternion;
|
|
||||||
accessible field net/minecraft/sound/SoundEvent id Lnet/minecraft/util/Identifier;
|
|
||||||
accessible field net/minecraft/block/entity/SignBlockEntity text [Lnet/minecraft/text/Text;
|
|
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"required": true,
|
|
||||||
"package": "dan200.computercraft.shared.mixin",
|
|
||||||
"compatibilityLevel": "JAVA_8",
|
|
||||||
"mixins": [
|
|
||||||
"MixinHeldItemRenderer",
|
|
||||||
"MixinItemFrameEntityRenderer",
|
|
||||||
"MixinMinecraftGame",
|
|
||||||
"MixinScreen",
|
|
||||||
"MixinWorldRenderer"
|
|
||||||
],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"required": true,
|
|
||||||
"package": "dan200.computercraft.shared.mixin",
|
|
||||||
"compatibilityLevel": "JAVA_8",
|
|
||||||
"mixins": [
|
|
||||||
"MixinBlock",
|
|
||||||
"MixinEntity",
|
|
||||||
"MixinServerWorld",
|
|
||||||
"MixinWorld"
|
|
||||||
],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
29
src/main/resources/computercraft.mixins.json
Normal file
29
src/main/resources/computercraft.mixins.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"package": "dan200.computercraft.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"mixins": [
|
||||||
|
"AffineTransformationAccess",
|
||||||
|
"BakedQuadAccess",
|
||||||
|
"ChatHudAccess",
|
||||||
|
"HeldItemRendererAccess",
|
||||||
|
"MinecraftServerAccess",
|
||||||
|
"MixinBlock",
|
||||||
|
"MixinEntity",
|
||||||
|
"MixinServerWorld",
|
||||||
|
"MixinWorld",
|
||||||
|
"SignBlockEntityAccess",
|
||||||
|
"SoundEventAccess",
|
||||||
|
"WorldSavePathAccess"
|
||||||
|
],
|
||||||
|
"client": [
|
||||||
|
"MixinHeldItemRenderer",
|
||||||
|
"MixinItemFrameEntityRenderer",
|
||||||
|
"MixinMinecraftGame",
|
||||||
|
"MixinScreen",
|
||||||
|
"MixinWorldRenderer"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
@@ -30,8 +30,6 @@
|
|||||||
"client": ["dan200.computercraft.client.proxy.ComputerCraftProxyClient"]
|
"client": ["dan200.computercraft.client.proxy.ComputerCraftProxyClient"]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
{ "config": "computercraft.client.json", "environment": "client" },
|
"computercraft.mixins.json"
|
||||||
"computercraft.common.json"
|
]
|
||||||
],
|
|
||||||
"accessWidener" : "computercraft.accesswidener"
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user