From f3af1d348943d83c16672ea8111f840484fc8f81 Mon Sep 17 00:00:00 2001 From: Technus Date: Sat, 22 Jul 2017 15:15:48 +0200 Subject: no message --- .../technus/tectech/loader/MachineLoader.java | 2 +- .../technus/tectech/thing/CustomItemList.java | 1 - .../multi/GT_MetaTileEntity_EM_microwave.java | 185 --------------------- .../multi/GT_MetaTileEntity_TM_microwave.java | 179 ++++++++++++++++++++ .../tectech/thing/metaTileEntity/multi/other todo | 2 +- 5 files changed, 181 insertions(+), 188 deletions(-) delete mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_microwave.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java (limited to 'src/main/java/com') 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 cd2eea6cca..6b37db2cee 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -182,7 +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_Microwave.set(new GT_MetaTileEntity_TM_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 d69789950f..d00e97ca36 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -1,6 +1,5 @@ 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; 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 deleted file mode 100644 index 0f23322bf3..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_microwave.java +++ /dev/null @@ -1,185 +0,0 @@ -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 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_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java new file mode 100644 index 0000000000..ba35db7a34 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -0,0 +1,179 @@ +package com.github.technus.tectech.thing.metaTileEntity.multi; + +import com.github.technus.tectech.CommonValues; +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 static gregtech.api.GregTech_API.sBlockCasings4; + +/** + * Created by danie_000 on 17.12.2016. + */ +public class GT_MetaTileEntity_TM_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_TM_microwave(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_TM_microwave(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TM_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 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/other todo b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo index f59c71bbbd..ba2a8d2062 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/other todo @@ -1,4 +1,3 @@ -microwave grinder forcefields colorizer -> aka colorable 'bloodmoon' in a box HAARP, holograms? gravity wells/entity accelerators @@ -15,6 +14,7 @@ design reader station - singleblock quantum dislocator - to move GT tiles? GT infusion altar +magic matter compounds Fucking regular multiblock container for EM... - hightier - with selection of what u want -- cgit