diff --git a/changelog b/changelog index d1aa96597..7ac809e1b 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,18 @@ +## Added +* Pneumatic Storage System + * Mass storage logistics system that can perform various automation tasks + * Items can be stored in clutter storages (steel crate equivalent) or mono type storages (ironically supports three types set using filters holding several thousand items) + * In order to be accessible, all storages need a supply of compressed air with the compression level dictating range + * Access points allow items to be retrieved and inserted manually + * Access points have a search function as well as several sorting options + * Importers allow hopper IO to add items to the network + * Exporters allow items to be retrieved and then taken using hopper IO, things like filters and request rules can be defined in several ways + * Allows continuous request and request on demand (redstone or RoR command) + * Filters can be set using items or RoR commands + * Requests can be configured to take as much as possible, to only take full stacks, or to only take full requests + * In combination with assembler recipe switching, using RoR logic, this means that on-demand recipe automation is now possible + * The budget didn't cover actually testing this so uh, you go figure it out + ## Changed * Updated chinese localization * Watz powerplant now has OC and RoR integration @@ -45,6 +60,17 @@ * Polling for receiving only fresh RoR signals * A command for writing the world time to the buffer, allowing for more precise timers * All RoR values/commands are now case-insensitive +* Changed mask man spawning rules + * Instead of random checks and chances, if a player meets the requirements, a timer starts (timer exists per player) + * Once this timer runs out, mask man spawns + * Should the timer run out but the spawn be unsuccessful (spawn restrictions) then a different message appears + * If the requirements are no longer met, the timer immediately resets, making it easier to avoid him deliberately + * The default spawn timer is now 20 minutes, making it easier to spawn him deliberately + * One minute before the timer ends, a warning message appears +* Changed normal mode control unit recipes + * Standard control units now use rubber instead of speed I upgrades + * Advanced control units now use hardplastics instead of speed III upgrades + * Quantum computers now use speed III upgrades instead of overdrive I ## Fixed * Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised @@ -56,3 +82,4 @@ * Fixed `anyBismoid` group not being a proper group, causing other mods' bismuth and arsenic to not be included * Fixed RoR gauge not using SI suffixes on values below 0 * Fixed AUTOCAL units not closing their GUI when the unit is destroyed +* Fixed AUTOCAL's $buffer$ substitution not working diff --git a/src/main/java/com/hbm/config/MobConfig.java b/src/main/java/com/hbm/config/MobConfig.java index f5b583df0..337a32754 100644 --- a/src/main/java/com/hbm/config/MobConfig.java +++ b/src/main/java/com/hbm/config/MobConfig.java @@ -5,8 +5,7 @@ import net.minecraftforge.common.config.Configuration; public class MobConfig { public static boolean enableMaskman = true; - public static int maskmanDelay = 60 * 60 * 60; - public static int maskmanChance = 3; + public static int maskmanDelay = 20 * 60; // 20 minutes public static int maskmanMinRad = 50; public static boolean maskmanUnderground = true; @@ -78,8 +77,7 @@ public class MobConfig { final String CATEGORY = CommonConfig.CATEGORY_MOBS; enableMaskman = CommonConfig.createConfigBool(config, CATEGORY, "12.M00_enableMaskman", "Whether mask man should spawn", true); - maskmanDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.M01_maskmanDelay", "How many world ticks need to pass for a check to be performed", 60 * 60 * 60); - maskmanChance = CommonConfig.createConfigInt(config, CATEGORY, "12.M02_maskmanChance", "1:x chance to spawn mask man, must be at least 1", 3); + maskmanDelay = CommonConfig.createConfigInt(config, CATEGORY, "12.M01_maskmanTimer", "How many world seconds need to pass for mask man to spawn, if the requirements are met", 20 * 60); maskmanMinRad = CommonConfig.createConfigInt(config, CATEGORY, "12.M03_maskmanMinRad", "The amount of radiation needed for mask man to spawn", 50); maskmanUnderground = CommonConfig.createConfigBool(config, CATEGORY, "12.M04_maskmanUnderound", "Whether players need to be underground for mask man to spawn", true); diff --git a/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanMinigun.java b/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanMinigun.java index c794a1d3b..3d451b9d5 100644 --- a/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanMinigun.java +++ b/src/main/java/com/hbm/entity/mob/ai/EntityAIMaskmanMinigun.java @@ -9,43 +9,45 @@ import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.util.Vec3; public class EntityAIMaskmanMinigun extends EntityAIBase { - + private EntityCreature owner; - private EntityLivingBase target; - int delay; - int timer; + private EntityLivingBase target; + int delay; + int timer; public EntityAIMaskmanMinigun(EntityCreature owner, boolean checkSight, boolean nearbyOnly, int delay) { this.owner = owner; this.delay = delay; - timer = delay; + this.timer = delay; } @Override public boolean shouldExecute() { - - EntityLivingBase entity = this.owner.getAttackTarget(); - if(entity == null) { - return false; - - } else { - this.target = entity; - double dist = Vec3.createVectorHelper(target.posX - owner.posX, target.posY - owner.posY, target.posZ - owner.posZ).lengthVector(); - return dist > 5 && dist < 10; - } + EntityLivingBase entity = this.owner.getAttackTarget(); + + if(entity == null || !entity.isEntityAlive()) { + return false; + } else { + this.target = entity; + double dist = Vec3.createVectorHelper(target.posX - owner.posX, target.posY - owner.posY, target.posZ - owner.posZ).lengthVector(); + return dist > 5 && dist < 10; + } } - - @Override - public boolean continueExecuting() { - return this.shouldExecute() || !this.owner.getNavigator().noPath(); - } @Override - public void updateTask() { - + public boolean continueExecuting() { + return this.shouldExecute() || !this.owner.getNavigator().noPath(); + } + + @Override + public void updateTask() { + timer--; - + + // TEST + if(target != null) this.owner.getLookHelper().setLookPositionWithEntity(this.target, 15F, 15F); + if(timer <= 0) { timer = delay; @@ -53,7 +55,7 @@ public class EntityAIMaskmanMinigun extends EntityAIBase { owner.worldObj.spawnEntityInWorld(bullet); owner.playSound("hbm:weapon.calShoot", 1.0F, 1.0F); } - + this.owner.rotationYaw = this.owner.rotationYawHead; - } + } } diff --git a/src/main/java/com/hbm/extprop/HbmPlayerProps.java b/src/main/java/com/hbm/extprop/HbmPlayerProps.java index 292c04412..29983c7df 100644 --- a/src/main/java/com/hbm/extprop/HbmPlayerProps.java +++ b/src/main/java/com/hbm/extprop/HbmPlayerProps.java @@ -25,35 +25,43 @@ public class HbmPlayerProps implements IExtendedEntityProperties { public static final String key = "NTM_EXT_PLAYER"; public EntityPlayer player; - public boolean hasReceivedBook = false; - + /* Toggles for keybind */ public boolean enableHUD = true; public boolean enableBackpack = true; public boolean enableMagnet = true; + /** Keybind tracking */ private boolean[] keysPressed = new boolean[EnumKeybind.values().length]; + + /* Dashes for bismuth armor/cloud in a bottle */ public boolean dashActivated = true; - - public static final int dashCooldownLength = 5; public int dashCooldown = 0; - public int totalDashCount = 0; public int stamina = 0; + public static final int dashCooldownLength = 5; - public static final int plinkCooldownLength = 10; + /** Cooldown for armor plinking noise when canceling damage */ public int plinkCooldown = 0; + public static final int plinkCooldownLength = 10; + /** Shield infusion */ public float shield = 0; public float maxShield = 0; public int lastDamage = 0; public static final float shieldCap = 100; + /** Latnern repair/destroy count */ public int reputation; + /** Hack for allowing ladders on multiblocks */ public boolean isOnLadder = false; + /** Pulling the pin on a grenade - it's a player prop instead of an NBT trait */ public int grenadeDeployment; + + /** Maskman timer */ + public int maskManTimer = 0; public HbmPlayerProps(EntityPlayer player) { this.player = player; @@ -187,7 +195,6 @@ public class HbmPlayerProps implements IExtendedEntityProperties { public void init(Entity entity, World world) { } public void serialize(ByteBuf buf) { - buf.writeBoolean(this.hasReceivedBook); buf.writeFloat(this.shield); buf.writeFloat(this.maxShield); buf.writeBoolean(this.enableBackpack); @@ -199,7 +206,6 @@ public class HbmPlayerProps implements IExtendedEntityProperties { public void deserialize(ByteBuf buf) { if(buf.readableBytes() > 0) { - this.hasReceivedBook = buf.readBoolean(); this.shield = buf.readFloat(); this.maxShield = buf.readFloat(); this.enableBackpack = buf.readBoolean(); @@ -216,7 +222,6 @@ public class HbmPlayerProps implements IExtendedEntityProperties { NBTTagCompound props = new NBTTagCompound(); - props.setBoolean("hasReceivedBook", hasReceivedBook); props.setFloat("shield", shield); props.setFloat("maxShield", maxShield); props.setBoolean("enableBackpack", enableBackpack); @@ -224,6 +229,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties { props.setBoolean("enableHUD", enableHUD); props.setInteger("reputation", reputation); props.setBoolean("isOnLadder", isOnLadder); + props.setInteger("maskManTimer", maskManTimer); nbt.setTag("HbmPlayerProps", props); } @@ -235,7 +241,6 @@ public class HbmPlayerProps implements IExtendedEntityProperties { NBTTagCompound props = (NBTTagCompound) nbt.getTag("HbmPlayerProps"); if(props != null) { - this.hasReceivedBook = props.getBoolean("hasReceivedBook"); this.shield = props.getFloat("shield"); this.maxShield = props.getFloat("maxShield"); this.enableBackpack = props.getBoolean("enableBackpack"); @@ -243,6 +248,7 @@ public class HbmPlayerProps implements IExtendedEntityProperties { this.enableHUD = props.getBoolean("enableHUD"); this.reputation = props.getInteger("reputation"); this.isOnLadder = props.getBoolean("isOnLadder"); + this.maskManTimer = props.getInteger("maskManTimer"); } } } diff --git a/src/main/java/com/hbm/handler/BossSpawnHandler.java b/src/main/java/com/hbm/handler/BossSpawnHandler.java index 756d1f1d8..a73a36bbe 100644 --- a/src/main/java/com/hbm/handler/BossSpawnHandler.java +++ b/src/main/java/com/hbm/handler/BossSpawnHandler.java @@ -13,6 +13,7 @@ import com.hbm.entity.mob.EntityMaskMan; import com.hbm.entity.mob.EntityRADBeast; import com.hbm.entity.projectile.EntityMeteor; import com.hbm.extprop.HbmLivingProps; +import com.hbm.extprop.HbmPlayerProps; import com.hbm.items.ModItems; import com.hbm.main.MainRegistry; import com.hbm.util.ContaminationUtil; @@ -29,6 +30,7 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.Vec3; +import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; @@ -45,33 +47,44 @@ public class BossSpawnHandler { * - the player has at least 50 RAD * - the player has either crafted or placed an ore acidizer before */ - if(MobConfig.enableMaskman) { - - if(world.getTotalWorldTime() % MobConfig.maskmanDelay == 0) { - - if(world.rand.nextInt(MobConfig.maskmanChance) == 0 && !world.playerEntities.isEmpty() && world.provider.isSurfaceWorld()) { //33% chance only if there is a player online - - EntityPlayer player = (EntityPlayer) world.playerEntities.get(world.rand.nextInt(world.playerEntities.size())); //choose a random player - int id = Item.getIdFromItem(Item.getItemFromBlock(ModBlocks.machine_crystallizer)); - - StatBase statCraft = StatList.objectCraftStats[id]; - StatBase statPlace = StatList.objectUseStats[id]; - - if(!(player instanceof EntityPlayerMP)) return; - EntityPlayerMP playerMP = (EntityPlayerMP) player; - - boolean acidizerStat = !GeneralConfig.enableStatReRegistering || (statCraft != null && playerMP.func_147099_x().writeStat(statCraft) > 0)|| (statPlace != null && playerMP.func_147099_x().writeStat(statPlace) > 0); - - if(acidizerStat && ContaminationUtil.getRads(player) >= MobConfig.maskmanMinRad && (world.getHeightValue((int)player.posX, (int)player.posZ) > player.posY + 3 || !MobConfig.maskmanUnderground)) { //if the player has more than 50 RAD and is underground - - player.addChatComponentMessage(new ChatComponentText("The mask man is about to claim another victim.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); - + if(MobConfig.enableMaskman && world.getTotalWorldTime() % 20 == 0 && world.provider.isSurfaceWorld() && world.difficultySetting != EnumDifficulty.PEACEFUL) { + + for(Object o : world.playerEntities) { + if(!(o instanceof EntityPlayerMP)) return; + EntityPlayerMP player = (EntityPlayerMP) o; + + int id = Item.getIdFromItem(Item.getItemFromBlock(ModBlocks.machine_crystallizer)); + StatBase statCraft = StatList.objectCraftStats[id]; + StatBase statPlace = StatList.objectUseStats[id]; + + boolean acidizerStat = !GeneralConfig.enableStatReRegistering || (statCraft != null && player.func_147099_x().writeStat(statCraft) > 0)|| (statPlace != null && player.func_147099_x().writeStat(statPlace) > 0); + boolean hasRads = ContaminationUtil.getRads(player) >= MobConfig.maskmanMinRad; + boolean underground = world.getHeightValue((int) Math.floor(player.posX), (int) Math.floor(player.posZ)) > player.posY + 3 || !MobConfig.maskmanUnderground; + + if(acidizerStat && hasRads && underground) { + HbmPlayerProps data = HbmPlayerProps.getData(player); + + data.maskManTimer++; + + if(data.maskManTimer == MobConfig.maskmanDelay - 20 * 60) { + player.addChatComponentMessage(new ChatComponentText("The mask man draws near.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + } + + if(data.maskManTimer >= MobConfig.maskmanDelay) { + data.maskManTimer = 0; + double spawnX = player.posX + world.rand.nextGaussian() * 20; double spawnZ = player.posZ + world.rand.nextGaussian() * 20; - double spawnY = world.getHeightValue((int)spawnX, (int)spawnZ); - - trySpawn(world, (float)spawnX, (float)spawnY, (float)spawnZ, new EntityMaskMan(world)); + double spawnY = world.getHeightValue((int) Math.floor(spawnX), (int) Math.floor(spawnZ)); + if(trySpawn(world, (float) spawnX, (float) spawnY, (float) spawnZ, new EntityMaskMan(world))) { + player.addChatComponentMessage(new ChatComponentText("The mask man is about to claim another victim.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); + } else { + player.addChatComponentMessage(new ChatComponentText("Seems like mask man couldn't come today.").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.BLUE))); + } } + + } else { + HbmPlayerProps.getData(player).maskManTimer = 0; } } } @@ -169,8 +182,7 @@ public class BossSpawnHandler { } } - private static void trySpawn(World world, float x, float y, float z, EntityLiving e) { - + private static boolean trySpawn(World world, float x, float y, float z, EntityLiving e) { e.setLocationAndAngles(x, y, z, world.rand.nextFloat() * 360.0F, 0.0F); Result canSpawn = ForgeEventFactory.canEntitySpawn(e, world, x, y, z); @@ -179,7 +191,10 @@ public class BossSpawnHandler { world.spawnEntityInWorld(e); ForgeEventFactory.doSpecialSpawn(e, world, x, y, z); e.onSpawnWithEgg(null); + return true; } + + return false; } public static void markFBI(EntityPlayer player) { diff --git a/src/main/java/com/hbm/inventory/gui/GUIPneumoStorageExporter.java b/src/main/java/com/hbm/inventory/gui/GUIPneumoStorageExporter.java index 2f7001c41..3a0164a54 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIPneumoStorageExporter.java +++ b/src/main/java/com/hbm/inventory/gui/GUIPneumoStorageExporter.java @@ -9,6 +9,7 @@ import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageExporter; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; public class GUIPneumoStorageExporter extends GuiInfoContainer { @@ -27,6 +28,25 @@ public class GUIPneumoStorageExporter extends GuiInfoContainer { @Override public void drawScreen(int x, int y, float interp) { super.drawScreen(x, y, interp); + + this.drawCustomInfoStat(x, y, guiLeft + 142, guiTop + 16, 18, 18, x, y, "Request mode: " + EnumChatFormatting.YELLOW + (this.importer.continuousRequest ? "Continuous" : "By request")); + + this.drawCustomInfoStat(x, y, guiLeft + 142, guiTop + 34, 18, 18, x, y, "Request type: " + EnumChatFormatting.YELLOW + ( + this.importer.requestMode == this.importer.MODE_AS_MUCH_AS_POSSIBLE ? "As much as possible" : + this.importer.requestMode == this.importer.MODE_FULL_STACK ? "Only full stacks" : "Only full requests" + )); + + if(this.importer.rorConfiguredMode) { + String[] label = new String[10]; + label[0] = "Filter type: " + EnumChatFormatting.YELLOW + "RoR configured"; + for(int i = 0; i < 9; i++) { + boolean hasFilter = this.importer.rorFilters[i][0] != 0 && this.importer.rorFilters[i][2] > 0; + label[i + 1] = "Slot " + (i + 1) + ": " + (!hasFilter ? "None" : ("Item #" + this.importer.rorFilters[i][0] + " with Meta " + this.importer.rorFilters[i][1] + " x" + this.importer.rorFilters[i][2])); + } + this.drawCustomInfoStat(x, y, guiLeft + 142, guiTop + 52, 18, 18, x, y, label); + } else { + this.drawCustomInfoStat(x, y, guiLeft + 142, guiTop + 52, 18, 18, x, y, "Filter type: " + EnumChatFormatting.YELLOW + "Manually configured"); + } } @Override @@ -52,8 +72,11 @@ public class GUIPneumoStorageExporter extends GuiInfoContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + if(this.importer.rorConfiguredMode) { + drawTexturedModalRect(guiLeft + 142, guiTop + 52, xSize, 18, 18, 18); + drawTexturedModalRect(guiLeft + 14, guiTop + 14, 77, 14, 58, 58); + } if(!this.importer.continuousRequest) drawTexturedModalRect(guiLeft + 142, guiTop + 16, xSize, 0, 18, 18); - if(!this.importer.rorConfiguredMode) drawTexturedModalRect(guiLeft + 142, guiTop + 52, xSize, 18, 18, 18); if(this.importer.requestMode == importer.MODE_FULL_STACK) drawTexturedModalRect(guiLeft + 142, guiTop + 34, xSize + 18, 0, 18, 18); if(this.importer.requestMode == importer.MODE_FULL_REQUEST) drawTexturedModalRect(guiLeft + 142, guiTop + 34, xSize + 18, 18, 18, 18); } diff --git a/src/main/java/com/hbm/inventory/recipes/SolderingRecipes.java b/src/main/java/com/hbm/inventory/recipes/SolderingRecipes.java index 5f03dcd54..dd88e66f6 100644 --- a/src/main/java/com/hbm/inventory/recipes/SolderingRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/SolderingRecipes.java @@ -118,7 +118,7 @@ public class SolderingRecipes extends SerializableRecipe { new ComparableStack(ModItems.circuit, lbsm ? 8 : 16, EnumCircuitType.CAPACITOR_TANTALIUM)}, new AStack[] { new ComparableStack(ModItems.circuit, 1, EnumCircuitType.CONTROLLER_CHASSIS), - new ComparableStack(ModItems.upgrade_speed_1)}, + new OreDictStack(RUBBER.ingot(), 4)}, new AStack[] { new OreDictStack(PB.wireFine(), 16)} )); @@ -130,7 +130,7 @@ public class SolderingRecipes extends SerializableRecipe { new ComparableStack(ModItems.circuit, 1, EnumCircuitType.ATOMIC_CLOCK)}, new AStack[] { new ComparableStack(ModItems.circuit, 1, EnumCircuitType.CONTROLLER_CHASSIS), - new ComparableStack(ModItems.upgrade_speed_3)}, + new OreDictStack(ANY_HARDPLASTIC.ingot(), 4)}, new AStack[] { new OreDictStack(PB.wireFine(), 24)} )); @@ -142,7 +142,7 @@ public class SolderingRecipes extends SerializableRecipe { new ComparableStack(ModItems.circuit, lbsm ? 1 : 8, EnumCircuitType.ATOMIC_CLOCK)}, new AStack[] { new ComparableStack(ModItems.circuit, 2, EnumCircuitType.CONTROLLER_ADVANCED), - new ComparableStack(ModItems.upgrade_overdrive_1)}, + new ComparableStack(ModItems.upgrade_speed_3)}, new AStack[] { new OreDictStack(PB.wireFine(), 32)} )); diff --git a/src/main/java/com/hbm/module/ParseMSES1.java b/src/main/java/com/hbm/module/ParseMSES1.java index 909dc5dd6..c79e367f7 100644 --- a/src/main/java/com/hbm/module/ParseMSES1.java +++ b/src/main/java/com/hbm/module/ParseMSES1.java @@ -264,10 +264,15 @@ public class ParseMSES1 implements IParse { if(!readingVar) { readingVar = true; } else { - if("buffer".equals(var)) { - joined.append(ctx.readBuffer()); + String varName = var.toString(); + if("buffer".equals(varName)) { + String variable = ctx.readBuffer(); + if(forceNumber && variable.isEmpty()) variable = "0"; + joined.append(variable); + var.delete(0, var.length()); + readingVar = false; } else { - String variable = ctx.variables.getString(var.toString()); + String variable = ctx.variables.getString(varName); if(forceNumber && variable.isEmpty()) variable = "0"; joined.append(variable); var.delete(0, var.length()); diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index 0efef5c6c..07e01bbca 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -57,10 +57,7 @@ import com.hbm.tileentity.machine.pile.*; import com.hbm.tileentity.machine.rbmk.*; import com.hbm.tileentity.machine.storage.*; import com.hbm.tileentity.network.*; -import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageAccess; -import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageClutter; -import com.hbm.tileentity.network.pneumatic.TileEntityPneumoStorageMono; -import com.hbm.tileentity.network.pneumatic.TileEntityPneumoTube; +import com.hbm.tileentity.network.pneumatic.*; import com.hbm.tileentity.turret.*; import com.hbm.util.Compat; @@ -476,6 +473,8 @@ public class TileMappings { put(TileEntityPneumoStorageAccess.class, "tileentity_pneumatic_storage_access"); put(TileEntityPneumoStorageClutter.class, "tileentity_pneumatic_storage_clutter"); put(TileEntityPneumoStorageMono.class, "tileentity_pneumatic_storage_mono"); + put(TileEntityPneumoStorageImporter.class, "tileentity_pneumatic_storage_importer"); + put(TileEntityPneumoStorageExporter.class, "tileentity_pneumatic_storage_exporter"); put(TileEntityRadioTorchSender.class, "tileentity_rtty_sender"); put(TileEntityRadioTorchReceiver.class, "tileentity_rtty_rec"); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java index 2e6f1bc82..4ecf97689 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityPWRController.java @@ -216,6 +216,12 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG if(this.rodTarget > this.rodLevel) this.rodLevel++; if(this.rodTarget < this.rodLevel) this.rodLevel--; + double multiplier = 1D; + + if(tanks[0].getTankType().hasTrait(FT_PWRModerator.class)) { + multiplier = tanks[0].getTankType().getTrait(FT_PWRModerator.class).getMultiplier(); + } + int newFlux = this.sourceCount * 20; if(typeLoaded != -1 && amountLoaded > 0) { @@ -227,6 +233,10 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG double totalOutput = outputPerRod * amountLoaded * usedRods; double totalHeatOutput = totalOutput * fuel.heatEmission; + if(tanks[0].getFill() > 0) { + totalHeatOutput *= multiplier; + } + this.coreHeat += totalHeatOutput; newFlux += totalOutput; @@ -266,8 +276,8 @@ public class TileEntityPWRController extends TileEntityMachineBase implements IG this.flux = newFlux; - if(tanks[0].getTankType().hasTrait(FT_PWRModerator.class) && tanks[0].getFill() > 0) { - this.flux *= tanks[0].getTankType().getTrait(FT_PWRModerator.class).getMultiplier(); + if(tanks[0].getFill() > 0) { + this.flux *= multiplier; } if(this.coreHeat > this.coreHeatCapacity) { diff --git a/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageExporter.java b/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageExporter.java index 8aa8b0df5..f0913de23 100644 --- a/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageExporter.java +++ b/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageExporter.java @@ -38,6 +38,8 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB public static final int MODE_FULL_STACK = 1; /** All request slots try to pull the desired quantities simultaneously */ public static final int MODE_FULL_REQUEST = 2; + + public boolean lastRedstone = false; public TileEntityPneumoStorageExporter() { super(18); @@ -57,11 +59,17 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB for(int i = 0; i < 9; i++) { if(slotDelay[i] > 0) slotDelay[i]--; } + + boolean redstone = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); if(continuousRequest) { this.doRequest(false); + } else { + if(redstone && !lastRedstone) this.doRequest(true); } + this.lastRedstone = redstone; + this.networkPackNT(15); } } @@ -90,7 +98,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB int requestSize = filter[2]; int existingSize = 0; - ItemStack existingStack = slots[i]; + ItemStack existingStack = slots[i + 9]; if(existingStack != null) { if(existingStack.getItem() == item && existingStack.getItemDamage() == meta && !existingStack.hasTagCompound()) { @@ -121,7 +129,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB int requestSize = filter[2]; int existingSize = 0; - ItemStack existingStack = slots[i]; + ItemStack existingStack = slots[i + 9]; if(existingStack != null) existingSize = existingStack.stackSize; ItemStack newStack = new ItemStack(item, 1, meta); @@ -132,8 +140,8 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB CacheSlot cacheSlot = this.cache.cacheSlots.get(hash); if(cacheSlot == null) continue; // safeguard - slots[i] = newStack; - slots[i].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, requestSize); + slots[i + 9] = newStack; + slots[i + 9].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, requestSize); } this.markChanged(); @@ -155,7 +163,7 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB int requestSize = filter[2]; int existingSize = 0; - ItemStack existingStack = slots[slot]; + ItemStack existingStack = slots[slot + 9]; if(existingStack != null) { if(existingStack.getItem() == item && existingStack.getItemDamage() == meta && !existingStack.hasTagCompound()) { @@ -181,8 +189,9 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB if(cacheSlot.stacksize <= 0) return false; int toPull = (int) BobMathUtil.min(requestSize, cacheSlot.stacksize, capacityLeft); - slots[slot] = newStack; - slots[slot].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, toPull); + + slots[slot + 9] = newStack; + slots[slot + 9].stackSize = existingSize + (int) this.cache.consumeItemsAndReturnQuantity(newStack, toPull); this.markChanged(); return true; @@ -237,6 +246,41 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB } } + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + + this.continuousRequest = nbt.getBoolean("continuousRequest"); + this.rorConfiguredMode = nbt.getBoolean("rorConfiguredMode"); + this.requestMode = nbt.getByte("requestMode"); + for(int i = 0; i < 9; i++) { + rorFilters[i][0] = nbt.getShort("filter_" + i + "_0"); + rorFilters[i][1] = nbt.getShort("filter_" + i + "_1"); + rorFilters[i][2] = nbt.getShort("filter_" + i + "_2"); + } + + this.lastRedstone = nbt.getBoolean("lastRedstone"); + this.slotDelay = nbt.getIntArray("slotDelay"); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + + nbt.setBoolean("continuousRequest", continuousRequest); + nbt.setBoolean("rorConfiguredMode", rorConfiguredMode); + nbt.setByte("requestMode", (byte) requestMode); + + for(int i = 0; i < 9; i++) { + nbt.setShort("filter_" + i + "_0", (short) rorFilters[i][0]); + nbt.setShort("filter_" + i + "_1", (short) rorFilters[i][1]); + nbt.setShort("filter_" + i + "_2", (short) rorFilters[i][2]); + } + + nbt.setBoolean("lastRedstone", lastRedstone); + nbt.setIntArray("slotDelay", slotDelay); + } + @Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerPneumoStorageExporter(player.inventory, this); } @Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIPneumoStorageExporter(player.inventory, this); }