Compare commits

...
Author SHA1 Message Date
Martin Robertz 1063233a53 update 2025-06-08 13:11:00 +02:00
jurrejelle cad1047525 Ring of loki tooltip fix 2025-06-08 13:08:46 +02:00
Martin Robertz 812c1ff336 update 2025-06-08 11:57:37 +02:00
Martin Robertz baadf4ba18 Merge remote-tracking branch 'ReignOfFROZE/master' into dev
# Conflicts:
#	dependencies.gradle
2025-06-08 11:57:25 +02:00
Maya 0b35b2eaf3 Merge branch 'master' into master 2025-05-25 19:38:53 -06:00
ReignOfFROZE ba991659a4 Added packet for renaming and check if the ring is null before trying to open UI 2025-03-22 13:09:00 -04:00
glowredman 82771d41b2 Don't use wildcard imports 2025-03-06 17:43:52 +01:00
ReignOfFROZE a3d8aa9391 Merge upstream/master to master 2025-03-05 10:55:17 -05:00
ReignOfFROZE dcfa71c8f2 Remove runtime dependency on MUI2 2025-03-05 10:51:39 -05:00
ReignOfFROZE 055aa629d0 Added a little bit of polish 2025-03-03 11:34:21 -05:00
ReignOfFROZE 29fe5f02e0 Organize imports 2025-03-03 11:18:26 -05:00
ReignOfFROZE 3bcfb4505e Remove useless annotation 2025-03-03 11:18:06 -05:00
ReignOfFROZE 2b59c48ee2 Adjust header text scale 2025-03-03 10:26:12 -05:00
ReignOfFROZE 3620cf91bb Added new icons and adjusted GUI scale 2025-03-03 10:20:25 -05:00
ReignOfFROZE da5cbb6d19 not sure why the pencil was big 2025-03-02 18:01:12 -05:00
ReignOfFROZE ff38e8e976 Remove unused files 2025-03-02 18:00:08 -05:00
ReignOfFROZE 8c6fb516e7 Update to MUI2 2025-03-02 17:58:32 -05:00
ReignOfFROZE fc21641317 Made ModularUI an optional dependency 2025-03-02 14:04:41 -05:00
ReignOfFROZE f601f77d95 Remove CT dep 2025-03-01 21:46:24 -05:00
ReignOfFROZE 79be44ed22 Added loki config switching 2025-03-01 21:45:35 -05:00
15 changed files with 629 additions and 62 deletions

No files matched your search

