diff --git a/changelog b/changelog index dcbffd01b..ee9739388 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,14 @@ +## Gun rework +* Place holder place holder place hooooooooooldeeeeeeeer + +## Added +* `/ntmclient` + * Allows some client-only config options to be edited while ingame + * Config is stored in `hbmClient.json` in the `hbmConfig` folder + * Configs can be edited ingame via `/ntmclient set ` or in the file and then `/ntmclient reload` + * Available configs include geiger counter HUD position, info system position and orientation, custom main menu splash texts, ore dict display and custom nuke item info + * Check the config file or `/ntmclient list` for a full list of values, the name should make them self-explanatory! + ## Changed * Updated russian and chinese localization * The fine soot recipe in the pyrolysis oven now only needs 4 tar @@ -12,6 +23,11 @@ * The strand caster will now cast its remaining buffer after 10 seconds of inactivity, even if the buffer is not full enough for a batch of 9 * The soldering station now has a toggle for the "refuse to do recipes with no fluid if fluid is present" behavior * Recipes using the ore dictionary "oreThorium232" are now also generated for "oreThorium" +* Conveyor grabbers can now output onto belts directly + * I could have just made grabbers delete the input and spawn an identical item on the output but simply changing the position makes it look like the item is sucked in and it looks hilarious +* Cable connections (connectors, pylons, substations) now render about 10x faster and no longer have weird inaccuracies where the segments meet +* Cables can be made even faster by setting `RENDER_CABLE_HANG` in the config to `false` + * This causes cable connections to render taut, eliminating the need for multiple segments per pylon side ## Fixed * The conveyor grabber should no longer skip over items when used in long lines diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 028fb0f0f..e705d7907 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -845,12 +845,7 @@ public class ModBlocks { public static Block struct_icf_core; public static Block factory_titanium_hull; - @Deprecated public static Block factory_titanium_furnace; - @Deprecated public static Block factory_titanium_conductor; - public static Block factory_advanced_hull; - @Deprecated public static Block factory_advanced_furnace; - @Deprecated public static Block factory_advanced_conductor; public static Block cm_block; public static Block cm_sheet; @@ -1955,11 +1950,7 @@ public class ModBlocks { struct_icf_core = new BlockICFStruct(Material.iron).setBlockName("struct_icf_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_icf_core"); factory_titanium_hull = new BlockGeneric(Material.iron).setBlockName("factory_titanium_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_titanium_hull"); - factory_titanium_furnace = new FactoryHatch(Material.iron).setBlockName("factory_titanium_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_titanium_furnace"); - factory_titanium_conductor = new BlockPillar(Material.iron, RefStrings.MODID + ":factory_titanium_conductor").setBlockName("factory_titanium_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_titanium_hull"); factory_advanced_hull = new BlockGeneric(Material.iron).setBlockName("factory_advanced_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_advanced_hull"); - factory_advanced_furnace = new FactoryHatch(Material.iron).setBlockName("factory_advanced_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_advanced_furnace"); - factory_advanced_conductor = new BlockPillar(Material.iron, RefStrings.MODID + ":factory_advanced_conductor").setBlockName("factory_advanced_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":factory_advanced_hull"); cm_block = new BlockCM(Material.iron, EnumCMMaterials.class, true, true).setBlockName("cm_block").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":cm_block"); cm_sheet = new BlockCM(Material.iron, EnumCMMaterials.class, true, true).setBlockName("cm_sheet").setCreativeTab(MainRegistry.machineTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":cm_sheet"); diff --git a/src/main/java/com/hbm/blocks/bomb/BlockChargeC4.java b/src/main/java/com/hbm/blocks/bomb/BlockChargeC4.java index ef67c63b8..65cca5d17 100644 --- a/src/main/java/com/hbm/blocks/bomb/BlockChargeC4.java +++ b/src/main/java/com/hbm/blocks/bomb/BlockChargeC4.java @@ -5,6 +5,9 @@ import java.util.List; import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; import com.hbm.explosion.vanillant.standard.BlockProcessorStandard; +import com.hbm.explosion.vanillant.standard.EntityProcessorStandard; +import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; +import com.hbm.particle.helper.ExplosionCreator; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.entity.player.EntityPlayer; @@ -22,10 +25,13 @@ public class BlockChargeC4 extends BlockChargeBase { world.setBlockToAir(x, y, z); safe = false; - ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 15F).makeStandard(); + ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 15F); xnt.setBlockAllocator(new BlockAllocatorStandard(32)); xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop()); + xnt.setEntityProcessor(new EntityProcessorStandard()); + xnt.setPlayerProcessor(new PlayerProcessorStandard()); xnt.explode(); + ExplosionCreator.composeEffectSmall(world, x + 0.5, y + 1, z + 0.5); return BombReturnCode.DETONATED; } diff --git a/src/main/java/com/hbm/blocks/bomb/BlockChargeDynamite.java b/src/main/java/com/hbm/blocks/bomb/BlockChargeDynamite.java index 9513e3c4d..b7f0b328d 100644 --- a/src/main/java/com/hbm/blocks/bomb/BlockChargeDynamite.java +++ b/src/main/java/com/hbm/blocks/bomb/BlockChargeDynamite.java @@ -1,7 +1,7 @@ package com.hbm.blocks.bomb; -import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNT; +import com.hbm.particle.helper.ExplosionSmallCreator; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.world.World; @@ -17,7 +17,7 @@ public class BlockChargeDynamite extends BlockChargeBase { safe = false; ExplosionNT exp = new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 4F); exp.explode(); - ExplosionLarge.spawnParticles(world, x + 0.5, y + 0.5, z + 0.5, 20); + ExplosionSmallCreator.composeEffect(world, x + 0.5, y + 0.5, z + 0.5, 15, 3F, 1.25F); return BombReturnCode.DETONATED; } diff --git a/src/main/java/com/hbm/blocks/bomb/BlockChargeMiner.java b/src/main/java/com/hbm/blocks/bomb/BlockChargeMiner.java index 1470e078c..61903dca3 100644 --- a/src/main/java/com/hbm/blocks/bomb/BlockChargeMiner.java +++ b/src/main/java/com/hbm/blocks/bomb/BlockChargeMiner.java @@ -2,9 +2,9 @@ package com.hbm.blocks.bomb; import java.util.List; -import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNT; import com.hbm.explosion.ExplosionNT.ExAttrib; +import com.hbm.particle.helper.ExplosionSmallCreator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -23,7 +23,7 @@ public class BlockChargeMiner extends BlockChargeBase { ExplosionNT exp = new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 4F); exp.addAllAttrib(ExAttrib.NOHURT, ExAttrib.ALLDROP); exp.explode(); - ExplosionLarge.spawnParticles(world, x + 0.5, y + 0.5, z + 0.5, 20); + ExplosionSmallCreator.composeEffect(world, x + 0.5, y + 0.5, z + 0.5, 15, 3F, 1.25F); return BombReturnCode.DETONATED; } diff --git a/src/main/java/com/hbm/blocks/bomb/BlockChargeSemtex.java b/src/main/java/com/hbm/blocks/bomb/BlockChargeSemtex.java index f731c7df2..ed880233d 100644 --- a/src/main/java/com/hbm/blocks/bomb/BlockChargeSemtex.java +++ b/src/main/java/com/hbm/blocks/bomb/BlockChargeSemtex.java @@ -5,7 +5,7 @@ import java.util.List; import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; import com.hbm.explosion.vanillant.standard.BlockProcessorStandard; -import com.hbm.explosion.vanillant.standard.ExplosionEffectStandard; +import com.hbm.particle.helper.ExplosionCreator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -27,8 +27,8 @@ public class BlockChargeSemtex extends BlockChargeBase { xnt.setBlockProcessor(new BlockProcessorStandard() .setAllDrop() .setFortune(3)); - xnt.setSFX(new ExplosionEffectStandard()); xnt.explode(); + ExplosionCreator.composeEffectSmall(world, x + 0.5, y + 1, z + 0.5); return BombReturnCode.DETONATED; } diff --git a/src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java b/src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java index 84ccebc63..dae6e61d4 100644 --- a/src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java +++ b/src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java @@ -5,10 +5,10 @@ import com.hbm.config.BombConfig; import com.hbm.entity.effect.EntityNukeTorex; import com.hbm.entity.item.EntityTNTPrimedBase; import com.hbm.entity.logic.EntityNukeExplosionMK5; -import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNT; import com.hbm.interfaces.IBomb; import com.hbm.lib.RefStrings; +import com.hbm.particle.helper.ExplosionCreator; import net.minecraft.util.MathHelper; import cpw.mods.fml.relauncher.Side; @@ -65,7 +65,7 @@ public class ExplosiveCharge extends BlockDetonatable implements IBomb, IDetConn } if(this == ModBlocks.det_charge) { new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 15).overrideResolution(64).explode(); - ExplosionLarge.spawnParticles(world, x, y, z, ExplosionLarge.cloudFunction(15)); + ExplosionCreator.composeEffectStandard(world, x + 0.5, y + 1, z + 0.5); } if(this == ModBlocks.det_nuke) { world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5)); diff --git a/src/main/java/com/hbm/blocks/machine/FactoryHatch.java b/src/main/java/com/hbm/blocks/machine/FactoryHatch.java deleted file mode 100644 index b8915a4dc..000000000 --- a/src/main/java/com/hbm/blocks/machine/FactoryHatch.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.hbm.blocks.machine; - -import com.hbm.blocks.ModBlocks; -import com.hbm.lib.RefStrings; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class FactoryHatch extends Block { - - @SideOnly(Side.CLIENT) - private IIcon iconFront; - - public FactoryHatch(Material p_i45394_1_) { - super(p_i45394_1_); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - this.iconFront = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.factory_titanium_furnace ? ":factory_titanium_furnace" : ":factory_advanced_furnace")); - this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + (this == ModBlocks.factory_titanium_furnace ? ":factory_titanium_hull" : ":factory_advanced_hull")); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int metadata) { - return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); - } - - @Override - public void onBlockAdded(World world, int x, int y, int z) { - super.onBlockAdded(world, x, y, z); - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { - int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { - world.setBlockMetadataWithNotify(x, y, z, 2, 2); - } - if(i == 1) - { - world.setBlockMetadataWithNotify(x, y, z, 5, 2); - } - if(i == 2) - { - world.setBlockMetadataWithNotify(x, y, z, 3, 2); - } - if(i == 3) - { - world.setBlockMetadataWithNotify(x, y, z, 4, 2); - } - } - -} diff --git a/src/main/java/com/hbm/commands/CommandReloadClient.java b/src/main/java/com/hbm/commands/CommandReloadClient.java index 013bd9b19..6f0c9672a 100644 --- a/src/main/java/com/hbm/commands/CommandReloadClient.java +++ b/src/main/java/com/hbm/commands/CommandReloadClient.java @@ -48,9 +48,21 @@ public class CommandReloadClient extends CommandBase { String operator = args[0]; if("help".equals(operator)) { - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "/ntmclient " + EnumChatFormatting.GOLD + "list")); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "/ntmclient " + EnumChatFormatting.GOLD + "get " + EnumChatFormatting.RED + "")); - sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "/ntmclient " + EnumChatFormatting.GOLD + "set " + EnumChatFormatting.RED + " ")); + + if(args.length >= 2) { + String command = args[1]; + if("help".equals(command)) sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Shows usage for /ntmclient subcommands.")); + if("list".equals(command)) sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Shows all client variable names and values.")); + if("reload".equals(command)) sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Reads client variables from the config file.")); + if("get".equals(command)) sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Shows value for the specified variable name.")); + if("set".equals(command)) sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Sets a variable's value and saves it to the config file.")); + } else { + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "/ntmclient " + EnumChatFormatting.GOLD + "help " + EnumChatFormatting.RED + "")); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "/ntmclient " + EnumChatFormatting.GOLD + "list")); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "/ntmclient " + EnumChatFormatting.GOLD + "reload")); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "/ntmclient " + EnumChatFormatting.GOLD + "get " + EnumChatFormatting.RED + "")); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "/ntmclient " + EnumChatFormatting.GOLD + "set " + EnumChatFormatting.RED + " ")); + } return; } @@ -61,6 +73,12 @@ public class CommandReloadClient extends CommandBase { } return; } + + if("reload".equals(operator)) { + ClientConfig.reload(); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Variables loaded from config file.")); + return; + } if(args.length < 2) throw new CommandException(getCommandUsage(sender)); @@ -100,7 +118,7 @@ public class CommandReloadClient extends CommandBase { public List addTabCompletionOptions(ICommandSender sender, String[] args) { if(!(sender instanceof EntityPlayer)) return Collections.emptyList(); if(args.length < 1) return Collections.emptyList(); - if(args.length == 1) return getListOfStringsMatchingLastWord(args, "list", "get", "set"); + if(args.length == 1) return getListOfStringsMatchingLastWord(args, "list", "reload", "get", "set"); String operator = args[0]; if(args.length == 2 && ("get".equals(operator) || "set".equals(operator))) { return getListOfStringsFromIterableMatchingLastWord(args, ClientConfig.configMap.keySet().stream().map(String::valueOf).collect(Collectors.toList())); diff --git a/src/main/java/com/hbm/config/ClientConfig.java b/src/main/java/com/hbm/config/ClientConfig.java index 8f040e5e5..3fbb4e04b 100644 --- a/src/main/java/com/hbm/config/ClientConfig.java +++ b/src/main/java/com/hbm/config/ClientConfig.java @@ -22,40 +22,60 @@ public class ClientConfig { public static final Gson gson = new Gson(); public static HashMap configMap = new HashMap(); - public static ConfigWrapper GEIGER_OFFSET_HORIZONTAL = new ConfigWrapper(0); - public static ConfigWrapper GEIGER_OFFSET_VERTICAL = new ConfigWrapper(0); - - public static ConfigWrapper GUN_ANIMS_LEGACY = new ConfigWrapper(false); + //separate fields because they are a tad faster than using a hashmap and also because using them is less verbose + public static ConfigWrapper GEIGER_OFFSET_HORIZONTAL = new ConfigWrapper(0); + public static ConfigWrapper GEIGER_OFFSET_VERTICAL = new ConfigWrapper(0); + public static ConfigWrapper INFO_OFFSET_HORIZONTAL = new ConfigWrapper(0); + public static ConfigWrapper INFO_OFFSET_VERTICAL = new ConfigWrapper(0); + public static ConfigWrapper INFO_POSITION = new ConfigWrapper(0); + public static ConfigWrapper GUN_ANIMS_LEGACY = new ConfigWrapper(false); + public static ConfigWrapper ITEM_TOOLTIP_SHOW_OREDICT = new ConfigWrapper(true); + public static ConfigWrapper ITEM_TOOLTIP_SHOW_CUSTOM_NUKE = new ConfigWrapper(true); + public static ConfigWrapper MAIN_MENU_WACKY_SPLASHES = new ConfigWrapper(true); + public static ConfigWrapper DODD_RBMK_DIAGNOSTIC = new ConfigWrapper(true); + public static ConfigWrapper RENDER_CABLE_HANG = new ConfigWrapper(true); private static void initDefaults() { configMap.put("GEIGER_OFFSET_HORIZONTAL", GEIGER_OFFSET_HORIZONTAL); configMap.put("GEIGER_OFFSET_VERTICAL", GEIGER_OFFSET_VERTICAL); + configMap.put("INFO_OFFSET_HORIZONTAL", INFO_OFFSET_HORIZONTAL); + configMap.put("INFO_OFFSET_VERTICAL", INFO_OFFSET_VERTICAL); + configMap.put("INFO_POSITION", INFO_POSITION); configMap.put("GUN_ANIMS_LEGACY", GUN_ANIMS_LEGACY); + configMap.put("ITEM_TOOLTIP_SHOW_OREDICT", ITEM_TOOLTIP_SHOW_OREDICT); + configMap.put("ITEM_TOOLTIP_SHOW_OREDICT", ITEM_TOOLTIP_SHOW_CUSTOM_NUKE); + configMap.put("MAIN_MENU_WACKY_SPLASHES", MAIN_MENU_WACKY_SPLASHES); + configMap.put("DODD_RBMK_DIAGNOSTIC", DODD_RBMK_DIAGNOSTIC); + configMap.put("RENDER_CABLE_HANG", RENDER_CABLE_HANG); } + /** Initializes defaults, then reads the config file if it exists, then writes the config file. */ public static void initConfig() { initDefaults(); - File folder = MainRegistry.configHbmDir; File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmClient.json"); if(config.exists()) readConfig(config); - refresh(); } + /** Writes over the config file using the running config. */ public static void refresh() { - File folder = MainRegistry.configHbmDir; File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmClient.json"); - writeConfig(config); } + /** Writes over the running config using the config file. */ + public static void reload() { + File folder = MainRegistry.configHbmDir; + File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmClient.json"); + if(config.exists()) readConfig(config); + } + private static void readConfig(File config) { try { JsonObject json = gson.fromJson(new FileReader(config), JsonObject.class); - HashMap newValues = new HashMap(); for(Entry line : configMap.entrySet()) { @@ -65,11 +85,13 @@ public class ClientConfig { try { //world's shittiest dynamic type parser - if(line.getValue().value instanceof String) newValues.put(line.getKey(), new ConfigWrapper(value.getAsString())); - if(line.getValue().value instanceof Float) newValues.put(line.getKey(), new ConfigWrapper(value.getAsFloat())); - if(line.getValue().value instanceof Double) newValues.put(line.getKey(), new ConfigWrapper(value.getAsDouble())); - if(line.getValue().value instanceof Integer) newValues.put(line.getKey(), new ConfigWrapper(value.getAsInt())); - if(line.getValue().value instanceof Boolean) newValues.put(line.getKey(), new ConfigWrapper(value.getAsBoolean())); + if(configMap.containsKey(line.getKey())) { + if(line.getValue().value instanceof String) configMap.get(line.getKey()).set(value.getAsString()); + if(line.getValue().value instanceof Float) configMap.get(line.getKey()).set(value.getAsFloat()); + if(line.getValue().value instanceof Double) configMap.get(line.getKey()).set(value.getAsDouble()); + if(line.getValue().value instanceof Integer) configMap.get(line.getKey()).set(value.getAsInt()); + if(line.getValue().value instanceof Boolean) configMap.get(line.getKey()).set(value.getAsBoolean()); + } //gson doesn't give me the option to read the raw value of a JsonPrimitive so we have to this shit effectively twice //once to make sure that the parsed data matches with what's determined by the default, @@ -81,8 +103,6 @@ public class ClientConfig { } } - configMap.putAll(newValues); - } catch(Exception ex) { ex.printStackTrace(); } @@ -99,7 +119,7 @@ public class ClientConfig { List keys = new ArrayList(); keys.addAll(configMap.keySet()); - Collections.sort(keys); + Collections.sort(keys); //readability is cool for(String key : keys) { @@ -126,8 +146,9 @@ public class ClientConfig { public ConfigWrapper(T o) { this.value = o; } - + public T get() { return value; } + public void set(T value) { this.value = value; } public void update(String param) { Object stupidBufferObject = null; // wahh wahh can't cast Float to T wahh wahh shut the fuck up diff --git a/src/main/java/com/hbm/explosion/ExplosionLarge.java b/src/main/java/com/hbm/explosion/ExplosionLarge.java index ae8f4e5cb..4dcbc9e12 100644 --- a/src/main/java/com/hbm/explosion/ExplosionLarge.java +++ b/src/main/java/com/hbm/explosion/ExplosionLarge.java @@ -22,7 +22,7 @@ public class ExplosionLarge { static Random rand = new Random(); - public static void spawnParticles(World world, double x, double y, double z, int count) { + @Deprecated public static void spawnParticles(World world, double x, double y, double z, int count) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "smoke"); @@ -153,7 +153,7 @@ public class ExplosionLarge { } } - public static void explode(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel, Entity exploder) { + @Deprecated public static void explode(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel, Entity exploder) { world.createExplosion(exploder, x, y, z, strength, true); if(cloud) spawnParticles(world, x, y, z, cloudFunction((int)strength)); @@ -163,7 +163,7 @@ public class ExplosionLarge { spawnShrapnels(world, x, y, z, shrapnelFunction((int)strength)); } - public static void explode(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel) { + @Deprecated public static void explode(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel) { world.createExplosion(null, x, y, z, strength, true); if(cloud) spawnParticles(world, x, y, z, cloudFunction((int)strength)); @@ -173,7 +173,7 @@ public class ExplosionLarge { spawnShrapnels(world, x, y, z, shrapnelFunction((int)strength)); } - public static void explodeFire(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel) { + @Deprecated public static void explodeFire(World world, double x, double y, double z, float strength, boolean cloud, boolean rubble, boolean shrapnel) { world.newExplosion((Entity)null, (float)x, (float)y, (float)z, strength, true, true); if(cloud) spawnParticles(world, x, y, z, cloudFunction((int)strength)); @@ -245,7 +245,6 @@ public class ExplosionLarge { } public static int cloudFunction(int i) { - //return (int)(345 * (1 - Math.pow(Math.E, -i/15)) + 15); return (int)(850 * (1 - Math.pow(Math.E, -i/15)) + 15); } diff --git a/src/main/java/com/hbm/explosion/vanillant/standard/EntityProcessorCross.java b/src/main/java/com/hbm/explosion/vanillant/standard/EntityProcessorCross.java index a463e016c..3bc9f6870 100644 --- a/src/main/java/com/hbm/explosion/vanillant/standard/EntityProcessorCross.java +++ b/src/main/java/com/hbm/explosion/vanillant/standard/EntityProcessorCross.java @@ -111,7 +111,6 @@ public class EntityProcessorCross implements IEntityProcessor { Entity entity = entry.getKey(); entity.attackEntityFrom(setExplosionSource(explosion.compat), entry.getValue()); - System.out.println(entity + " " + entry.getValue()); if(damage != null) { double distanceScaled = entity.getDistance(x, y, z) / size; diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index bafb52c23..b4f899061 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -14,6 +14,7 @@ import org.lwjgl.opengl.GL11; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockAshes; +import com.hbm.config.ClientConfig; import com.hbm.config.GeneralConfig; import com.hbm.entity.mob.EntityHunterChopper; import com.hbm.entity.projectile.EntityChopperMine; @@ -200,7 +201,7 @@ public class ModEventHandlerClient { } /// DODD DIAG HOOK FOR RBMK - if(event.type == ElementType.CROSSHAIRS) { + if(event.type == ElementType.CROSSHAIRS && ClientConfig.DODD_RBMK_DIAGNOSTIC.get()) { Minecraft mc = Minecraft.getMinecraft(); World world = mc.theWorld; MovingObjectPosition mop = mc.objectMouseOver; @@ -736,7 +737,7 @@ public class ModEventHandlerClient { /// HAZARDS /// HazardSystem.addFullTooltip(stack, event.entityPlayer, list); - if(event.showAdvancedItemTooltips) { + if(event.showAdvancedItemTooltips && ClientConfig.ITEM_TOOLTIP_SHOW_OREDICT.get()) { List names = ItemStackUtil.getOreDictNames(stack); if(names.size() > 0) { @@ -758,18 +759,21 @@ public class ModEventHandlerClient { /// CUSTOM NUKE /// ComparableStack comp = new ComparableStack(stack).makeSingular(); - CustomNukeEntry entry = TileEntityNukeCustom.entries.get(comp); - if(entry != null) { + if(ClientConfig.ITEM_TOOLTIP_SHOW_CUSTOM_NUKE.get()) { + CustomNukeEntry entry = TileEntityNukeCustom.entries.get(comp); - if(!list.isEmpty()) - list.add(""); - - if(entry.entry == EnumEntryType.ADD) - list.add(EnumChatFormatting.GOLD + "Adds " + entry.value + " to the custom nuke stage " + entry.type); - - if(entry.entry == EnumEntryType.MULT) - list.add(EnumChatFormatting.GOLD + "Adds multiplier " + entry.value + " to the custom nuke stage " + entry.type); + if(entry != null) { + + if(!list.isEmpty()) + list.add(""); + + if(entry.entry == EnumEntryType.ADD) + list.add(EnumChatFormatting.GOLD + "Adds " + entry.value + " to the custom nuke stage " + entry.type); + + if(entry.entry == EnumEntryType.MULT) + list.add(EnumChatFormatting.GOLD + "Adds multiplier " + entry.value + " to the custom nuke stage " + entry.type); + } } try { @@ -1277,24 +1281,6 @@ public class ModEventHandlerClient { } } } - - /*@SubscribeEvent - public void setupFog(RenderFogEvent event) { - event.setResult(Result.DENY); - } - - @SubscribeEvent - public void thickenFog(FogDensity event) { - event.density = 0.05F; - event.setCanceled(true); - } - - @SubscribeEvent - public void tintFog(FogColors event) { - event.red = 0.5F; - event.green = 0.0F; - event.blue = 0.0F; - }*/ public static IIcon particleBase; public static IIcon particleLeaf; @@ -1378,7 +1364,7 @@ public class ModEventHandlerClient { @SubscribeEvent public void onOpenGUI(GuiOpenEvent event) { - if(event.gui instanceof GuiMainMenu) { + if(event.gui instanceof GuiMainMenu && ClientConfig.MAIN_MENU_WACKY_SPLASHES.get()) { GuiMainMenu main = (GuiMainMenu) event.gui; int rand = (int)(Math.random() * 150); diff --git a/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java b/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java index 1d69ca2ba..4db727ba5 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java +++ b/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java @@ -2,6 +2,7 @@ package com.hbm.render.tileentity; import org.lwjgl.opengl.GL11; +import com.hbm.config.ClientConfig; import com.hbm.main.ResourceManager; import com.hbm.tileentity.network.TileEntityPylonBase; @@ -105,37 +106,58 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { GL11.glDisable(GL11.GL_CULL_FACE); tess.startDrawingQuads(); Vec3 delta = Vec3.createVectorHelper(x0 - x1, y0 - y1, z0 - z1); - double hang = Math.min(delta.lengthVector() / 15D, 2.5D); - for(float j = 0; j < count; j++) { - - float k = j + 1; + double girth = 0.03125D; + double hyp = Math.sqrt(delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord); + double yaw = Math.atan2(delta.xCoord, delta.zCoord); + double pitch = Math.atan2(delta.yCoord, hyp); + double rotator = Math.PI * 0.5D; + double newPitch = pitch + rotator; + double newYaw = yaw + rotator; + double iZ = Math.cos(yaw) * Math.cos(newPitch) * girth; + double iX = Math.sin(yaw) * Math.cos(newPitch) * girth; + double iY = Math.sin(newPitch) * girth; + double jZ = Math.cos(newYaw) * girth; + double jX = Math.sin(newYaw) * girth; - double sagJ = Math.sin(j / count * Math.PI * 0.5) * hang; - double sagK = Math.sin(k / count * Math.PI * 0.5) * hang; - double sagMean = (sagJ + sagK) / 2D; - - double deltaX = x1 - x0; - double deltaY = y1 - y0; - double deltaZ = z1 - z0; - - double ja = j + 0.5D; - double ix = pyl.xCoord + x0 + deltaX / (double)(count) * ja; - double iy = pyl.yCoord + y0 + deltaY / (double)(count) * ja - sagMean; - double iz = pyl.zCoord + z0 + deltaZ / (double)(count) * ja; - - int brightness = world.getLightBrightnessForSkyBlocks(MathHelper.floor_double(ix), MathHelper.floor_double(iy), MathHelper.floor_double(iz), 0); - tess.setBrightness(brightness); - + if(!ClientConfig.RENDER_CABLE_HANG.get()) { tess.setColorOpaque_I(pyl.color == 0 ? 0xffffff : pyl.color); + drawLineSegment(tess, x0, y0, z0, x1, y1, z1, iX, iY, iZ, jX, jZ); + } else { - drawLineSegment(tess, - x0 + (deltaX * j / count), - y0 + (deltaY * j / count) - sagJ, - z0 + (deltaZ * j / count), - x0 + (deltaX * k / count), - y0 + (deltaY * k / count) - sagK, - z0 + (deltaZ * k / count)); + double hang = Math.min(delta.lengthVector() / 15D, 2.5D); + + for(float j = 0; j < count; j++) { + + float k = j + 1; + + double sagJ = Math.sin(j / count * Math.PI * 0.5) * hang; + double sagK = Math.sin(k / count * Math.PI * 0.5) * hang; + double sagMean = (sagJ + sagK) / 2D; + + double deltaX = x1 - x0; + double deltaY = y1 - y0; + double deltaZ = z1 - z0; + + double ja = j + 0.5D; + double ix = pyl.xCoord + x0 + deltaX / (double)(count) * ja; + double iy = pyl.yCoord + y0 + deltaY / (double)(count) * ja - sagMean; + double iz = pyl.zCoord + z0 + deltaZ / (double)(count) * ja; + + int brightness = world.getLightBrightnessForSkyBlocks(MathHelper.floor_double(ix), MathHelper.floor_double(iy), MathHelper.floor_double(iz), 0); + tess.setBrightness(brightness); + + tess.setColorOpaque_I(pyl.color == 0 ? 0xffffff : pyl.color); + + drawLineSegment(tess, + x0 + (deltaX * j / count), + y0 + (deltaY * j / count) - sagJ, + z0 + (deltaZ * j / count), + x0 + (deltaX * k / count), + y0 + (deltaY * k / count) - sagK, + z0 + (deltaZ * k / count), + iX, iY, iZ, jX, jZ); + } } tess.draw(); GL11.glEnable(GL11.GL_LIGHTING); @@ -155,24 +177,11 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { * @param b * @param c */ - public void drawLineSegment(Tessellator tessellator, double x, double y, double z, double a, double b, double c) { - - double girth = 0.03125D; + public void drawLineSegment(Tessellator tessellator, double x, double y, double z, double a, double b, double c, double iX, double iY, double iZ, double jX, double jZ) { double deltaX = a - x; double deltaY = b - y; double deltaZ = c - z; - double hyp = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ); - double yaw = Math.atan2(deltaX, deltaZ); - double pitch = Math.atan2(deltaY, hyp); - double rotator = Math.PI * 0.5D; - double newPitch = pitch + rotator; - double newYaw = yaw + rotator; - double iZ = Math.cos(yaw) * Math.cos(newPitch) * girth; - double iX = Math.sin(yaw) * Math.cos(newPitch) * girth; - double iY = Math.sin(newPitch) * girth; - double jZ = Math.cos(newYaw) * girth; - double jX = Math.sin(newYaw) * girth; double length = Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ); int wrap = (int) Math.ceil(length * 8); diff --git a/src/main/java/com/hbm/render/util/RenderInfoSystem.java b/src/main/java/com/hbm/render/util/RenderInfoSystem.java index 94f7760d2..4ea75768f 100644 --- a/src/main/java/com/hbm/render/util/RenderInfoSystem.java +++ b/src/main/java/com/hbm/render/util/RenderInfoSystem.java @@ -7,7 +7,7 @@ import java.util.List; import org.lwjgl.opengl.GL11; -import com.hbm.config.GeneralConfig; +import com.hbm.config.ClientConfig; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; @@ -72,10 +72,13 @@ public class RenderInfoSystem { longest = length; } - int mode = GeneralConfig.hintPos; + int mode = ClientConfig.INFO_POSITION.get(); int pX = mode == 0 ? 15 : mode == 1 ? (resolution.getScaledWidth() - longest - 15) : mode == 2 ? (resolution.getScaledWidth() / 2 + 7) : (resolution.getScaledWidth() / 2 - longest - 6); int pZ = mode == 0 ? 15 : mode == 1 ? 15 : resolution.getScaledHeight() / 2 + 7; + + pX += ClientConfig.INFO_OFFSET_HORIZONTAL.get(); + pZ += ClientConfig.INFO_OFFSET_VERTICAL.get(); int side = pX + 5 + longest; int height = messages.size() * 10 + pZ + 2; diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java index 96af1dbc2..da1fba418 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneGrabber.java @@ -1,5 +1,6 @@ package com.hbm.tileentity.network; +import api.hbm.conveyor.IConveyorBelt; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.network.CraneInserter; import com.hbm.entity.item.EntityMovingItem; @@ -77,24 +78,12 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP ForgeDirection inputSide = getInputSide(); ForgeDirection outputSide = getOutputSide(); - TileEntity te = worldObj.getTileEntity(xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ); + Block beltBlock = worldObj.getBlock(xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ); - int[] access = null; - ISidedInventory sided = null; - - if(te instanceof ISidedInventory) { - sided = (ISidedInventory) te; - access = InventoryUtil.masquerade(sided, outputSide.getOpposite().ordinal()); - } - - if(te instanceof IInventory) { + //unholy copy paste bullshit because i can't be assed to rework the entire thing + if(beltBlock instanceof IConveyorBelt) { + IConveyorBelt belt = (IConveyorBelt) beltBlock; - /* - * due to this really primitive way of just offsetting the AABB instead of contracting it, there's a wacky - * edge-case where it's possible to feed the grabber by inserting items from the side if there's a triple - * lane conveyor in front of the grabbing end. this is such a non-issue that i'm not going to bother trying - * to fuck with the AABB further, since that's just a major headache for no practical benefit - */ double reach = 1D; if(this.getBlockMetadata() > 1) { //ignore if pointing up or down Block b = worldObj.getBlock(xCoord + inputSide.offsetX, yCoord + inputSide.offsetY, zCoord + inputSide.offsetZ); @@ -105,6 +94,7 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP double x = xCoord + inputSide.offsetX * reach; double y = yCoord + inputSide.offsetY * reach; double z = zCoord + inputSide.offsetZ * reach; + List items = worldObj.getEntitiesWithinAABB(EntityMovingItem.class, AxisAlignedBB.getBoundingBox(x + 0.1875D, y + 0.1875D, z + 0.1875D, x + 0.8125D, y + 0.8125D, z + 0.8125D)); for(EntityMovingItem item : items) { @@ -113,21 +103,67 @@ public class TileEntityCraneGrabber extends TileEntityCraneBase implements IGUIP if(this.isWhitelist && !match || !this.isWhitelist && match) continue; lastGrabbedTick = worldObj.getTotalWorldTime(); + + Vec3 pos = Vec3.createVectorHelper(xCoord + 0.5 + outputSide.offsetX * 0.55, yCoord + 0.5 + outputSide.offsetY * 0.55, zCoord + 0.5 + outputSide.offsetZ * 0.55); + Vec3 snap = belt.getClosestSnappingPosition(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, pos); + item.setPosition(snap.xCoord, snap.yCoord, snap.zCoord); + break; + } + + } else { + + TileEntity te = worldObj.getTileEntity(xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ); + + int[] access = null; + ISidedInventory sided = null; + + if(te instanceof ISidedInventory) { + sided = (ISidedInventory) te; + access = InventoryUtil.masquerade(sided, outputSide.getOpposite().ordinal()); + } + + if(te instanceof IInventory) { - ItemStack copy = stack.copy(); - int toAdd = Math.min(stack.stackSize, amount); - copy.stackSize = toAdd; - ItemStack ret = CraneInserter.addToInventory((IInventory) te, access, copy, outputSide.getOpposite().ordinal()); - int didAdd = toAdd - (ret != null ? ret.stackSize : 0); - stack.stackSize -= didAdd; - - if(stack.stackSize <= 0) { - item.setDead(); + /* + * due to this really primitive way of just offsetting the AABB instead of contracting it, there's a wacky + * edge-case where it's possible to feed the grabber by inserting items from the side if there's a triple + * lane conveyor in front of the grabbing end. this is such a non-issue that i'm not going to bother trying + * to fuck with the AABB further, since that's just a major headache for no practical benefit + */ + double reach = 1D; + if(this.getBlockMetadata() > 1) { //ignore if pointing up or down + Block b = worldObj.getBlock(xCoord + inputSide.offsetX, yCoord + inputSide.offsetY, zCoord + inputSide.offsetZ); + if(b == ModBlocks.conveyor_double) reach = 0.5D; + if(b == ModBlocks.conveyor_triple) reach = 0.33D; } + + double x = xCoord + inputSide.offsetX * reach; + double y = yCoord + inputSide.offsetY * reach; + double z = zCoord + inputSide.offsetZ * reach; + List items = worldObj.getEntitiesWithinAABB(EntityMovingItem.class, AxisAlignedBB.getBoundingBox(x + 0.1875D, y + 0.1875D, z + 0.1875D, x + 0.8125D, y + 0.8125D, z + 0.8125D)); - amount -= didAdd; - if(amount <= 0) { - break; + for(EntityMovingItem item : items) { + ItemStack stack = item.getItemStack(); + boolean match = this.matchesFilter(stack); + if(this.isWhitelist && !match || !this.isWhitelist && match) continue; + + lastGrabbedTick = worldObj.getTotalWorldTime(); + + ItemStack copy = stack.copy(); + int toAdd = Math.min(stack.stackSize, amount); + copy.stackSize = toAdd; + ItemStack ret = CraneInserter.addToInventory((IInventory) te, access, copy, outputSide.getOpposite().ordinal()); + int didAdd = toAdd - (ret != null ? ret.stackSize : 0); + stack.stackSize -= didAdd; + + if(stack.stackSize <= 0) { + item.setDead(); + } + + amount -= didAdd; + if(amount <= 0) { + break; + } } } }