mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-10 18:49:08 +01:00
parent
d046b44979
commit
6c01ffaa87
7 changed files with 42 additions and 14 deletions
|
@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.Network;
|
import de.ellpeck.actuallyadditions.api.laser.Network;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
||||||
|
@ -31,7 +32,6 @@ import net.minecraft.client.gui.ScaledResolution;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemCompass;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -169,7 +169,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
if(stack.getItem() instanceof ItemLaserWrench){
|
if(stack.getItem() instanceof ItemLaserWrench){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if(stack.getItem() instanceof ItemCompass){
|
else if(stack.getItem() == ConfigValues.itemCompassConfigurator){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
relay.onCompassAction(player);
|
relay.onCompassAction(player);
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
if(posHit != null && posHit.getBlockPos() != null && minecraft.world != null){
|
if(posHit != null && posHit.getBlockPos() != null && minecraft.world != null){
|
||||||
boolean wearing = ItemEngineerGoggles.isWearing(player);
|
boolean wearing = ItemEngineerGoggles.isWearing(player);
|
||||||
if(wearing || StackUtil.isValid(stack)){
|
if(wearing || StackUtil.isValid(stack)){
|
||||||
boolean compass = stack.getItem() instanceof ItemCompass;
|
boolean compass = stack.getItem() == ConfigValues.itemCompassConfigurator;
|
||||||
if(wearing || compass || stack.getItem() instanceof ItemLaserWrench){
|
if(wearing || compass || stack.getItem() instanceof ItemLaserWrench){
|
||||||
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos());
|
||||||
if(tile instanceof TileEntityLaserRelay){
|
if(tile instanceof TileEntityLaserRelay){
|
||||||
|
@ -260,10 +260,10 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
|
||||||
|
|
||||||
String expl;
|
String expl;
|
||||||
if(compass){
|
if(compass){
|
||||||
expl = relay.getCompassDisplayString().replaceAll("\\\\n", "\n");
|
expl = relay.getCompassDisplayString();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".laserRelay.mode.noCompasss");
|
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".laserRelay.mode.noCompasss", StringUtil.localize(ConfigValues.itemCompassConfigurator.getUnlocalizedName()+".name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
StringUtil.drawSplitString(minecraft.fontRendererObj, expl, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true);
|
StringUtil.drawSplitString(minecraft.fontRendererObj, expl, resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+15, Integer.MAX_VALUE, StringUtil.DECIMAL_COLOR_WHITE, true);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
|
@ -18,7 +19,6 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.BlockRedstoneTorch;
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
@ -115,7 +115,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
||||||
|
|
||||||
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
|
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){
|
||||||
ItemStack stack = player.getHeldItemMainhand();
|
ItemStack stack = player.getHeldItemMainhand();
|
||||||
if(StackUtil.isValid(stack) && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
|
if(StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator){
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityBase){
|
if(tile instanceof TileEntityBase){
|
||||||
TileEntityBase base = (TileEntityBase)tile;
|
TileEntityBase base = (TileEntityBase)tile;
|
||||||
|
|
|
@ -14,6 +14,7 @@ package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
||||||
|
@ -25,7 +26,6 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemCompass;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -56,7 +56,7 @@ public class RenderLaserRelay extends TileEntitySpecialRenderer{
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack hand = player.getHeldItemMainhand();
|
ItemStack hand = player.getHeldItemMainhand();
|
||||||
if(hasGoggles || (StackUtil.isValid(hand) && (hand.getItem() instanceof ItemCompass || hand.getItem() instanceof ItemLaserWrench)) || "themattabase".equals(player.getName())){
|
if(hasGoggles || (StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench)) || "themattabase".equals(player.getName())){
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
|
||||||
float yTrans = tile.getBlockMetadata() == 0 ? 0.2F : 0.8F;
|
float yTrans = tile.getBlockMetadata() == 0 ? 0.2F : 0.8F;
|
||||||
|
|
|
@ -14,10 +14,18 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntListValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
|
||||||
public final class ConfigValues{
|
public final class ConfigValues{
|
||||||
|
|
||||||
|
public static Item itemRedstoneTorchConfigurator;
|
||||||
|
public static Item itemCompassConfigurator;
|
||||||
|
|
||||||
public static void defineConfigValues(Configuration config){
|
public static void defineConfigValues(Configuration config){
|
||||||
for(ConfigIntValues currConf : ConfigIntValues.values()){
|
for(ConfigIntValues currConf : ConfigIntValues.values()){
|
||||||
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt();
|
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc, currConf.min, currConf.max).getInt();
|
||||||
|
@ -35,5 +43,24 @@ public final class ConfigValues{
|
||||||
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getStringList();
|
currConf.currentValue = config.get(currConf.category, currConf.name, currConf.defaultValue, currConf.desc).getStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parseConfiguratorConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void parseConfiguratorConfig(){
|
||||||
|
itemRedstoneTorchConfigurator = null;
|
||||||
|
itemCompassConfigurator = null;
|
||||||
|
|
||||||
|
String[] conf = ConfigStringListValues.CONFIGURE_ITEMS.getValue();
|
||||||
|
if(conf.length == 2){
|
||||||
|
itemRedstoneTorchConfigurator = Item.REGISTRY.getObject(new ResourceLocation(conf[0]));
|
||||||
|
itemCompassConfigurator = Item.REGISTRY.getObject(new ResourceLocation(conf[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(itemRedstoneTorchConfigurator == null || itemCompassConfigurator == null){
|
||||||
|
ModUtil.LOGGER.error("Parsing the Configuration Items config failed, reverting back to the default settings!");
|
||||||
|
|
||||||
|
itemRedstoneTorchConfigurator = Item.getItemFromBlock(Blocks.REDSTONE_TORCH);
|
||||||
|
itemCompassConfigurator = Items.COMPASS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.config.ConfigCategories;
|
||||||
|
|
||||||
public enum ConfigStringListValues{
|
public enum ConfigStringListValues{
|
||||||
|
|
||||||
|
CONFIGURE_ITEMS("Configuration Items", ConfigCategories.OTHER, new String[]{"minecraft:redstone_torch", "minecraft:compass"}, "The non-Actually Additions items that are used to configure blocks from the mod. The first one is the Redstone Torch used to configure the Redstone Mode, and the second one is the Compass used to configure Laser Relays. If another mod overrides usage of either one of these items, you can change the registry name of the used items (using blocks is not possible) here."),
|
||||||
CRUSHER_RECIPE_EXCEPTIONS("Crusher Recipe Exceptions", ConfigCategories.OTHER, new String[]{"ingotBrick", "ingotBrickNether"}, "Ingots, Dusts and Ores that will be blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only."),
|
CRUSHER_RECIPE_EXCEPTIONS("Crusher Recipe Exceptions", ConfigCategories.OTHER, new String[]{"ingotBrick", "ingotBrickNether"}, "Ingots, Dusts and Ores that will be blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only."),
|
||||||
CRUSHER_OUTPUT_BLACKLIST("Crusher Output Blacklist", ConfigCategories.OTHER, new String[0], "The items that aren't allowed as outputs from OreDict Crusher recipes. Use this in case a mod, for example, adds a dust variant that can't be smelted into an ingot. Use REGISTRY NAMES, and if metadata is needed, add it like so: somemod:some_item@3"),
|
CRUSHER_OUTPUT_BLACKLIST("Crusher Output Blacklist", ConfigCategories.OTHER, new String[0], "The items that aren't allowed as outputs from OreDict Crusher recipes. Use this in case a mod, for example, adds a dust variant that can't be smelted into an ingot. Use REGISTRY NAMES, and if metadata is needed, add it like so: somemod:some_item@3"),
|
||||||
MINING_LENS_BLACKLIST("Mining Lens Blacklist", ConfigCategories.OTHER, new String[0], "The items that aren't allowed as being generated by the Lens of the Miner. Use REGISTRY NAMES, and if metadata is needed, add it like so: somemod:some_block@3"),
|
MINING_LENS_BLACKLIST("Mining Lens Blacklist", ConfigCategories.OTHER, new String[0], "The items that aren't allowed as being generated by the Lens of the Miner. Use REGISTRY NAMES, and if metadata is needed, add it like so: somemod:some_block@3"),
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.event;
|
package de.ellpeck.actuallyadditions.mod.event;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
import de.ellpeck.actuallyadditions.mod.data.WorldData;
|
||||||
|
@ -22,7 +23,6 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockRedstoneTorch;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
@ -201,11 +201,11 @@ public class ClientEvents{
|
||||||
font.drawStringWithShadow(strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
|
font.drawStringWithShadow(strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
|
|
||||||
String expl;
|
String expl;
|
||||||
if(StackUtil.isValid(stack) && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
|
if(StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator){
|
||||||
expl = TextFormatting.GREEN+StringUtil.localize("info."+ModUtil.MOD_ID+".redstoneMode.validItem");
|
expl = TextFormatting.GREEN+StringUtil.localize("info."+ModUtil.MOD_ID+".redstoneMode.validItem");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localize("info."+ModUtil.MOD_ID+".redstoneMode.invalidItem");;
|
expl = TextFormatting.GRAY.toString()+TextFormatting.ITALIC+StringUtil.localizeFormatted("info."+ModUtil.MOD_ID+".redstoneMode.invalidItem", StringUtil.localize(ConfigValues.itemRedstoneTorchConfigurator.getUnlocalizedName()+".name"));
|
||||||
}
|
}
|
||||||
font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
|
font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -651,7 +651,7 @@ info.actuallyadditions.machineBroke=The block shattered as you tried to break it
|
||||||
info.actuallyadditions.redstoneMode.name=Redstone Mode
|
info.actuallyadditions.redstoneMode.name=Redstone Mode
|
||||||
info.actuallyadditions.redstoneMode.pulse=Pulse
|
info.actuallyadditions.redstoneMode.pulse=Pulse
|
||||||
info.actuallyadditions.redstoneMode.deactivation=Deactivation
|
info.actuallyadditions.redstoneMode.deactivation=Deactivation
|
||||||
info.actuallyadditions.redstoneMode.invalidItem=Hold a Redstone Torch to toggle!
|
info.actuallyadditions.redstoneMode.invalidItem=Hold a %s to toggle!
|
||||||
info.actuallyadditions.redstoneMode.validItem=Right-Click to toggle!
|
info.actuallyadditions.redstoneMode.validItem=Right-Click to toggle!
|
||||||
info.actuallyadditions.laserRelay.item.extra=Priority
|
info.actuallyadditions.laserRelay.item.extra=Priority
|
||||||
info.actuallyadditions.laserRelay.item.display.1=Right-Click to increase!
|
info.actuallyadditions.laserRelay.item.display.1=Right-Click to increase!
|
||||||
|
@ -662,7 +662,7 @@ info.actuallyadditions.laserRelay.fluid.extra=Fluid Flow
|
||||||
info.actuallyadditions.laserRelay.mode.both=Both Directions
|
info.actuallyadditions.laserRelay.mode.both=Both Directions
|
||||||
info.actuallyadditions.laserRelay.mode.outputOnly=Only into adjacent Blocks
|
info.actuallyadditions.laserRelay.mode.outputOnly=Only into adjacent Blocks
|
||||||
info.actuallyadditions.laserRelay.mode.inputOnly=Only out of adjacent Blocks
|
info.actuallyadditions.laserRelay.mode.inputOnly=Only out of adjacent Blocks
|
||||||
info.actuallyadditions.laserRelay.mode.noCompasss=Hold a Compass to modify!
|
info.actuallyadditions.laserRelay.mode.noCompasss=Hold a %s to modify!
|
||||||
|
|
||||||
#Container Names
|
#Container Names
|
||||||
container.actuallyadditions.inputter.name=ESD
|
container.actuallyadditions.inputter.name=ESD
|
||||||
|
|
Loading…
Reference in a new issue