diff options
4 files changed, 64 insertions, 36 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java b/src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java index 76999906e3..8ead6373c0 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/PreciseAssembler.java @@ -5,10 +5,13 @@ import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_H import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import goodgenerator.blocks.tileEntity.base.GT_MetaTileEntity_TooltipMultiBlockBase_EM; import goodgenerator.loader.Loaders; +import goodgenerator.main.GoodGenerator; +import goodgenerator.network.MessageResetTileTexture; import goodgenerator.util.DescTextLocalization; import goodgenerator.util.MyRecipeAdder; import gregtech.api.GregTech_API; @@ -27,6 +30,7 @@ import gregtech.api.util.GT_Utility; import ic2.core.Ic2Items; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; @@ -194,7 +198,7 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM if (this.mode == 0) { for (GT_MetaTileEntity_Hatch_InputBus bus : mInputBusses) { if (!isValidMetaTileEntity(bus)) continue; - GT_Recipe tRecipe = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), true, Math.min(getMachineVoltageLimit(), getMaxInputVoltage()), inputFluids, getStoredItemFromHatch(bus)); + GT_Recipe tRecipe = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), false, Math.min(getMachineVoltageLimit(), getMaxInputVoltage()), inputFluids, getStoredItemFromHatch(bus)); if (tRecipe != null && tRecipe.mSpecialValue <= casingTier) { this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; @@ -211,8 +215,8 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM } else { for (GT_MetaTileEntity_Hatch_InputBus bus : mInputBusses) { - if (!isValidMetaTileEntity(bus)) continue; - GT_Recipe tRecipe = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), true, Math.min(getMachineVoltageLimit(), getMaxInputVoltage()), inputFluids, getStoredItemFromHatch(bus)); + if (!isValidMetaTileEntity(bus) || getStoredItemFromHatch(bus).length < 1) continue; + GT_Recipe tRecipe = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), false, Math.min(getMachineVoltageLimit(), getMaxInputVoltage()), inputFluids, getStoredItemFromHatch(bus)); if (tRecipe != null) { this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; @@ -319,7 +323,8 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM if (casingTier != 0) { reUpdate(1538 + casingTier); } - return casingAmount >= 12 && machineTier != 0 && casingTier != 0 && mMaintenanceHatches.size() == 1 && !mMufflerHatches.isEmpty(); + GoodGenerator.CHANNEL.sendToAllAround(new MessageResetTileTexture(aBaseMetaTileEntity, casingTier), new NetworkRegistry.TargetPoint(aBaseMetaTileEntity.getWorld().provider.dimensionId, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), 16)); + return casingAmount >= 42 && machineTier != 0 && casingTier != 0 && mMaintenanceHatches.size() == 1 && !mMufflerHatches.isEmpty(); } return false; } @@ -431,34 +436,4 @@ public class PreciseAssembler extends GT_MetaTileEntity_TooltipMultiBlockBase_EM } else return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(1538 + t)}; } - - @SideOnly(Side.CLIENT) - public int getCasingTierClient() { - if (this.getBaseMetaTileEntity().getWorld() == null) { - return 0; - } - try { - for (byte i = 0; i < 6; i++) { - Block casing = getBaseMetaTileEntity().getBlockAtSide(i); - if (casing != null && casing.equals(Loaders.preciseUnitCasing)) { - return getBaseMetaTileEntity().getMetaIDAtSide(i) + 1; - } - } - } - catch (Throwable t) { - return 0; - } - return 0; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isClientSide()) { - if (this.getBaseMetaTileEntity() != null && this.getBaseMetaTileEntity().getWorld() != null) { - this.casingTier = getCasingTierClient(); - markDirty(); - } - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } } diff --git a/src/main/java/goodgenerator/main/GoodGenerator.java b/src/main/java/goodgenerator/main/GoodGenerator.java index e81d6b1dc1..36bf8d4231 100644 --- a/src/main/java/goodgenerator/main/GoodGenerator.java +++ b/src/main/java/goodgenerator/main/GoodGenerator.java @@ -5,6 +5,7 @@ import goodgenerator.crossmod.thaumcraft.Research; import goodgenerator.items.MyMaterial; import goodgenerator.loader.*; import goodgenerator.network.MessageOpenNeutronSensorGUI; +import goodgenerator.network.MessageResetTileTexture; import goodgenerator.network.MessageSetNeutronSensorData; import goodgenerator.tabs.MyTabs; import com.github.bartimaeusnek.bartworks.API.WerkstoffAdderRegistry; @@ -39,6 +40,7 @@ public final class GoodGenerator { static { CHANNEL.registerMessage(MessageSetNeutronSensorData.ServerHandler.class, MessageSetNeutronSensorData.class, 0, Side.SERVER); CHANNEL.registerMessage(MessageOpenNeutronSensorGUI.ClientHandler.class, MessageOpenNeutronSensorGUI.class, 1, Side.CLIENT); + CHANNEL.registerMessage(MessageResetTileTexture.ClientHandler.class, MessageResetTileTexture.class, 1, Side.CLIENT); } @Mod.Instance(GoodGenerator.MOD_ID) diff --git a/src/main/java/goodgenerator/network/MessageResetTileTexture.java b/src/main/java/goodgenerator/network/MessageResetTileTexture.java new file mode 100644 index 0000000000..dd729af662 --- /dev/null +++ b/src/main/java/goodgenerator/network/MessageResetTileTexture.java @@ -0,0 +1,51 @@ +package goodgenerator.network; + +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import goodgenerator.blocks.tileEntity.PreciseAssembler; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import io.netty.buffer.ByteBuf; + +public class MessageResetTileTexture extends MessageMTEBase { + + protected int index; + + public MessageResetTileTexture(){ + } + + public MessageResetTileTexture(IGregTechTileEntity tile, int index) { + super(tile); + this.index = index; + } + + @Override + public void fromBytes(ByteBuf buf) { + super.fromBytes(buf); + index = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf) { + super.toBytes(buf); + buf.writeInt(index); + } + + public static class ClientHandler extends MessageMTEBase.Handler<MessageResetTileTexture, IMessage> { + + @Override + protected IMessage onError(MessageResetTileTexture message, MessageContext ctx) { + return null; + } + + @Override + protected IMessage onSuccess(MessageResetTileTexture message, MessageContext ctx, IMetaTileEntity mte) { + if (mte instanceof PreciseAssembler) { + ((PreciseAssembler) mte).setCasingTier(message.index); + mte.markDirty(); + } + return null; + } + } + +} diff --git a/src/main/resources/assets/goodgenerator/lang/en_US.lang b/src/main/resources/assets/goodgenerator/lang/en_US.lang index 23b3780c8d..9c7e5d9af6 100644 --- a/src/main/resources/assets/goodgenerator/lang/en_US.lang +++ b/src/main/resources/assets/goodgenerator/lang/en_US.lang @@ -324,7 +324,7 @@ ExtremeHeatExchanger.hint.2=2 - Output hatch for SC Steam/SH Steam/Steam ExtremeHeatExchanger.hint.3=3 - Input hatch for hot fluid ExtremeHeatExchanger.hint.4=4 - Output hatch for cold fluid ExtremeHeatExchanger.hint.5=Any Casing - Maintenance Hatch -PreciseAssembler.hint.0=At least 12x Precise Electronic Unit Casings +PreciseAssembler.hint.0=At least 42x Precise Electronic Unit Casings PreciseAssembler.hint.1=12x Tungstensteel Frame Box PreciseAssembler.hint.2=42x Reinforced Glasses PreciseAssembler.hint.3=21x Machine Casing (Not Machine Hull!) @@ -461,4 +461,4 @@ research.ESSENTIA_UPGRADE_RADIATION.page.0=The use of this Essentia for power ge research.ESSENTIA_UPGRADE_RADIATION.page.1=Acceptable Aspects:<BR><BR>Radio: 238000EU Coefficient:x1.0<BR><BR>Custom4: 118000EU Coefficient:x0.5 research.ESSENTIA_UPGRADE_RADIATION.page.2=Optional Liquid:<BR><BR>Molten Caesium: Efficiency:x2.0<BR><BR>Molten Uranium-235: Efficiency:x3.0<BR><BR>Molten Naquadah: Efficiency:x4.0<BR><BR>Molten Atomic Separation Catalyst: Efficiency:x16.0 research.ESSENTIA_UPGRADE_ELECTRIC.page.0=The ELECTRUM Essentia itself represents electricity!<BR><BR>The higher the voltage of the generator dynamo hatch, the more ELECTRUM will be affected by potential difference and increase the amount of energy. -research.ESSENTIA_UPGRADE_ELECTRIC.page.1=Acceptable Aspects: Electrum<BR><BR>The formula to calculate its power:<BR>8x(3.0^Dynamo Hatch Tier)EU
\ No newline at end of file +research.ESSENTIA_UPGRADE_ELECTRIC.page.1=Acceptable Aspects: Electrum<BR><BR>The formula to calculate its power:<BR>8x(3.0^Dynamo Hatch Tier)EU |