the rim flappe on a bongfish
16
changelog
@ -1,12 +1,10 @@
|
|||||||
## Changed
|
## Changed
|
||||||
* Updated chinese localiation
|
* The RBMK console's grid can now be rotated using a screwdriver
|
||||||
* Duds now have a radioactive AoE effect around them based on type
|
* Tool abilities have changed
|
||||||
* HPS is no longer tagged as radioactive and no longer requires hazardous materials tanks to store
|
* Righ-clicking while holding ALT now opens a configuration window
|
||||||
* Somehow, these meaningless tags triggered people exceptionally hard. Go annoy someone else.
|
* The configuration window allows creation of tool presets
|
||||||
* Solderers and arc welders can now use overdrive upgrades
|
* Area and block abilities can now be toggled independently from each other. For example, the vein miner ability can be combined with silk touch
|
||||||
* Do note that processing speed rises linearly, but power draw rises exponentially
|
* Clicking on the same ability allows switching between levels
|
||||||
|
* Updated textures for the armor and gun modification tables
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
* Crates? Maybe?
|
|
||||||
* Fixed conveyor placer not being usable on the conveyor sorter
|
|
||||||
* Fixed crucible trying to autogen recipes for nonexistant nether thorium ore
|
|
||||||
@ -16,403 +16,387 @@ import com.hbm.lib.RefStrings;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toserver.NBTItemControlPacket;
|
import com.hbm.packet.toserver.NBTItemControlPacket;
|
||||||
import com.hbm.util.EnumUtil;
|
|
||||||
import com.hbm.util.I18nUtil;
|
|
||||||
import com.hbm.util.Tuple.Pair;
|
import com.hbm.util.Tuple.Pair;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class GUIScreenToolAbility extends GuiScreen {
|
public class GUIScreenToolAbility extends GuiScreen {
|
||||||
|
|
||||||
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/tool/gui_tool_ability.png");
|
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/tool/gui_tool_ability.png");
|
||||||
|
|
||||||
protected int guiLeft;
|
protected int guiLeft;
|
||||||
protected int guiTop;
|
protected int guiTop;
|
||||||
protected int xSize;
|
protected int xSize;
|
||||||
protected int ySize;
|
protected int ySize;
|
||||||
protected int insetWidth;
|
protected int insetWidth;
|
||||||
|
|
||||||
public static class AbilityInfo {
|
public static class AbilityInfo {
|
||||||
public IBaseAbility ability;
|
public IBaseAbility ability;
|
||||||
public int textureU, textureV;
|
public int textureU, textureV;
|
||||||
|
|
||||||
public AbilityInfo(IBaseAbility ability, int textureU, int textureV) {
|
public AbilityInfo(IBaseAbility ability, int textureU, int textureV) {
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
this.textureU = textureU;
|
this.textureU = textureU;
|
||||||
this.textureV = textureV;
|
this.textureV = textureV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final List<AbilityInfo> abilitiesArea = new ArrayList<>();
|
public static final List<AbilityInfo> abilitiesArea = new ArrayList<>();
|
||||||
public static final List<AbilityInfo> abilitiesHarvest = new ArrayList<>();
|
public static final List<AbilityInfo> abilitiesHarvest = new ArrayList<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.NONE, 0, 91));
|
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.NONE, 0, 91));
|
||||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.RECURSION, 32, 91));
|
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.RECURSION, 32, 91));
|
||||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.HAMMER, 64, 91));
|
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.HAMMER, 64, 91));
|
||||||
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.EXPLOSION, 96, 91));
|
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.EXPLOSION, 96, 91));
|
||||||
|
|
||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.NONE, 0, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.NONE, 0, 107));
|
||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SILK, 32, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SILK, 32, 107));
|
||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.LUCK, 64, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.LUCK, 64, 107));
|
||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SMELTER, 96, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SMELTER, 96, 107));
|
||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SHREDDER, 128, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SHREDDER, 128, 107));
|
||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.CENTRIFUGE, 160, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.CENTRIFUGE, 160, 107));
|
||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.CRYSTALLIZER, 192, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.CRYSTALLIZER, 192, 107));
|
||||||
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.MERCURY, 224, 107));
|
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.MERCURY, 224, 107));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemStack toolStack;
|
protected ItemStack toolStack;
|
||||||
protected AvailableAbilities availableAbilities;
|
protected AvailableAbilities availableAbilities;
|
||||||
protected ItemToolAbility.Configuration config;
|
protected ItemToolAbility.Configuration config;
|
||||||
|
|
||||||
protected int hoverIdxHarvest = -1;
|
protected int hoverIdxHarvest = -1;
|
||||||
protected int hoverIdxArea = -1;
|
protected int hoverIdxArea = -1;
|
||||||
protected int hoverIdxExtraBtn = -1;
|
protected int hoverIdxExtraBtn = -1;
|
||||||
|
|
||||||
public GUIScreenToolAbility(AvailableAbilities availableAbilities) {
|
public GUIScreenToolAbility(AvailableAbilities availableAbilities) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.availableAbilities = availableAbilities;
|
this.availableAbilities = availableAbilities;
|
||||||
|
|
||||||
this.xSize = 186; // Note: increased dynamically
|
this.xSize = 186; // Note: increased dynamically
|
||||||
this.ySize = 76;
|
this.ySize = 76;
|
||||||
|
|
||||||
this.insetWidth = 20 * Math.max(abilitiesArea.size() - 4, abilitiesHarvest.size() - 8);
|
this.insetWidth = 20 * Math.max(abilitiesArea.size() - 4, abilitiesHarvest.size() - 8);
|
||||||
this.xSize += insetWidth;
|
this.xSize += insetWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
this.toolStack = this.mc.thePlayer.getHeldItem();
|
this.toolStack = this.mc.thePlayer.getHeldItem();
|
||||||
|
|
||||||
if(this.toolStack == null) {
|
if(this.toolStack == null) {
|
||||||
doClose();
|
doClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.config = ((ItemToolAbility) this.toolStack.getItem()).getConfiguration(this.toolStack);
|
this.config = ((ItemToolAbility) this.toolStack.getItem()).getConfiguration(this.toolStack);
|
||||||
|
|
||||||
guiLeft = (width - xSize) / 2;
|
guiLeft = (width - xSize) / 2;
|
||||||
guiTop = (height - ySize) / 2;
|
guiTop = (height - ySize) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||||
this.drawDefaultBackground();
|
this.drawDefaultBackground();
|
||||||
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
|
|
||||||
// Draw window background
|
// Draw window background
|
||||||
drawStretchedRect(guiLeft, guiTop, 0, 0, xSize, xSize - insetWidth, ySize, 74, 87);
|
drawStretchedRect(guiLeft, guiTop, 0, 0, xSize, xSize - insetWidth, ySize, 74, 87);
|
||||||
|
|
||||||
// Draw the switches
|
// Draw the switches
|
||||||
ToolPreset activePreset = config.getActivePreset();
|
ToolPreset activePreset = config.getActivePreset();
|
||||||
hoverIdxArea = drawSwitches(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, guiLeft + 15, guiTop + 25, mouseX, mouseY);
|
hoverIdxArea = drawSwitches(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, guiLeft + 15, guiTop + 25, mouseX, mouseY);
|
||||||
hoverIdxHarvest = drawSwitches(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, guiLeft + 15, guiTop + 45, mouseX, mouseY);
|
hoverIdxHarvest = drawSwitches(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, guiLeft + 15, guiTop + 45, mouseX, mouseY);
|
||||||
|
|
||||||
// Draw preset indicator
|
// Draw preset indicator
|
||||||
drawNumber(config.currentPreset + 1, guiLeft + insetWidth + 115, guiTop + 25);
|
drawNumber(config.currentPreset + 1, guiLeft + insetWidth + 115, guiTop + 25);
|
||||||
drawNumber(config.presets.size(), guiLeft + insetWidth + 149, guiTop + 25);
|
drawNumber(config.presets.size(), guiLeft + insetWidth + 149, guiTop + 25);
|
||||||
|
|
||||||
// Draw extra buttons hover highlights
|
// Draw extra buttons hover highlights
|
||||||
int extraBtnsX = guiLeft + xSize - 86;
|
int extraBtnsX = guiLeft + xSize - 86;
|
||||||
|
|
||||||
hoverIdxExtraBtn = -1;
|
hoverIdxExtraBtn = -1;
|
||||||
for (int i = 0; i < 7; ++i) {
|
for(int i = 0; i < 7; ++i) {
|
||||||
if (isInAABB(mouseX, mouseY, extraBtnsX + i * 11, guiTop + 11, 9, 9)) {
|
if(isInAABB(mouseX, mouseY, extraBtnsX + i * 11, guiTop + 11, 9, 9)) {
|
||||||
hoverIdxExtraBtn = i;
|
hoverIdxExtraBtn = i;
|
||||||
drawTexturedModalRect(extraBtnsX + i * 11, guiTop + 11, 193 + i * 9, 0, 9, 9);
|
drawTexturedModalRect(extraBtnsX + i * 11, guiTop + 11, 193 + i * 9, 0, 9, 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw tooltip
|
// Draw tooltip
|
||||||
String tooltipValue = "";
|
String tooltipValue = "";
|
||||||
|
|
||||||
if (hoverIdxArea != -1) {
|
if(hoverIdxArea != -1) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
if (abilitiesArea.get(hoverIdxArea).ability == activePreset.areaAbility) {
|
if(abilitiesArea.get(hoverIdxArea).ability == activePreset.areaAbility) {
|
||||||
level = activePreset.areaAbilityLevel;
|
level = activePreset.areaAbilityLevel;
|
||||||
}
|
}
|
||||||
tooltipValue = abilitiesArea.get(hoverIdxArea).ability.getFullName(level);
|
tooltipValue = abilitiesArea.get(hoverIdxArea).ability.getFullName(level);
|
||||||
} else if (hoverIdxHarvest != -1) {
|
} else if(hoverIdxHarvest != -1) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
if (abilitiesHarvest.get(hoverIdxHarvest).ability == activePreset.harvestAbility) {
|
if(abilitiesHarvest.get(hoverIdxHarvest).ability == activePreset.harvestAbility) {
|
||||||
level = activePreset.harvestAbilityLevel;
|
level = activePreset.harvestAbilityLevel;
|
||||||
}
|
}
|
||||||
tooltipValue = abilitiesHarvest.get(hoverIdxHarvest).ability.getFullName(level);
|
tooltipValue = abilitiesHarvest.get(hoverIdxHarvest).ability.getFullName(level);
|
||||||
} else if (hoverIdxExtraBtn != -1) {
|
} else if(hoverIdxExtraBtn != -1) {
|
||||||
switch (hoverIdxExtraBtn) {
|
switch(hoverIdxExtraBtn) {
|
||||||
case 0: tooltipValue = "Reset all presets"; break;
|
case 0: tooltipValue = "Reset all presets"; break;
|
||||||
case 1: tooltipValue = "Delete current preset"; break;
|
case 1: tooltipValue = "Delete current preset"; break;
|
||||||
case 2: tooltipValue = "Add new preset"; break;
|
case 2: tooltipValue = "Add new preset"; break;
|
||||||
case 3: tooltipValue = "Select first preset"; break;
|
case 3: tooltipValue = "Select first preset"; break;
|
||||||
case 4: tooltipValue = "Next preset"; break;
|
case 4: tooltipValue = "Next preset"; break;
|
||||||
case 5: tooltipValue = "Previous preset"; break;
|
case 5: tooltipValue = "Previous preset"; break;
|
||||||
case 6: tooltipValue = "Close window"; break;
|
case 6: tooltipValue = "Close window"; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tooltipValue.isEmpty()) {
|
if(!tooltipValue.isEmpty()) {
|
||||||
int tooltipWidth = Math.max(6, fontRendererObj.getStringWidth(tooltipValue));
|
int tooltipWidth = Math.max(6, fontRendererObj.getStringWidth(tooltipValue));
|
||||||
int tooltipX = guiLeft + xSize / 2 - tooltipWidth / 2;
|
int tooltipX = guiLeft + xSize / 2 - tooltipWidth / 2;
|
||||||
int tooltipY = guiTop + ySize + 1 + 4;
|
int tooltipY = guiTop + ySize + 1 + 4;
|
||||||
drawStretchedRect(tooltipX - 5, tooltipY - 4, 0, 76, tooltipWidth + 10, 186, 15, 3, 3);
|
drawStretchedRect(tooltipX - 5, tooltipY - 4, 0, 76, tooltipWidth + 10, 186, 15, 3, 3);
|
||||||
fontRendererObj.drawString(tooltipValue, tooltipX, tooltipY, 0xffffffff);
|
fontRendererObj.drawString(tooltipValue, tooltipX, tooltipY, 0xffffffff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawStretchedRect(int x, int y, int u, int v, int realWidth, int width, int height, int keepLeft, int keepRight) {
|
protected void drawStretchedRect(int x, int y, int u, int v, int realWidth, int width, int height, int keepLeft, int keepRight) {
|
||||||
int midWidth = width - keepLeft - keepRight;
|
int midWidth = width - keepLeft - keepRight;
|
||||||
int realMidWidth = realWidth - keepLeft - keepRight;
|
int realMidWidth = realWidth - keepLeft - keepRight;
|
||||||
drawTexturedModalRect(x, y, u, v, keepLeft, height);
|
drawTexturedModalRect(x, y, u, v, keepLeft, height);
|
||||||
for (int i = 0; i < realMidWidth; i += midWidth) {
|
for(int i = 0; i < realMidWidth; i += midWidth) {
|
||||||
drawTexturedModalRect(x + keepLeft + i, y, u + keepLeft, v, Math.min(midWidth, realMidWidth - i), height);
|
drawTexturedModalRect(x + keepLeft + i, y, u + keepLeft, v, Math.min(midWidth, realMidWidth - i), height);
|
||||||
}
|
}
|
||||||
drawTexturedModalRect(x + keepLeft + realMidWidth, y, u + keepLeft + midWidth, v, keepRight, height);
|
drawTexturedModalRect(x + keepLeft + realMidWidth, y, u + keepLeft + midWidth, v, keepRight, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int drawSwitches(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int x, int y, int mouseX, int mouseY) {
|
protected int drawSwitches(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int x, int y, int mouseX, int mouseY) {
|
||||||
int hoverIdx = -1;
|
int hoverIdx = -1;
|
||||||
|
|
||||||
for (int i = 0; i < abilities.size(); ++i) {
|
for(int i = 0; i < abilities.size(); ++i) {
|
||||||
AbilityInfo abilityInfo = abilities.get(i);
|
AbilityInfo abilityInfo = abilities.get(i);
|
||||||
boolean available = abilityAvailable(abilityInfo.ability);
|
boolean available = abilityAvailable(abilityInfo.ability);
|
||||||
boolean selected = abilityInfo.ability == selectedAbility;
|
boolean selected = abilityInfo.ability == selectedAbility;
|
||||||
|
|
||||||
// Draw switch
|
// Draw switch
|
||||||
drawTexturedModalRect(x + 20 * i, y, abilityInfo.textureU + (available ? 16 : 0), abilityInfo.textureV, 16, 16);
|
drawTexturedModalRect(x + 20 * i, y, abilityInfo.textureU + (available ? 16 : 0), abilityInfo.textureV, 16, 16);
|
||||||
|
|
||||||
// Draw level LEDs
|
// Draw level LEDs
|
||||||
if (abilityInfo.ability.levels() > 1) {
|
if(abilityInfo.ability.levels() > 1) {
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
if (selected) {
|
if(selected) {
|
||||||
level = selectedLevel + 1;
|
level = selectedLevel + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: only visual effect for the LEDs
|
// Note: only visual effect for the LEDs
|
||||||
// int maxLevel = Math.min(abilityInfo.ability.levels(), 5);
|
// int maxLevel = Math.min(abilityInfo.ability.levels(), 5);
|
||||||
int maxLevel = 5;
|
int maxLevel = 5;
|
||||||
|
|
||||||
if (level > 10 || level < 0) {
|
if(level > 10 || level < 0) {
|
||||||
// All-red LEDs for invalid levels
|
// All-red LEDs for invalid levels
|
||||||
level = -1;
|
level = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawTexturedModalRect(x + 20 * i + 17, y + 1, 188 + level * 2, maxLevel * 14, 2, 14);
|
drawTexturedModalRect(x + 20 * i + 17, y + 1, 188 + level * 2, maxLevel * 14, 2, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isHovered = isInAABB(mouseX, mouseY, x + 20 * i, y, 16, 16);
|
boolean isHovered = isInAABB(mouseX, mouseY, x + 20 * i, y, 16, 16);
|
||||||
|
|
||||||
if (isHovered) {
|
if(isHovered) {
|
||||||
hoverIdx = i;
|
hoverIdx = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected) {
|
if(selected) {
|
||||||
// Draw selection highlight
|
// Draw selection highlight
|
||||||
drawTexturedModalRect(x + 20 * i - 1, y - 1, 220, 9, 18, 18);
|
drawTexturedModalRect(x + 20 * i - 1, y - 1, 220, 9, 18, 18);
|
||||||
} else if (available && isHovered) {
|
} else if(available && isHovered) {
|
||||||
// Draw hover highlight
|
// Draw hover highlight
|
||||||
drawTexturedModalRect(x + 20 * i - 1, y - 1, 238, 9, 18, 18);
|
drawTexturedModalRect(x + 20 * i - 1, y - 1, 238, 9, 18, 18);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hoverIdx;
|
return hoverIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawNumber(int number, int x, int y) {
|
protected void drawNumber(int number, int x, int y) {
|
||||||
number += 100; // Against accidental negatives
|
number += 100; // Against accidental negatives
|
||||||
drawDigit((number / 10) % 10, x, y);
|
drawDigit((number / 10) % 10, x, y);
|
||||||
drawDigit(number % 10, x + 12, y);
|
drawDigit(number % 10, x + 12, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawDigit(int digit, int x, int y) {
|
protected void drawDigit(int digit, int x, int y) {
|
||||||
drawTexturedModalRect(x, y, digit * 10, 123, 10, 15);
|
drawTexturedModalRect(x, y, digit * 10, 123, 10, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInAABB(int mouseX, int mouseY, int x, int y, int width, int height) {
|
private boolean isInAABB(int mouseX, int mouseY, int x, int y, int width, int height) {
|
||||||
return x <= mouseX && x + width > mouseX && y <= mouseY && y + height > mouseY;
|
return x <= mouseX && x + width > mouseX && y <= mouseY && y + height > mouseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean abilityAvailable(IBaseAbility ability) {
|
private boolean abilityAvailable(IBaseAbility ability) {
|
||||||
if (!availableAbilities.supportsAbility(ability)) {
|
if(!availableAbilities.supportsAbility(ability)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolPreset activePreset = config.getActivePreset();
|
ToolPreset activePreset = config.getActivePreset();
|
||||||
if (ability instanceof IToolHarvestAbility && ability != IToolHarvestAbility.NONE && !activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
|
if(ability instanceof IToolHarvestAbility && ability != IToolHarvestAbility.NONE && !activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: This spuriously trigger way too often, and I can't see why. I'll disable it altogether, I guess
|
@Override
|
||||||
// @Override
|
public void handleMouseInput() {
|
||||||
// public void updateScreen() {
|
super.handleMouseInput();
|
||||||
// EntityPlayer player = this.mc.thePlayer;
|
|
||||||
//
|
if(Mouse.getEventButton() == -1) {
|
||||||
// if(player.getHeldItem() == null || player.getHeldItem().getItem() != toolStack.getItem()) {
|
int scroll = Mouse.getEventDWheel();
|
||||||
// // TODO: Remove
|
|
||||||
// MainRegistry.logger.warn("GUIScreenToolAbility.updateScreen: toolStack changed!");
|
if(scroll < 0) doPrevPreset(true);
|
||||||
// player.closeScreen();
|
if(scroll > 0) doNextPreset(true);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMouseInput() {
|
protected void mouseClicked(int mouseX, int mouseY, int button) {
|
||||||
super.handleMouseInput();
|
ToolPreset activePreset = config.getActivePreset();
|
||||||
|
|
||||||
if(Mouse.getEventButton() == -1) {
|
// Process switches
|
||||||
int scroll = Mouse.getEventDWheel();
|
Pair<IBaseAbility, Integer> clickResult;
|
||||||
|
|
||||||
if(scroll < 0) doPrevPreset(true);
|
clickResult = handleSwitchesClicked(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, hoverIdxArea, mouseX, mouseY);
|
||||||
if(scroll > 0) doNextPreset(true);
|
activePreset.areaAbility = (IToolAreaAbility) clickResult.key;
|
||||||
}
|
activePreset.areaAbilityLevel = clickResult.value;
|
||||||
}
|
|
||||||
|
clickResult = handleSwitchesClicked(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, hoverIdxHarvest, mouseX, mouseY);
|
||||||
@Override
|
activePreset.harvestAbility = (IToolHarvestAbility) clickResult.key;
|
||||||
protected void mouseClicked(int mouseX, int mouseY, int button) {
|
activePreset.harvestAbilityLevel = clickResult.value;
|
||||||
ToolPreset activePreset = config.getActivePreset();
|
|
||||||
|
if(!activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
|
||||||
// Process switches
|
activePreset.harvestAbility = IToolHarvestAbility.NONE;
|
||||||
Pair<IBaseAbility, Integer> clickResult;
|
activePreset.harvestAbilityLevel = 0;
|
||||||
|
}
|
||||||
clickResult = handleSwitchesClicked(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, hoverIdxArea, mouseX, mouseY);
|
|
||||||
activePreset.areaAbility = (IToolAreaAbility)clickResult.key;
|
// Process extra buttons
|
||||||
activePreset.areaAbilityLevel = clickResult.value;
|
if(hoverIdxExtraBtn != -1) {
|
||||||
|
switch(hoverIdxExtraBtn) {
|
||||||
clickResult = handleSwitchesClicked(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, hoverIdxHarvest, mouseX, mouseY);
|
case 0: doResetPresets(); break;
|
||||||
activePreset.harvestAbility = (IToolHarvestAbility)clickResult.key;
|
case 1: doDelPreset(); break;
|
||||||
activePreset.harvestAbilityLevel = clickResult.value;
|
case 2: doAddPreset(); break;
|
||||||
|
case 3: doZeroPreset(); break;
|
||||||
if (!activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
|
case 4: doNextPreset(false); break;
|
||||||
activePreset.harvestAbility = IToolHarvestAbility.NONE;
|
case 5: doPrevPreset(false); break;
|
||||||
activePreset.harvestAbilityLevel = 0;
|
case 6: doClose(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process extra buttons
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F));
|
||||||
if (hoverIdxExtraBtn != -1) {
|
}
|
||||||
switch (hoverIdxExtraBtn) {
|
|
||||||
case 0: doResetPresets(); break;
|
// Allow quick-closing
|
||||||
case 1: doDelPreset(); break;
|
if(!isInAABB(mouseX, mouseY, guiLeft, guiTop, xSize, ySize)) {
|
||||||
case 2: doAddPreset(); break;
|
doClose();
|
||||||
case 3: doZeroPreset(); break;
|
}
|
||||||
case 4: doNextPreset(false); break;
|
}
|
||||||
case 5: doPrevPreset(false); break;
|
|
||||||
case 6: doClose(); break;
|
protected Pair<IBaseAbility, Integer> handleSwitchesClicked(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int hoverIdx, int mouseX, int mouseY) {
|
||||||
}
|
if(hoverIdx != -1) {
|
||||||
|
IBaseAbility hoveredAbility = abilities.get(hoverIdx).ability;
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F));
|
boolean available = abilityAvailable(hoveredAbility);
|
||||||
}
|
|
||||||
|
if(available) {
|
||||||
// Allow quick-closing
|
int availableLevels = availableAbilities.maxLevel(hoveredAbility) + 1;
|
||||||
if (!isInAABB(mouseX, mouseY, guiLeft, guiTop, xSize, ySize)) {
|
|
||||||
MainRegistry.logger.info("GUIScreenToolAbility.mouseClicked: Clicked outside GUI, closing...");
|
if(hoveredAbility != selectedAbility || availableLevels > 1) {
|
||||||
doClose();
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if(hoveredAbility == selectedAbility) {
|
||||||
protected Pair<IBaseAbility, Integer> handleSwitchesClicked(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int hoverIdx, int mouseX, int mouseY) {
|
selectedLevel = (selectedLevel + 1) % availableLevels;
|
||||||
if (hoverIdx != -1) {
|
} else {
|
||||||
IBaseAbility hoveredAbility = abilities.get(hoverIdx).ability;
|
selectedLevel = 0;
|
||||||
boolean available = abilityAvailable(hoveredAbility);
|
}
|
||||||
|
|
||||||
if (available) {
|
selectedAbility = hoveredAbility;
|
||||||
int availableLevels = availableAbilities.maxLevel(hoveredAbility) + 1;
|
}
|
||||||
|
}
|
||||||
if (hoveredAbility != selectedAbility || availableLevels > 1) {
|
|
||||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F));
|
return new Pair<>(selectedAbility, selectedLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hoveredAbility == selectedAbility) {
|
@Override
|
||||||
selectedLevel = (selectedLevel + 1) % availableLevels;
|
protected void keyTyped(char c, int key) {
|
||||||
} else {
|
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||||
selectedLevel = 0;
|
doClose();
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
selectedAbility = hoveredAbility;
|
|
||||||
}
|
super.keyTyped(c, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Pair<>(selectedAbility, selectedLevel);
|
@Override
|
||||||
}
|
public boolean doesGuiPauseGame() {
|
||||||
|
return false;
|
||||||
@Override
|
}
|
||||||
protected void keyTyped(char c, int key) {
|
|
||||||
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
|
protected void doResetPresets() {
|
||||||
doClose();
|
config.reset(availableAbilities);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
protected void doDelPreset() {
|
||||||
super.keyTyped(c, key);
|
if(config.presets.size() <= 1) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
@Override
|
config.presets.remove(config.currentPreset);
|
||||||
public boolean doesGuiPauseGame() {
|
config.currentPreset = Math.min(config.currentPreset, config.presets.size() - 1);
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
protected void doAddPreset() {
|
||||||
protected void doResetPresets() {
|
if(config.presets.size() >= 99) {
|
||||||
config.reset(availableAbilities);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doDelPreset() {
|
config.presets.add(config.currentPreset + 1, new ToolPreset());
|
||||||
if (config.presets.size() <= 1) {
|
config.currentPreset += 1;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
config.presets.remove(config.currentPreset);
|
protected void doZeroPreset() {
|
||||||
config.currentPreset = Math.min(config.currentPreset, config.presets.size() - 1);
|
config.currentPreset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doAddPreset() {
|
protected void doNextPreset(boolean bound) {
|
||||||
if (config.presets.size() >= 99) {
|
if(bound) {
|
||||||
return;
|
if(config.currentPreset < config.presets.size() - 1) {
|
||||||
}
|
config.currentPreset += 1;
|
||||||
|
}
|
||||||
config.presets.add(config.currentPreset + 1, new ToolPreset());
|
} else {
|
||||||
config.currentPreset += 1;
|
config.currentPreset = (config.currentPreset + 1) % config.presets.size();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
protected void doZeroPreset() {
|
|
||||||
config.currentPreset = 0;
|
protected void doPrevPreset(boolean bound) {
|
||||||
}
|
if(bound) {
|
||||||
|
if(config.currentPreset > 0) {
|
||||||
protected void doNextPreset(boolean bound) {
|
config.currentPreset -= 1;
|
||||||
if (bound) {
|
}
|
||||||
if (config.currentPreset < config.presets.size() - 1) {
|
} else {
|
||||||
config.currentPreset += 1;
|
config.currentPreset = (config.currentPreset + config.presets.size() - 1) % config.presets.size();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
config.currentPreset = (config.currentPreset + 1) % config.presets.size();
|
|
||||||
}
|
protected void doClose() {
|
||||||
}
|
// A bit messy, but I suppose it works
|
||||||
|
((ItemToolAbility) this.toolStack.getItem()).setConfiguration(toolStack, config);
|
||||||
protected void doPrevPreset(boolean bound) {
|
PacketDispatcher.wrapper.sendToServer(new NBTItemControlPacket(this.toolStack.getTagCompound()));
|
||||||
if (bound) {
|
|
||||||
if (config.currentPreset > 0) {
|
this.mc.thePlayer.closeScreen();
|
||||||
config.currentPreset -= 1;
|
|
||||||
}
|
MainRegistry.proxy.displayTooltip(config.getActivePreset().getMessage().getFormattedText(), MainRegistry.proxy.ID_TOOLABILITY);
|
||||||
} else {
|
|
||||||
config.currentPreset = (config.currentPreset + config.presets.size() - 1) % config.presets.size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void doClose() {
|
|
||||||
// A bit messy, but I suppose it works
|
|
||||||
((ItemToolAbility) this.toolStack.getItem()).setConfiguration(toolStack, config);
|
|
||||||
PacketDispatcher.wrapper.sendToServer(new NBTItemControlPacket(this.toolStack.getTagCompound()));
|
|
||||||
|
|
||||||
this.mc.thePlayer.closeScreen();
|
|
||||||
|
|
||||||
MainRegistry.proxy.displayTooltip(config.getActivePreset().getMessage().getFormattedText(), MainRegistry.proxy.ID_TOOLABILITY);
|
|
||||||
|
|
||||||
this.mc.theWorld.playSoundAtEntity(this.mc.thePlayer, "random.orb", 0.25F, config.getActivePreset().isNone() ? 0.75F : 1.25F);
|
this.mc.theWorld.playSoundAtEntity(this.mc.thePlayer, "random.orb", 0.25F, config.getActivePreset().isNone() ? 0.75F : 1.25F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ public class ItemGuideBook extends Item implements IGUIProvider {
|
|||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
|
|
||||||
for(int i = 1; i < BookType.values().length; i++)
|
for(int i = 1; i < BookType.values().length; i++)
|
||||||
list.add(new ItemStack(item, 1, i));
|
if(i != 2) list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -24,11 +24,9 @@ import com.hbm.handler.ability.ToolPreset;
|
|||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
import com.hbm.packet.toclient.PlayerInformPacket;
|
import com.hbm.packet.toclient.PlayerInformPacket;
|
||||||
import com.hbm.packet.toserver.NBTItemControlPacket;
|
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
|
|
||||||
import api.hbm.item.IDepthRockTool;
|
import api.hbm.item.IDepthRockTool;
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|||||||
@ -929,7 +929,6 @@ public class CraftingManager {
|
|||||||
|
|
||||||
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.TEST.ordinal()), new Object[] { Items.book, ModItems.canned_conserve.stackFromEnum(EnumFoodType.JIZZ) });
|
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.TEST.ordinal()), new Object[] { Items.book, ModItems.canned_conserve.stackFromEnum(EnumFoodType.JIZZ) });
|
||||||
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.RBMK.ordinal()), new Object[] { Items.book, Items.potato });
|
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.RBMK.ordinal()), new Object[] { Items.book, Items.potato });
|
||||||
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.HADRON.ordinal()), new Object[] { Items.book, ModItems.fuse });
|
|
||||||
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.STARTER.ordinal()), new Object[] { Items.book, Items.iron_ingot });
|
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.STARTER.ordinal()), new Object[] { Items.book, Items.iron_ingot });
|
||||||
|
|
||||||
addRecipeAuto(new ItemStack(ModBlocks.charger), new Object[] { "G", "S", "C", 'G', Items.glowstone_dust, 'S', STEEL.ingot(), 'C', ModItems.coil_copper });
|
addRecipeAuto(new ItemStack(ModBlocks.charger), new Object[] { "G", "S", "C", 'G', Items.glowstone_dust, 'S', STEEL.ingot(), 'C', ModItems.coil_copper });
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 238 B |
|
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 203 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 353 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 417 B |