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 ## 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

View File

@ -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 guiTop;
protected int xSize;
protected int ySize;
protected int insetWidth;
public static class AbilityInfo { protected int guiLeft;
public IBaseAbility ability; protected int guiTop;
public int textureU, textureV; protected int xSize;
protected int ySize;
protected int insetWidth;
public AbilityInfo(IBaseAbility ability, int textureU, int textureV) { public static class AbilityInfo {
this.ability = ability; public IBaseAbility ability;
this.textureU = textureU; public int textureU, textureV;
this.textureV = textureV;
}
}
public static final List<AbilityInfo> abilitiesArea = new ArrayList<>(); public AbilityInfo(IBaseAbility ability, int textureU, int textureV) {
public static final List<AbilityInfo> abilitiesHarvest = new ArrayList<>(); this.ability = ability;
this.textureU = textureU;
this.textureV = textureV;
}
}
static { public static final List<AbilityInfo> abilitiesArea = new ArrayList<>();
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.NONE, 0, 91)); public static final List<AbilityInfo> abilitiesHarvest = new ArrayList<>();
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));
}
protected ItemStack toolStack; static {
protected AvailableAbilities availableAbilities; abilitiesArea.add(new AbilityInfo(IToolAreaAbility.NONE, 0, 91));
protected ItemToolAbility.Configuration config; abilitiesArea.add(new AbilityInfo(IToolAreaAbility.RECURSION, 32, 91));
abilitiesArea.add(new AbilityInfo(IToolAreaAbility.HAMMER, 64, 91));
protected int hoverIdxHarvest = -1; abilitiesArea.add(new AbilityInfo(IToolAreaAbility.EXPLOSION, 96, 91));
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;
this.insetWidth = 20 * Math.max(abilitiesArea.size() - 4, abilitiesHarvest.size() - 8); abilitiesHarvest.add(new AbilityInfo(IToolHarvestAbility.NONE, 0, 107));
this.xSize += insetWidth; 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 protected ItemStack toolStack;
public void initGui() { protected AvailableAbilities availableAbilities;
this.toolStack = this.mc.thePlayer.getHeldItem(); protected ItemToolAbility.Configuration config;
if(this.toolStack == null) { protected int hoverIdxHarvest = -1;
doClose(); protected int hoverIdxArea = -1;
} protected int hoverIdxExtraBtn = -1;
this.config = ((ItemToolAbility) this.toolStack.getItem()).getConfiguration(this.toolStack); public GUIScreenToolAbility(AvailableAbilities availableAbilities) {
super();
guiLeft = (width - xSize) / 2;
guiTop = (height - ySize) / 2;
}
@Override this.availableAbilities = availableAbilities;
public void drawScreen(int mouseX, int mouseY, float f) {
this.drawDefaultBackground();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.xSize = 186; // Note: increased dynamically
Minecraft.getMinecraft().getTextureManager().bindTexture(texture); this.ySize = 76;
// Draw window background this.insetWidth = 20 * Math.max(abilitiesArea.size() - 4, abilitiesHarvest.size() - 8);
drawStretchedRect(guiLeft, guiTop, 0, 0, xSize, xSize - insetWidth, ySize, 74, 87); this.xSize += insetWidth;
}
// 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 preset indicator @Override
drawNumber(config.currentPreset + 1, guiLeft + insetWidth + 115, guiTop + 25); public void initGui() {
drawNumber(config.presets.size(), guiLeft + insetWidth + 149, guiTop + 25); this.toolStack = this.mc.thePlayer.getHeldItem();
// Draw extra buttons hover highlights if(this.toolStack == null) {
int extraBtnsX = guiLeft + xSize - 86; doClose();
}
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);
}
}
// Draw tooltip this.config = ((ItemToolAbility) this.toolStack.getItem()).getConfiguration(this.toolStack);
String tooltipValue = "";
if (hoverIdxArea != -1) { guiLeft = (width - xSize) / 2;
int level = 0; guiTop = (height - ySize) / 2;
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 (!tooltipValue.isEmpty()) { @Override
int tooltipWidth = Math.max(6, fontRendererObj.getStringWidth(tooltipValue)); public void drawScreen(int mouseX, int mouseY, float f) {
int tooltipX = guiLeft + xSize / 2 - tooltipWidth / 2; this.drawDefaultBackground();
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);
}
}
protected void drawStretchedRect(int x, int y, int u, int v, int realWidth, int width, int height, int keepLeft, int keepRight) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int midWidth = width - keepLeft - keepRight; Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
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);
}
protected int drawSwitches(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int x, int y, int mouseX, int mouseY) { // Draw window background
int hoverIdx = -1; drawStretchedRect(guiLeft, guiTop, 0, 0, xSize, xSize - insetWidth, ySize, 74, 87);
for (int i = 0; i < abilities.size(); ++i) { // Draw the switches
AbilityInfo abilityInfo = abilities.get(i); ToolPreset activePreset = config.getActivePreset();
boolean available = abilityAvailable(abilityInfo.ability); hoverIdxArea = drawSwitches(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, guiLeft + 15, guiTop + 25, mouseX, mouseY);
boolean selected = abilityInfo.ability == selectedAbility; hoverIdxHarvest = drawSwitches(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, guiLeft + 15, guiTop + 45, mouseX, mouseY);
// Draw switch // Draw preset indicator
drawTexturedModalRect(x + 20 * i, y, abilityInfo.textureU + (available ? 16 : 0), abilityInfo.textureV, 16, 16); drawNumber(config.currentPreset + 1, guiLeft + insetWidth + 115, guiTop + 25);
drawNumber(config.presets.size(), guiLeft + insetWidth + 149, guiTop + 25);
// Draw level LEDs
if (abilityInfo.ability.levels() > 1) {
int level = 0;
if (selected) { // Draw extra buttons hover highlights
level = selectedLevel + 1; int extraBtnsX = guiLeft + xSize - 86;
}
// Note: only visual effect for the LEDs hoverIdxExtraBtn = -1;
// int maxLevel = Math.min(abilityInfo.ability.levels(), 5); for(int i = 0; i < 7; ++i) {
int maxLevel = 5; if(isInAABB(mouseX, mouseY, extraBtnsX + i * 11, guiTop + 11, 9, 9)) {
hoverIdxExtraBtn = i;
if (level > 10 || level < 0) { drawTexturedModalRect(extraBtnsX + i * 11, guiTop + 11, 193 + i * 9, 0, 9, 9);
// All-red LEDs for invalid levels }
level = -1; }
}
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) { if(!tooltipValue.isEmpty()) {
hoverIdx = i; 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) { protected void drawStretchedRect(int x, int y, int u, int v, int realWidth, int width, int height, int keepLeft, int keepRight) {
// Draw selection highlight int midWidth = width - keepLeft - keepRight;
drawTexturedModalRect(x + 20 * i - 1, y - 1, 220, 9, 18, 18); int realMidWidth = realWidth - keepLeft - keepRight;
} else if (available && isHovered) { drawTexturedModalRect(x, y, u, v, keepLeft, height);
// Draw hover highlight for(int i = 0; i < realMidWidth; i += midWidth) {
drawTexturedModalRect(x + 20 * i - 1, y - 1, 238, 9, 18, 18); 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) { for(int i = 0; i < abilities.size(); ++i) {
number += 100; // Against accidental negatives AbilityInfo abilityInfo = abilities.get(i);
drawDigit((number / 10) % 10, x, y); boolean available = abilityAvailable(abilityInfo.ability);
drawDigit(number % 10, x + 12, y); boolean selected = abilityInfo.ability == selectedAbility;
}
protected void drawDigit(int digit, int x, int y) { // Draw switch
drawTexturedModalRect(x, y, digit * 10, 123, 10, 15); 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) { // Draw level LEDs
return x <= mouseX && x + width > mouseX && y <= mouseY && y + height > mouseY; if(abilityInfo.ability.levels() > 1) {
} int level = 0;
private boolean abilityAvailable(IBaseAbility ability) { if(selected) {
if (!availableAbilities.supportsAbility(ability)) { level = selectedLevel + 1;
return false; }
}
ToolPreset activePreset = config.getActivePreset(); // Note: only visual effect for the LEDs
if (ability instanceof IToolHarvestAbility && ability != IToolHarvestAbility.NONE && !activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) { // int maxLevel = Math.min(abilityInfo.ability.levels(), 5);
return false; 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 drawTexturedModalRect(x + 20 * i + 17, y + 1, 188 + level * 2, maxLevel * 14, 2, 14);
// @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();
// }
// }
@Override boolean isHovered = isInAABB(mouseX, mouseY, x + 20 * i, y, 16, 16);
public void handleMouseInput() {
super.handleMouseInput();
if(Mouse.getEventButton() == -1) { if(isHovered) {
int scroll = Mouse.getEventDWheel(); hoverIdx = i;
}
if(scroll < 0) doPrevPreset(true); if(selected) {
if(scroll > 0) doNextPreset(true); // 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 return hoverIdx;
protected void mouseClicked(int mouseX, int mouseY, int button) { }
ToolPreset activePreset = config.getActivePreset();
// Process switches
Pair<IBaseAbility, Integer> clickResult;
clickResult = handleSwitchesClicked(abilitiesArea, activePreset.areaAbility, activePreset.areaAbilityLevel, hoverIdxArea, mouseX, mouseY); protected void drawNumber(int number, int x, int y) {
activePreset.areaAbility = (IToolAreaAbility)clickResult.key; number += 100; // Against accidental negatives
activePreset.areaAbilityLevel = clickResult.value; drawDigit((number / 10) % 10, x, y);
drawDigit(number % 10, x + 12, y);
}
clickResult = handleSwitchesClicked(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, hoverIdxHarvest, mouseX, mouseY); protected void drawDigit(int digit, int x, int y) {
activePreset.harvestAbility = (IToolHarvestAbility)clickResult.key; drawTexturedModalRect(x, y, digit * 10, 123, 10, 15);
activePreset.harvestAbilityLevel = clickResult.value; }
if (!activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) { private boolean isInAABB(int mouseX, int mouseY, int x, int y, int width, int height) {
activePreset.harvestAbility = IToolHarvestAbility.NONE; return x <= mouseX && x + width > mouseX && y <= mouseY && y + height > mouseY;
activePreset.harvestAbilityLevel = 0; }
}
// Process extra buttons private boolean abilityAvailable(IBaseAbility ability) {
if (hoverIdxExtraBtn != -1) { if(!availableAbilities.supportsAbility(ability)) {
switch (hoverIdxExtraBtn) { return false;
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;
}
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 return true;
if (!isInAABB(mouseX, mouseY, guiLeft, guiTop, xSize, ySize)) { }
MainRegistry.logger.info("GUIScreenToolAbility.mouseClicked: Clicked outside GUI, closing...");
doClose();
}
}
protected Pair<IBaseAbility, Integer> handleSwitchesClicked(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int hoverIdx, int mouseX, int mouseY) { @Override
if (hoverIdx != -1) { public void handleMouseInput() {
IBaseAbility hoveredAbility = abilities.get(hoverIdx).ability; super.handleMouseInput();
boolean available = abilityAvailable(hoveredAbility);
if (available) { if(Mouse.getEventButton() == -1) {
int availableLevels = availableAbilities.maxLevel(hoveredAbility) + 1; int scroll = Mouse.getEventDWheel();
if (hoveredAbility != selectedAbility || availableLevels > 1) { if(scroll < 0) doPrevPreset(true);
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F)); if(scroll > 0) doNextPreset(true);
} }
}
if (hoveredAbility == selectedAbility) { @Override
selectedLevel = (selectedLevel + 1) % availableLevels; protected void mouseClicked(int mouseX, int mouseY, int button) {
} else { ToolPreset activePreset = config.getActivePreset();
selectedLevel = 0;
}
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 clickResult = handleSwitchesClicked(abilitiesHarvest, activePreset.harvestAbility, activePreset.harvestAbilityLevel, hoverIdxHarvest, mouseX, mouseY);
protected void keyTyped(char c, int key) { activePreset.harvestAbility = (IToolHarvestAbility) clickResult.key;
if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) { activePreset.harvestAbilityLevel = clickResult.value;
doClose();
return;
}
super.keyTyped(c, key);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
protected void doResetPresets() { if(!activePreset.areaAbility.allowsHarvest(activePreset.areaAbilityLevel)) {
config.reset(availableAbilities); activePreset.harvestAbility = IToolHarvestAbility.NONE;
} activePreset.harvestAbilityLevel = 0;
}
protected void doDelPreset() { // Process extra buttons
if (config.presets.size() <= 1) { if(hoverIdxExtraBtn != -1) {
return; switch(hoverIdxExtraBtn) {
} case 0: doResetPresets(); break;
config.presets.remove(config.currentPreset); case 1: doDelPreset(); break;
config.currentPreset = Math.min(config.currentPreset, config.presets.size() - 1); 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() { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 0.5F));
if (config.presets.size() >= 99) { }
return;
}
config.presets.add(config.currentPreset + 1, new ToolPreset()); // Allow quick-closing
config.currentPreset += 1; if(!isInAABB(mouseX, mouseY, guiLeft, guiTop, xSize, ySize)) {
} doClose();
}
}
protected void doZeroPreset() { protected Pair<IBaseAbility, Integer> handleSwitchesClicked(List<AbilityInfo> abilities, IBaseAbility selectedAbility, int selectedLevel, int hoverIdx, int mouseX, int mouseY) {
config.currentPreset = 0; if(hoverIdx != -1) {
} IBaseAbility hoveredAbility = abilities.get(hoverIdx).ability;
boolean available = abilityAvailable(hoveredAbility);
protected void doNextPreset(boolean bound) { if(available) {
if (bound) { int availableLevels = availableAbilities.maxLevel(hoveredAbility) + 1;
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(hoveredAbility != selectedAbility || availableLevels > 1) {
if (bound) { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:item.techBoop"), 2F));
if (config.currentPreset > 0) { }
config.currentPreset -= 1;
}
} else {
config.currentPreset = (config.currentPreset + config.presets.size() - 1) % config.presets.size();
}
}
protected void doClose() { if(hoveredAbility == selectedAbility) {
// A bit messy, but I suppose it works selectedLevel = (selectedLevel + 1) % availableLevels;
((ItemToolAbility) this.toolStack.getItem()).setConfiguration(toolStack, config); } else {
PacketDispatcher.wrapper.sendToServer(new NBTItemControlPacket(this.toolStack.getTagCompound())); 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); 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) { 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

View File

@ -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;

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.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 });

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