Merge pull request #1426 from MellowArpeggiation/qol

QoL changes
This commit is contained in:
HbmMods 2024-04-15 14:05:00 +02:00 committed by GitHub
commit 99f1f6ab06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 111 additions and 55 deletions

View File

@ -87,4 +87,21 @@ public class CommonConfig {
return prop.getStringList();
}
public static int parseStructureFlag(String flag) {
if(flag == null) flag = "";
switch(flag.toLowerCase(Locale.US)) {
case "true":
case "on":
case "yes":
return 1;
case "false":
case "off":
case "no":
return 0;
default:
return 2;
}
}
}

View File

@ -9,7 +9,7 @@ public class GeneralConfig {
public static boolean enableDebugMode = true;
public static boolean enableMycelium = false;
public static boolean enablePlutoniumOre = false;
public static boolean enableDungeons = true;
public static int enableDungeons = 2;
public static boolean enableMDOres = true;
public static boolean enableMines = true;
public static boolean enableRad = true;
@ -73,7 +73,10 @@ public class GeneralConfig {
enableDebugMode = config.get(CATEGORY_GENERAL, "1.00_enableDebugMode", false, "Enable debugging mode").getBoolean(false);
enableMycelium = config.get(CATEGORY_GENERAL, "1.01_enableMyceliumSpread", false, "Allows glowing mycelium to spread").getBoolean(false);
enablePlutoniumOre = config.get(CATEGORY_GENERAL, "1.02_enablePlutoniumNetherOre", false, "Enables plutonium ore generation in the nether").getBoolean(false);
enableDungeons = config.get(CATEGORY_GENERAL, "1.03_enableDungeonSpawn", true, "Allows structures and dungeons to spawn").getBoolean(true);
String unparsedDungeonFlag = config.get(CATEGORY_GENERAL, "1.03_enableDungeonSpawn", "flag", "Allows structures and dungeons to spawn. Valid values are true|false|flag - flag will respect the \"Generate Structures\" world flag.").getString();
enableDungeons = CommonConfig.parseStructureFlag(unparsedDungeonFlag);
enableMDOres = config.get(CATEGORY_GENERAL, "1.04_enableOresInModdedDimensions", true, "Allows NTM ores to generate in modded dimensions").getBoolean(true);
enableMines = config.get(CATEGORY_GENERAL, "1.05_enableLandmineSpawn", true, "Allows landmines to generate").getBoolean(true);
enableRad = config.get(CATEGORY_GENERAL, "1.06_enableRadHotspotSpawn", true, "Allows radiation hotspots to generate").getBoolean(true);

View File

@ -8,7 +8,7 @@ import net.minecraftforge.common.config.Configuration;
public class StructureConfig {
public static boolean enableStructures = true;
public static int enableStructures = 2;
public static int structureMinChunks = 8;
public static int structureMaxChunks = 24;
@ -18,7 +18,10 @@ public class StructureConfig {
public static void loadFromConfig(Configuration config) {
final String CATEGORY_STRUCTURES = CommonConfig.CATEGORY_STRUCTURES;
enableStructures = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.00_enableStructures", "Switch for whether structures using the MapGenStructure system spawn.", true);
String unparsedStructureFlag = CommonConfig.createConfigString(config, CATEGORY_STRUCTURES, "5.00_enableStructures", "Flag for whether modern NTM structures will spawn. Valid values are true|false|flag - flag will respect the \"Generate Structures\" world flag.", "flag");
enableStructures = CommonConfig.parseStructureFlag(unparsedStructureFlag);
structureMinChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.01_structureMinChunks", "Minimum non-zero distance between structures in chunks (Settings lower than 8 may be problematic).", 8);
structureMaxChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.02_structureMaxChunks", "Maximum non-zero distance between structures in chunks.", 24);

View File

@ -0,0 +1,28 @@
package com.hbm.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
/**
* Deprecated slots can hold items from previous versions, but are otherwise entirely uninteractable
*/
public class SlotDeprecated extends Slot {
public SlotDeprecated(IInventory inventory, int id, int x, int y) {
super(inventory, id, x, y);
}
@Override
public boolean isItemValid(ItemStack stack) {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean func_111238_b() {
return false;
}
}

View File

@ -1,5 +1,6 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotDeprecated;
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.items.ModItems;
import com.hbm.items.machine.IItemFluidIdentifier;
@ -26,10 +27,10 @@ public class ContainerMachineHydrotreater extends Container {
this.addSlotToContainer(new Slot(tedf, 1, 35, 90));
//Canister Output
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 35, 108));
//Hydrogen Input
this.addSlotToContainer(new Slot(tedf, 3, 53, 90));
//Hydrogen Output
this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 53, 108));
//Hydrogen Input (removed, requires pressurization)
this.addSlotToContainer(new SlotDeprecated(tedf, 3, 53, 90));
//Hydrogen Output (samesies)
this.addSlotToContainer(new SlotDeprecated(tedf, 4, 53, 108));
//Desulfated Oil Input
this.addSlotToContainer(new Slot(tedf, 5, 125, 90));
//Desulfated Oil Output

View File

@ -1,5 +1,6 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotDeprecated;
import com.hbm.inventory.SlotTakeOnly;
import com.hbm.tileentity.machine.oil.TileEntityMachineVacuumDistill;
@ -20,10 +21,10 @@ public class ContainerMachineVacuumDistill extends Container {
//Battery
this.addSlotToContainer(new Slot(tedf, 0, 26, 90));
//Canister Input
this.addSlotToContainer(new Slot(tedf, 1, 44, 90));
//Canister Output
this.addSlotToContainer(new SlotTakeOnly(tedf, 2, 44, 108));
//Canister Input (removed, requires pressurization)
this.addSlotToContainer(new SlotDeprecated(tedf, 1, 44, 90));
//Canister Output (same as above)
this.addSlotToContainer(new SlotDeprecated(tedf, 2, 44, 108));
//Heavy Oil Input
this.addSlotToContainer(new Slot(tedf, 3, 80, 90));
//Heavy Oil Output

View File

@ -10,6 +10,7 @@ import org.lwjgl.opengl.GL11;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.gui.GuiInfoContainer;
import com.hbm.items.ModItems;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.TEFluidPacket;
@ -126,6 +127,11 @@ public class FluidTank {
if(slots[in] == null)
return false;
boolean isInfiniteBarrel = slots[in].getItem() == ModItems.fluid_barrel_infinite;
if(!isInfiniteBarrel && pressure != 0)
return false;
int prev = this.getFill();

View File

@ -67,6 +67,7 @@ public class GUIScreenFluid extends GuiScreen {
this.search.setTextColor(-1);
this.search.setDisabledTextColour(-1);
this.search.setEnableBackgroundDrawing(false);
this.search.setFocused(true);
if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.fluid_identifier_multi) {
this.primary = ItemFluidIDMulti.getType(player.getHeldItem(), true);

View File

@ -12,6 +12,8 @@ import org.lwjgl.opengl.GL11;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.items.ModItems;
import com.hbm.util.ContaminationUtil;
import com.hbm.util.I18nUtil;
import cpw.mods.fml.common.gameevent.TickEvent;
@ -48,8 +50,8 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
private String texture = "";
private ResourceLocation overlay = null;
public List<PotionEffect> effects = new ArrayList();
public HashMap<String, Float> resistance = new HashMap();
public List<PotionEffect> effects = new ArrayList<PotionEffect>();
public HashMap<String, Float> resistance = new HashMap<String, Float>();
public float blastProtection = -1;
public float projectileProtection = -1;
public float damageCap = -1;
@ -572,34 +574,34 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
if(this.armorType != 1)
return;
if(!this.hasFSBArmor(entity) || !this.geigerSound)
if(!hasFSBArmor(entity) || !this.geigerSound)
return;
if(entity.inventory.hasItem(ModItems.geiger_counter) || entity.inventory.hasItem(ModItems.dosimeter))
return;
if(world.getTotalWorldTime() % 5 == 0) {
float x = HbmLivingProps.getRadBuf((EntityLivingBase)entity);
// Armor piece dosimeters indicate radiation dosage inside the armor, so reduce the counts by the effective protection
float mod = ContaminationUtil.calculateRadiationMod(entity);
float x = HbmLivingProps.getRadBuf(entity) * mod;
if(x > 1E-5) {
if(x > 0) {
List<Integer> list = new ArrayList<Integer>();
if(x < 1) list.add(0);
if(x < 5) list.add(0);
if(x < 10) list.add(1);
if(x > 5 && x < 15) list.add(2);
if(x > 10 && x < 20) list.add(3);
if(x > 15 && x < 25) list.add(4);
if(x > 20 && x < 30) list.add(5);
if(x > 25) list.add(6);
int r = list.get(world.rand.nextInt(list.size()));
if(r > 0)
world.playSoundAtEntity(entity, "hbm:item.geiger" + r, 1.0F, 1.0F);
} else if(world.rand.nextInt(50) == 0) {
world.playSoundAtEntity(entity, "hbm:item.geiger" + (1 + world.rand.nextInt(1)), 1.0F, 1.0F);
}
List<Integer> list = new ArrayList<Integer>();
if(x < 1) list.add(0);
if(x < 5) list.add(0);
if(x < 10) list.add(1);
if(x > 5 && x < 15) list.add(2);
if(x > 10 && x < 20) list.add(3);
if(x > 15 && x < 25) list.add(4);
if(x > 20 && x < 30) list.add(5);
if(x > 25) list.add(6);
int r = list.get(world.rand.nextInt(list.size()));
if(r > 0)
world.playSoundAtEntity(entity, "hbm:item.geiger" + r, 1.0F, 1.0F);
}
}
}
@ -645,7 +647,7 @@ public class ArmorFSB extends ItemArmor implements IArmorDisableModel {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
private HashSet<EnumPlayerPart> hidden = new HashSet();
private HashSet<EnumPlayerPart> hidden = new HashSet<EnumPlayerPart>();
private boolean needsFullSet = false;
public ArmorFSB hides(EnumPlayerPart... parts) {

View File

@ -5,7 +5,6 @@ import java.util.List;
import java.util.Random;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.items.armor.ArmorFSB;
import com.hbm.util.ContaminationUtil;
import net.minecraft.entity.Entity;
@ -25,12 +24,6 @@ public class ItemDosimeter extends Item {
if(!(entity instanceof EntityLivingBase) || world.isRemote)
return;
if(entity instanceof EntityPlayer) {
if(ArmorFSB.hasFSBArmor((EntityPlayer)entity) && ((ArmorFSB)((EntityPlayer)entity).inventory.armorInventory[2].getItem()).geigerSound)
return;
}
float x = HbmLivingProps.getRadBuf((EntityLivingBase)entity);
if(world.getTotalWorldTime() % 5 == 0) {

View File

@ -6,7 +6,6 @@ import java.util.Random;
import com.hbm.extprop.HbmLivingProps;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.items.armor.ArmorFSB;
import com.hbm.util.ContaminationUtil;
import net.minecraft.entity.Entity;
@ -27,12 +26,6 @@ public class ItemGeigerCounter extends Item {
if(!(entity instanceof EntityLivingBase) || world.isRemote)
return;
if(entity instanceof EntityPlayer) {
if(ArmorFSB.hasFSBArmor((EntityPlayer)entity) && ((ArmorFSB)((EntityPlayer)entity).inventory.armorInventory[2].getItem()).geigerSound)
return;
}
float x = HbmLivingProps.getRadBuf((EntityLivingBase)entity);
if(world.getTotalWorldTime() % 5 == 0) {

View File

@ -220,8 +220,10 @@ public class HbmWorldGen implements IWorldGenerator {
}
boolean enableDungeons = world.getWorldInfo().isMapFeaturesEnabled();
if(GeneralConfig.enableDungeons == 1) enableDungeons = true;
if(GeneralConfig.enableDungeons == 0) enableDungeons = false;
if(GeneralConfig.enableDungeons && world.provider.dimensionId == 0 && enableDungeons) {
if(enableDungeons && world.provider.dimensionId == 0) {
if(MobConfig.enableHives && rand.nextInt(MobConfig.hiveSpawn) == 0) {
int x = i + rand.nextInt(16) + 8;

View File

@ -49,7 +49,8 @@ public class NTMWorldGenerator implements IWorldGenerator {
setRandomSeed(event.world, event.chunkX, event.chunkZ); //Set random for population down the line.
hasPopulationEvent = true;
if(!StructureConfig.enableStructures || !event.world.getWorldInfo().isMapFeaturesEnabled()) return;
if(StructureConfig.enableStructures == 0) return;
if(StructureConfig.enableStructures == 2 && !event.world.getWorldInfo().isMapFeaturesEnabled()) return;
switch (event.world.provider.dimensionId) {
case -1:
@ -94,7 +95,12 @@ public class NTMWorldGenerator implements IWorldGenerator {
private void generateSurface(World world, Random rand, IChunkProvider chunkGenerator, IChunkProvider chunkProvider, int chunkX, int chunkZ) {
if(!hasPopulationEvent) { //If we've failed to generate any structures (flatlands)
setRandomSeed(world, chunkX, chunkZ); //Reset the random seed to compensate
if(StructureConfig.enableStructures) generateOverworldStructures(world, chunkGenerator, chunkX, chunkZ); //Do it through the post-population generation directly
boolean enableStructures = world.getWorldInfo().isMapFeaturesEnabled();
if(StructureConfig.enableStructures == 1) enableStructures = true;
if(StructureConfig.enableStructures == 0) enableStructures = false;
if(enableStructures) generateOverworldStructures(world, chunkGenerator, chunkX, chunkZ); //Do it through the post-population generation directly
}
/* biome dictionary my beloved <3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB