Jump to content

Bedrock_Miner

Forge Modder
  • Posts

    613
  • Joined

  • Last visited

Everything posted by Bedrock_Miner

  1. Well, great.. Another thing which sounds so easy and I just don't understand it. How/Where do I use this eclipse.log.level? (Please explain idiot-safe)
  2. I looked over this, added -debug to the VM Arguments and got the same result as always. But I want to see the debug logs as they are listed in fml-client-latest.log. Why did they add the "Levels" of logging if you cannot make them appear in the console?
  3. I know how to display the output of the program! I want to know how I can make Forge show the logs that are made using FMLLog.log(Level.DEBUG, format, data); and so on...
  4. Heyho guys! Just a small question, how do I enable the logs of the DEBUG or even TRACE level inside of eclipse?
  5. Heyho Guys! I wanted to ask how you can find out which mod registered a special Item (or Block). Can you tell me how I can do this?
  6. Here is the GUI Handler: package com.bedrockminer.magicum.network; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; import com.bedrockminer.magicum.block.tileentity.TileElementaryExtractor; import com.bedrockminer.magicum.block.tileentity.TileMagicCrafting; import com.bedrockminer.magicum.block.tileentity.TileMagicTable; import com.bedrockminer.magicum.block.tileentity.TileMagicalBrewing; import com.bedrockminer.magicum.client.gui.GuiCodexMagicum; import com.bedrockminer.magicum.client.gui.container.ContainerElementaryExtractor; import com.bedrockminer.magicum.client.gui.container.ContainerEmpty; import com.bedrockminer.magicum.client.gui.container.ContainerMagicCrafting; import com.bedrockminer.magicum.client.gui.container.ContainerMagicTable; import com.bedrockminer.magicum.client.gui.container.ContainerMagicalBrewing; import com.bedrockminer.magicum.client.gui.guicontainer.GuiElementaryExtractor; import com.bedrockminer.magicum.client.gui.guicontainer.GuiMagicCrafting; import com.bedrockminer.magicum.client.gui.guicontainer.GuiMagicTable; import com.bedrockminer.magicum.client.gui.guicontainer.GuiMagicalBrewing; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { public static final int IDCodexMagicum = 0; @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == IDCodexMagicum) return new ContainerEmpty(); return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { if (ID == IDCodexMagicum) return new GuiCodexMagicum(); return null; } } ContainerEmpty: package com.bedrockminer.magicum.client.gui.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; public class ContainerEmpty extends Container { @Override public boolean canInteractWith(EntityPlayer player) { return true; } }
  7. THe variable which is null is "slot". Its created with this line: Slot slot = this.playerEntity.openContainer.getSlotFromInventory(this.playerEntity.inventory, this.playerEntity.inventory.currentItem);
  8. Heyho Guys! I created a Item which has a gui, but when I click it to open the gui, close it and click again, I get this crash report: Item class: GuiClass: ( I left out some code which is used for internal stuff) Write if you need more code!
  9. Yes, this can be the reason, thanks. Only one problem: inGround is private, so I need to use reflection again... I'll try and let you know of it works.
  10. Heyho Guys! I created a custom bow for custom arrows. The problem with this thing is, that the arrows rotate while they are flying, but only if the player is in survivalmode. Basically the entity just extends EntityArrow without changing any thing of the movement. I didn't attach a renderer, the default one is used instead. Code of the Arrow: public class EntityMagicArrow extends EntityArrow { public EntityMagicArrow(World world) { super(world); } public EntityMagicArrow(World world, double x, double y, double z) { super(world, x, y, z); } public EntityMagicArrow(World world, EntityLivingBase source, EntityLivingBase target, float f1, float f2) { super(world, source, target, f1, f2); } public EntityMagicArrow(World world, EntityLivingBase source, float speed) { super(world, source, speed); } @Override public void onUpdate() { super.onUpdate(); //No Gravity this.motionY += 0.049999; this.motionX /= 0.99; this.motionY /= 0.99; this.motionZ /= 0.99; if (this.posY > 512) this.kill(); } }
  11. No, I can't. Then I'd have to use another EnumAction and then I'd have to recreate the arm Movement.
  12. So, what I did now is that I analysed the movement and added transformations that revert the movement. Took me about two hours to get the exact configuration, but not the bow is not moving anymore and i can add my own movement.
  13. OK, here is the renderer: The animation I want to change is applied because of the itemUseAction of the Bow which is EnumAction.bow (I don't want to change this). BowClass: This class extends ItemBow, so everything else is defined in vanilla source code (Not sure, where exactly the rendering code is)
  14. Heyho Guys! I want to create a new bow which can be pulled twice as fast as the normal vanilla bow. I created a bow renderer which renders it exactly like the normal one, so it has the three changing textures etc. The problem is now: I need to change the duration of the animation which rescales the bow while pulling, because this is now much to slow. Also I want to make this shaking effect when the bow is fully pulled out appear when my bow is ready and not after the second which is needed to pull a vanilla bow. Is there a way to change the speed of these animations? If nothing else works, it would be ok to reverse the GL Matrix transformations and apply new ones, but I only want to do this if nothing else works. And even if I have to, I have no idea how. Thanks for your help!
  15. Ok, so I can only make the Entity invisible with a special renderer and hope that nobody uses F3-B or some Hacks that display every entity.. Thanks anyway..
  16. Heyho Guys! I planned some different Entities for my mod which should be hidden from some clients completely. For instance, I have a projectile which should be only visible for the owner. But if I just add a renderer which does nothing, you can still see the entity if you activate F3-B. Is there a way to stop the Entity from being synchronized with the special (not-owner) clients? Additionally, can you do the same with Blocks? So that a block that should be hidden is sent to the client as a completely different block? Example: You have a special block, maybe a (modded) storage chest. Only you as the owner can see it, for everyone else its a block of grass. Is anything like this possible? Or are there other ways to achieve the same thing? I'm looking forward to reading your ideas about this
  17. That's because I added the rendering stuff directly to that class. I should probably change this... package com.bedrockminer.magicum.codex.entries; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import com.bedrockminer.magicum.Magicum; import com.bedrockminer.magicum.client.gui.GuiCodexMagicum; import com.bedrockminer.magicum.codex.Codex; import com.bedrockminer.magicum.codex.CodexPage; import com.bedrockminer.magicum.element.Elements; import com.bedrockminer.magicum.extendedproperties.PropertiesCodex; import com.bedrockminer.minersbasic.client.gui.GuiRenderer; import com.bedrockminer.minersbasic.client.render.Color; import com.bedrockminer.minersbasic.items.ItemTemplate; import com.bedrockminer.minersbasic.log.Log; import com.bedrockminer.minersbasic.position.Point; import com.google.gson.stream.JsonReader; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class CodexEntry { /** A unique ID for this Codex Entry */ private final int ID; /** The internal name of this Codex Entry */ private final String name; /** These IDs are required to display the Entry */ private int[] requiredIDs = new int[0]; /** X Position on screen */ private final int x; /** Y Position on Screen */ private final int y; /** Colour of the Connecting lines */ private int lineColour = Color.BLACK.toInt(); /** List of all Lines. Lines are stored as a List of Control Vertices */ private List<Point[]> lines = new ArrayList<Point[]>(); /** If true the entry has a special symbol */ private boolean hasSpecialLayout = false; /** If true the Entry has a special research that has to be completed before ready to craft */ private boolean needsResearch = false; /** List of Items that are shown as a tooltip as help for the Research */ private ItemStack[] researchHelpItems = new ItemStack[0]; /** List of Elements that are shown as a tooltip as help for the Research */ private Elements[] researchHelpElements = new Elements[0]; /** Localized Title of the Entry */ private String title = ""; /** Localized Description of the Entry */ private String desc = ""; /** Localized Pages of the Entry */ private String[] pages = new String[0]; /** Data for the Commands of this Object */ private Object[] command_data = new Object[0]; /** Optional special Text shown when completing a research for this Entry. Not used if equals "" */ private String researchText = ""; /** Optional special Text shown when completing crafting for this Entry. Not used if equals "" */ private String craftingText = ""; /** If true the iconItem is used for rendering, otherwise the coordinates */ private boolean isIconItem = false; /** Itemstack to show as the entry's Icon */ private ItemStack iconItem = null; /** Entry's Icon's x coordinate */ private int iconX = 1; /** Entry's Icon's y coordinate */ private int iconY = 1; private static GuiRenderer g = GuiRenderer.instance; protected static ResourceLocation icons = new ResourceLocation(Magicum.MODID, "codex/codex_icons.png"); protected static ResourceLocation labels = new ResourceLocation(Magicum.MODID, "codex/achievement_labels.png"); public CodexEntry(int ID, String name, int x, int y) { this.ID = ID; this.title = this.name = name; this.x = x; this.y = y; Codex.registerEntry(this); } /** Adds a Line Rendering to this Entry */ public CodexEntry addLine(Point ... vertices) { this.lines.add(vertices); return this; } /** Adds this Codex Entry to the given CodexPage */ public CodexEntry addToCodexPage(CodexPage page) { page.add(this); return this; } public void checkDependencies(EntityPlayer player) { if (PropertiesCodex.get(player).codexList.get(this.getID()) <= (this.needsResearch() ? Codex.HIDDEN : Codex.RESEARCHED)) { boolean reveal = true; for (int i : this.getRequiredIDs()) { if (i == -1 || PropertiesCodex.get(player).codexList.get(i) < Codex.RESEARCHED || (PropertiesCodex.get(player).codexList.get(i) < Codex.COMPLETE && !Codex.entryList.get(i).needsResearch)) { reveal = false; break; } } if (reveal) { if (this.needsResearch()) this.reveal(player); else this.completeResearch(player); } } } /** Sets the given Codex Entry for the given Player to the status {@link Codex#COMPLETE} if it is not completed. */ public void completeCraft(EntityPlayer player) { if (PropertiesCodex.get(player).codexList.get(this.getID()) < Codex.COMPLETE) { PropertiesCodex.get(player).codexList.set(this.getID(), Codex.COMPLETE); if (player instanceof EntityPlayerMP) { Codex.sendCodexChanges((EntityPlayerMP) player, this); Codex.publishCompletion((EntityPlayerMP) player, this); } Codex.updateCodexDependencies(player); } } /** Sets the given Codex Entry for the given Player to the status {@link Codex#RESEARCHED} if it is only visible or hidden. */ public void completeResearch(EntityPlayer player) { if (PropertiesCodex.get(player).codexList.get(this.getID()) < Codex.RESEARCHED) { PropertiesCodex.get(player).codexList.set(this.getID(), Codex.RESEARCHED); if (player instanceof EntityPlayerMP) Codex.sendCodexChanges((EntityPlayerMP) player, this); Codex.updateCodexDependencies(player); } } public Object[] getCommand_data() { return this.command_data; } /** * @return the ID */ public int getID() { return this.ID; } /** Returns the message shown as achievement when completing this codex entry. * Used in translations with either "text.codex." or "chat.codex.achievement." as prefix*/ public String getMessage() { return "text.codex.completion.entry_complete"; } /** * @return the Name */ public String getName() { return this.name; } /** * @return The localized Pages of this Entry */ public String[] getPages() { return this.pages; } /** * @return the requiredIDs */ public int[] getRequiredIDs() { return this.requiredIDs; } /** @return The unlocalized String to show in the tooltip concerning the status of this entry*/ public String getStatusText(byte state) { if (state < Codex.COMPLETE && !this.needsResearch()) return "text.codex.status.not_completed"; if (state == Codex.RESEARCHED) return "text.codex.status.researched"; if (state == Codex.COMPLETE) return "text.codex.status.completed"; return "text.codex.status.needs_research"; } /** * @return The localized Title of this Entry */ public String getTitle() { return this.title; } public int getX() { return this.x; } public int getY() { return this.y; } @Override public int hashCode() { return this.ID; } public boolean hasSpecialLayout() { return this.hasSpecialLayout; } public void loadFromAssets(String languageCode) { ResourceLocation res = new ResourceLocation(Magicum.MODID, "codex/lang/" + languageCode + "/" + this.getName() + ".json"); try { Minecraft.getMinecraft().getResourceManager().getResource(res); } catch (IOException e1) { res = new ResourceLocation(Magicum.MODID, "codex/lang/en_US/" + this.getName() + ".json"); } try { JsonReader reader = new JsonReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream(), "UTF-8")); reader.beginObject(); while (reader.hasNext()) { String identifier = reader.nextName(); if (identifier.equals("title")) { this.title = reader.nextString(); } else if (identifier.equals("desc")) { this.desc = reader.nextString(); } else if (identifier.equals("icon_item")) { ItemTemplate temp = ItemTemplate.createFromString(reader.nextString()); if (temp != null) { this.iconItem = temp.createStack(); this.isIconItem = true; } } else if (identifier.equals("icon_x")) { this.iconX = reader.nextInt(); this.isIconItem = false; } else if (identifier.equals("icon_y")) { this.iconY = reader.nextInt(); this.isIconItem = false; } else if (identifier.equals("pages")) { reader.beginArray(); List<String> data = new ArrayList<String>(); while (reader.hasNext()) { data.add(reader.nextString()); } reader.endArray(); this.pages = new String[data.size()]; data.toArray(this.pages); } else if (identifier.equals("command_data")) { reader.beginArray(); List<String> data = new ArrayList<String>(); while (reader.hasNext()) { data.add(reader.nextString()); } reader.endArray(); this.command_data = new Object[data.size()]; for (int i = 0; i < data.size(); i ++) { if (data.get(i).startsWith("resource:")) { this.command_data[i] = new ResourceLocation(Magicum.MODID, data.get(i).substring(9)); } else if (data.get(i).startsWith("stack:")) { ItemTemplate tmp = ItemTemplate.createFromString(data.get(i).substring(6)); if (tmp != null) this.command_data[i] = tmp.createStack(); } } } else { reader.skipValue(); } } reader.endObject(); reader.close(); } catch (FileNotFoundException e) { Log.warn(Magicum.MODID, "Resource File Missing: %s", res.toString()); } catch (IOException e) { Log.error(Magicum.MODID, "Encountered IOException"); e.printStackTrace(); } } /** * @return the needsResearch */ public boolean needsResearch() { return this.needsResearch; } @SideOnly(Side.CLIENT) public void onEntryClicked(GuiCodexMagicum gui, Minecraft mc) { if (Codex.getStatusFor(mc.thePlayer, this) >= Codex.RESEARCHED) gui.showEntryPage(this.getID()); } @SideOnly(Side.CLIENT) public void renderLinesToCodex(GuiCodexMagicum gui, Minecraft mc, int x0, int y0) { this.g.reset(); GL11.glLineWidth(gui.scale); this.g.disableTexture(); if (Codex.getStatusFor(mc.thePlayer, this) <= 1) { Color c = Color.fromInt(this.lineColour); c.r /= 3.0; c.g /= 3.0; c.b /= 3.0; if (Codex.getStatusFor(mc.thePlayer, this) == 0) c.a = 0.15; this.g.setColor(c); } else { this.g.setColor(Color.fromInt(this.lineColour)); } for (Point[] line : this.lines) { if (line.length > 2) { this.g.renderCurve(this.g.controlpoints(line, x0, y0)); } else { GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3d(line[0].x + x0, line[0].y + y0, this.g.zLevel); GL11.glVertex3d(line[1].x + x0, line[1].y + y0, this.g.zLevel); GL11.glEnd(); } } } @SideOnly(Side.CLIENT) public void renderEntry(Minecraft mc, int x, int y) { if (Codex.getStatusFor(mc.thePlayer, this) > 0) { this.g.bindTexture(this.icons); this.g.reset(); if (Codex.getStatusFor(mc.thePlayer, this) == Codex.VISIBLE) this.g.setColor(new Color(0.25, 0.25, 0.25)); if (Codex.getStatusFor(mc.thePlayer, this) == Codex.RESEARCHED) { double value = 0.85 + 0.15 * Math.sin(Minecraft.getSystemTime() / 200.0 + this.getID()); this.g.setColor(new Color(value, value, value)); } this.g.drawTexturedRect(x, y, (Codex.getStatusFor(mc.thePlayer, this) - 1) * 26, this.hasSpecialLayout ? 26 : 0, 26, 26); this.renderEntryIcon(mc, x + 5, y + 5); } else { this.g.bindTexture(this.icons); this.g.reset(); this.g.setColor(new Color(0.25, 0.25, 0.25, 0.15)); this.g.drawTexturedRect(x, y, 0, this.hasSpecialLayout ? 26 : 0, 26, 26); } } @SideOnly(Side.CLIENT) public void renderEntryIcon(Minecraft mc, int x, int y) { if (this.isIconItem) { this.g.drawItemStack(this.iconItem, x, y, ""); } else { this.g.bindTexture(this.labels); this.g.drawTexturedRect(x, y, this.iconX * 16, this.iconY * 16, 16, 16); } } @SideOnly(Side.CLIENT) public void renderEntryTooltip(GuiCodexMagicum gui, Minecraft mc, int x, int y) { byte state = Codex.getStatusFor(mc.thePlayer, this); List<String> strings = new ArrayList<String>(); strings.add(this.title); strings.add("" + EnumChatFormatting.GRAY + this.desc); strings.add("" + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.ITALIC + I18n.format(this.getStatusText(state))); List<ItemStack> items = new ArrayList<ItemStack>(); for (ItemStack s : this.researchHelpItems) items.add(s); List<Elements> elements = new ArrayList<Elements>(); for (Elements e : this.researchHelpElements) elements.add(e); if (state == Codex.HIDDEN) return; if (state == Codex.VISIBLE) { gui.drawAdvancedTooltip(strings, items, elements, x, y, mc.fontRenderer); } if (state >= Codex.RESEARCHED) { gui.drawAdvancedTooltip(strings, new ArrayList<ItemStack>(), new ArrayList<Elements>(), x, y, mc.fontRenderer); } } /** Sets the given Codex Entry for the given Player to the status {@link Codex#VISIBLE} if it is hidden. */ public void reveal(EntityPlayer player) { if (PropertiesCodex.get(player).codexList.get(this.getID()) < Codex.VISIBLE) { PropertiesCodex.get(player).codexList.set(this.getID(), Codex.VISIBLE); Codex.updateCodexDependencies(player); if (player instanceof EntityPlayerMP) Codex.sendCodexChanges((EntityPlayerMP) player, this); } } /** Sets the colour of the lines */ public CodexEntry setLineColour(int lineColour) { this.lineColour = lineColour; return this; } /** Sets the required IDs to display this Entry.*/ public CodexEntry setRequiredIDs(int... requiredIDs) { this.requiredIDs = requiredIDs; return this; } /** Activates the Research Requirement for this Entry */ public CodexEntry setResearch(boolean needsResearch) { this.needsResearch = needsResearch; return this; } /** Sets the help information for this Entry */ public CodexEntry setResearchHelp(Elements... researchHelpElements) { this.researchHelpElements = researchHelpElements; return this; } /** Sets the help information for this Entry */ public CodexEntry setResearchHelp(ItemStack... researchHelpItems) { this.researchHelpItems = researchHelpItems; return this; } /** Activates the special layout for this Entry */ public CodexEntry setSpecialLayout(boolean hasSpecialLayout) { this.hasSpecialLayout = hasSpecialLayout; return this; } public boolean shouldBeAnnounced() { return true; } public boolean shouldShowCompletedOverlay() { return true; } }
  18. OK, understood But actually I don't want to copy every single method from GuiRenderer into the client proxy. Is there any workaround which would return the instance of the class itself (on client side of course)? I actually can't imagine a method without the need to import the (ClientOnly) class in the CommonProxy or the place where you need it. Do you think, there is a way to create a method that I can use the syntax: Main.proxy.gui().anyRenderingMethodFromGuiUtil() or even better, with a reference to the proxy: p.gui().anyRenderingMethod() Is something like this possible? Thoughts about it: gui() must not return GuiUtil itself, otherwise I have to import it. the returned class can not be casted to GuiUtil, otherwise I have to import it again the returned class must have the rendering methods implemented. -> No way around copying everything (?) Maybe gui() returns either GuiUtilCaller or GuiUtil which then needs to be a subclass of GuiUtilCaller
  19. OK, and how exactly can I do this? Never done before, I think. And.. why does it say EntityClientPlayerMP?!
  20. Heyho Guys! I have tested my mod which works fine on CombinedClient on a Server and, of course , got an error: The stacktrace points to the class for my custom Achievement (CodexEntry.class) (This class has nothing to do with Achievement.class). This class is needed on both client and server. The line the error shows is: private static GuiRenderer g = GuiRenderer.instance; The GuiRenderer here is a class created by me which does not use EntityClientPlayerMP, so I do not understand why this causes the Error. Anyway, here is the code of GuiRenderer and its superclasses: I already tried to add a @SideOnly(Side.CLIENT) in front of the declaration but this didn't work either. I hope anyone can understand what's going on there.. If you need more code, just write. Yours, _B_M_
  21. Here I am again Everything worked like I expected, but there is one thing that you always forget as a modder who tests everything in creative mode: What happens when the player dies. The achievements are all resetted when the player dies. How can I disable this?
  22. Heyho Guys! Thanks so far! Now a new thing: How can I check if the correct version of the library is installed? I have found out that you could add requirements to the @Mod annotation like this: dependencies="required-after:minersbasic" Also I've seen that there is a version control implemented if you add @[1.0.0 or something. But I always use a String in front of the version to clarify whether its a full version or a prerelease (pre-0.1.0 or v.1.0.0). I don't want to change this because it shows clearly whether its a complete Mod or a prerelease. But I don't think, the built-in Version control can work with this. I've created a method which checks the version like I want it to but I don't know how I can get the version of the Mod. I want to do it as follows: 1st: in @Mod I'll add required-after:minersbasic 2nd: in the client and server proxy's preInit I'll add the check if the correct version of the library is loaded. 3rd: if not, I'll add some console output on a dedicated server and a popup window on a combined client to inform the user about what's happening, then I'll shutdown the game. Is this a good procedure? And my main question: How do I get the Version from the Modid "minersbasic"?
  23. OK, so a coremod is only for this stuff with ASM and so on.. Well, then I'm doing this splitting technique. But I don't quite understand how the build process would work. What do I have to write into build.gradle and where do I have to place the .jar-file?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.