Added loki config switching

This commit is contained in:
ReignOfFROZE committed 2025-03-01 21:45:35 -05:00
1 parent 2b586edcf2
commit 79be44ed22
13 files changed
+448 -48

No files matched your search

+2
View File
@@ -11,9 +11,11 @@ dependencies {
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.7.18-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.42:api') {transitive=false}
api('com.github.GTNewHorizons:GTNHLib:0.6.1:dev')
implementation("com.github.GTNewHorizons:ModularUI:1.2.18:dev")
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.18-GTNH:dev')
devOnlyNonPublishable("com.github.GTNewHorizons:CraftTweaker:3.4.0:dev") { transitive = false }
}
@@ -1,10 +1,13 @@
package vazkii.botania.client.core.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
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 net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.item.relic.ItemLokiRing;
import vazkii.botania.common.network.*;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -17,12 +20,16 @@ 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 +48,29 @@ 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() {
ItemStack ring = ItemLokiRing.getLokiRing(Minecraft.getMinecraft().thePlayer);
ItemLokiRing.openUI(Minecraft.getMinecraft().thePlayer, ring);
}
}
@@ -0,0 +1,144 @@
package vazkii.botania.client.gui.loki;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.UIInfos;
import com.gtnewhorizons.modularui.api.drawable.AdaptableUITexture;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.math.Alignment;
import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.math.Size;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.api.widget.IWidgetParent;
import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
import com.gtnewhorizons.modularui.common.widget.MultiChildWidget;
import com.gtnewhorizons.modularui.common.widget.Scrollable;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
import com.gtnewhorizons.modularui.common.widget.textfield.TextFieldWidget;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
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 java.util.concurrent.atomic.AtomicInteger;
public class GuiLokiSchematics {
private static final AdaptableUITexture BACKGROUND = AdaptableUITexture
.of("botania:textures/gui/croppedPaper", 330, 252, 12);
private static Object selectedSchematic;
private static final AdaptableUITexture DELETE = AdaptableUITexture
.of("botania:textures/gui/lokiDelete", 500, 500, 0);
private static final AdaptableUITexture RENAME = AdaptableUITexture
.of("botania:textures/gui/lokiRename", 500, 500, 0);
private static String newSchematicName = "";
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;
public static ModularWindow getWindow(UIBuildContext buildContext, ItemStack lokiRing) {
if(lokiRing.getTagCompound().tagMap.containsKey(ItemLokiRing.TAG_CURRENT_SCHEMATIC)) {
// Substring to remove the leading and ending double quotes
selectedSchematic = lokiRing.stackTagCompound.getString(ItemLokiRing.TAG_CURRENT_SCHEMATIC).substring(1);
selectedSchematic = selectedSchematic.toString().substring(0, selectedSchematic.toString().length() - 1);
}
ItemLokiRing ring = (ItemLokiRing) lokiRing.getItem();
ModularWindow.Builder builder = ModularWindow.builder(WINDOW_WIDTH, WINDOW_HEIGHT);
buildContext.setShowNEI(false);
builder.setBackground(ModularUITextures.VANILLA_BACKGROUND);
Scrollable scrollArea =
new Scrollable()
.setVerticalScroll();
if(lokiRing.getTagCompound().tagMap.containsKey(ItemLokiRing.TAG_SAVED_SCHEMATICS) && !lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).tagMap.keySet().isEmpty()) {
final AtomicInteger offset = new AtomicInteger();
final AtomicInteger disabled = new AtomicInteger();
for(Object schematicName : lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).tagMap.keySet()) {
scrollArea = scrollArea.widget(new ButtonWidget()
.setOnClick((clickData, widget) -> {
selectedSchematic = schematicName;
PacketHandler.INSTANCE.sendToServer(new PacketLokiChangeSchematic(schematicName.toString()));
})
.setBackground(() -> new IDrawable[]{new Text(schematicName.toString()).format(selectedSchematic.toString().equals(schematicName.toString()) ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.BLACK)})
.setSize(SCROLL_AREA_WIDTH - 60, SCROLL_AREA_HEIGHT / 10)
.setEnabled((widget) -> {
if(lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).hasKey(schematicName.toString())) {
return true;
}
disabled.getAndIncrement();
return false;
})
.setPosProvider((Size screenSize, ModularWindow window, IWidgetParent parent) -> new Pos2d(0, ring.schematicNames.indexOf(schematicName) * (SCROLL_AREA_HEIGHT / 10 + 1))));
scrollArea = scrollArea.widget(new ButtonWidget()
.setOnClick((clickData, widget) -> {
UIInfos.openClientUI(buildContext.getPlayer(), (context) -> GuiLokiSchematics.getRenameWindow(context, lokiRing, schematicName));
})
.setBackground(RENAME)
.setPosProvider((Size screenSize, ModularWindow window, IWidgetParent parent) -> new Pos2d(SCROLL_AREA_WIDTH - 55, ring.schematicNames.indexOf(schematicName) * (SCROLL_AREA_HEIGHT / 10 + 1)))
.setEnabled((widget) -> lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).hasKey(schematicName.toString()))
.setSize(20, 20));
scrollArea = scrollArea.widget(new ButtonWidget()
.setOnClick((clickData, widget) -> {
PacketHandler.INSTANCE.sendToServer(new PacketLokiDeleteSchematic(schematicName.toString()));
buildContext.setValidator(() -> false);
})
.setBackground(DELETE)
.setPosProvider((Size screenSize, ModularWindow window, IWidgetParent parent) -> new Pos2d(SCROLL_AREA_WIDTH - 30, ring.schematicNames.indexOf(schematicName) * (SCROLL_AREA_HEIGHT / 10 + 1)))
.setEnabled((widget) -> lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).hasKey(schematicName.toString()))
.setSize(20, 20));
offset.addAndGet((SCROLL_AREA_HEIGHT / 10) + 1);
}
}
scrollArea = scrollArea.widget(new TextWidget("No saved schematics!")
.setEnabled((widget) -> !lokiRing.getTagCompound().hasKey(ItemLokiRing.TAG_SAVED_SCHEMATICS) || lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).tagMap.keySet().isEmpty())
.setSize(SCROLL_AREA_WIDTH, SCROLL_AREA_HEIGHT)
.setPos(0, 0));
return builder
.widget(
new MultiChildWidget()
.addChild(
new TextWidget()
.setScale(0.5F)
.setTextSupplier(() -> new Text(selectedSchematic == null ? StatCollector.translateToLocal("botaniamisc.select_schematic") : StatCollector.translateToLocal("botaniamisc.selected_schematic") + " " + selectedSchematic)
.format(selectedSchematic == null ? EnumChatFormatting.RED : EnumChatFormatting.BLACK)
.alignment(Alignment.Center))
.setSize(SCROLL_AREA_WIDTH, SAVED_SCHEMATICS_HEADER_HEIGHT))
.addChild(
scrollArea
.setSize(SCROLL_AREA_WIDTH, SCROLL_AREA_HEIGHT - SAVED_SCHEMATICS_HEADER_HEIGHT - Y_PADDING * 2)
.setPos(0, SAVED_SCHEMATICS_HEADER_HEIGHT))
.setPos(WINDOW_WIDTH - SCROLL_AREA_WIDTH - X_PADDING, 0))
.setBackground(BACKGROUND)
.build();
}
public static ModularWindow getRenameWindow(UIBuildContext buildContext, ItemStack lokiRing, Object schematicName) {
ModularWindow.Builder builder = ModularWindow.builder(200, 100);
buildContext.addCloseListener(() -> {
if(lokiRing.getTagCompound().getString(ItemLokiRing.TAG_CURRENT_SCHEMATIC).equals(schematicName)) {
lokiRing.getTagCompound().setString(ItemLokiRing.TAG_CURRENT_SCHEMATIC, newSchematicName);
}
NBTBase nbt = lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).getTag(schematicName.toString());
lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).removeTag(schematicName.toString());
lokiRing.getTagCompound().getCompoundTag(ItemLokiRing.TAG_SAVED_SCHEMATICS).setTag(newSchematicName, nbt);
});
return builder
.widget(new TextWidget()
.setTextSupplier(() -> new Text("Schematic Name:").format(EnumChatFormatting.BLACK))
.setPos(10, 10)
.setSize(180, 20))
.widget(new TextFieldWidget()
.setGetter(() -> newSchematicName)
.setSetter((newValue) -> newSchematicName = newValue)
.setSize(150, 20)
.setPos(25, 40))
.setBackground(BACKGROUND)
.build();
}
}
@@ -12,9 +12,14 @@ package vazkii.botania.common.item.relic;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import com.gtnewhorizon.gtnhlib.GTNHLib;
import com.gtnewhorizons.modularui.api.UIInfos;
import com.gtnewhorizons.modularui.api.screen.IItemWithModularUI;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
@@ -29,6 +34,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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;
@@ -47,6 +53,7 @@ import vazkii.botania.api.item.ISequentialBreaker;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.client.core.handler.BoundTileRenderer;
import vazkii.botania.client.gui.loki.GuiLokiSchematics;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.LokiCursor;
import vazkii.botania.common.item.ModItems;
@@ -62,21 +69,40 @@ import cpw.mods.fml.relauncher.SideOnly;
import vazkii.botania.common.network.PacketLokiHudNotificationAck;
public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, IManaUsingItem, IInWorldRenderable {
public class ItemLokiRing extends ItemRelicBauble implements IExtendedWireframeCoordinateListProvider, IManaUsingItem, IInWorldRenderable, IItemWithModularUI {
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 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;
private ModularWindow window;
public List<Object> schematicNames;
@Override
public ModularWindow createWindow(UIBuildContext buildContext, ItemStack heldStack) {
this.window = GuiLokiSchematics.getWindow(buildContext, heldStack);
this.schematicNames = new ArrayList<>(heldStack.getTagCompound().getCompoundTag(TAG_SAVED_SCHEMATICS).tagMap.keySet());
return window;
}
public static void openUI(EntityPlayer player, ItemStack stack) {
if(isLokiRing(stack) && stack.getItem() instanceof ItemLokiRing) {
ItemLokiRing lokiRing = (ItemLokiRing) stack.getItem();
UIInfos.openClientUI(player, uiBuildContext -> lokiRing.createWindow(uiBuildContext, stack));
}
}
public static enum HUD_MESSAGE {
MODE, BREAKING, CLEAR, MIRROR, INSUFFICIENT_MANA
MODE, BREAKING, CLEAR, MIRROR, INSUFFICIENT_MANA, SCHEMATIC_SAVED
}
public ItemLokiRing() {
@@ -127,23 +153,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 +304,69 @@ 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 = UUID.randomUUID().toString();
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 deleteSchematic(ItemStack lokiStack, String schematicName) {
NBTTagCompound map = lokiStack.getTagCompound().getCompoundTag(TAG_SAVED_SCHEMATICS);
if(map != null) {
if(map.hasKey(schematicName)) {
map.removeTag(schematicName);
}
}
ItemLokiRing lokiRing = ((ItemLokiRing) lokiStack.getItem());
if(lokiRing != null) {
lokiRing.schematicNames.remove(schematicName);
lokiRing.window.markNeedsRebuild();
}
}
@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);
}
@@ -21,6 +21,7 @@ import vazkii.botania.client.gui.box.GuiBaubleBox;
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
import vazkii.botania.client.gui.crafting.GuiCraftingHalo;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.client.gui.loki.GuiLokiSchematics;
import vazkii.botania.common.lib.LibGuiIDs;
import cpw.mods.fml.common.network.IGuiHandler;
@@ -45,17 +46,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;
@@ -16,6 +16,9 @@ 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(PacketLokiHudNotificationAck.class, PacketLokiHudNotificationAck.class, 7, 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,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: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB