mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Fix #1369 Add button click noise to various buttons
This commit is contained in:
1 parent
a3a1f7720e
commit
6b59736ffe
8 files changed
+23
-3
No files matched your search
@@ -93,5 +93,6 @@ public class GameTokenWidget extends Widget {
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
game.choose(index);
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(index, 0));
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ public class ProbeButton extends Widget {
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
pressed = true;
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(-1, 0));
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,8 +15,11 @@ import java.io.File;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -92,4 +95,11 @@ public class ProxyClient extends ProxyCommon {
|
||||
public EntityPlayer getPlayer() {
|
||||
return Minecraft.getMinecraft().thePlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playButtonClick() {
|
||||
Minecraft minecraft = getClientInstance();
|
||||
SoundHandler soundHandler = minecraft.getSoundHandler();
|
||||
soundHandler.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
}
|
||||
}
|
||||
@@ -86,4 +86,8 @@ public class ProxyCommon {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void playButtonClick() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,9 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.factory.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.gui.buttons.GuiBetterButton;
|
||||
@@ -23,6 +20,8 @@ import forestry.factory.gui.widgets.ClearWorktable;
|
||||
import forestry.factory.gui.widgets.MemorizedRecipeSlot;
|
||||
import forestry.factory.recipes.RecipeMemory;
|
||||
import forestry.factory.tiles.TileWorktable;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWorktable> {
|
||||
private static final int SPACING = 18;
|
||||
@@ -71,5 +70,6 @@ public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWork
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
int id = 100 + button.id;
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(id, 0));
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.factory.gui.widgets;
|
||||
|
||||
import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
|
||||
public class ClearWorktable extends Widget {
|
||||
@@ -29,5 +30,6 @@ public class ClearWorktable extends Widget {
|
||||
@Override
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
ContainerWorktable.clearRecipe();
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@ public class MemorizedRecipeSlot extends ItemStackWidgetBase {
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
if (getItemStack() != null) {
|
||||
ContainerWorktable.sendRecipeClick(mouseButton, slotNumber);
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@ public class AddresseeSlot extends Widget {
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
if (!containerLetter.getLetter().isProcessed()) {
|
||||
containerLetter.advanceCarrierType();
|
||||
Proxies.common.playButtonClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user