the rim flappe on a bongfish

This commit is contained in:
Boblet 2025-05-21 16:29:18 +02:00
parent 411d73ff9b
commit 716e429772
12 changed files with 13419 additions and 21207 deletions

View File

@ -1,12 +1,10 @@
## Changed
* Updated chinese localiation
* Duds now have a radioactive AoE effect around them based on type
* HPS is no longer tagged as radioactive and no longer requires hazardous materials tanks to store
* Somehow, these meaningless tags triggered people exceptionally hard. Go annoy someone else.
* Solderers and arc welders can now use overdrive upgrades
* Do note that processing speed rises linearly, but power draw rises exponentially
* The RBMK console's grid can now be rotated using a screwdriver
* Tool abilities have changed
* Righ-clicking while holding ALT now opens a configuration window
* The configuration window allows creation of tool presets
* Area and block abilities can now be toggled independently from each other. For example, the vein miner ability can be combined with silk touch
* Clicking on the same ability allows switching between levels
* Updated textures for the armor and gun modification tables
## Fixed
* Crates? Maybe?
* Fixed conveyor placer not being usable on the conveyor sorter
* Fixed crucible trying to autogen recipes for nonexistant nether thorium ore
## Fixed

View File

@ -16,403 +16,387 @@ import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toserver.NBTItemControlPacket;
import com.hbm.util.EnumUtil;
import com.hbm.util.I18nUtil;
import com.hbm.util.Tuple.Pair;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class GUIScreenToolAbility extends GuiScreen {
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/tool/gui_tool_ability.png");
protected int guiLeft;
protected int guiTop;
protected int xSize;
protected int ySize;
protected int insetWidth;
public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/tool/gui_tool_ability.png");
public static class AbilityInfo {
public IBaseAbility ability;
public int textureU, textureV;
protected int guiLeft;
protected int guiTop;
protected int xSize;
protected int ySize;
protected int insetWidth;
public AbilityInfo(IBaseAbility ability, int textureU, int textureV) {
this.ability = ability;
this.textureU = textureU;
this.textureV = textureV;
}
}
public static class AbilityInfo {
public IBaseAbility ability;
public int textureU, textureV;
public static final List<AbilityInfo> abilitiesArea = new ArrayList<>();
public static final List<AbilityInfo> abilitiesHarvest = new ArrayList<>();
public AbilityInfo(IBaseAbility ability, int textureU, int textureV) {
this.ability = ability;
this.textureU = textureU;
this.textureV = textureV;
}
}
static {
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.NONE, 0, 91));
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.RECURSION, 32, 91));
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.HAMMER, 64, 91));
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.EXPLOSION, 96, 91));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.NONE, 0, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SILK, 32, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.LUCK, 64, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SMELTER, 96, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SHREDDER, 128, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.CENTRIFUGE, 160, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.CRYSTALLIZER, 192, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.MERCURY, 224, 107));
}
public static final List<AbilityInfo> abilitiesArea = new ArrayList<>();
public static final List<AbilityInfo> abilitiesHarvest = new ArrayList<>();
protected ItemStack toolStack;
protected AvailableAbilities availableAbilities;
protected ItemToolAbility.Configuration config;
protected int hoverIdxHarvest = -1;
protected int hoverIdxArea = -1;
protected int hoverIdxExtraBtn = -1;
public GUIScreenToolAbility(AvailableAbilities availableAbilities) {
super();
this.availableAbilities = availableAbilities;
this.xSize = 186; // Note: increased dynamically
this.ySize = 76;
static {
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.NONE, 0, 91));
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.RECURSION, 32, 91));
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.HAMMER, 64, 91));
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.EXPLOSION, 96, 91));
this.insetWidth = 20 * Math.max(abilitiesArea.size() - 4, abilitiesHarvest.size() - 8);
this.xSize += insetWidth;
}
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.NONE, 0, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SILK, 32, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.LUCK, 64, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SMELTER, 96, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.SHREDDER, 128, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.CENTRIFUGE, 160, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.CRYSTALLIZER, 192, 107));
abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.MERCURY, 224, 107));
}
@Override
public void initGui() {
this.toolStack = this.mc.thePlayer.getHeldItem();
protected ItemStack toolStack;
protected AvailableAbilities availableAbilities;
protected ItemToolAbility.Configuration config;
if(this.toolStack == null) {
doClose();
}
protected int hoverIdxHarvest = -1;
protected int hoverIdxArea = -1;
protected int hoverIdxExtraBtn = -1;
this.config = ((ItemToolAbility) this.toolStack.getItem()).getConfiguration(this.toolStack);
guiLeft = (width - xSize) / 2;
guiTop = (height - ySize) / 2;
}
public GUIScreenToolAbility(AvailableAbilities availableAbilities) {
super();
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
this.drawDefaultBackground();
this.availableAbilities = availableAbilities;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
this.xSize = 186; // Note: increased dynamically
this.ySize = 76;
// Draw window background
drawStretchedRect(guiLeft, guiTop, 0, 0, xSize, xSize - insetWidth, ySize, 74, 87);
// Draw the switches
ToolPreset activePreset = config.getActivePreset();
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);
this.insetWidth = 20 * Math.max(abilitiesArea.size() - 4, abilitiesHarvest.size() - 8);
this.xSize += insetWidth;
}
// Draw preset indicator
drawNumber(config.currentPreset + 1, guiLeft + insetWidth + 115, guiTop + 25);
drawNumber(config.presets.size(), guiLeft + insetWidth + 149, guiTop + 25);
@Override
public void initGui() {
this.toolStack = this.mc.thePlayer.getHeldItem();
// Draw extra buttons hover highlights
int extraBtnsX = guiLeft + xSize - 86;
hoverIdxExtraBtn = -1;
for (int i = 0; i < 7; ++i) {
if (isInAABB(mouseX, mouseY, extraBtnsX + i * 11, guiTop + 11, 9, 9)) {
hoverIdxExtraBtn = i;
drawTexturedModalRect(extraBtnsX + i * 11, guiTop + 11, 193 + i * 9, 0, 9, 9);
}
}
if(this.toolStack == null) {
doClose();
}
// Draw tooltip
String tooltipValue = "";
this.config = ((ItemToolAbility) this.toolStack.getItem()).getConfiguration(this.toolStack);
if (hoverIdxArea != -1) {
int level = 0;
if (abilitiesArea.get(hoverIdxArea).ability == activePreset.areaAbility) {
level = activePreset.areaAbilityLevel;
}
tooltipValue = abilitiesArea.get(hoverIdxArea).ability.getFullName(level);
} else if (hoverIdxHarvest != -1) {
int level = 0;
if (abilitiesHarvest.get(hoverIdxHarvest).ability == activePreset.harvestAbility) {
level = activePreset.harvestAbilityLevel;
}
tooltipValue = abilitiesHarvest.get(hoverIdxHarvest).ability.getFullName(level);
} else if (hoverIdxExtraBtn != -1) {
switch (hoverIdxExtraBtn) {
case 0: tooltipValue = "Reset all presets"; break;
case 1: tooltipValue = "Delete current preset"; break;
case 2: tooltipValue = "Add new preset"; break;
case 3: tooltipValue = "Select first preset"; break;
case 4: tooltipValue = "Next preset"; break;
case 5: tooltipValue = "Previous preset"; break;
case 6: tooltipValue = "Close window"; break;
}
}
guiLeft = (width - xSize) / 2;
guiTop = (height - ySize) / 2;
}
if (!tooltipValue.isEmpty()) {
int tooltipWidth = Math.max(6, fontRendererObj.getStringWidth(tooltipValue));
int tooltipX = guiLeft + xSize / 2 - tooltipWidth / 2;
int tooltipY = guiTop + ySize + 1 + 4;
drawStretchedRect(tooltipX - 5, tooltipY - 4, 0, 76, tooltipWidth + 10, 186, 15, 3, 3);
fontRendererObj.drawString(tooltipValue, tooltipX, tooltipY, 0xffffffff);
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
this.drawDefaultBackground();
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 realMidWidth = realWidth - keepLeft - keepRight;
drawTexturedModalRect(x, y, u, v, keepLeft, height);
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 + realMidWidth, y, u + keepLeft + midWidth, v, keepRight, height);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
protected int drawSwitches(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int x, int y, int mouseX, int mouseY) {
int hoverIdx = -1;
// Draw window background
drawStretchedRect(guiLeft, guiTop, 0, 0, xSize, xSize - insetWidth, ySize, 74, 87);
for (int i = 0; i < abilities.size(); ++i) {
AbilityInfo abilityInfo = abilities.get(i);
boolean available = abilityAvailable(abilityInfo.ability);
boolean selected = abilityInfo.ability == selectedAbility;
// Draw the switches
ToolPreset activePreset = config.getActivePreset();
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);
// Draw switch
drawTexturedModalRect(x + 20 * i, y, abilityInfo.textureU + (available ? 16 : 0), abilityInfo.textureV, 16, 16);
// Draw level LEDs
if (abilityInfo.ability.levels() > 1) {
int level = 0;
// Draw preset indicator
drawNumber(config.currentPreset + 1, guiLeft + insetWidth + 115, guiTop + 25);
drawNumber(config.presets.size(), guiLeft + insetWidth + 149, guiTop + 25);
if (selected) {
level = selectedLevel + 1;
}
// Draw extra buttons hover highlights
int extraBtnsX = guiLeft + xSize - 86;
// Note: only visual effect for the LEDs
// int maxLevel = Math.min(abilityInfo.ability.levels(), 5);
int maxLevel = 5;
if (level > 10 || level < 0) {
// All-red LEDs for invalid levels
level = -1;
}
hoverIdxExtraBtn = -1;
for(int i = 0; i < 7; ++i) {
if(isInAABB(mouseX, mouseY, extraBtnsX + i * 11, guiTop + 11, 9, 9)) {
hoverIdxExtraBtn = i;
drawTexturedModalRect(extraBtnsX + i * 11, guiTop + 11, 193 + i * 9, 0, 9, 9);
}
}
drawTexturedModalRect(x + 20 * i + 17, y + 1, 188 + level * 2, maxLevel * 14, 2, 14);
}
// Draw tooltip
String tooltipValue = "";
boolean isHovered = isInAABB(mouseX, mouseY, x + 20 * i, y, 16, 16);
if(hoverIdxArea != -1) {
int level = 0;
if(abilitiesArea.get(hoverIdxArea).ability == activePreset.areaAbility) {
level = activePreset.areaAbilityLevel;
}
tooltipValue = abilitiesArea.get(hoverIdxArea).ability.getFullName(level);
} else if(hoverIdxHarvest != -1) {
int level = 0;
if(abilitiesHarvest.get(hoverIdxHarvest).ability == activePreset.harvestAbility) {
level = activePreset.harvestAbilityLevel;
}
tooltipValue = abilitiesHarvest.get(hoverIdxHarvest).ability.getFullName(level);
} else if(hoverIdxExtraBtn != -1) {
switch(hoverIdxExtraBtn) {
case 0: tooltipValue = "Reset all presets"; break;
case 1: tooltipValue = "Delete current preset"; break;
case 2: tooltipValue = "Add new preset"; break;
case 3: tooltipValue = "Select first preset"; break;
case 4: tooltipValue = "Next preset"; break;
case 5: tooltipValue = "Previous preset"; break;
case 6: tooltipValue = "Close window"; break;
}
}
if (isHovered) {
hoverIdx = i;
}
if(!tooltipValue.isEmpty()) {
int tooltipWidth = Math.max(6, fontRendererObj.getStringWidth(tooltipValue));
int tooltipX = guiLeft + xSize / 2 - tooltipWidth / 2;
int tooltipY = guiTop + ySize + 1 + 4;
drawStretchedRect(tooltipX - 5, tooltipY - 4, 0, 76, tooltipWidth + 10, 186, 15, 3, 3);
fontRendererObj.drawString(tooltipValue, tooltipX, tooltipY, 0xffffffff);
}
}
if (selected) {
// Draw selection highlight
drawTexturedModalRect(x + 20 * i - 1, y - 1, 220, 9, 18, 18);
} else if (available && isHovered) {
// Draw hover highlight
drawTexturedModalRect(x + 20 * i - 1, y - 1, 238, 9, 18, 18);
}
}
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 realMidWidth = realWidth - keepLeft - keepRight;
drawTexturedModalRect(x, y, u, v, keepLeft, height);
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 + realMidWidth, y, u + keepLeft + midWidth, v, keepRight, height);
}
return hoverIdx;
}
protected int drawSwitches(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int x, int y, int mouseX, int mouseY) {
int hoverIdx = -1;
protected void drawNumber(int number, int x, int y) {
number += 100; // Against accidental negatives
drawDigit((number / 10) % 10, x, y);
drawDigit(number % 10, x + 12, y);
}
for(int i = 0; i < abilities.size(); ++i) {
AbilityInfo abilityInfo = abilities.get(i);
boolean available = abilityAvailable(abilityInfo.ability);
boolean selected = abilityInfo.ability == selectedAbility;
protected void drawDigit(int digit, int x, int y) {
drawTexturedModalRect(x, y, digit * 10, 123, 10, 15);
}
// Draw switch
drawTexturedModalRect(x + 20 * i, y, abilityInfo.textureU + (available ? 16 : 0), abilityInfo.textureV, 16, 16);
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;
}
// Draw level LEDs
if(abilityInfo.ability.levels() > 1) {
int level = 0;
private boolean abilityAvailable(IBaseAbility ability) {
if (!availableAbilities.supportsAbility(ability)) {
return false;
}
if(selected) {
level = selectedLevel + 1;
}
ToolPreset activePreset = config.getActivePreset();
if (ability instanceof IToolHarvestAbility && ability != IToolHarvestAbility.NONE && !activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
return false;
}
// Note: only visual effect for the LEDs
// int maxLevel = Math.min(abilityInfo.ability.levels(), 5);
int maxLevel = 5;
return true;
}
if(level > 10 || level < 0) {
// All-red LEDs for invalid levels
level = -1;
}
// Note: This spuriously trigger way too often, and I can't see why. I'll disable it altogether, I guess
// @Override
// public void updateScreen() {
// EntityPlayer player = this.mc.thePlayer;
//
// if(player.getHeldItem() == null || player.getHeldItem().getItem() != toolStack.getItem()) {
// // TODO: Remove
// MainRegistry.logger.warn("GUIScreenToolAbility.updateScreen: toolStack changed!");
// player.closeScreen();
// }
// }
drawTexturedModalRect(x + 20 * i + 17, y + 1, 188 + level * 2, maxLevel * 14, 2, 14);
}
@Override
public void handleMouseInput() {
super.handleMouseInput();
boolean isHovered = isInAABB(mouseX, mouseY, x + 20 * i, y, 16, 16);
if(Mouse.getEventButton() == -1) {
int scroll = Mouse.getEventDWheel();
if(isHovered) {
hoverIdx = i;
}
if(scroll < 0) doPrevPreset(true);
if(scroll > 0) doNextPreset(true);
}
}
if(selected) {
// Draw selection highlight
drawTexturedModalRect(x + 20 * i - 1, y - 1, 220, 9, 18, 18);
} else if(available && isHovered) {
// Draw hover highlight
drawTexturedModalRect(x + 20 * i - 1, y - 1, 238, 9, 18, 18);
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int button) {
ToolPreset activePreset = config.getActivePreset();
// Process switches
Pair<IBaseAbility, Integer> clickResult;
return hoverIdx;
}
clickResult = handleSwitchesClicked(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, hoverIdxArea, mouseX, mouseY);
activePreset.areaAbility = (IToolAreaAbility)clickResult.key;
activePreset.areaAbilityLevel = clickResult.value;
protected void drawNumber(int number, int x, int y) {
number += 100; // Against accidental negatives
drawDigit((number / 10) % 10, x, y);
drawDigit(number % 10, x + 12, y);
}
clickResult = handleSwitchesClicked(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, hoverIdxHarvest, mouseX, mouseY);
activePreset.harvestAbility = (IToolHarvestAbility)clickResult.key;
activePreset.harvestAbilityLevel = clickResult.value;
protected void drawDigit(int digit, int x, int y) {
drawTexturedModalRect(x, y, digit * 10, 123, 10, 15);
}
if (!activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
activePreset.harvestAbility = IToolHarvestAbility.NONE;
activePreset.harvestAbilityLevel = 0;
}
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;
}
// Process extra buttons
if (hoverIdxExtraBtn != -1) {
switch (hoverIdxExtraBtn) {
case 0: doResetPresets(); break;
case 1: doDelPreset(); break;
case 2: doAddPreset(); break;
case 3: doZeroPreset(); break;
case 4: doNextPreset(false); break;
case 5: doPrevPreset(false); break;
case 6: doClose(); break;
}
private boolean abilityAvailable(IBaseAbility ability) {
if(!availableAbilities.supportsAbility(ability)) {
return false;
}
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F));
}
ToolPreset activePreset = config.getActivePreset();
if(ability instanceof IToolHarvestAbility && ability != IToolHarvestAbility.NONE && !activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
return false;
}
// Allow quick-closing
if (!isInAABB(mouseX, mouseY, guiLeft, guiTop, xSize, ySize)) {
MainRegistry.logger.info("GUIScreenToolAbility.mouseClicked: Clicked outside GUI, closing...");
doClose();
}
}
return true;
}
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;
boolean available = abilityAvailable(hoveredAbility);
@Override
public void handleMouseInput() {
super.handleMouseInput();
if (available) {
int availableLevels = availableAbilities.maxLevel(hoveredAbility) + 1;
if(Mouse.getEventButton() == -1) {
int scroll = Mouse.getEventDWheel();
if (hoveredAbility != selectedAbility || availableLevels > 1) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F));
}
if(scroll < 0) doPrevPreset(true);
if(scroll > 0) doNextPreset(true);
}
}
if (hoveredAbility == selectedAbility) {
selectedLevel = (selectedLevel + 1) % availableLevels;
} else {
selectedLevel = 0;
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int button) {
ToolPreset activePreset = config.getActivePreset();
selectedAbility = hoveredAbility;
}
}
// Process switches
Pair<IBaseAbility, Integer> clickResult;
return new Pair<>(selectedAbility, selectedLevel);
}
clickResult = handleSwitchesClicked(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, hoverIdxArea, mouseX, mouseY);
activePreset.areaAbility = (IToolAreaAbility) clickResult.key;
activePreset.areaAbilityLevel = clickResult.value;
@Override
protected void keyTyped(char c, int key) {
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
doClose();
return;
}
super.keyTyped(c, key);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
clickResult = handleSwitchesClicked(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, hoverIdxHarvest, mouseX, mouseY);
activePreset.harvestAbility = (IToolHarvestAbility) clickResult.key;
activePreset.harvestAbilityLevel = clickResult.value;
protected void doResetPresets() {
config.reset(availableAbilities);
}
if(!activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
activePreset.harvestAbility = IToolHarvestAbility.NONE;
activePreset.harvestAbilityLevel = 0;
}
protected void doDelPreset() {
if (config.presets.size() <= 1) {
return;
}
config.presets.remove(config.currentPreset);
config.currentPreset = Math.min(config.currentPreset, config.presets.size() - 1);
}
// Process extra buttons
if(hoverIdxExtraBtn != -1) {
switch(hoverIdxExtraBtn) {
case 0: doResetPresets(); break;
case 1: doDelPreset(); break;
case 2: doAddPreset(); break;
case 3: doZeroPreset(); break;
case 4: doNextPreset(false); break;
case 5: doPrevPreset(false); break;
case 6: doClose(); break;
}
protected void doAddPreset() {
if (config.presets.size() >= 99) {
return;
}
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F));
}
config.presets.add(config.currentPreset + 1, new ToolPreset());
config.currentPreset += 1;
}
// Allow quick-closing
if(!isInAABB(mouseX, mouseY, guiLeft, guiTop, xSize, ySize)) {
doClose();
}
}
protected void doZeroPreset() {
config.currentPreset = 0;
}
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;
boolean available = abilityAvailable(hoveredAbility);
protected void doNextPreset(boolean bound) {
if (bound) {
if (config.currentPreset < config.presets.size() - 1) {
config.currentPreset += 1;
}
} else {
config.currentPreset = (config.currentPreset + 1) % config.presets.size();
}
}
if(available) {
int availableLevels = availableAbilities.maxLevel(hoveredAbility) + 1;
protected void doPrevPreset(boolean bound) {
if (bound) {
if (config.currentPreset > 0) {
config.currentPreset -= 1;
}
} else {
config.currentPreset = (config.currentPreset + config.presets.size() - 1) % config.presets.size();
}
}
if(hoveredAbility != selectedAbility || availableLevels > 1) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F));
}
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()));
if(hoveredAbility == selectedAbility) {
selectedLevel = (selectedLevel + 1) % availableLevels;
} else {
selectedLevel = 0;
}
this.mc.thePlayer.closeScreen();
selectedAbility = hoveredAbility;
}
}
MainRegistry.proxy.displayTooltip(config.getActivePreset().getMessage().getFormattedText(), MainRegistry.proxy.ID_TOOLABILITY);
return new Pair<>(selectedAbility, selectedLevel);
}
@Override
protected void keyTyped(char c, int key) {
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
doClose();
return;
}
super.keyTyped(c, key);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
protected void doResetPresets() {
config.reset(availableAbilities);
}
protected void doDelPreset() {
if(config.presets.size() <= 1) {
return;
}
config.presets.remove(config.currentPreset);
config.currentPreset = Math.min(config.currentPreset, config.presets.size() - 1);
}
protected void doAddPreset() {
if(config.presets.size() >= 99) {
return;
}
config.presets.add(config.currentPreset + 1, new ToolPreset());
config.currentPreset += 1;
}
protected void doZeroPreset() {
config.currentPreset = 0;
}
protected void doNextPreset(boolean bound) {
if(bound) {
if(config.currentPreset < config.presets.size() - 1) {
config.currentPreset += 1;
}
} else {
config.currentPreset = (config.currentPreset + 1) % config.presets.size();
}
}
protected void doPrevPreset(boolean bound) {
if(bound) {
if(config.currentPreset > 0) {
config.currentPreset -= 1;
}
} 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);
}
}
}

View File

@ -39,7 +39,7 @@ public class ItemGuideBook extends Item implements IGUIProvider {
public void getSubItems(Item item, CreativeTabs tab, List list) {
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

View File

@ -24,11 +24,9 @@ import com.hbm.handler.ability.ToolPreset;
import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.toclient.PlayerInformPacket;
import com.hbm.packet.toserver.NBTItemControlPacket;
import com.hbm.tileentity.IGUIProvider;
import api.hbm.item.IDepthRockTool;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;

View File

@ -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.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 });
addRecipeAuto(new ItemStack(ModBlocks.charger), new Object[] { "G", "S", "C", 'G', Items.glowstone_dust, 'S', STEEL.ingot(), 'C', ModItems.coil_copper });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 B

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 417 B