diff --git a/dependencies.gradle b/dependencies.gradle
index 36ec6e74..e8ea1093 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -61,5 +61,8 @@ dependencies {
//These 2 deps have conflicts with Amun-Ra by default, see Twist-Space-Technology-Mod#150
compileOnly('curse.maven:witchery-69673:2234410')
implementation('com.github.GTNewHorizons:WitcheryExtras:1.2.2:dev')
+ compileOnly('com.github.GTNewHorizons:BloodMagic:1.6.2:dev')
+ implementation 'com.google.auto.value:auto-value-annotations:1.10.1'
+ annotationProcessor 'com.google.auto.value:auto-value:1.10.1'
// implementation('com.github.RealSilverMoon:BoxPlusPlus:1.2.0:dev')
}
diff --git a/gradle.properties b/gradle.properties
index 03e0a83f..7865d539 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -83,7 +83,7 @@ apiPackage =
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
-usesMixins = false
+usesMixins = true
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
@@ -92,12 +92,12 @@ usesMixinDebug = false
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
-mixinsPackage =
+mixinsPackage = mixin
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
-coreModClass =
+coreModClass = TwistSpaceTechnology
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/ASM/BaseMetaTileEntityASM.java b/src/main/java/com/Nxer/TwistSpaceTechnology/ASM/BaseMetaTileEntityASM.java
new file mode 100644
index 00000000..cd4ed21b
--- /dev/null
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/ASM/BaseMetaTileEntityASM.java
@@ -0,0 +1,157 @@
+package com.Nxer.TwistSpaceTechnology.ASM;
+
+import net.minecraft.launchwrapper.IClassTransformer;
+
+import org.spongepowered.asm.lib.ClassReader;
+import org.spongepowered.asm.lib.ClassVisitor;
+import org.spongepowered.asm.lib.ClassWriter;
+import org.spongepowered.asm.lib.Label;
+import org.spongepowered.asm.lib.MethodVisitor;
+import org.spongepowered.asm.lib.Opcodes;
+
+public class BaseMetaTileEntityASM implements IClassTransformer {
+
+ @Override
+ public byte[] transform(String name, String transformedName, byte[] basicClass) {
+ // 捕获BaseMetaTileEntity类的加载
+ if ("gregtech.api.metatileentity.BaseMetaTileEntity".equals(transformedName)) {
+ return transformBaseClass(basicClass);
+ }
+ return basicClass;
+ }
+
+ private byte[] transformBaseClass(byte[] basicClass) {
+ ClassReader classReader = new ClassReader(basicClass);
+ ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
+ ClassVisitor classVisitor = new BaseClassVisitor(Opcodes.ASM5, classWriter);
+ classReader.accept(classVisitor, 0);
+ return classWriter.toByteArray();
+ }
+
+ static class BaseClassVisitor extends ClassVisitor {
+
+ public BaseClassVisitor(int api, ClassVisitor classVisitor) {
+ super(api, classVisitor);
+ }
+
+ @Override
+ public void visitEnd() {
+ // 访问getRenderBoundingBox方法
+ MethodVisitor mv = cv.visitMethod(
+ Opcodes.ACC_PUBLIC,
+ "getRenderBoundingBox",
+ "()Lnet/minecraft/util/AxisAlignedBB;",
+ null,
+ null);
+ if (mv != null) {
+ mv.visitCode();
+
+ // 将“this”加载到堆栈上
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+
+ // 调用getMetaTileEntity方法
+ mv.visitMethodInsn(
+ Opcodes.INVOKEVIRTUAL,
+ "gregtech/api/metatileentity/BaseMetaTileEntity",
+ "getMetaTileEntity",
+ "()Lgregtech/api/interfaces/metatileentity/IMetaTileEntity;",
+ false);
+
+ // 判断是否来自于IMachineTESR的实例
+ mv.visitTypeInsn(Opcodes.INSTANCEOF, "com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR");
+
+ // 如果为false则跳过调用
+ Label ifFalse = new Label();
+ mv.visitJumpInsn(Opcodes.IFEQ, ifFalse);
+
+ // 将类型转换为IMachineTESR,并调用IMachineTESR接口的getRenderBoundingBox方法
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitMethodInsn(
+ Opcodes.INVOKEVIRTUAL,
+ "gregtech/api/metatileentity/BaseMetaTileEntity",
+ "getMetaTileEntity",
+ "()Lgregtech/api/interfaces/metatileentity/IMetaTileEntity;",
+ false);
+ mv.visitTypeInsn(Opcodes.CHECKCAST, "com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR");
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitMethodInsn(
+ Opcodes.INVOKEINTERFACE,
+ "com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR",
+ "getRenderBoundingBox",
+ "(Lgregtech/api/metatileentity/BaseMetaTileEntity;)Lnet/minecraft/util/AxisAlignedBB;",
+ true);
+ mv.visitInsn(Opcodes.ARETURN);
+
+ mv.visitLabel(ifFalse);
+
+ // 如果为false则调用原来父类的方法
+ mv.visitVarInsn(Opcodes.ALOAD, 0);
+ mv.visitMethodInsn(
+ Opcodes.INVOKESPECIAL,
+ "gregtech/api/metatileentity/CommonMetaTileEntity",
+ "getRenderBoundingBox",
+ "()Lnet/minecraft/util/AxisAlignedBB;",
+ false);
+ mv.visitInsn(Opcodes.ARETURN);
+
+ mv.visitMaxs(3, 1);
+ mv.visitEnd();
+ }
+ MethodVisitor mv1 = cv.visitMethod(Opcodes.ACC_PUBLIC, "getMaxRenderDistanceSquared", "()D", null, null);
+ if (mv1 != null) {
+ mv1.visitCode();
+
+ // 将“this”加载到堆栈上
+ mv1.visitVarInsn(Opcodes.ALOAD, 0);
+
+ // 调用getMetaTileEntity方法
+ mv1.visitMethodInsn(
+ Opcodes.INVOKEVIRTUAL,
+ "gregtech/api/metatileentity/BaseMetaTileEntity",
+ "getMetaTileEntity",
+ "()Lgregtech/api/interfaces/metatileentity/IMetaTileEntity;",
+ false);
+
+ // 判断是否来自于IMachineTESR的实例
+ mv1.visitTypeInsn(Opcodes.INSTANCEOF, "com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR");
+
+ // 如果为false则跳过调用
+ Label ifFalse = new Label();
+ mv1.visitJumpInsn(Opcodes.IFEQ, ifFalse);
+
+ // 将类型转换为IMachineTESR,并调用IMachineTESR接口的getMaxRenderDistanceSquared方法
+ mv1.visitVarInsn(Opcodes.ALOAD, 0);
+ mv1.visitMethodInsn(
+ Opcodes.INVOKEVIRTUAL,
+ "gregtech/api/metatileentity/BaseMetaTileEntity",
+ "getMetaTileEntity",
+ "()Lgregtech/api/interfaces/metatileentity/IMetaTileEntity;",
+ false);
+ mv1.visitTypeInsn(Opcodes.CHECKCAST, "com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR");
+ mv1.visitMethodInsn(
+ Opcodes.INVOKEINTERFACE,
+ "com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR",
+ "getMaxRenderDistanceSquared",
+ "()D",
+ true);
+ mv1.visitInsn(Opcodes.DRETURN);
+
+ mv1.visitLabel(ifFalse);
+
+ // 如果为false则调用原来父类的方法
+ mv1.visitVarInsn(Opcodes.ALOAD, 0);
+ mv1.visitMethodInsn(
+ Opcodes.INVOKESPECIAL,
+ "gregtech/api/metatileentity/CommonMetaTileEntity",
+ "getMaxRenderDistanceSquared",
+ "()D",
+ false);
+ mv1.visitInsn(Opcodes.DRETURN);
+
+ mv1.visitMaxs(3, 1);
+ mv1.visitEnd();
+ }
+ super.visitEnd();
+ }
+ }
+}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/ClientProxy.java b/src/main/java/com/Nxer/TwistSpaceTechnology/ClientProxy.java
index a168331f..99736b57 100644
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/ClientProxy.java
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/ClientProxy.java
@@ -5,7 +5,7 @@
import com.Nxer.TwistSpaceTechnology.client.Sound.SoundLoader;
import com.Nxer.TwistSpaceTechnology.client.render.ArtificialStarRender;
import com.Nxer.TwistSpaceTechnology.common.machine.TST_BigBroArray;
-import com.Nxer.TwistSpaceTechnology.loader.RendereLoader;
+import com.Nxer.TwistSpaceTechnology.loader.RendererLoader;
import com.Nxer.TwistSpaceTechnology.system.ItemCooldown.CooldownEventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -26,7 +26,9 @@ public void init(FMLInitializationEvent event) {
@Override
public void postInit(FMLPostInitializationEvent event) {
super.postInit(event);
- new RendereLoader();
+ RendererLoader loader = new RendererLoader();
+ loader.registerTileEntityRenderers();
+ loader.registerItemRenderers();
new SoundLoader();
}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/TwistSpaceTechnology.java b/src/main/java/com/Nxer/TwistSpaceTechnology/TwistSpaceTechnology.java
index 7be00986..38d604b9 100644
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/TwistSpaceTechnology.java
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/TwistSpaceTechnology.java
@@ -2,6 +2,8 @@
import static com.Nxer.TwistSpaceTechnology.loader.RecipeLoader.loadRecipesServerStarted;
+import java.util.Map;
+
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -30,6 +32,7 @@
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.registry.EntityRegistry;
+import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
@Mod(
modid = Tags.MODID,
@@ -37,7 +40,9 @@
name = Tags.MODNAME,
dependencies = "required-before:gregtech; " + "before:dreamcraft;",
acceptedMinecraftVersions = "[1.7.10]")
-public class TwistSpaceTechnology {
+@IFMLLoadingPlugin.MCVersion("1.7.10")
+@IFMLLoadingPlugin.TransformerExclusions({ "com.Nxer.TwistSpaceTechnology" })
+public class TwistSpaceTechnology implements IFMLLoadingPlugin {
/**
*
The signal of whether in Development Mode.
@@ -148,4 +153,26 @@ public void serverStarted(FMLServerStartedEvent event) {
loadRecipesServerStarted();
}
+ @Override
+ public String[] getASMTransformerClass() {
+ return new String[] { "com.Nxer.TwistSpaceTechnology.ASM.BaseMetaTileEntityASM" };
+ }
+
+ @Override
+ public String getModContainerClass() {
+ return null;
+ }
+
+ @Override
+ public String getSetupClass() {
+ return null;
+ }
+
+ @Override
+ public void injectData(Map data) {}
+
+ @Override
+ public String getAccessTransformerClass() {
+ return null;
+ }
}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/client/ModelEnum.java b/src/main/java/com/Nxer/TwistSpaceTechnology/client/ModelEnum.java
new file mode 100644
index 00000000..f0c07353
--- /dev/null
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/client/ModelEnum.java
@@ -0,0 +1,25 @@
+package com.Nxer.TwistSpaceTechnology.client;
+
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.model.AdvancedModelLoader;
+import net.minecraftforge.client.model.IModelCustom;
+
+public enum ModelEnum {
+
+ PowerChair,
+ Yamato,
+ STAR;
+
+ private IModelCustom Model;
+
+ ModelEnum() {}
+
+ public ModelEnum set(ResourceLocation resourceLocation) {
+ this.Model = AdvancedModelLoader.loadModel(resourceLocation);;
+ return this;
+ }
+
+ public IModelCustom get() {
+ return this.Model;
+ }
+}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ArtificialStarRender.java b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ArtificialStarRender.java
index f29b3d45..a3aa9446 100644
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ArtificialStarRender.java
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ArtificialStarRender.java
@@ -4,11 +4,10 @@
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.client.model.AdvancedModelLoader;
-import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
+import com.Nxer.TwistSpaceTechnology.client.ModelEnum;
import com.Nxer.TwistSpaceTechnology.common.tile.TileStar;
import cpw.mods.fml.client.registry.ClientRegistry;
@@ -19,8 +18,6 @@
public class ArtificialStarRender extends TileEntitySpecialRenderer {
private static final ResourceLocation STARTEXTURE = new ResourceLocation("gtnhcommunitymod:model/Star.png");
- private static final IModelCustom STAR = AdvancedModelLoader
- .loadModel(new ResourceLocation("gtnhcommunitymod:model/Sol.obj"));
public ArtificialStarRender() {
ClientRegistry.bindTileEntitySpecialRenderer(TileStar.class, this);
@@ -45,7 +42,8 @@ private void renderStar(double size) {
this.bindTexture(STARTEXTURE);
GL11.glScaled(size, size, size);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
- STAR.renderAll();
+ ModelEnum.STAR.get()
+ .renderAll();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_CULL_FACE);
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR.java b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR.java
new file mode 100644
index 00000000..18e1764c
--- /dev/null
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/IMachineTESR.java
@@ -0,0 +1,37 @@
+package com.Nxer.TwistSpaceTechnology.client.render;
+
+import static net.minecraft.tileentity.TileEntity.INFINITE_EXTENT_AABB;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.World;
+
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+
+public interface IMachineTESR {
+
+ // 如果您不熟悉OpenGL操作,请不要实现此接口!!!
+ void render(TileEntitySpecialRenderer TESR, TileEntity TileEntity, double x, double y, double z,
+ float timeSinceLastTick);
+
+ /**
+ * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated
+ * with this {@link TileEntity}
+ * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)}
+ * associated with the block
+ * at this location.
+ *
+ * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity}
+ */
+
+ default AxisAlignedBB getRenderBoundingBox(BaseMetaTileEntity baseMetaTile) {
+ return INFINITE_EXTENT_AABB;
+ }
+
+ // 最大渲染距离
+ default double getMaxRenderDistanceSquared() {
+ return 4096.0D;
+ }
+}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ItemRenderers/PowerChairRenderer.java b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ItemRenderers/ItemPowerChairRenderer.java
similarity index 94%
rename from src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ItemRenderers/PowerChairRenderer.java
rename to src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ItemRenderers/ItemPowerChairRenderer.java
index 24fc7342..925f63d6 100644
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ItemRenderers/PowerChairRenderer.java
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/ItemRenderers/ItemPowerChairRenderer.java
@@ -12,12 +12,12 @@
import com.Nxer.TwistSpaceTechnology.common.block.blockClass.ItemBlockPowerChair;
-public class PowerChairRenderer implements IItemRenderer {
+public class ItemPowerChairRenderer implements IItemRenderer {
protected IModelCustom models;
protected ResourceLocation textures;
- public PowerChairRenderer(final IModelCustom models, final ResourceLocation textures) {
+ public ItemPowerChairRenderer(final IModelCustom models, final ResourceLocation textures) {
this.models = models;
this.textures = textures;
}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntitySpecialRenderer/MachineRenderer.java b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntitySpecialRenderer/MachineRenderer.java
new file mode 100644
index 00000000..c073ff86
--- /dev/null
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntitySpecialRenderer/MachineRenderer.java
@@ -0,0 +1,25 @@
+package com.Nxer.TwistSpaceTechnology.client.render.TileEntitySpecialRenderer;
+
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
+import net.minecraft.tileentity.TileEntity;
+
+import com.Nxer.TwistSpaceTechnology.client.render.IMachineTESR;
+
+import cpw.mods.fml.client.registry.ClientRegistry;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
+
+public class MachineRenderer extends TileEntitySpecialRenderer {
+
+ public MachineRenderer() {
+ ClientRegistry.bindTileEntitySpecialRenderer(BaseMetaTileEntity.class, this);
+ }
+
+ @Override
+ public void renderTileEntityAt(TileEntity TileEntity, double x, double y, double z, float timeSinceLastTick) {
+ if (TileEntity instanceof BaseMetaTileEntity T) {
+ if (T.getMetaTileEntity() instanceof IMachineTESR Machine) {
+ Machine.render(this, TileEntity, x, y, z, timeSinceLastTick);
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntityRenderer.java b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntitySpecialRenderer/PowerChairRenderer.java
similarity index 90%
rename from src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntityRenderer.java
rename to src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntitySpecialRenderer/PowerChairRenderer.java
index 5bb1e09d..d1a10cf8 100644
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntityRenderer.java
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/client/render/TileEntitySpecialRenderer/PowerChairRenderer.java
@@ -1,4 +1,4 @@
-package com.Nxer.TwistSpaceTechnology.client.render;
+package com.Nxer.TwistSpaceTechnology.client.render.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@@ -11,12 +11,12 @@
import cpw.mods.fml.client.registry.ClientRegistry;
-public class TileEntityRenderer extends TileEntitySpecialRenderer {
+public class PowerChairRenderer extends TileEntitySpecialRenderer {
private final IModelCustom Renderer;
private final ResourceLocation textures;
- public TileEntityRenderer(final IModelCustom Renderer, final ResourceLocation textures) {
+ public PowerChairRenderer(final IModelCustom Renderer, final ResourceLocation textures) {
this.Renderer = Renderer;
this.textures = textures;
ClientRegistry.bindTileEntitySpecialRenderer(TilePowerChair.class, this);
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/common/machine/GT_TileEntity_IndustrialMagicMatrix.java b/src/main/java/com/Nxer/TwistSpaceTechnology/common/machine/GT_TileEntity_IndustrialMagicMatrix.java
index 6e51b11c..86e87892 100644
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/common/machine/GT_TileEntity_IndustrialMagicMatrix.java
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/common/machine/GT_TileEntity_IndustrialMagicMatrix.java
@@ -13,23 +13,33 @@
import static thaumcraft.common.config.ConfigItems.itemEldritchObject;
import static thaumcraft.common.lib.research.ResearchManager.getResearchForPlayer;
+import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.annotation.Nonnull;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.client.renderer.texture.TextureManager;
+import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.jetbrains.annotations.NotNull;
+import org.lwjgl.opengl.GL11;
+import com.Nxer.TwistSpaceTechnology.client.ModelEnum;
+import com.Nxer.TwistSpaceTechnology.client.render.IMachineTESR;
import com.Nxer.TwistSpaceTechnology.common.GTCMItemList;
import com.Nxer.TwistSpaceTechnology.common.api.ModBlocksHandler;
import com.Nxer.TwistSpaceTechnology.common.machine.multiMachineClasses.GTCM_MultiMachineBase;
@@ -50,6 +60,7 @@
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
@@ -70,7 +81,7 @@
import thaumicenergistics.common.tiles.TileInfusionProvider;
public class GT_TileEntity_IndustrialMagicMatrix extends GTCM_MultiMachineBase
- implements ISidedInventory {
+ implements ISidedInventory, IMachineTESR {
// region default value
@@ -3169,4 +3180,70 @@ public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirect
}
return new ITexture[] { TextureFactory.of(blockStoneDevice, 2) };
}
+
+ private static final ResourceLocation textures = new ResourceLocation(
+ "gtnhcommunitymod:textures/MagicCircle/WellOfSufferingArray.png");
+ private static final ResourceLocation TestTextures = new ResourceLocation(
+ "gtnhcommunitymod:textures/MagicCircle/Test.png");
+
+ /*
+ * 这里现在是用来测试的
+ */
+
+ @Override
+ public AxisAlignedBB getRenderBoundingBox(BaseMetaTileEntity baseMetaTile) {
+ return IMachineTESR.super.getRenderBoundingBox(baseMetaTile);
+ }
+
+ @Override
+ public double getMaxRenderDistanceSquared() {
+ return 65536;
+ }
+
+ @Override
+ public void render(TileEntitySpecialRenderer TESR, TileEntity TileEntity, double x, double y, double z,
+ float timeSinceLastTick) {
+ TextureManager textureManager = Minecraft.getMinecraft()
+ .getTextureManager();
+ long worldTime = TileEntity.getWorldObj()
+ .getTotalWorldTime();
+ GL11.glPushMatrix();
+ Tessellator tessellator = Tessellator.instance;
+ textureManager.bindTexture(textures);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_CULL_FACE);
+ GL11.glTranslated(x + 0.5, y - 0.1, z + 0.5);
+ GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
+ GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
+ tessellator.startDrawingQuads();
+ tessellator.addVertexWithUV(-2.5, 0, -2.5, 0, 0);
+ tessellator.addVertexWithUV(2.5, 0, -2.5, 1, 0);
+ tessellator.addVertexWithUV(2.5, 0, 2.5, 1, 1);
+ tessellator.addVertexWithUV(-2.5, 0, 2.5, 0, 1);
+ double Rotated = (worldTime % 360 + timeSinceLastTick) * 10 % 360;
+ GL11.glRotated(Rotated, 0, 1, 0);
+ tessellator.draw();
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_CULL_FACE);
+ GL11.glPopMatrix();
+
+ float hue = (worldTime + timeSinceLastTick) % 60 / 60.0f;
+ int color = Color.HSBtoRGB(hue, 1.0f, 1.0f);
+
+ float red = (color >> 16 & 255) / 255.0f;
+ float green = (color >> 8 & 255) / 255.0f;
+ float blue = (color & 255) / 255.0f;
+ GL11.glPushMatrix();
+ textureManager.bindTexture(TestTextures);
+ GL11.glTranslated(x + 0.5, y + 4, z + 0.5);
+ GL11.glScalef(0.5F, 0.5F, 0.5F);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_CULL_FACE);
+ GL11.glColor3f(red, green, blue);
+ ModelEnum.STAR.get()
+ .renderAll();
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_CULL_FACE);
+ GL11.glPopMatrix();
+ }
}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/loader/RendereLoader.java b/src/main/java/com/Nxer/TwistSpaceTechnology/loader/RendereLoader.java
deleted file mode 100644
index 37301ad8..00000000
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/loader/RendereLoader.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.Nxer.TwistSpaceTechnology.loader;
-
-import static com.Nxer.TwistSpaceTechnology.common.block.BasicBlocks.BlockPowerChair;
-
-import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.client.MinecraftForgeClient;
-import net.minecraftforge.client.model.AdvancedModelLoader;
-import net.minecraftforge.client.model.IModelCustom;
-
-import com.Nxer.TwistSpaceTechnology.client.render.ItemRenderers.PowerChairRenderer;
-import com.Nxer.TwistSpaceTechnology.client.render.ItemRenderers.YamatoRenderer;
-import com.Nxer.TwistSpaceTechnology.client.render.TileEntityRenderer;
-import com.Nxer.TwistSpaceTechnology.common.block.blockClass.ItemBlockPowerChair;
-import com.Nxer.TwistSpaceTechnology.common.item.items.BasicItems;
-
-public class RendereLoader {
-
- public static IModelCustom PowerChairModel = null;
- public static IModelCustom YamatoModel = null;
-
- public RendereLoader() {
- PowerChairModel = AdvancedModelLoader.loadModel(new ResourceLocation("gtnhcommunitymod:model/PowerChair.obj"));
- YamatoModel = AdvancedModelLoader.loadModel(new ResourceLocation("gtnhcommunitymod:model/Yamato.obj"));
- RendereLoader.registerItemRenderers();
- RendereLoader.registerTileEntityRenderers();
- }
-
- public static void registerItemRenderers() {
- MinecraftForgeClient.registerItemRenderer(
- ItemBlockPowerChair.getItemFromBlock(BlockPowerChair),
- new PowerChairRenderer(PowerChairModel, new ResourceLocation("gtnhcommunitymod", "model/PowerChair.png")));
- MinecraftForgeClient.registerItemRenderer(
- BasicItems.Yamato,
- new YamatoRenderer(YamatoModel, new ResourceLocation("gtnhcommunitymod", "model/Yamato.png")));
- }
-
- public static void registerTileEntityRenderers() {
- new TileEntityRenderer(PowerChairModel, new ResourceLocation("gtnhcommunitymod", "model/PowerChair.png"));
- }
-}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/loader/RendererLoader.java b/src/main/java/com/Nxer/TwistSpaceTechnology/loader/RendererLoader.java
new file mode 100644
index 00000000..550be33a
--- /dev/null
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/loader/RendererLoader.java
@@ -0,0 +1,41 @@
+package com.Nxer.TwistSpaceTechnology.loader;
+
+import static com.Nxer.TwistSpaceTechnology.common.block.BasicBlocks.BlockPowerChair;
+
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.MinecraftForgeClient;
+
+import com.Nxer.TwistSpaceTechnology.client.ModelEnum;
+import com.Nxer.TwistSpaceTechnology.client.render.ItemRenderers.ItemPowerChairRenderer;
+import com.Nxer.TwistSpaceTechnology.client.render.ItemRenderers.YamatoRenderer;
+import com.Nxer.TwistSpaceTechnology.client.render.TileEntitySpecialRenderer.MachineRenderer;
+import com.Nxer.TwistSpaceTechnology.client.render.TileEntitySpecialRenderer.PowerChairRenderer;
+import com.Nxer.TwistSpaceTechnology.common.block.blockClass.ItemBlockPowerChair;
+import com.Nxer.TwistSpaceTechnology.common.item.items.BasicItems;
+
+public class RendererLoader {
+
+ public RendererLoader() {
+ ModelEnum.PowerChair.set(new ResourceLocation("gtnhcommunitymod:model/PowerChair.obj"));
+ ModelEnum.Yamato.set(new ResourceLocation("gtnhcommunitymod:model/Yamato.obj"));
+ ModelEnum.STAR.set(new ResourceLocation("gtnhcommunitymod:model/Sol.obj"));
+ }
+
+ public void registerItemRenderers() {
+ MinecraftForgeClient.registerItemRenderer(
+ ItemBlockPowerChair.getItemFromBlock(BlockPowerChair),
+ new ItemPowerChairRenderer(
+ ModelEnum.PowerChair.get(),
+ new ResourceLocation("gtnhcommunitymod", "model/PowerChair.png")));
+ MinecraftForgeClient.registerItemRenderer(
+ BasicItems.Yamato,
+ new YamatoRenderer(ModelEnum.Yamato.get(), new ResourceLocation("gtnhcommunitymod", "model/Yamato.png")));
+ }
+
+ public void registerTileEntityRenderers() {
+ new MachineRenderer();
+ new PowerChairRenderer(
+ ModelEnum.PowerChair.get(),
+ new ResourceLocation("gtnhcommunitymod", "model/PowerChair.png"));
+ }
+}
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/recipe/machineRecipe/IndustrialMagicMatrixRecipePool.java b/src/main/java/com/Nxer/TwistSpaceTechnology/recipe/machineRecipe/IndustrialMagicMatrixRecipePool.java
index f42f68a7..0c489e42 100644
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/recipe/machineRecipe/IndustrialMagicMatrixRecipePool.java
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/recipe/machineRecipe/IndustrialMagicMatrixRecipePool.java
@@ -3,10 +3,15 @@
import static fox.spiteful.avaritia.items.LudicrousItems.bigPearl;
import static gregtech.api.enums.TierEU.RECIPE_LV;
import static gregtech.api.enums.TierEU.RECIPE_LuV;
+import static gregtech.api.util.GT_RecipeConstants.AssemblyLine;
+import static gregtech.api.util.GT_RecipeConstants.OREDICT_INPUT;
import static thaumcraft.common.config.ConfigBlocks.blockCosmeticSolid;
import static thaumcraft.common.config.ConfigItems.*;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
+import java.util.Objects;
import java.util.Set;
import net.minecraft.item.Item;
@@ -25,7 +30,7 @@
import gregtech.api.enums.Mods;
import gregtech.api.interfaces.IRecipeMap;
import gregtech.api.recipe.RecipeMaps;
-import thaumcraft.common.items.ItemEssence;
+import gregtech.api.util.GT_Recipe;
public class IndustrialMagicMatrixRecipePool implements IRecipePool {
@@ -43,6 +48,17 @@ protected ItemStack[] checkInputSpecial(ItemStack... itemStacks) {
return itemStacks;
}
+ private static final IRecipeMap Test = IRecipeMap.newRecipeMap(builder -> {
+ Collection ret = new ArrayList<>();
+ for (ItemStack itemStack : (ItemStack[]) Objects.requireNonNull(builder.getMetadata(OREDICT_INPUT))) {
+ ret.addAll(
+ builder.copy()
+ .itemInputs(itemStack)
+ .addTo(GTCMRecipe.IndustrialMagicMatrixRecipe));
+ }
+ return ret;
+ });
+
protected Set- skips;
protected boolean shouldSkip(Item item) {
@@ -69,6 +85,7 @@ protected boolean shouldSkip(Item item) {
@Override
public void loadRecipes() {
TCRecipeTools.getInfusionCraftingRecipe();
+ TCRecipeTools.getCrucibleRecipe();
final IRecipeMap IIM = GTCMRecipe.IndustrialMagicMatrixRecipe;
for (TCRecipeTools.InfusionCraftingRecipe Recipe : TCRecipeTools.ICR) {
@@ -83,7 +100,7 @@ public void loadRecipes() {
// # Recipe required Essentia
// #zh_CN 配方所需源质
Essence.setStackDisplayName(TextEnums.tr("IndustrialMagicMatrixRecipeInputAspects"));
- new ItemEssence().setAspects(Essence, Recipe.getInputAspects());
+ TCRecipeTools.setAspects(Essence, Recipe.getInputAspects());
GT_Values.RA.stdBuilder()
.ignoreCollision()
.clearInvalid()
@@ -98,6 +115,38 @@ public void loadRecipes() {
.addTo(IIM);
}
+ for (TCRecipeTools.TCCrucibleRecipe C : TCRecipeTools.CR) {
+ ItemStack Essence = new ItemStack(itemEssence);
+ Essence.setItemDamage(1);
+ TCRecipeTools.setAspects(Essence, C.getAspects());
+ Object input = C.getCatalyst();
+ if (input instanceof ArrayList>) { // 这里处理矿辞物品输入
+ ArrayList inputs = (ArrayList) input;
+ ItemStack[] itemStacks = new ItemStack[inputs.size()];
+ for (int i = 0; i < inputs.size(); i++) {
+ itemStacks[i] = inputs.get(i);
+ }
+ GT_Values.RA.stdBuilder()
+ .ignoreCollision()
+ .special(Essence)
+ .metadata(OREDICT_INPUT, itemStacks)
+ .itemOutputs((C.getRecipeOutput()))
+ .duration(600)
+ .eut(RECIPE_LuV)
+ .addTo(Test);
+ } else if (input instanceof ItemStack itemStack) { // 这里处理正常物品输入
+ GT_Values.RA.stdBuilder()
+ .ignoreCollision()
+ .special(Essence)
+ .itemInputs(itemStack)
+ .itemOutputs(C.getRecipeOutput())
+ .noOptimize()
+ .duration(600)
+ .eut(RECIPE_LuV)
+ .addTo(AssemblyLine);
+ }
+ }
+
GT_Values.RA.stdBuilder()
.clearInvalid()
.itemInputs(new ItemStack(blockCosmeticSolid, 8, 6), new ItemStack(itemShard, 1, 6))
diff --git a/src/main/java/com/Nxer/TwistSpaceTechnology/recipe/specialRecipe/TCRecipeTools.java b/src/main/java/com/Nxer/TwistSpaceTechnology/recipe/specialRecipe/TCRecipeTools.java
index a7eac0b1..8a68439b 100644
--- a/src/main/java/com/Nxer/TwistSpaceTechnology/recipe/specialRecipe/TCRecipeTools.java
+++ b/src/main/java/com/Nxer/TwistSpaceTechnology/recipe/specialRecipe/TCRecipeTools.java
@@ -3,18 +3,35 @@
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
+import thaumcraft.api.crafting.CrucibleRecipe;
import thaumcraft.api.crafting.InfusionRecipe;
public class TCRecipeTools {
public static ArrayList ICR = new ArrayList<>();// InfusionCraftingRecipeList
+ public static ArrayList CR = new ArrayList<>();
public TCRecipeTools() {}
+ public static void getCrucibleRecipe() {
+ for (Object r : ThaumcraftApi.getCraftingRecipes()) {
+ if ((r instanceof CrucibleRecipe recipe && recipe.getRecipeOutput() != null)) {
+ TCCrucibleRecipe c = new TCCrucibleRecipe(
+ recipe.key,
+ recipe.getRecipeOutput(),
+ recipe.catalyst,
+ recipe.aspects);
+ CR.add(c);
+ }
+ }
+ }
+
public static void getInfusionCraftingRecipe() {
for (Object r : ThaumcraftApi.getCraftingRecipes()) {
if (!(r instanceof InfusionRecipe recipe)) {
@@ -36,6 +53,14 @@ public static void getInfusionCraftingRecipe() {
}
+ public static void setAspects(ItemStack itemstack, AspectList aspects) {
+ if (!itemstack.hasTagCompound()) {
+ itemstack.setTagCompound(new NBTTagCompound());
+ }
+
+ aspects.writeToNBT(itemstack.getTagCompound());
+ }
+
public static class InfusionCraftingRecipe {
private final ItemStack InputItem;
@@ -93,4 +118,38 @@ public int getAspectAmount() {
}
}
+
+ public static class TCCrucibleRecipe {
+
+ private final ItemStack recipeOutput;
+ private Object catalyst;
+ private final AspectList aspects;
+ private final String key;
+
+ public TCCrucibleRecipe(String researchKey, ItemStack result, Object cat, AspectList tags) {
+ this.recipeOutput = result;
+ this.aspects = tags;
+ this.key = researchKey;
+ this.catalyst = cat;
+ if (cat instanceof String) {
+ this.catalyst = OreDictionary.getOres((String) cat);
+ }
+ }
+
+ public Object getCatalyst() {
+ return catalyst;
+ }
+
+ public AspectList getAspects() {
+ return aspects;
+ }
+
+ public ItemStack getRecipeOutput() {
+ return recipeOutput;
+ }
+
+ public String getKey() {
+ return key;
+ }
+ }
}
diff --git a/src/main/resources/assets/gtnhcommunitymod/textures/MagicCircle/Test.png b/src/main/resources/assets/gtnhcommunitymod/textures/MagicCircle/Test.png
new file mode 100644
index 00000000..d53fce60
Binary files /dev/null and b/src/main/resources/assets/gtnhcommunitymod/textures/MagicCircle/Test.png differ
diff --git a/src/main/resources/assets/gtnhcommunitymod/textures/MagicCircle/WellOfSufferingArray.png b/src/main/resources/assets/gtnhcommunitymod/textures/MagicCircle/WellOfSufferingArray.png
new file mode 100644
index 00000000..c5c63f6a
Binary files /dev/null and b/src/main/resources/assets/gtnhcommunitymod/textures/MagicCircle/WellOfSufferingArray.png differ
diff --git a/src/main/resources/mixins.TwistSpaceTechnology.json b/src/main/resources/mixins.TwistSpaceTechnology.json
new file mode 100644
index 00000000..11f76584
--- /dev/null
+++ b/src/main/resources/mixins.TwistSpaceTechnology.json
@@ -0,0 +1,11 @@
+{
+ "required": true,
+ "minVersion": "0.8.5-GTNH",
+ "package": "com.Nxer.TwistSpaceTechnology.mixin",
+ "refmap": "mixins.TwistSpaceTechnology.refmap.json",
+ "target": "@env(DEFAULT)",
+ "compatibilityLevel": "JAVA_8",
+ "mixins": [],
+ "client": [],
+ "server": []
+}