From 55a40919ccf2175aff9214fadd1642f6c4b9a61c Mon Sep 17 00:00:00 2001 From: Boblet Date: Thu, 9 Jul 2026 11:59:11 +0200 Subject: [PATCH] now with extra non-glooby slime --- changelog | 14 +++- .../com/hbm/blocks/generic/BlockPedestal.java | 70 ++++++++++++++++++- .../hbm/entity/mob/glyphid/EntityGlyphid.java | 7 ++ .../com/hbm/handler/BossSpawnHandler.java | 21 +++++- .../gui/GUIMachineElectricFurnace.java | 30 ++++---- .../com/hbm/items/armor/ItemModDefuser.java | 7 +- .../java/com/hbm/items/armor/ItemModMilk.java | 6 +- .../java/com/hbm/items/tool/ItemDefuser.java | 2 +- .../java/com/hbm/main/ModEventHandler.java | 24 ++++--- src/main/java/com/hbm/potion/HbmPotion.java | 2 +- .../tileentity/IControlReceiverFilter.java | 9 +-- .../hbm/tileentity/TileEntityDoorGeneric.java | 20 +++--- .../machine/rbmk/TileEntityRBMKTerminal.java | 45 +++++++++++- .../TileEntityPneumoStorageExporter.java | 14 +++- .../TileEntityPneumoStorageMono.java | 11 ++- .../com/hbm/world/gen/MapGenChainloader.java | 2 - .../com/hbm/world/gen/NTMWorldGenerator.java | 46 ++++++------ .../hbm/world/generator/TimedGenerator.java | 4 +- 18 files changed, 253 insertions(+), 81 deletions(-) diff --git a/changelog b/changelog index e80502e33..be0317ad2 100644 --- a/changelog +++ b/changelog @@ -11,7 +11,9 @@ * 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 - * Still in testing, there's no recpes for any of the parts yet + * Still in testing, there's no recipes for any of the parts yet +* Cargo door + * Steel grate door which goes well with the cargo elevators ## Changed * Updated chinese localization @@ -71,6 +73,15 @@ * 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 +* Updated electric furnace GUI +* The RoR terminal can now accept RoR controller input, allowing the terminal screen to be written directly and RoR terminal commands to be executed via incoming RoR signals + * The last part seems redundant, why would you need to send RoR by sending RoR? The answer being, the terminal can be toggled to send polling signals, which will run independently of the source + * For AUTOCALs, this means that they can now send polling signals "in parallel", i.e. independently of the code that actually runs on said AUTOCAL, by simply toggling polling on a terminal + * Since AUTOCALs now have a proper screen to output things with, it is now theoretically possible to program a functioning arcade machine (with terminal graphics) +* Glyphids will now try to target new players every 5 seconds if their current target is farther away than any other potential target + * 1/3 of glyphids do not have this behavior, this means that larger groups of glyphids cannot be trapped indefinitely by triggering target changes on purpose +* Pedestal blocks fitted with charms now have a 200x200 block square area around them where the charm effect of repelling meteors applies to all players +* Pedestal blocks fitted with golden defusers now have a 50x50 block area around them where creepers are automatically defused ## Fixed * Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised @@ -85,3 +96,4 @@ * Fixed AUTOCAL's $buffer$ substitution not working * Fixed meteorite sword localization still being broken * Fixed missing localization on the FM radio +* Fixed mufflers not working on large doors diff --git a/src/main/java/com/hbm/blocks/generic/BlockPedestal.java b/src/main/java/com/hbm/blocks/generic/BlockPedestal.java index 82a2b46bb..a1d1207dd 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockPedestal.java +++ b/src/main/java/com/hbm/blocks/generic/BlockPedestal.java @@ -1,14 +1,19 @@ package com.hbm.blocks.generic; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import com.hbm.extprop.HbmPlayerProps; import com.hbm.inventory.recipes.PedestalRecipes; import com.hbm.inventory.recipes.PedestalRecipes.PedestalRecipe; +import com.hbm.items.ModItems; +import com.hbm.items.armor.ItemModDefuser; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.particle.helper.ExplosionSmallCreator; import com.hbm.util.Compat; +import com.hbm.util.fauxpointtwelve.BlockPos; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; @@ -18,6 +23,7 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -194,8 +200,24 @@ public class BlockPedestal extends BlockContainer { public ItemStack item; - @Override public boolean canUpdate() { return false; } - + @Override + public void updateEntity() { + + if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 20 == 0) { + + if(this.item != null) { + if(item.getItem() == ModItems.protection_charm) pushPedestalEntry(worldObj, PedestalEntryType.CHARM_OF_PROTECTION, xCoord, yCoord, zCoord); + if(item.getItem() == ModItems.meteor_charm) pushPedestalEntry(worldObj, PedestalEntryType.METEORITE_CHARM, xCoord, yCoord, zCoord); + if(worldObj.getTotalWorldTime() % 60 == 0 && item.getItem() == ModItems.defuser) castrateCreepers(); + } + } + } + + public void castrateCreepers() { + List creepers = worldObj.getEntitiesWithinAABB(EntityCreeper.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1).expand(25, 25, 25)); + for(EntityCreeper creeper : creepers) ItemModDefuser.castrateCreeper(creeper, null, false); + } + @Override public Packet getDescriptionPacket() { NBTTagCompound nbt = new NBTTagCompound(); @@ -224,4 +246,48 @@ public class BlockPedestal extends BlockContainer { } } } + + public static HashMap> pedestalEntries = new HashMap(); + + public static void pushPedestalEntry(World world, PedestalEntryType type, int x, int y, int z) { + PedestalEntry entry = new PedestalEntry(type, x, y, z, world.getTotalWorldTime()); + + int dim = world.provider.dimensionId; + List entries = pedestalEntries.get(dim); + + if(entries == null) { + entries = new ArrayList(); + pedestalEntries.put(dim, entries); + } + entries.add(entry); + } + + public static final int timeout = 60; //3 seconds + + public static void checkPedestalEntries(int dim, long currentTime) { + List entries = getEntriesForDimension(dim); + if(entries == null) return; + entries.removeIf(x -> { return x.timestamp < currentTime - timeout; }); + } + + public static List getEntriesForDimension(int dim) { + return pedestalEntries.get(dim); + } + + public static class PedestalEntry { + public PedestalEntryType type; + public BlockPos pos; + public long timestamp; + + public PedestalEntry(PedestalEntryType type, int x, int y, int z, long timestamp) { + this.type = type; + this.pos = new BlockPos(x, y, z); + this.timestamp = timestamp; + } + } + + public static enum PedestalEntryType { + CHARM_OF_PROTECTION, + METEORITE_CHARM + } } diff --git a/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphid.java index ac2f90e7d..95d1e6578 100644 --- a/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/glyphid/EntityGlyphid.java @@ -223,6 +223,13 @@ public class EntityGlyphid extends EntityMob implements IResistanceProvider { @Override protected void updateEntityActionState() { super.updateEntityActionState(); + + // re-scan for new targets every so often + // every third glyphid does not do this, so you cannot "juggle" hordes on purpose + if(this.getEntityId() % 3 > 0 && (this.getEntityId() + this.ticksExisted) % 100 == 0) { + Entity newTarget = this.findPlayerToAttack(); + if(newTarget != null) this.setTarget(newTarget); + } if(!this.isPotionActive(Potion.blindness)) { if (!this.hasPath()) { diff --git a/src/main/java/com/hbm/handler/BossSpawnHandler.java b/src/main/java/com/hbm/handler/BossSpawnHandler.java index a73a36bbe..4b77a265c 100644 --- a/src/main/java/com/hbm/handler/BossSpawnHandler.java +++ b/src/main/java/com/hbm/handler/BossSpawnHandler.java @@ -1,8 +1,12 @@ package com.hbm.handler; +import java.util.List; import java.util.Random; import com.hbm.blocks.ModBlocks; +import com.hbm.blocks.generic.BlockPedestal; +import com.hbm.blocks.generic.BlockPedestal.PedestalEntry; +import com.hbm.blocks.generic.BlockPedestal.PedestalEntryType; import com.hbm.config.GeneralConfig; import com.hbm.config.MobConfig; import com.hbm.config.WorldConfig; @@ -231,9 +235,22 @@ public class BossSpawnHandler { } } } + + // only check if either charm is not present + if(!repell || strike) { + int x = (int) Math.floor(p.posX); + int z = (int) Math.floor(p.posZ); + + List entries = BlockPedestal.getEntriesForDimension(world.provider.dimensionId); + if(entries != null) for(PedestalEntry entry : entries) { + if(Math.abs(entry.pos.getX() - x) <= 100 && Math.abs(entry.pos.getZ() - z) <= 100) { + if(entry.type == PedestalEntryType.CHARM_OF_PROTECTION) repell = true; + if(entry.type == PedestalEntryType.METEORITE_CHARM) strike = false; + } + } + } - if(strike) - spawnMeteorAtPlayer(p, repell); + if(strike) spawnMeteorAtPlayer(p, repell); } } } diff --git a/src/main/java/com/hbm/inventory/gui/GUIMachineElectricFurnace.java b/src/main/java/com/hbm/inventory/gui/GUIMachineElectricFurnace.java index 01bf13c3c..e31ed7ed4 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIMachineElectricFurnace.java +++ b/src/main/java/com/hbm/inventory/gui/GUIMachineElectricFurnace.java @@ -16,11 +16,11 @@ import com.hbm.util.i18n.I18nUtil; public class GUIMachineElectricFurnace extends GuiInfoContainer { private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/GUIElectricFurnace.png"); - private TileEntityMachineElectricFurnace diFurnace; + private TileEntityMachineElectricFurnace furnace; - public GUIMachineElectricFurnace(InventoryPlayer invPlayer, TileEntityMachineElectricFurnace tedf) { - super(new ContainerElectricFurnace(invPlayer, tedf)); - diFurnace = tedf; + public GUIMachineElectricFurnace(InventoryPlayer invPlayer, TileEntityMachineElectricFurnace furnace) { + super(new ContainerElectricFurnace(invPlayer, furnace)); + this.furnace = furnace; this.xSize = 176; this.ySize = 186; @@ -30,18 +30,18 @@ public class GUIMachineElectricFurnace extends GuiInfoContainer { public void drawScreen(int mouseX, int mouseY, float f) { super.drawScreen(mouseX, mouseY, f); - this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 20, guiTop + 69 - 52, 16, 52, diFurnace.power, diFurnace.maxPower); + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 52 - 34, 16, 34, furnace.power, furnace.maxPower); String[] upgradeText = new String[3]; upgradeText[0] = I18nUtil.resolveKey("desc.gui.upgrade"); upgradeText[1] = I18nUtil.resolveKey("desc.gui.upgrade.speed"); upgradeText[2] = I18nUtil.resolveKey("desc.gui.upgrade.power"); - this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 151, guiTop + 19, 8, 8, mouseX, mouseY, upgradeText); + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 116, guiTop + 20, 8, 8, mouseX, mouseY, upgradeText); } @Override protected void drawGuiContainerForegroundLayer(int i, int j) { - String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); + String name = this.furnace.hasCustomInventoryName() ? this.furnace.getInventoryName() : I18n.format(this.furnace.getInventoryName()); this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); @@ -58,21 +58,21 @@ public class GUIMachineElectricFurnace extends GuiInfoContainer { //if initial ZE is still present, it'll be used instead //works so that container packets can still be used //efficiency! - if(diFurnace.isInvalid() && diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) instanceof TileEntityMachineElectricFurnace) - diFurnace = (TileEntityMachineElectricFurnace) diFurnace.getWorldObj().getTileEntity(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord); + if(furnace.isInvalid() && furnace.getWorldObj().getTileEntity(furnace.xCoord, furnace.yCoord, furnace.zCoord) instanceof TileEntityMachineElectricFurnace) + furnace = (TileEntityMachineElectricFurnace) furnace.getWorldObj().getTileEntity(furnace.xCoord, furnace.yCoord, furnace.zCoord); - if(diFurnace.hasPower()) { - int i = (int)diFurnace.getPowerScaled(34); - drawTexturedModalRect(guiLeft + 152, guiTop + 52 - i, 176, 64 - i, 16, i); + if(furnace.hasPower()) { + int p = (int) furnace.getPowerScaled(34); + drawTexturedModalRect(guiLeft + 152, guiTop + 52 - p, 176, 64 - p, 16, p); } - if(diFurnace.getWorldObj().getBlock(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord) == ModBlocks.machine_electric_furnace_on) { + if(furnace.getWorldObj().getBlock(furnace.xCoord, furnace.yCoord, furnace.zCoord) == ModBlocks.machine_electric_furnace_on) { drawTexturedModalRect(guiLeft + 45, guiTop + 20, 192, 12, 18, 16); drawTexturedModalRect(guiLeft + 45, guiTop + 47, 192, 36, 18, 16); } - int j1 = diFurnace.getProgressScaled(28); - drawTexturedModalRect(guiLeft + 43, guiTop + 36, 176, 0, j1, 12); + int p = furnace.getProgressScaled(28); + drawTexturedModalRect(guiLeft + 43, guiTop + 36, 176, 0, p, 12); this.drawInfoPanel(guiLeft + 116, guiTop + 20, 8, 8, 8); } diff --git a/src/main/java/com/hbm/items/armor/ItemModDefuser.java b/src/main/java/com/hbm/items/armor/ItemModDefuser.java index fafc290f1..ea7426817 100644 --- a/src/main/java/com/hbm/items/armor/ItemModDefuser.java +++ b/src/main/java/com/hbm/items/armor/ItemModDefuser.java @@ -42,10 +42,11 @@ public class ItemModDefuser extends ItemArmorMod { List creepers = entity.worldObj.getEntitiesWithinAABB(EntityCreeper.class, entity.boundingBox.expand(5, 5, 5)); - for(EntityCreeper creeper : creepers) defuse(creeper, entity, true); + for(EntityCreeper creeper : creepers) castrateCreeper(creeper, entity, true); } - public static boolean defuse(EntityCreeper creeper, EntityLivingBase entity, boolean dropItem) { + /** my bualls */ + public static boolean castrateCreeper(EntityCreeper creeper, EntityLivingBase entity, boolean dropItem) { creeper.setCreeperState(-1); creeper.getDataWatcher().updateObject(18, new Byte((byte) 0)); @@ -66,7 +67,7 @@ public class ItemModDefuser extends ItemArmorMod { if(dropItem) { creeper.worldObj.playSoundEffect(creeper.posX, creeper.posY, creeper.posZ, "hbm:item.pinBreak", 1.0F, 1.0F); creeper.dropItem(ModItems.safety_fuse, 1); - creeper.attackEntityFrom(DamageSource.causeMobDamage(entity), 1.0F); + creeper.attackEntityFrom(entity != null ? DamageSource.causeMobDamage(entity) : DamageSource.magic, 1.0F); creeper.addPotionEffect(new PotionEffect(Potion.weakness.id, 0, 200)); } creeper.getEntityData().setBoolean("hfr_defused", true); diff --git a/src/main/java/com/hbm/items/armor/ItemModMilk.java b/src/main/java/com/hbm/items/armor/ItemModMilk.java index 1985c6b17..5350516f6 100644 --- a/src/main/java/com/hbm/items/armor/ItemModMilk.java +++ b/src/main/java/com/hbm/items/armor/ItemModMilk.java @@ -38,11 +38,9 @@ public class ItemModMilk extends ItemArmorMod { public void modUpdate(EntityLivingBase entity, ItemStack armor) { List ints = new ArrayList(); - Iterator iterator = ((Collection) entity.getActivePotionEffects()).iterator(); while(iterator.hasNext()) { - PotionEffect eff = (PotionEffect) iterator.next(); if(HbmPotion.getIsBadEffect(Potion.potionTypes[eff.getPotionID()])) { @@ -50,8 +48,6 @@ public class ItemModMilk extends ItemArmorMod { } } - for(Integer i : ints) { - entity.removePotionEffect(i); - } + for(Integer i : ints) entity.removePotionEffect(i); } } diff --git a/src/main/java/com/hbm/items/tool/ItemDefuser.java b/src/main/java/com/hbm/items/tool/ItemDefuser.java index 9a1aa6d9b..c2a04c3b9 100644 --- a/src/main/java/com/hbm/items/tool/ItemDefuser.java +++ b/src/main/java/com/hbm/items/tool/ItemDefuser.java @@ -27,7 +27,7 @@ public class ItemDefuser extends ItemTooling { public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity) { if(entity instanceof EntityCreeper) { - return ItemModDefuser.defuse((EntityCreeper) entity, player, true); + return ItemModDefuser.castrateCreeper((EntityCreeper) entity, player, true); } if(entity instanceof EntityGlyphidNuclear) { diff --git a/src/main/java/com/hbm/main/ModEventHandler.java b/src/main/java/com/hbm/main/ModEventHandler.java index e4d50949d..a6f3cb7fe 100644 --- a/src/main/java/com/hbm/main/ModEventHandler.java +++ b/src/main/java/com/hbm/main/ModEventHandler.java @@ -5,6 +5,7 @@ import com.google.common.collect.Multimap; import com.hbm.blocks.IStepTickReceiver; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockAshes; +import com.hbm.blocks.generic.BlockPedestal; import com.hbm.config.GeneralConfig; import com.hbm.config.MobConfig; import com.hbm.config.RadiationConfig; @@ -508,7 +509,7 @@ public class ModEventHandler { public void onLivingUpdate(LivingUpdateEvent event) { if(event.entityLiving instanceof EntityCreeper && event.entityLiving.getEntityData().getBoolean("hfr_defused")) { - ItemModDefuser.defuse((EntityCreeper) event.entityLiving, null, false); + ItemModDefuser.castrateCreeper((EntityCreeper) event.entityLiving, null, false); } ItemStack[] prevArmor = event.entityLiving.previousEquipment; @@ -586,12 +587,15 @@ public class ModEventHandler { @SubscribeEvent public void worldTick(WorldTickEvent event) { + + World world = event.world; + long time = world.getTotalWorldTime(); - if(event.world != null && !event.world.isRemote) { + if(world != null && !world.isRemote) { if(reference != null) { - for(Object player : event.world.playerEntities) { - if(((EntityPlayer) player).ridingEntity != null && event.world.getTotalWorldTime() % (1 * 60 * 20) == 0) { + for(Object player : world.playerEntities) { + if(((EntityPlayer) player).ridingEntity != null && time % (1 * 60 * 20) == 0) { ((EntityPlayer) player).mountEntity(null); didSit = true; } @@ -605,7 +609,7 @@ public class ModEventHandler { int tickrate = Math.max(1, ServerConfig.ITEM_HAZARD_DROP_TICKRATE.get()); - if(event.world.getTotalWorldTime() % tickrate == 0) { + if(time % tickrate == 0) { List loadedEntityList = new ArrayList(); loadedEntityList.addAll(event.world.loadedEntityList); // ConcurrentModificationException my balls @@ -618,13 +622,17 @@ public class ModEventHandler { } } - EntityRailCarBase.updateMotion(event.world); + EntityRailCarBase.updateMotion(world); + } + + if(time % 20 == 0) { + BlockPedestal.checkPedestalEntries(world.provider.dimensionId, time); } } if(event.phase == Phase.START) { - BossSpawnHandler.rollTheDice(event.world); - TimedGenerator.automaton(event.world, 100); + BossSpawnHandler.rollTheDice(world); + TimedGenerator.automaton(world, 100); } } diff --git a/src/main/java/com/hbm/potion/HbmPotion.java b/src/main/java/com/hbm/potion/HbmPotion.java index c1189b8b6..0e03d6458 100644 --- a/src/main/java/com/hbm/potion/HbmPotion.java +++ b/src/main/java/com/hbm/potion/HbmPotion.java @@ -176,7 +176,7 @@ public class HbmPotion extends Potion { public static boolean getIsBadEffect(Potion potion) { try { - Field isBadEffect = ReflectionHelper.findField(Potion.class, "isBadEffect", "field_76418_K"); + Field isBadEffect = ReflectionHelper.findField(Potion.class, "isBadEffect", "field_76418_K"); //TODO: use an AT for this boolean ret = isBadEffect.getBoolean(potion); return ret; diff --git a/src/main/java/com/hbm/tileentity/IControlReceiverFilter.java b/src/main/java/com/hbm/tileentity/IControlReceiverFilter.java index b007be844..5801d7bd4 100644 --- a/src/main/java/com/hbm/tileentity/IControlReceiverFilter.java +++ b/src/main/java/com/hbm/tileentity/IControlReceiverFilter.java @@ -15,11 +15,6 @@ public interface IControlReceiverFilter extends IControlReceiver, ICopiable { void nextMode(int i); - /* - default ModulePatternMatcher getMatcher(){ - - }*/ - @Override default void receiveControl(NBTTagCompound data) { if(data.hasKey("slot")) { @@ -44,11 +39,11 @@ public interface IControlReceiverFilter extends IControlReceiver, ICopiable { } /** * Used for the copy tool - * @return The start and end (start inclusive, end exclusive) of the filter slots of the TE + * @return The start and end (start inclusive, end exclusive) of the filter slots of the TE // seven, what the fuck? */ int[] getFilterSlots(); - @Override + @Override default NBTTagCompound getSettings(World world, int x, int y, int z) { IInventory inv = (IInventory) this; NBTTagCompound nbt = new NBTTagCompound(); diff --git a/src/main/java/com/hbm/tileentity/TileEntityDoorGeneric.java b/src/main/java/com/hbm/tileentity/TileEntityDoorGeneric.java index 29bfb46ae..ffda38e6b 100644 --- a/src/main/java/com/hbm/tileentity/TileEntityDoorGeneric.java +++ b/src/main/java/com/hbm/tileentity/TileEntityDoorGeneric.java @@ -243,18 +243,18 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase { } if(doorType.getOpenSoundLoop() != null) { - audio = MainRegistry.proxy.getLoopedSound(doorType.getOpenSoundLoop(), xCoord, yCoord, zCoord, doorType.getSoundVolume(), 10F, 1F); + audio = MainRegistry.proxy.getLoopedSound(doorType.getOpenSoundLoop(), xCoord, yCoord, zCoord, getVolume(), 10F, 1F); audio.startSound(); } if(doorType.getOpenSoundStart() != null) { - worldObj.playSound(xCoord, yCoord, zCoord, doorType.getOpenSoundStart(), doorType.getSoundVolume(), 1F, false); + worldObj.playSound(xCoord, yCoord, zCoord, doorType.getOpenSoundStart(), getVolume(), 1F, false); } if(doorType.getSoundLoop2() != null) { if(audio2 != null) audio2.stopSound(); - audio2 = MainRegistry.proxy.getLoopedSound(doorType.getSoundLoop2(), xCoord, yCoord, zCoord, doorType.getSoundVolume(), 10F, 1F); + audio2 = MainRegistry.proxy.getLoopedSound(doorType.getSoundLoop2(), xCoord, yCoord, zCoord, getVolume(), 10F, 1F); audio2.startSound(); } } @@ -265,18 +265,18 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase { } if(doorType.getCloseSoundLoop() != null) { - audio = MainRegistry.proxy.getLoopedSound(doorType.getCloseSoundLoop(), xCoord, yCoord, zCoord, doorType.getSoundVolume(), 10F, 1F); + audio = MainRegistry.proxy.getLoopedSound(doorType.getCloseSoundLoop(), xCoord, yCoord, zCoord, getVolume(), 10F, 1F); audio.startSound(); } if(doorType.getCloseSoundStart() != null) { - worldObj.playSound(xCoord, yCoord, zCoord, doorType.getCloseSoundStart(), doorType.getSoundVolume(), 1F, false); + worldObj.playSound(xCoord, yCoord, zCoord, doorType.getCloseSoundStart(), getVolume(), 1F, false); } if(doorType.getSoundLoop2() != null) { if(audio2 != null) audio2.stopSound(); - audio2 = MainRegistry.proxy.getLoopedSound(doorType.getSoundLoop2(), xCoord, yCoord, zCoord, doorType.getSoundVolume(), 10F, 1F); + audio2 = MainRegistry.proxy.getLoopedSound(doorType.getSoundLoop2(), xCoord, yCoord, zCoord, getVolume(), 10F, 1F); audio2.startSound(); } } @@ -294,13 +294,13 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase { if(this.state == STATE_OPENING && state == STATE_OPEN) { // Door finished transitioning to open if(doorType.getOpenSoundEnd() != null) { - worldObj.playSound(xCoord, yCoord, zCoord, doorType.getOpenSoundEnd(), doorType.getSoundVolume(), 1F, false); + worldObj.playSound(xCoord, yCoord, zCoord, doorType.getOpenSoundEnd(), getVolume(), 1F, false); } } if(this.state == STATE_CLOSING && state == STATE_CLOSED) { // Door finished transitioning to closed if(doorType.getCloseSoundEnd() != null) { - worldObj.playSound(xCoord, yCoord, zCoord, doorType.getCloseSoundEnd(), doorType.getSoundVolume(), 1F, false); + worldObj.playSound(xCoord, yCoord, zCoord, doorType.getCloseSoundEnd(), getVolume(), 1F, false); } } @@ -313,6 +313,10 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase { } } } + + public float getVolume() { + return getVolume(doorType.getSoundVolume()); + } public int getSkinIndex() { return skinIndex; diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKTerminal.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKTerminal.java index 493ff0a21..c53d8b088 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKTerminal.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKTerminal.java @@ -12,6 +12,7 @@ import com.hbm.tileentity.TileEntityLoadedBase; import com.hbm.tileentity.network.RTTYSystem; import com.hbm.util.BufferUtil; +import api.hbm.redstoneoverradio.IRORInteractive; import cpw.mods.fml.common.Optional; import io.netty.buffer.ByteBuf; import li.cil.oc.api.machine.Arguments; @@ -24,7 +25,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityRBMKTerminal extends TileEntityLoadedBase implements IGUIProvider, IControlReceiver, SimpleComponent, CompatHandler.OCComponent { +public class TileEntityRBMKTerminal extends TileEntityLoadedBase implements IGUIProvider, IControlReceiver, SimpleComponent, CompatHandler.OCComponent, IRORInteractive { public String[] history = new String[17]; public String channel = ""; @@ -249,4 +250,46 @@ public class TileEntityRBMKTerminal extends TileEntityLoadedBase implements IGUI markDirty(); return new Object[] {true}; } + + @Override + public String[] getFunctionInfo() { + return new String[] { + PREFIX_FUNCTION + "clear", + PREFIX_FUNCTION + "write" + NAME_SEPARATOR + "text", + PREFIX_FUNCTION + "set" + NAME_SEPARATOR + "text", + PREFIX_FUNCTION + "submit" + NAME_SEPARATOR + "command", + }; + } + + @Override + public String runRORFunction(String name, String[] params) { + + if((PREFIX_FUNCTION + "clear").equals(name)) { + for(int i = 0; i < history.length; i++) history[i] = ""; + this.markChanged(); + return null; + } + + String allParams = String.join(" ", params); + + if((PREFIX_FUNCTION + "write").equals(name)) { + this.push(allParams); + this.markChanged(); + return null; + } + + if(name.startsWith(PREFIX_FUNCTION + "set")) { + int line = IRORInteractive.parseInt(name.substring(3), 1, 17) - 1; + this.history[line] = allParams; + this.markChanged(); + return null; + } + + if((PREFIX_FUNCTION + "submit").equals(name)) { + this.eval(allParams); + return null; + } + + return null; + } } 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 e2e0165ce..631ea9879 100644 --- a/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageExporter.java +++ b/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageExporter.java @@ -4,6 +4,7 @@ package com.hbm.tileentity.network.pneumatic; import com.hbm.interfaces.IControlReceiver; import com.hbm.inventory.container.ContainerPneumoStorageExporter; import com.hbm.inventory.gui.GUIPneumoStorageExporter; +import com.hbm.tileentity.IControlReceiverFilter; import com.hbm.tileentity.network.RTTYSystem; import com.hbm.util.BobMathUtil; @@ -18,7 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineBase implements IRORInteractive, IControlReceiver { +public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineBase implements IRORInteractive, IControlReceiver, IControlReceiverFilter { /** If requests should be pulled repeatedly every tick */ public boolean continuousRequest = false; @@ -303,9 +304,20 @@ public class TileEntityPneumoStorageExporter extends TileEntityPneumaticMachineB if(data.hasKey("ror")) { this.rorConfiguredMode = !this.rorConfiguredMode; } + if(data.hasKey("slot")) { + setFilterContents(data); + } this.markChanged(); } + @Override + public int[] getFilterSlots() { + return new int[] {0, 9}; + } + + @Override + public void nextMode(int i) { } + @Override public String[] getFunctionInfo() { return new String[] { diff --git a/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageMono.java b/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageMono.java index 30f7c62e4..dcf4d5552 100644 --- a/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageMono.java +++ b/src/main/java/com/hbm/tileentity/network/pneumatic/TileEntityPneumoStorageMono.java @@ -3,6 +3,7 @@ package com.hbm.tileentity.network.pneumatic; import com.hbm.interfaces.IControlReceiver; import com.hbm.inventory.container.ContainerPneumoStorageMono; import com.hbm.inventory.gui.GUIPneumoStorageMono; +import com.hbm.tileentity.IControlReceiverFilter; import com.hbm.tileentity.IGUIProvider; import api.hbm.fluidmk2.IFluidStandardReceiverMK2; @@ -15,7 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; -public class TileEntityPneumoStorageMono extends TileEntityPneumaticStorageBase implements IPneumaticConnector, IFluidStandardReceiverMK2, ISlotMonitorProvider, IControlReceiver, IGUIProvider { +public class TileEntityPneumoStorageMono extends TileEntityPneumaticStorageBase implements IPneumaticConnector, IFluidStandardReceiverMK2, ISlotMonitorProvider, IControlReceiver, IGUIProvider, IControlReceiverFilter { public static final int CAPACITY = 100_000; public int[] amounts; @@ -86,4 +87,12 @@ public class TileEntityPneumoStorageMono extends TileEntityPneumaticStorageBase } @Override public long setupType(int index, ItemStack zeroStack, long amount) { return amount; } + + @Override + public void nextMode(int i) { } + + @Override + public int[] getFilterSlots() { + return new int[] {0, 3}; + } } diff --git a/src/main/java/com/hbm/world/gen/MapGenChainloader.java b/src/main/java/com/hbm/world/gen/MapGenChainloader.java index 01a605a4c..143b827b6 100644 --- a/src/main/java/com/hbm/world/gen/MapGenChainloader.java +++ b/src/main/java/com/hbm/world/gen/MapGenChainloader.java @@ -116,7 +116,5 @@ public class MapGenChainloader extends MapGenBase { blockMetas = event.metaArray; } } - } - } diff --git a/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java index dbf6922fa..051b11d1e 100644 --- a/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java +++ b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java @@ -35,43 +35,45 @@ public class NTMWorldGenerator implements IWorldGenerator { boolean regTest = false; - public static boolean isInvalidBiome(BiomeGenBase biome) { - return BiomeDictionary.isBiomeOfType(biome, Type.OCEAN) || BiomeDictionary.isBiomeOfType(biome, Type.RIVER); + /** Includes all biomes tagged as ocean or river */ + public static boolean isWaterBiome(BiomeGenBase biome) { + return BiomeDictionary.isBiomeOfType(biome, Type.WATER); } + /** Includes biomes with little height variation and sparse vegetation, excludes water biomes */ public static boolean isFlatBiome(BiomeGenBase biome) { - return biome.heightVariation <= 0.2F && !isInvalidBiome(biome) && BiomeDictionary.isBiomeOfType(biome, Type.SPARSE); + return biome.heightVariation <= 0.2F && !isWaterBiome(biome) && BiomeDictionary.isBiomeOfType(biome, Type.SPARSE); } public NTMWorldGenerator() { /// SPIRE /// NBTStructure.registerStructure(0, new SpawnCondition("spire") {{ - canSpawn = biome -> biome.heightVariation <= 0.05F && !isInvalidBiome(biome); + canSpawn = biome -> biome.heightVariation <= 0.05F && !isWaterBiome(biome); structure = new JigsawPiece("spire", StructureManager.spire, -1); spawnWeight = StructureConfig.spireSpawnWeight; }}); NBTStructure.registerStructure(0, new SpawnCondition("features") {{ - canSpawn = biome -> !isInvalidBiome(biome); + canSpawn = biome -> !isWaterBiome(biome); start = d -> new MapGenNTMFeatures.Start(d.getW(), d.getX(), d.getY(), d.getZ()); spawnWeight = StructureConfig.featuresSpawnWeight; }}); NBTStructure.registerStructure(0, new SpawnCondition("bunker") {{ - canSpawn = biome -> !isInvalidBiome(biome); + canSpawn = biome -> !isWaterBiome(biome); start = d -> new BunkerStart(d.getW(), d.getX(), d.getY(), d.getZ()); spawnWeight = StructureConfig.bunkerSpawnWeight; }}); NBTStructure.registerStructure(0, new SpawnCondition("vertibird") {{ - canSpawn = biome -> !isInvalidBiome(biome) && BiomeDictionary.isBiomeOfType(biome, Type.SANDY); + canSpawn = biome -> !isWaterBiome(biome) && BiomeDictionary.isBiomeOfType(biome, Type.SANDY); structure = new JigsawPiece("vertibird", StructureManager.vertibird, -3); spawnWeight = StructureConfig.vertibirdSpawnWeight; }}); NBTStructure.registerStructure(0, new SpawnCondition("crashed_vertibird") {{ - canSpawn = biome -> !isInvalidBiome(biome) && BiomeDictionary.isBiomeOfType(biome, Type.SANDY); + canSpawn = biome -> !isWaterBiome(biome) && BiomeDictionary.isBiomeOfType(biome, Type.SANDY); structure = new JigsawPiece("crashed_vertibird", StructureManager.crashed_vertibird, -10); spawnWeight = StructureConfig.vertibirdCrashedSpawnWeight; }}); @@ -116,7 +118,7 @@ public class NTMWorldGenerator implements IWorldGenerator { }}); NBTStructure.registerStructure(0, new SpawnCondition("forestchem") {{ - canSpawn = biome -> biome.heightVariation <= 0.3F && !isInvalidBiome(biome); + canSpawn = biome -> biome.heightVariation <= 0.3F && !isWaterBiome(biome); structure = new JigsawPiece("forest_chem", StructureManager.forest_chem, -9); spawnWeight = StructureConfig.forestChemSpawnWeight; }}); @@ -130,7 +132,7 @@ public class NTMWorldGenerator implements IWorldGenerator { }}); NBTStructure.registerStructure(0, new SpawnCondition("forest_post") {{ - canSpawn = biome -> biome.heightVariation <= 0.3F && !isInvalidBiome(biome); + canSpawn = biome -> biome.heightVariation <= 0.3F && !isWaterBiome(biome); structure = new JigsawPiece("forest_post", StructureManager.forest_post, -10); spawnWeight = StructureConfig.forestPostSpawnWeight; }}); @@ -160,13 +162,13 @@ public class NTMWorldGenerator implements IWorldGenerator { }}); NBTStructure.registerStructure(0, new SpawnCondition("plane1") {{ - canSpawn = biome -> biome.heightVariation <= 0.3F && !isInvalidBiome(biome); + canSpawn = biome -> biome.heightVariation <= 0.3F && !isWaterBiome(biome); structure = new JigsawPiece("crashed_plane_1", StructureManager.plane1, -5); spawnWeight = StructureConfig.plane1SpawnWeight; }}); NBTStructure.registerStructure(0, new SpawnCondition("plane2") {{ - canSpawn = biome -> biome.heightVariation <= 0.3F && !isInvalidBiome(biome); + canSpawn = biome -> biome.heightVariation <= 0.3F && !isWaterBiome(biome); structure = new JigsawPiece("crashed_plane_2", StructureManager.plane2, -8); spawnWeight = StructureConfig.plane2SpawnWeight; }}); @@ -190,52 +192,52 @@ public class NTMWorldGenerator implements IWorldGenerator { }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinA") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsA", StructureManager.ntmruinsA, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsASpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinB") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsB", StructureManager.ntmruinsB, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsBSpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinC") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsC", StructureManager.ntmruinsC, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsCSpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinD") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsD", StructureManager.ntmruinsD, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsDSpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinE") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsE", StructureManager.ntmruinsE, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsESpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinF") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsF", StructureManager.ntmruinsF, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsFSpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinG") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsG", StructureManager.ntmruinsG, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsGSpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinH") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsH", StructureManager.ntmruinsH, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsHSpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinI") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsI", StructureManager.ntmruinsI, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsISpawnWeight : 0; }}); NBTStructure.registerStructure(0, new SpawnCondition("ruinJ") {{ - canSpawn = biome -> !isInvalidBiome(biome) && biome.canSpawnLightningBolt(); + canSpawn = biome -> !isWaterBiome(biome) && biome.canSpawnLightningBolt(); structure = new JigsawPiece("NTMRuinsJ", StructureManager.ntmruinsJ, -1) {{conformToTerrain = true;}}; spawnWeight = StructureConfig.enableRuins ? StructureConfig.ruinsJSpawnWeight : 0; }}); diff --git a/src/main/java/com/hbm/world/generator/TimedGenerator.java b/src/main/java/com/hbm/world/generator/TimedGenerator.java index 9501bbc8d..a9269c8a6 100644 --- a/src/main/java/com/hbm/world/generator/TimedGenerator.java +++ b/src/main/java/com/hbm/world/generator/TimedGenerator.java @@ -3,10 +3,12 @@ package com.hbm.world.generator; import java.util.ArrayList; import java.util.HashMap; +import com.hbm.interfaces.NotableComments; import com.hbm.interfaces.Spaghetti; import net.minecraft.world.World; +@NotableComments @Deprecated @Spaghetti("this class should be destroyed") public class TimedGenerator { @@ -46,7 +48,7 @@ public class TimedGenerator { list.add(job); } - //should i be doing this? probably not, but watch me go + //should i be doing this? probably not, but watch me go // no for the love of fucking god don't do this public interface ITimedJob { public void work();