+5 -2
View File
@@ -5,8 +5,11 @@ dependencies {
api('com.github.GTNewHorizons:GTNHLib:0.6.30:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.43:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.4:dev') {transitive=false}
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.51-GTNH:dev')
compileOnly('com.github.GTNewHorizons:ModularUI2:2.2.15-1.7.10:dev')
// runtimeOnlyNonPublishable('com.github.GTNewHorizons:ModularUI2:2.2.15-1.7.10:dev')
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.6.6:dev') {transitive=false}
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.52-GTNH:dev')
compileOnly('com.github.GTNewHorizons:Railcraft:9.16.30:api') {transitive=false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.1.2-GTNH:api') {transitive=false}
compileOnly('curse.maven:cofh-lib-220333:2388748')
@@ -1,28 +1,40 @@
package vazkii.botania.client.core.handler;
import net.minecraft.client.settings.KeyBinding;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.network.PacketLokiClear;
import vazkii.botania.common.network.PacketLokiMirror;
import vazkii.botania.common.network.PacketLokiToggle;
import com.cleanroommc.modularui.factory.ClientGUI;
import com.cleanroommc.modularui.factory.GuiData;
import com.cleanroommc.modularui.factory.GuiFactories;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import vazkii.botania.client.gui.loki.GuiLokiSchematics;
import vazkii.botania.common.item.relic.ItemLokiRing;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.network.PacketLokiClear;
import vazkii.botania.common.network.PacketLokiMirror;
import vazkii.botania.common.network.PacketLokiSaveSchematic;
import vazkii.botania.common.network.PacketLokiToggle;
public class KeyHandler {
private static final KeyBinding keyToggleRingOfLoki= new KeyBinding("botaniamisc.toggleLoki", 0, "botaniamisc.keyCategory");
private static final KeyBinding keyRingOfLokiClear= new KeyBinding("botaniamisc.ringOfLokiClear", 0, "botaniamisc.keyCategory");
private static final KeyBinding keyRingOfLokiMirror= new KeyBinding("botaniamisc.ringOfLokiMirror", 0, "botaniamisc.keyCategory");
private static final KeyBinding keyRingOfLokiSaveSchematic= new KeyBinding("botaniamisc.ringOfLokiSaveSchematic", 0, "botaniamisc.keyCategory");
private static final KeyBinding keyRingOfLokiOpenUI= new KeyBinding("botaniamisc.ringOfLokiOpenUI", 0, "botaniamisc.keyCategory");
public KeyHandler() {
FMLCommonHandler.instance().bus().register(this);
ClientRegistry.registerKeyBinding(keyToggleRingOfLoki);
ClientRegistry.registerKeyBinding(keyRingOfLokiClear);
ClientRegistry.registerKeyBinding(keyRingOfLokiMirror);
ClientRegistry.registerKeyBinding(keyRingOfLokiSaveSchematic);
ClientRegistry.registerKeyBinding(keyRingOfLokiOpenUI);
}
@SideOnly(Side.CLIENT)
@@ -41,16 +53,32 @@ public class KeyHandler {
if(keyRingOfLokiMirror.isPressed()){
toggleRingLokiMirroring();
}
if(keyRingOfLokiSaveSchematic.isPressed()){
ringOfLokiSaveSchematic();
}
if(keyRingOfLokiOpenUI.isPressed()) {
ringOfLokiOpenUI();
}
}
private static void toggleRingLoki() {
PacketHandler.INSTANCE.sendToServer(new PacketLokiToggle());
}
private static void ringOfLokiClear() {
PacketHandler.INSTANCE.sendToServer(new PacketLokiClear());
}
private static void toggleRingLokiMirroring() {
PacketHandler.INSTANCE.sendToServer(new PacketLokiMirror());
}
private static void ringOfLokiSaveSchematic() {
PacketHandler.INSTANCE.sendToServer(new PacketLokiSaveSchematic());
}
private static void ringOfLokiOpenUI() {
if(ItemLokiRing.isModularUIEnabled) {
ItemStack ring = ItemLokiRing.getLokiRing(Minecraft.getMinecraft().thePlayer);
if(ring != null)
GuiLokiSchematics.open(ring);
}
}
}
@@ -0,0 +1,243 @@
package vazkii.botania.client.gui.loki;
import com.cleanroommc.modularui.api.drawable.IKey;
import com.cleanroommc.modularui.api.value.IStringValue;
import com.cleanroommc.modularui.drawable.AdaptableUITexture;
import com.cleanroommc.modularui.drawable.Rectangle;
import com.cleanroommc.modularui.drawable.UITexture;
import com.cleanroommc.modularui.factory.ClientGUI;
import com.cleanroommc.modularui.screen.CustomModularScreen;
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.screen.RichTooltip;
import com.cleanroommc.modularui.screen.viewport.ModularGuiContext;
import com.cleanroommc.modularui.utils.Alignment;
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.value.sync.InteractionSyncHandler;
import com.cleanroommc.modularui.widget.ParentWidget;
import com.cleanroommc.modularui.widget.ScrollWidget;
import com.cleanroommc.modularui.widget.scroll.VerticalScrollData;
import com.cleanroommc.modularui.widgets.ButtonWidget;
import com.cleanroommc.modularui.widgets.TextWidget;
import com.cleanroommc.modularui.widgets.layout.Row;
import com.cleanroommc.modularui.widgets.textfield.TextFieldWidget;
import cpw.mods.fml.common.Optional;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import vazkii.botania.common.item.relic.ItemLokiRing;
import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.network.PacketLokiChangeSchematic;
import vazkii.botania.common.network.PacketLokiDeleteSchematic;
import vazkii.botania.common.network.PacketLokiRenameSchematic;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
public class GuiLokiSchematics extends CustomModularScreen {
public static void open(ItemStack ring) {
GuiLokiSchematics.itemStack = ring;
ClientGUI.open(new GuiLokiSchematics(ring));
}
public static ItemStack itemStack;
public GuiLokiSchematics(ItemStack itemStack) {
this.itemStack = itemStack;
}
private static Object selectedSchematic;
private static Object schematicToBeRenamed;
private static final int WINDOW_WIDTH = 350, WINDOW_HEIGHT = 225, SCROLL_AREA_WIDTH = 350, SCROLL_AREA_HEIGHT = 200, SAVED_SCHEMATICS_HEADER_HEIGHT = 25, X_PADDING = 5, Y_PADDING = 5;
@Override
@Optional.Method(modid = "modularui2")
public ModularPanel buildUI(ModularGuiContext context) {
final UITexture backgroundTexture = AdaptableUITexture
.builder()
.location("botania:textures/gui/croppedPaper")
.imageSize(330, 252)
.adaptable(12)
.build();
final UITexture checkIcon = UITexture
.builder()
.location("botania:textures/gui/check")
.imageSize(20, 20)
.build();
final UITexture deleteIcon = UITexture
.builder()
.location("botania:textures/gui/delete")
.imageSize(20, 20)
.build();
final UITexture renameIcon = UITexture
.builder()
.location("botania:textures/gui/rename")
.imageSize(20, 20)
.build();
selectedSchematic = itemStack.getTagCompound().getString(ItemLokiRing.TAG_CURRENT_SCHEMATIC);
ItemLokiRing ring = (ItemLokiRing) itemStack.getItem();
ring.schematicNames = Arrays.asList(itemStack.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).tagMap.keySet().stream().sorted(Comparator.comparing(Object::toString)).toArray());
Set<Object> deleted = new HashSet<>();
final ScrollWidget<?> scrollWidget = new ScrollWidget<>(new VerticalScrollData());
scrollWidget.getScrollArea().getScrollY().setScrollSize(ring.schematicNames.size() * (SCROLL_AREA_HEIGHT / 5 + 1));
int idx = 0;
for(Object key : itemStack.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).tagMap.keySet()) {
scrollWidget.child(
new Row()
.sizeRel(1f, 0.2f)
.pos(0, ring.schematicNames.indexOf(key) * (SCROLL_AREA_HEIGHT / 5 + 1))
.padding(5, 0, 5, 5)
.setEnabledIf((w) -> !deleted.contains(key))
.background(new Rectangle()
.setColor(idx % 2 == 0 ? Color.ORANGE.brighter(3) : Color.ORANGE.brighter(2)))
.child(
new TextWidget(key.toString())
.widthRel(0.72f))
.child(
new ParentWidget<>()
.tooltip(new RichTooltip().parent(new TextWidget("Activate Schematic")))
.widthRel(0.083f)
.heightRel(1f)
.setEnabledIf((w) -> !key.equals(selectedSchematic))
.child(
new ButtonWidget<>()
.onMousePressed(ignored -> {
PacketHandler.INSTANCE.sendToServer(new PacketLokiChangeSchematic(key.toString()));
selectedSchematic = key;
return true;
})
.background(checkIcon)
.hoverBackground(checkIcon)
.size(20,20)
.center()))
.child(
new ParentWidget<>()
.widthRel(0.083f)
.heightRel(1f)
.child(
new ButtonWidget<>()
.tooltip(new RichTooltip().parent(new TextWidget("Rename Schematic")))
.onMousePressed(ignored -> {
this.schematicToBeRenamed = key;
ClientGUI.open(new RenameGui());
return true;
})
.background(renameIcon)
.hoverBackground(renameIcon)
.size(20, 20)
.center()))
.child(
new ParentWidget<>()
.widthRel(0.083f)
.heightRel(1f)
.child(
new ButtonWidget<>()
.tooltip(new RichTooltip().parent(new TextWidget("Delete Schematic")))
.onMousePressed(ignored -> {
PacketHandler.INSTANCE.sendToServer(new PacketLokiDeleteSchematic(key.toString()));
deleted.add(key);
if(key.equals(selectedSchematic))
selectedSchematic = null;
return true;
})
.background(deleteIcon)
.hoverBackground(deleteIcon)
.size(20, 20)
.center())));
idx++;
}
return ModularPanel.defaultPanel("lokiSchematics")
.child(
new TextWidget(IKey.dynamic(() -> selectedSchematic == null ? StatCollector.translateToLocal("botaniamisc.select_schematic") : StatCollector.translateToLocal("botaniamisc.selected_schematic") + " " + selectedSchematic))
.align(Alignment.TopCenter)
.marginTop(8)
.scale(0.5f))
.child(
scrollWidget
.pos(10, 20)
.widthRel(SCROLL_AREA_WIDTH - 20)
.margin(10, 0)
.height(SCROLL_AREA_HEIGHT - 10))
.background(backgroundTexture)
.size(WINDOW_WIDTH, WINDOW_HEIGHT);
}
public static class RenameGui extends CustomModularScreen {
private String newValue = "";
@Override
public void close() {
super.close();
this.persist();
}
@Override
public void close(boolean force) {
super.close(force);
this.persist();
}
public void persist() {
PacketHandler.INSTANCE.sendToServer(new PacketLokiRenameSchematic(schematicToBeRenamed.toString(), newValue));
}
@Override
public ModularPanel buildUI(ModularGuiContext context) {
final UITexture BACKGROUND = AdaptableUITexture.builder()
.location("botania:textures/gui/croppedPaper")
.imageSize(330, 252)
.adaptable(12)
.build();
InteractionSyncHandler handler = new InteractionSyncHandler();
handler.setOnKeyPressed((key) -> {
System.out.println(key.character);
});
return ModularPanel.defaultPanel("rename")
.child(new TextWidget("Schematic Name:")
.pos(10, 10)
.size(180, 20))
.child(new TextFieldWidget()
.value(new IStringValue<String>() {
@Override
public String getStringValue() {
return newValue;
}
@Override
public void setStringValue(String val) {
newValue = val;
}
@Override
public String getValue() {
return newValue;
}
@Override
public void setValue(String value) {
newValue = value;
}
})
.disableHoverBackground()
.size(150, 20)
.pos(25, 40))
.background(BACKGROUND)
.size(200, 100);
}
}
}
@@ -11,10 +11,16 @@
package vazkii.botania.common.item.relic;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import baubles.common.network.PacketSyncBauble;
import com.gtnewhorizon.gtnhlib.GTNHLib;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@@ -27,8 +33,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.EnumChatFormatting;
@@ -52,31 +59,35 @@ import vazkii.botania.common.core.helper.LokiCursor;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.tool.ToolCommons;
import vazkii.botania.common.lib.LibItemNames;
import baubles.api.BaubleType;
import baubles.common.container.InventoryBaubles;
import baubles.common.lib.PlayerHandler;
import baubles.common.network.PacketSyncBauble;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import vazkii.botania.common.network.PacketLokiHudNotificationAck;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, IManaUsingItem, IInWorldRenderable {
private static final String TAG_CURSOR_LIST = "cursorList";
private static final String TAG_CURSOR_PREFIX = "cursor";
private static final String TAG_CURSOR_COUNT = "cursorCount";
private static final String TAG_X_ORIGIN = "xOrigin";
private static final String TAG_Y_ORIGIN = "yOrigin";
private static final String TAG_Z_ORIGIN = "zOrigin";
private static final String TAG_MODE = "mode";
private static final String TAG_BREAKING_MODE = "breaking";
private static final String TAG_MIRROR_MODE = "mirror";
public static final boolean isModularUIEnabled = Loader.isModLoaded("modularui2");
public static final String TAG_CURSOR_LIST = "cursorList";
public static final String TAG_CURSOR_PREFIX = "cursor";
public static final String TAG_CURSOR_COUNT = "cursorCount";
public static final String TAG_X_ORIGIN = "xOrigin";
public static final String TAG_Y_ORIGIN = "yOrigin";
public static final String TAG_Z_ORIGIN = "zOrigin";
public static final String TAG_MODE = "mode";
public static final String TAG_BREAKING_MODE = "breaking";
public static final String TAG_MIRROR_MODE = "mirror";
public static final String TAG_SAVED_SCHEMATICS = "savedSchematics";
public static final String TAG_CURRENT_SCHEMATIC = "currentSchematic";
private boolean recursion = false;
public static enum HUD_MESSAGE {
MODE, BREAKING, CLEAR, MIRROR, INSUFFICIENT_MANA
public Object window;
public List<Object> schematicNames;
public enum HUD_MESSAGE {
MODE, BREAKING, CLEAR, MIRROR, INSUFFICIENT_MANA, SCHEMATIC_SAVED
}
public ItemLokiRing() {
@@ -127,23 +138,23 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
syncLokiRing(player);
} else {
addCursor : {
int relX = lookPos.blockX - originCoords.posX;
int relY = lookPos.blockY - originCoords.posY;
int relZ = lookPos.blockZ - originCoords.posZ;
int relX = lookPos.blockX - originCoords.posX;
int relY = lookPos.blockY - originCoords.posY;
int relZ = lookPos.blockZ - originCoords.posZ;
for(LokiCursor cursor : cursors)
if(cursor.getX() == relX && cursor.getY() == relY && cursor.getZ() == relZ) {
cursors.remove(cursor);
setCursorList(lokiRing, cursors);
if(player instanceof EntityPlayerMP)
syncLokiRing(player);
break addCursor;
}
for(LokiCursor cursor : cursors)
if(cursor.getX() == relX && cursor.getY() == relY && cursor.getZ() == relZ) {
cursors.remove(cursor);
setCursorList(lokiRing, cursors);
if(player instanceof EntityPlayerMP)
syncLokiRing(player);
break addCursor;
}
addCursor(lokiRing, relX, relY, relZ, getRingMirrorMode(lokiRing) );
if(player instanceof EntityPlayerMP)
syncLokiRing(player);
}
addCursor(lokiRing, relX, relY, relZ, getRingMirrorMode(lokiRing) );
if(player instanceof EntityPlayerMP)
syncLokiRing(player);
}
}
}
} else if (heldItemStack != null && event.action == Action.RIGHT_CLICK_BLOCK && lookPos != null && isRingEnabled(lokiRing)) {
@@ -278,6 +289,84 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
stack.stackTagCompound.setByte(TAG_MIRROR_MODE, state);
}
public static void saveCurrentSelectionAsSchematic(ItemStack stack) {
if(!stack.getTagCompound().tagMap.containsKey(TAG_SAVED_SCHEMATICS)) {
stack.getTagCompound().setTag(TAG_SAVED_SCHEMATICS, new NBTTagCompound());
}
NBTTagCompound map = (NBTTagCompound) stack.getTagCompound().getTag(TAG_SAVED_SCHEMATICS);
NBTTagCompound currentState = new NBTTagCompound();
for(String s : new String[]{
TAG_CURSOR_LIST,
TAG_CURSOR_PREFIX,
TAG_CURSOR_COUNT,
TAG_X_ORIGIN,
TAG_Y_ORIGIN,
TAG_Z_ORIGIN,
TAG_BREAKING_MODE,
TAG_MIRROR_MODE
}) {
if(stack.getTagCompound().getTag(s) != null)
currentState.setTag(s, stack.getTagCompound().getTag(s));
}
String newSchematicName = "New Schematic";
int idx = 1;
if(map.hasKey(newSchematicName)) {
do {
newSchematicName = "New Schematic (" + idx + ")";
idx++;
} while (map.hasKey(newSchematicName));
}
map.setTag(newSchematicName, currentState);
stack.getTagCompound().setTag(TAG_CURRENT_SCHEMATIC, new NBTTagString(newSchematicName));
}
public static void changeSchematic(ItemStack stack, String schematicName) {
if(!stack.getTagCompound().tagMap.containsKey(TAG_SAVED_SCHEMATICS)) {
return;
}
NBTTagCompound map = (NBTTagCompound) stack.getTagCompound().getTag(TAG_SAVED_SCHEMATICS);
if(!map.tagMap.containsKey(schematicName)) {
return;
}
NBTTagCompound schematic = (NBTTagCompound) map.getTag(schematicName);
for(String s : new String[]{
TAG_CURSOR_LIST,
TAG_CURSOR_PREFIX,
TAG_CURSOR_COUNT,
TAG_X_ORIGIN,
TAG_Y_ORIGIN,
TAG_Z_ORIGIN,
TAG_BREAKING_MODE,
TAG_MIRROR_MODE
}) {
if(schematic.getTag(s) != null) {
stack.getTagCompound().setTag(s, schematic.getTag(s));
}
}
stack.getTagCompound().setTag(TAG_CURRENT_SCHEMATIC, new NBTTagString(schematicName));
}
public static void renameSchematic(ItemStack lokiStack, String schematicToBeRenamed, String newName) {
if (lokiStack.getTagCompound().getString(ItemLokiRing.TAG_CURRENT_SCHEMATIC).equals(schematicToBeRenamed)) {
lokiStack.getTagCompound().setString(ItemLokiRing.TAG_CURRENT_SCHEMATIC, newName);
}
NBTBase nbt = lokiStack.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).getTag(schematicToBeRenamed.toString());
lokiStack.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).removeTag(schematicToBeRenamed.toString());
lokiStack.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).setTag(newName, nbt);
}
@Optional.Method(modid = "modularui2")
public static void deleteSchematic(ItemStack lokiStack, String schematicName) {
NBTTagCompound map = lokiStack.getTagCompound().getCompoundTag(TAG_SAVED_SCHEMATICS);
if(map != null) {
if(map.hasKey(schematicName)) {
map.removeTag(schematicName);
}
}
if(schematicName.equals(lokiStack.getTagCompound().getString(TAG_CURRENT_SCHEMATIC))) {
lokiStack.getTagCompound().removeTag(TAG_CURRENT_SCHEMATIC);
}
}
@SideOnly(Side.CLIENT)
public static void renderHUDNotification(HUD_MESSAGE type){
@@ -291,7 +380,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
text = getLokiBreakingModeText(getLokiRing(mc.thePlayer));
break;
case CLEAR:
text = getLokiCearText(getLokiRing(mc.thePlayer));
text = getLokiClearText();
break;
case MIRROR:
text = getLokiMirrorText(getLokiRing(mc.thePlayer));
@@ -299,6 +388,9 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
case INSUFFICIENT_MANA:
text = EnumChatFormatting.RED + StatCollector.translateToLocal("botaniamisc.insufficient_mana");
break;
case SCHEMATIC_SAVED:
text = EnumChatFormatting.GREEN + StatCollector.translateToLocal("botaniamisc.schematic_saved");
break;
default:
return;
@@ -329,7 +421,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
getAxisString(getRingMirrorMode(stack));
}
public static String getLokiCearText(ItemStack stack){
public static String getLokiClearText(){
return EnumChatFormatting.GOLD + StatCollector.translateToLocal("botaniamisc.lokiClear");
}
@@ -445,7 +537,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.lokiMirror") + getAxisString(getRingMirrorMode(stack)), list);
addStringToTooltip("", list);
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.lokiToggleDescription") + " " + getOnOffString(true) + EnumChatFormatting.RESET + "/"+ getOnOffString(false), list);
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.lokiBreakingDescription") + " " + getOnOffString(true) + EnumChatFormatting.RESET+"/" + getOnOffString(false), list);
addStringToTooltip(StatCollector.translateToLocal("botaniamisc.lokiBreakingDescription") + " " + getOnOffString(true) + EnumChatFormatting.RESET+"/" + getOnOffString(false), list);
super.addInformation(stack, player, list, adv);
}
@@ -516,7 +608,7 @@ public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeC
baubles.common.network.PacketHandler.INSTANCE.sendTo(new PacketSyncBauble(player, getLokiRingSlot(player)), (EntityPlayerMP) player);
}
private static boolean isLokiRing(ItemStack stack) {
public static boolean isLokiRing(ItemStack stack) {
return stack != null && (stack.getItem() == ModItems.lokiRing || stack.getItem() == ModItems.aesirRing);
}
@@ -45,17 +45,17 @@ public class GuiHandler implements IGuiHandler {
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch(ID) {
case LibGuiIDs.LEXICON :
GuiLexicon lex = GuiLexicon.currentOpenLexicon;
return lex;
case LibGuiIDs.CRAFTING_HALO :
return new GuiCraftingHalo(player.inventory, world);
case LibGuiIDs.FLOWER_BAG :
return new GuiFlowerBag(player);
case LibGuiIDs.SHROOM_BAG:
return new GuiShroomBag(player);
case LibGuiIDs.BAUBLE_BOX :
return new GuiBaubleBox(player);
case LibGuiIDs.LEXICON :
GuiLexicon lex = GuiLexicon.currentOpenLexicon;
return lex;
case LibGuiIDs.CRAFTING_HALO :
return new GuiCraftingHalo(player.inventory, world);
case LibGuiIDs.FLOWER_BAG :
return new GuiFlowerBag(player);
case LibGuiIDs.SHROOM_BAG:
return new GuiShroomBag(player);
case LibGuiIDs.BAUBLE_BOX :
return new GuiBaubleBox(player);
}
return null;
@@ -1,9 +1,9 @@
package vazkii.botania.common.network;
import vazkii.botania.common.lib.LibMisc;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
import vazkii.botania.common.lib.LibMisc;
public class PacketHandler {
@@ -16,6 +16,10 @@ public class PacketHandler {
INSTANCE.registerMessage(PacketLokiToggle.class, PacketLokiToggle.class, 1, Side.SERVER);
INSTANCE.registerMessage(PacketLokiClear.class, PacketLokiClear.class, 2, Side.SERVER);
INSTANCE.registerMessage(PacketLokiMirror.class, PacketLokiMirror.class, 3, Side.SERVER);
INSTANCE.registerMessage(PacketLokiHudNotificationAck.class, PacketLokiHudNotificationAck.class, 4, Side.CLIENT);
INSTANCE.registerMessage(PacketLokiSaveSchematic.class, PacketLokiSaveSchematic.class, 4, Side.SERVER);
INSTANCE.registerMessage(PacketLokiChangeSchematic.class, PacketLokiChangeSchematic.class, 5, Side.SERVER);
INSTANCE.registerMessage(PacketLokiDeleteSchematic.class, PacketLokiDeleteSchematic.class, 6, Side.SERVER);
INSTANCE.registerMessage(PacketLokiRenameSchematic.class, PacketLokiRenameSchematic.class, 7, Side.SERVER);
INSTANCE.registerMessage(PacketLokiHudNotificationAck.class, PacketLokiHudNotificationAck.class, 8, Side.CLIENT);
}
}
@@ -0,0 +1,48 @@
package vazkii.botania.common.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.relic.ItemLokiRing;
public class PacketLokiChangeSchematic implements IMessage, IMessageHandler<PacketLokiChangeSchematic, IMessage> {
private String schematicName;
public PacketLokiChangeSchematic() {
}
public PacketLokiChangeSchematic(String schematicName) {
this.schematicName = schematicName;
}
@Override
public void fromBytes(ByteBuf buf) {
int schematicNameLength = buf.readInt();
this.schematicName = new String(buf.readBytes(schematicNameLength).array());
if(schematicName.equals("null")) {
schematicName = null;
}
}
@Override
public void toBytes(ByteBuf buf) {
schematicName = schematicName == null ? "null" : schematicName;
buf.writeInt(schematicName.length());
buf.writeBytes(schematicName.getBytes());
}
@Override
public IMessage onMessage(PacketLokiChangeSchematic message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
ItemStack lokiStack = ItemLokiRing.getLokiRing(player);
if(lokiStack != null && lokiStack.getItem() instanceof ItemLokiRing) {
ItemLokiRing.changeSchematic(lokiStack, message.schematicName);
ItemLokiRing.syncLokiRing(player);
}
return null;
}
}
@@ -0,0 +1,49 @@
package vazkii.botania.common.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.relic.ItemLokiRing;
public class PacketLokiDeleteSchematic implements IMessage, IMessageHandler<PacketLokiDeleteSchematic, IMessage> {
private String schematicName;
public PacketLokiDeleteSchematic() {
}
public PacketLokiDeleteSchematic(String schematicName) {
this.schematicName = schematicName;
}
@Override
public void fromBytes(ByteBuf buf) {
int schematicNameLength = buf.readInt();
this.schematicName = new String(buf.readBytes(schematicNameLength).array());
if(schematicName.equals("null")) {
schematicName = null;
}
}
@Override
public void toBytes(ByteBuf buf) {
schematicName = schematicName == null ? "null" : schematicName;
buf.writeInt(schematicName.length());
buf.writeBytes(schematicName.getBytes());
}
@Override
public IMessage onMessage(PacketLokiDeleteSchematic message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
ItemStack lokiStack = ItemLokiRing.getLokiRing(player);
if(lokiStack != null && lokiStack.getItem() instanceof ItemLokiRing) {
ItemLokiRing.deleteSchematic(lokiStack, message.schematicName);
ItemLokiRing.syncLokiRing(player);
}
return null;
}
}
@@ -0,0 +1,59 @@
package vazkii.botania.common.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.relic.ItemLokiRing;
public class PacketLokiRenameSchematic implements IMessage, IMessageHandler<PacketLokiRenameSchematic, IMessage> {
private String schematicToBeRenamed;
private String newName;
public PacketLokiRenameSchematic() {
}
public PacketLokiRenameSchematic(String schematicToBeRenamed, String newValue) {
this.schematicToBeRenamed = schematicToBeRenamed;
this.newName = newValue;
}
@Override
public void fromBytes(ByteBuf buf) {
int schematicToBeRenamedLength = buf.readInt();
this.schematicToBeRenamed = new String(buf.readBytes(schematicToBeRenamedLength).array());
if(schematicToBeRenamed.equals("null")) {
this.schematicToBeRenamed = null;
}
int newNameLength = buf.readInt();
this.newName = new String(buf.readBytes(newNameLength).array());
if(newName.equals("null")) {
this.newName = null;
}
}
@Override
public void toBytes(ByteBuf buf) {
schematicToBeRenamed = schematicToBeRenamed == null ? "null" : schematicToBeRenamed;
buf.writeInt(schematicToBeRenamed.length());
buf.writeBytes(schematicToBeRenamed.getBytes());
newName = newName == null ? "null" : newName;
buf.writeInt(newName.length());
buf.writeBytes(newName.getBytes());
}
@Override
public IMessage onMessage(PacketLokiRenameSchematic message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
ItemStack lokiStack = ItemLokiRing.getLokiRing(player);
if(lokiStack != null && lokiStack.getItem() instanceof ItemLokiRing) {
ItemLokiRing.renameSchematic(lokiStack, message.schematicToBeRenamed, message.newName);
ItemLokiRing.syncLokiRing(player);
}
return null;
}
}
@@ -0,0 +1,33 @@
package vazkii.botania.common.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.relic.ItemLokiRing;
public class PacketLokiSaveSchematic implements IMessage, IMessageHandler<PacketLokiSaveSchematic, IMessage> {
@Override
public void fromBytes(ByteBuf buf) {
}
@Override
public void toBytes(ByteBuf buf) {
}
@Override
public IMessage onMessage(PacketLokiSaveSchematic message, MessageContext ctx) {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
final ItemStack aRing = ItemLokiRing.getLokiRing(player);
if (aRing != null) {
ItemLokiRing.saveCurrentSelectionAsSchematic(aRing);
ItemLokiRing.syncLokiRing(player);
PacketHandler.INSTANCE.sendTo(new PacketLokiHudNotificationAck(ItemLokiRing.HUD_MESSAGE.SCHEMATIC_SAVED), player);
}
return null;
}
}
@@ -160,6 +160,8 @@ botaniamisc.keyCategory=Botania
#LOKI
botaniamisc.toggleLoki=Ring of Loki Switch Key
botaniamisc.ringOfLokiClear=Clear Ring of Loki Selection
botaniamisc.ringOfLokiSaveSchematic=Save Ring of Loki Schematic
botaniamisc.ringOfLokiOpenUI=Open Ring of Loki Schematic GUI
botaniamisc.lokiOn=On
botaniamisc.lokiOff=Off
botaniamisc.breaking=Breaking
@@ -172,6 +174,12 @@ botaniamisc.lokiCurrent=Current
botaniamisc.lokiState=Ring
botaniamisc.lokiMirror=Current mirror:
botaniamisc.insufficient_mana=Not enough mana!
botaniamisc.schematic_saved=Schematic successfully saved!
#LOKI UI
botaniamisc.saved_schematics=Saved Schematics
botaniamisc.select_schematic=Select a Schematic!
botaniamisc.selected_schematic=Currently selected schematic:
# NEI INTEGRATION
botania.nei.brewery=Botanical Brewery
Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B