Jump to content

superckl

Members
  • Posts

    52
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    https://github.com/superckl/BetterOceans
  • Location
    United States
  • Personal Text
    If brute force doesn't work, use more brute force.

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

superckl's Achievements

Stone Miner

Stone Miner (3/8)

4

Reputation

  1. Hey everyone, I'm having a bit of a problem patching classes with ASM. I'm attempting to patch two functions, one in BiomeGenBase and one in ChunkProviderGenerate. The patching works fine for BiomeGenBase, however, the class cannot be found by the JVM once I've patched it. Here is my class transformer: And the error I get: The error is thrown on this line of code: final BiomeGenBetterOcean boO = new BiomeGenBetterOcean(BiomeGenBase.ocean.biomeID); If I remove the class transformer, everything works fine. I'm not entirely sure what is going on here... Maybe I'm doing something completely wrong her - It's my first time working with ASM. Thanks for any help you can offer. EDIT: I forgot to mention that it works fine in my eclipse development environment. The patch works and does what it's supposed to. It seems like the obfuscation is messing it up in some way. EDIT 2: Fixed! I just applied a sorting index of > 1000 to get above the FML deobfuscater and it all worked!
  2. I've been thinking a bit more and it might just be best to use connectionOpened and check the server String . As I edited, they could just create a local server using the above method.
  3. For that, I would use the playerLoggedIn method since it is fired server side when the connection is actually established. I haven't actually tried it, but this should work in your connection handler: @Override public void playerLoggedIn(final Player player, final NetHandler netHandler, final INetworkManager manager) { if(player instanceof EntityPlayerMP) ((EntityPlayerMP)player).addStat(ExtraAchievments.prot3ch, 1); } EDIT: I forgot to mention, you're going to want to make sure that code is actually running on the intended server. Using this, someone could just create a local server and join to get the achievement. Perhaps an encrypted key in a configuration file?
  4. Well, I see two ways. First, ensuring you are connected to a server, you can use reflection to access serverName in Minecraft. But that's probably not the best idea. The better way is to create a ConnectionHandler. Simply make a class: public class ConnectionHandler implements IConnectionHandler and register it in your @Init using: NetworkRegistry.instance().registerConnectionHandler(new ConnectionHandler()); You can then use to these to methods in your connection handler to keep track of the current server: @Override public void connectionOpened(final NetHandler netClientHandler, final String server, final int port, final INetworkManager manager) { } @Override public void connectionClosed(final INetworkManager manager) { }
  5. I'm having a problem where my drawSlot method is not being called in my GuiRewardsList that extends GuiSlot. Here is the relevant code: GuiVote (the parent GUI): package me.superckl.VoltzationCore.client; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.gui.inventory.GuiContainer; import org.lwjgl.opengl.GL11; public class GuiVote extends GuiScreen{ private final GuiRewardList list; public GuiVote() { this.list = new GuiRewardList(this, this.fontRenderer); } @Override public void initGui() { //TODO add buttons and such here } @Override protected void actionPerformed(final GuiButton par1GuiButton) { //TODO called when a button is clicked } @Override public void updateScreen() { //TODO If vote while open, change to thank you } @Override public void drawScreen(int par1, int par2, float par3){ // TODO refer to following code, drawn before items this.drawDefaultBackground(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.bindTexture("/mods/voltzationcore/textures/gui/vote.png"); final int k = (this.width - 176) / 2; final int l = (this.height - 166) / 2; this.drawTexturedModalRect(k, l, 0, 0, 176, 166); this.list.drawScreen(par1, par2, par3); super.drawScreen(par1, par2, par3); } } GuiRewardsList: package me.superckl.VoltzationCore.client; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiSlot; import net.minecraft.client.renderer.Tessellator; public class GuiRewardList extends GuiSlot{ private final GuiVote gui; private final FontRenderer font; public GuiRewardList(GuiVote gui, FontRenderer font) { super(Minecraft.getMinecraft(), gui.width, gui.height, 32, gui.height, 20); this.gui = gui; this.font = font; } @Override protected int getSize() { // TODO Auto-generated method stub return 1; } @Override protected void elementClicked(int i, boolean flag) { // TODO Auto-generated method stub } @Override protected boolean isSelected(int i) { // TODO Auto-generated method stub return false; } @Override public int getContentHeight(){ return 20; } @Override public void drawScreen(int i, int j, float k){ //this.font.setBidiFlag(true); //this.gui.drawCenteredString(this.font, "testing 123", this.gui.width / 2, this.gui.height/2, 0x19ee37); System.out.println("Drawing Screen"); super.drawScreen(i, j, k); } @Override protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator tessellator) { this.font.setBidiFlag(true); this.gui.drawCenteredString(this.font, "testing 123", this.gui.width / 2, this.gui.height/2, 0x19ee37); System.out.println("DREW THE STRING!"); } @Override protected void drawBackground() { // TODO Auto-generated method stub System.out.println("Drawing background"); } } In the GuiSlot class, drawBackground and drawScreen are being called, since the logs are being printed (about 20 times a second, obviously). But, the drawSlot method is not called once. Does it have something to do with my positioning or is there something wrong that's deeper? Thanks for any help.
  6. I finally got it. I changed the registration to: e.manager.soundPoolSounds.addSound("mods/voltzationcore/sound/money.ogg", VoltzationCore.class.getResource("/mods/voltzationcore/sound/money.ogg")); And I use this to play it: Minecraft.getMinecraft().sndManager.playSoundFX("mods.voltzationcore.sound.money", 1.0F, 1.0F); Thanks for all the help guys.
  7. I'm looking right now, and there definitely isn't a String only method for addSound. That code must be written for 1.6. I tried using the String, URL version, and I converted to .ogg, but it's still not playing.
  8. As far as I know, there is no method to add a sound that takes only a String. It requires a String and a File. I've tried copying what other, more established, mods do, but none of it is working.
  9. I've looked around a lot and haven't found anything useful. No errors are thrown, my sound just isn't played.
  10. Does this apply for 1.5.2? If I recall correctly, the assets folder wasn't used until 1.6.
  11. Thanks, that fixed it. But, I have another problem now. My sound isn't playing. My sound file, update.wav, is located in VoltzationClient.zip/mods/voltzationclient/sounds/update.wav. I use this to play the sound: Minecraft.getMinecraft().theWorld.playSoundAtEntity(Minecraft.getMinecraft().thePlayer, "money.update", 20F, 1F); Know what's wrong? The getResource call is pointing to: file:/C:/Users/superckl/AppData/Roaming/.technic/modpacks/temporary/mods/VoltzationClient.zip!/mods/voltzationclient/sounds/update.wav I'm using a custom mod pack to test the mod, if you were wondering.
  12. I'm having a weird problem. I'm trying to get my mod to play a sound file (update.wav), but I can't seem to get the SoundLoadEvent to fire. I know my load method is being called because the functionality from the ConnectionHandler and TickHandler all work fine, but the logs from my EventHandler are never called. I'm using forge build 737 for 1.5.2. Main mod class: package me.superckl.VoltzationClient; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.TickRegistry; import cpw.mods.fml.relauncher.Side; @Mod(modid = "VoltzationClient", name = "Voltzation Client", version = "1.0", dependencies = "required-after:VoltzationCore") @NetworkMod(clientSideRequired = true, serverSideRequired = false, channels = {"VoltzMoney", "VoltzMRequest"}, packetHandler = PacketHandler.class) public class VoltzationClient { @Instance(value = "VoltzationClient") public static VoltzationClient instance; @SidedProxy(clientSide = "me.superckl.VoltzationClient.ClientProxy", serverSide = "me.superckl.VoltzationClient.CommonProxy") public static CommonProxy proxy; public static final String logFormat = "[VoltzationClient] %s"; @PreInit public void preInit(final FMLPreInitializationEvent e) { //Config.initialize(e.getSuggestedConfigurationFile()); } @Init public void load(final FMLInitializationEvent e) { MinecraftForge.EVENT_BUS.register(new EventHandler()); NetworkRegistry.instance().registerConnectionHandler(new ConnectionHandler()); TickRegistry.registerTickHandler(new TickHandler(), Side.CLIENT); } } EventHandler: package me.superckl.VoltzationClient; import java.io.File; import cpw.mods.fml.common.FMLLog; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; public class EventHandler { @ForgeSubscribe public void onSoundLoad(final SoundLoadEvent e){ FMLLog.info(VoltzationClient.logFormat, "Here it comes!"); FMLLog.info(VoltzationClient.logFormat, VoltzationClient.class.getResource("/mods/voltzationclient/sounds/update.wav").getFile()); e.manager.addSound("money/update.wav", new File(VoltzationClient.class.getResource("/mods/voltzationclient/sounds/update.wav").getFile())); } } Any ideas?
  13. First, try adding an @Override to your idPicked method to make sure it's properly overridden. If it is, I can tell you isBlockSingleSlab(this.blockID) is returning false for your half slab. Why, I have no idea. Try changing up what you return in idPicked and see what happens.
  14. Ah thanks. I had a feeling I was missing something easy. I'll try that out when I get home.
  15. I already know how to get the scaled height of the screen. The problem is that if I render the text at (0, scaledHeight), it will render off the screen and not show. I need to move the text up by how tall the text is, which is what I don't know how to find.
×
×
  • Create New...

Important Information

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