Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

Commit

Permalink
Add support for Buttons
Browse files Browse the repository at this point in the history
Currently just a "Fill network" button
  • Loading branch information
TehNut committed Sep 2, 2016
1 parent 44cf949 commit 59135f5
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ dependencies {
deobfCompile "mezz.jei:jei_${mc_version}:${jei_version}"
deobfCompile "mcp.mobius.waila:Waila:${waila_version}_${mc_version}:dev"
deobfCompile "info.amerifrance.guideapi:Guide-API:${mc_version}-${guideapi_version}"
deobfCompile "info.tehnut.buttons:Buttons:${buttons_version}:api"

// compile name: "Thaumcraft", version: "${mc_version}-${thaumcraft_version}", ext: "jar"
// compile name: 'Baubles', version: "${baubles_version}", ext: 'jar'
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jei_version=3.4.0.204
waila_version=1.7.0-B3
thaumcraft_version=5.1.5
baubles_version=1.1.3.0
guideapi_version=2.0.0-37
guideapi_version=2.0.0-37
buttons_version=1.10.2-0.0.3-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package WayofTime.bloodmagic.compat.buttons;

import WayofTime.bloodmagic.compat.buttons.button.ButtonFillNetwork;
import net.minecraft.util.ResourceLocation;
import tehnut.buttons.api.ButtonsPlugin;
import tehnut.buttons.api.IWidgetPlugin;
import tehnut.buttons.api.IWidgetRegistry;
import tehnut.buttons.api.WidgetTexture;

@ButtonsPlugin
public class BloodMagicPlugin extends IWidgetPlugin.Base {

public static final WidgetTexture FILL_BUTTON = new WidgetTexture(
new ResourceLocation("bloodmagic", "textures/gui/buttons_compat.png"),
0,
0,
20,
20
);

@Override
public void register(IWidgetRegistry widgetRegistry) {
widgetRegistry.addUtilityButton(new ButtonFillNetwork());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package WayofTime.bloodmagic.compat.buttons.button;

import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.saving.SoulNetwork;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.compat.buttons.BloodMagicPlugin;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import tehnut.buttons.api.button.utility.Button;

import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;

public class ButtonFillNetwork extends Button {

public ButtonFillNetwork() {
super(BloodMagicPlugin.FILL_BUTTON);

setServerRequired();
}

@Nullable
@Override
public List<? extends ITextComponent> getTooltip() {
return Collections.singletonList(new TextComponentTranslation("button.bloodmagic.tooltip.fill"));
}

@Override
public void onServerClick(EntityPlayerMP player) {
SoulNetwork network = NetworkHelper.getSoulNetwork(player);
network.setCurrentEssence(Integer.MAX_VALUE);
}

@Override
public ResourceLocation getButtonId() {
return new ResourceLocation(Constants.Mod.MODID, "button_fillnetwork");
}
}
5 changes: 4 additions & 1 deletion src/main/resources/assets/bloodmagic/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -702,4 +702,7 @@ tc.research_category.BLOODMAGIC=Sanguine Arcana
# Thaumcraft Research
bloodmagic.research_name.BLOODMAGIC=Blood Magic
bloodmagic.research_text.BLOODMAGIC=Sanguine Arcana
bloodmagic.research_page.BLOODMAGIC.1=The realm of the Blood Magics has always appeared to be a more solitary and "individual" art with blood mages being notoriously reclusive and a bit insane at times. However, the powers of self-sacrifice and life essence have uses even beyond a normal blood mage's sight, in fact, it is quite apparent that it may have some uses in thaumaturgy after all!
bloodmagic.research_page.BLOODMAGIC.1=The realm of the Blood Magics has always appeared to be a more solitary and "individual" art with blood mages being notoriously reclusive and a bit insane at times. However, the powers of self-sacrifice and life essence have uses even beyond a normal blood mage's sight, in fact, it is quite apparent that it may have some uses in thaumaturgy after all!

# Buttons
button.bloodmagic.tooltip.fill=Fill network
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 59135f5

Please sign in to comment.