aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBass <basdxz@github.com>2017-07-19 18:50:48 +0100
committerBass <basdxz@github.com>2017-07-19 18:50:48 +0100
commitab3c3189b1bad0804e1a1766a6d17f248767cd71 (patch)
tree0dab77dee20ac3e0588618e36b8a5d6804eb6c64
parentb4dffb9fed2342ca2df09c9d2bd9ecbe35bd3613 (diff)
downloadGT5-Unofficial-ab3c3189b1bad0804e1a1766a6d17f248767cd71.tar.gz
GT5-Unofficial-ab3c3189b1bad0804e1a1766a6d17f248767cd71.tar.bz2
GT5-Unofficial-ab3c3189b1bad0804e1a1766a6d17f248767cd71.zip
Added Microwave multiblock just in time for supper!
-rw-r--r--src/main/java/com/github/technus/tectech/CommonValues.java5
-rw-r--r--src/main/java/com/github/technus/tectech/loader/MachineLoader.java1
-rw-r--r--src/main/java/com/github/technus/tectech/thing/CustomItemList.java3
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_microwave.java185
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java12
5 files changed, 201 insertions, 5 deletions
diff --git a/src/main/java/com/github/technus/tectech/CommonValues.java b/src/main/java/com/github/technus/tectech/CommonValues.java
index 7293c351d2..0b01377a95 100644
--- a/src/main/java/com/github/technus/tectech/CommonValues.java
+++ b/src/main/java/com/github/technus/tectech/CommonValues.java
@@ -10,6 +10,11 @@ public final class CommonValues {
EnumChatFormatting.BLUE + "Tec" +
EnumChatFormatting.DARK_BLUE + "Tech" +
EnumChatFormatting.BLUE + ": Elemental Matter";
+ public final static String bassMark =
+ EnumChatFormatting.BLUE + "Bass" +
+ EnumChatFormatting.DARK_BLUE + "Tech" +
+ EnumChatFormatting.BLUE + ": Theta Movement";
+
public final static byte decayAt = 0;// hatches compute decays
public final static byte multiPurge1At = 2;// multiblocks clean their hatches 1
public final static byte moveAt = 4;// move stuff around
diff --git a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java
index f5cab894e6..cd2eea6cca 100644
--- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java
@@ -182,6 +182,7 @@ public class MachineLoader implements Runnable {
Machine_Multi_Switch.set(new GT_MetaTileEntity_EM_switch(15310, "multimachine.em.switch", "Network Switch With QoS").getStackForm(1L));
Machine_Multi_Computer.set(new GT_MetaTileEntity_EM_computer(15311, "multimachine.em.computer", "Quantum Computer").getStackForm(1L));
+ Machine_Multi_Microwave.set(new GT_MetaTileEntity_EM_microwave(15312, "multimachine.tm.microwave", "Microwave Grinder").getStackForm(1L));
Machine_Multi_EMjunction.set(new GT_MetaTileEntity_EM_junction(15320, "multimachine.em.junction", "Matter Junction").getStackForm(1L));
Machine_Multi_MatterToEM.set(new GT_MetaTileEntity_EM_quantizer(15321, "multimachine.em.mattertoem", "Matter Quantizer").getStackForm(1L));
diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
index ff2d15a580..d69789950f 100644
--- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
+++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
@@ -1,5 +1,6 @@
package com.github.technus.tectech.thing;
+import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_microwave;
import gregtech.api.interfaces.IItemContainer;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
@@ -33,7 +34,7 @@ public enum CustomItemList implements IItemContainer {
debugBlock,
Machine_Multi_EssentiaToEM, Machine_Multi_EMToEssentia,
Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction,
- Machine_Multi_Transformer, Machine_Multi_Computer, Machine_Multi_Infuser, Machine_Multi_Switch,
+ Machine_Multi_Transformer, Machine_Multi_Computer, Machine_Multi_Microwave, Machine_Multi_Infuser, Machine_Multi_Switch,
Machine_Multi_BHG, Machine_Multi_Annihilation, Machine_Multi_Decay,
Machine_Multi_EMmachine, Machine_Multi_Stabilizer, Machine_Multi_Collider, Machine_Multi_Wormhole, Machine_Multi_EMCrafter, Machine_Multi_Scanner, Machine_Multi_Research;
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_microwave.java
new file mode 100644
index 0000000000..0f23322bf3
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_microwave.java
@@ -0,0 +1,185 @@
+package com.github.technus.tectech.thing.metaTileEntity.multi;
+
+import com.github.technus.tectech.CommonValues;
+import com.github.technus.tectech.thing.block.QuantumGlassBlock;
+import gregtech.GT_Mod;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static com.github.technus.tectech.thing.casing.GT_Container_CasingsTT.sBlockCasingsTT;
+import static gregtech.api.GregTech_API.sBlockCasings1;
+import static gregtech.api.GregTech_API.sBlockCasings4;
+
+/**
+ * Created by danie_000 on 17.12.2016.
+ */
+public class GT_MetaTileEntity_EM_microwave extends GT_MetaTileEntity_MultiblockBase_EM {
+ private int powerSetting = 1000;
+ private int timerSetting = 0;
+ private int timerValue = 0,timerValueBackup=0;
+
+ //region Structure
+ //use multi A energy inputs, use less power the longer it runs
+ private static final String[][] shape = new String[][]{
+ {"00000", "00000", "00.00", "0 0",},
+ {"0C0", "0C0", "0C0", " 000 ",},
+ {"0C0", "0C0", "0C0", " 000 ",},
+ {"0C0", "0C0", "0C0", " 000 ",},
+ {"00000", "00000", "00000", "0 0",},
+ };
+ private static final Block[] blockType = new Block[]{sBlockCasings4};
+ private static final byte[] blockMeta = new byte[]{1};
+
+ private static final String[] addingMethods = new String[]{"addClassicToMachineList"};
+ private static final byte[] casingTextures = new byte[]{49};
+ private static final Block[] blockTypeFallback = new Block[]{sBlockCasings4};
+ private static final byte[] blockMetaFallback = new byte[]{1};
+ //endregion
+
+ public GT_MetaTileEntity_EM_microwave(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_EM_microwave(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_EM_microwave(this.mName);
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]};
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing >= 2;
+ }
+
+ @Override
+ public boolean EM_checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
+ return EM_StructureCheckAdvanced(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ CommonValues.bassMark,
+ "High Frequency Oven",
+ EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "From live to done in seconds!",
+ EnumChatFormatting.BLUE + "I said nuke the chinese, I meant microwave supper!",
+ };
+ }
+
+ @Override
+ public boolean EM_checkRecipe(ItemStack itemStack) {
+ if(powerSetting<=300 || eParamsInStatus[0] == PARAM_TOO_HIGH || timerSetting<=0 || timerSetting>3000) return false;
+ if (timerValue <= 0) {
+ timerValueBackup=timerValue=timerSetting;
+ }
+ mEUt = -(powerSetting >> 1);
+ eAmpereFlow = 1;
+ mMaxProgresstime = 20;
+ mEfficiencyIncrease = 10000;
+ return true;
+ }
+
+ @Override
+ public void EM_outputFunction() {
+ timerValue=timerValueBackup--;
+ IGregTechTileEntity mte=getBaseMetaTileEntity();
+ int xDirShift = ForgeDirection.getOrientation(mte.getBackFacing()).offsetX*2;
+ int zDirShift = ForgeDirection.getOrientation(mte.getBackFacing()).offsetZ*2;
+ float xPos=mte.getXCoord()+0.5f;
+ float yPos=mte.getYCoord()+0.5f;
+ float zPos=mte.getZCoord()+0.5f;
+ ArrayList<ItemStack> itemsToOutput=new ArrayList<>();
+
+ AxisAlignedBB aabb=AxisAlignedBB.getBoundingBox(xPos-1.5+xDirShift,yPos-.5,zPos-1.5+zDirShift,xPos+1.5+xDirShift,yPos+2.5,zPos+1.5+zDirShift);
+
+ for(Object entity : mte.getWorld().getEntitiesWithinAABBExcludingEntity(null,aabb)){
+ if(entity instanceof Entity){
+ if(entity instanceof EntityItem){
+ itemsToOutput.add(((EntityItem) entity).getEntityItem());
+ ((EntityItem) entity).setDead(); //todo FIX
+ //todo cook stuff with microwave recipes
+ }else if(entity instanceof EntityLiving){
+ ((EntityLiving) entity).attackEntityFrom(DamageSource.inFire,powerSetting>>9);//todo add microwaving damage type
+ }
+ }
+ }
+ mOutputItems=itemsToOutput.toArray(new ItemStack[0]);
+ if(timerValue==0) stopMachine();
+ }
+
+ @Override
+ public void EM_checkParams() {
+ if (eParamsIn[0] <= 300)
+ eParamsInStatus[0] = PARAM_TOO_LOW;
+ else if (eParamsIn[0] < 1000)
+ eParamsInStatus[0] = PARAM_LOW;
+ else if (eParamsIn[0] == 1000)
+ eParamsInStatus[0] = PARAM_OK;
+ else if (eParamsIn[0] <= Integer.MAX_VALUE)
+ eParamsInStatus[0] = PARAM_HIGH;
+ else eParamsInStatus[0] = PARAM_TOO_HIGH;
+
+ if (eParamsIn[10] <= 1)
+ eParamsInStatus[10] = PARAM_TOO_LOW;
+ else if (eParamsIn[10] <= 3000)
+ eParamsInStatus[10] = PARAM_OK;
+ else eParamsInStatus[10] = PARAM_TOO_HIGH;
+
+ powerSetting = (int)eParamsIn[0];
+ timerSetting = (int)eParamsIn[10];
+
+ eParamsOut[0] = timerValue;
+
+ if (eSafeVoid) {
+ eSafeVoid=false;
+ stopMachine();
+ timerValue=timerValueBackup;
+ }
+ }
+
+ @Override
+ protected void EM_stopMachine() {
+ timerValue=0;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("eTimerVal", timerValue);
+ aNBT.setInteger("eTimerValBU", timerValueBackup);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ timerValue = aNBT.getInteger("eTimerVal");
+ timerValueBackup = aNBT.getInteger("eTimerValBU");
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java
index ae9b52e645..6679a0ea60 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java
@@ -69,10 +69,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
public ArrayList<GT_MetaTileEntity_Hatch_InputData> eInputData = new ArrayList<>();
public ArrayList<GT_MetaTileEntity_Hatch_OutputData> eOutputData = new ArrayList<>();
- public final float[] eParamsIn = new float[20];
- public final float[] eParamsOut = new float[20];
- public final byte[] eParamsInStatus = new byte[20];
- public final byte[] eParamsOutStatus = new byte[20];
+ // 0 and 10 are from first parametrizer
+ // 1 and 11 are from second etc...
+
+ public final float[] eParamsIn = new float[20];//float number I from parametrizers
+ public final float[] eParamsOut = new float[20];//float number O to parametrizers
+ public final byte[] eParamsInStatus = new byte[20];//LED status for I
+ public final byte[] eParamsOutStatus = new byte[20];//LED status for O
public final static byte PARAM_UNUSED = 0, PARAM_OK = 1, PARAM_TOO_LOW = 2, PARAM_LOW = 3, PARAM_TOO_HIGH = 4, PARAM_HIGH = 5, PARAM_WRONG = 6;
//TO ENABLE this change value in <init> to false and/or other than 0, can also be added in recipe check or whatever
@@ -169,6 +172,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
super.registerIcons(aBlockIconRegister);
}
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[textureOffset + 4], new GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)};