This repository has been archived by the owner on May 13, 2023. It is now read-only.
forked from WayofTime/BloodMagic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently just a "Fill network" button
- Loading branch information
Showing
6 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/WayofTime/bloodmagic/compat/buttons/BloodMagicPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/WayofTime/bloodmagic/compat/buttons/button/ButtonFillNetwork.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.