Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

mrgreaper

Forge Modder
  • Posts

    105
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

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

mrgreaper's Achievements

Creeper Killer

Creeper Killer (4/8)

10

Reputation

  1. ah ok, that explains why i couldnt get it to work lol Love the stargate's
  2. having difficulty hooking the new 1.8.9 builds up with computer craft, the base of the stargate does not seem to be acting as a peripheral is there an extra step needed now? (did try the dhd, and chevlon and adding the iris lol ...been trying for over an hour to sus it out)
  3. i cant remember what went wrong, i believe it was fine in singleplayer but once in a multiplayer enviroment it failed or crashed. on my laptop i have my work around, basicly what i have done is made it play the sound if thier is one, and start a timer (all this is in the onUpdate) when the timer reaches x the sound is played again, this repeats until the sound given to it is nulled (its pretty much how pneumaticcraft does it), x in my case though is setup from my constants file which will have a list of all the sound files im likely to need to loop and thier length in ticks, so to get x i simply call the method in the constants with the sound name and it returns the length its not pretty its not efficent On a server with a bad tick rate it will have pauses in the loop but atleast i can understand it, at a much later point when my knowledge gets better i may be able to do it right but for now i have to settle for the work around, the end user should only notice a difference if the tps is low..it which point they have more important things to deal with then my sound file sounding wierd **edit** looking at some of the other threads and info on updating to 1.8 i kind of think i would be better scrapping what i have and starting again but at 1.8, granted some of the stuff in my mod wont work for months as they rely on other mods (or are addons to other mods) but better that then learn stuff that i will need to do differently in a few months anyway.
  4. it seems i had this problem before (http://www.minecraftforge.net/forum/index.php/topic,20966.msg106896.html#msg106896) sadly im cursed with a memory issue (short term and some long term is fine but other long term just...well gets deleted) read through it all and i feel i would of been better off not finding my old thread, more confused then ever Still i sort of understand packets now (i have even managed to successfully send one) and that may help. I confess i was hoping for a more newb friendly response then look at this class, trying to work it out from the class feels like reinventing the wheel given that other mods have done it successfully. **edit** nope, i just cant figure it out from the old thread and that class, i ny be missing something blindingly obvoiuse but then i wasnt taught java at school and i mod for fun, i have enough java knowledge to do something but this is clearly beyond me. for now i will play sound the only way i know how and have it play every x ticks where x is the length of ticks the file is.....if its on a server that has tick issues that could be bad but i see no way to do looped sounds and be server friendly. I dont get much free time between work and life hence my comment about not wanting to reinvent the wheel and have wasted what little i had tonight on trying this may try again at the end of the month when ill have more time.
  5. Ok first of all i have block in "" as im pretty sure its done in the blocks tileEntity and not the block itself...though im open to the posibility im wrong. A perfect example of what i want to achieve is the pulverisor or sawmill from ThermalExpansion, when the block is active it emits a noise, now i know how to register sounds (unless they are registered differently if we need them to loop ofcourse) so lets take a sound for an example laugh we have this line in our sounds.json (if additional stuff needs to be added let me know) "laugh": {"category": "master","sounds": [{"name": "laugh","stream": false}]}, how would we then trigger that sound to be heard from that "block " on a loop untill we tell it not to ? If its on a loop can we stop it and then start it with a different pitch? the goal im going for in my mod: my block detects its raining (done) if its raining it starts to charge up ...this will mean a sparking noise quiet and slow the duration being random, then a switch to the next sound file again random duration , a faster spark i now how to make a sound play once but not how to make it loop, im pretty sure thermal expansion arnt playing thier sound waiting for it to end then playing it again...but i could be wrong.
  6. ah i see, for some reason i thought it took only one value....hence my confusion. seems rather simple now lol thank you.
  7. ah! ok now its working! thank you i still dont get targetpoints though. Lets take an example of what i want to do, a tile entity will emit the speech synth and all with in a range of x will hear it.. now how i would do that on 1.6.4 is to use the code from the beacon to get all the players in a box and then play a sound at them (or in this case send a packet to them, 1 by 1 just going through the list of players in that range), the sendToAllAround seems like a god send, but i just dont know how to make it use the tile entitiy (or any entitiy/co-ords) as the main point...or how to tell it the range
  8. The reply is appreciated but i have read that a few times, thats how im as far as i am (it seemed the only uptodate one i could find and was referenced in a lot of other places) That doesnt help the issue though registering the packet....yep its registered implementing the packet class ...yep thats done implementing the packet handler...yep done (even did it inside the other class as shown, though i dont like having classes inside classes as thats new to me) sending packets.... done...but not working packet responses...not needed a response so havent done that, but it looks self explanatory
  9. Ok so im trying to get back into modding and to get something done i never managed before...packets i spent a fair while following some well made guides but nothing went right....turns out they were out of date lol so i searched more and i see "simple network wrapper" is the way to go, and i thought i had it sorted....untill i tried to use them in my main mod file i have public static SimpleNetworkWrapper network; ..snip.. @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { configHandler.init(event.getSuggestedConfigurationFile()); network = NetworkRegistry.INSTANCE.newSimpleChannel("messengerBunny"); //so we create the channel //here is where we add the pacets...registering one packet per class network.registerMessage(speechPacket.speechPacketHandler.class,speechPacket.class,0, Side.CLIENT);//so we are registering a packet called speechpacket to channel one of our network (the messenger bunny) hmmm ok can understand that permissions.init();//lets give the artists thier well deserved credit! creativeTabs.init();//set up the creative tabs blocks.init(); //lets load our blocks if (configHandler.RecordsEnabled){ records.init();} //load the records if (configHandler.BunnysEnabled){ bunnys.init();} // if bunnys are enabled we load them (this modular stuff is gonna kill me lol) FMLCommonHandler.instance().bus().register(new eventHandler());// load the event handlers MinecraftForge.EVENT_BUS.register(new eventHandler()); } ..snip.. then my packet is package com.mrgreaper.themrgmod.network; import com.mrgreaper.themrgmod.themrgmod; import cpw.mods.fml.common.network.ByteBufUtils; 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.nbt.NBTTagCompound; /** * Created by david on 11/01/2015. */ public class speechPacket implements IMessage { private String message; private double voice; private float pitch; private float pitchRange; private float pitchShift; //private String voiceName; public speechPacket(){} //without this blank one the packet crashes ...why do we need it? arghhhhhhhhhh public speechPacket(String message,double voice,float pitch, float pitchRange, float pitchShift ){ this.message=message; this.voice=voice; this.pitchRange = pitchRange; this.pitch = pitch; this.pitchShift= pitchShift; } @Override public void fromBytes(ByteBuf buf) { // so we will need an nbt tag to store the info we want to send...here we read it NBTTagCompound tag = ByteBufUtils.readTag(buf); message = tag.getString("message"); voice = tag.getDouble("voice"); pitch = tag.getFloat("pitch"); pitchRange = tag.getFloat("pitchRange"); pitchShift = tag.getFloat("pitchShift"); } @Override public void toBytes(ByteBuf buf) { //and here we create it NBTTagCompound tag = new NBTTagCompound(); tag.setString("message",message); tag.setDouble("voice",voice); tag.setFloat("pitch",pitch); tag.setFloat("pitchRange",pitchRange); tag.setFloat("pitchShift",pitchShift); } public static class speechPacketHandler implements IMessageHandler <speechPacket,IMessage> { //so dont lile classes inside classes but everything i read suggests this is the way to go...still grrrrrr @Override public IMessage onMessage(speechPacket message, MessageContext ctx) { themrgmod.proxy.speechCreate(message.message,message.voice,message.pitch,message.pitchRange,message.pitchShift); return null; } } } that has the handler class inside it too now its called from my eventhandler (as a test) package com.mrgreaper.themrgmod.lib; import com.mrgreaper.themrgmod.network.speechPacket; import com.mrgreaper.themrgmod.themrgmod; import cpw.mods.fml.client.event.ConfigChangedEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; /** * Created by david on 11/01/2015. */ public class eventHandler { @SubscribeEvent public void onConfigurationChangeEvent(ConfigChangedEvent.OnConfigChangedEvent event) { if (event.modID.equalsIgnoreCase(constants.modid)) { configHandler.loadConfiguration(); } } @SubscribeEvent//test event public void TwistedPickupEvent(PlayerEvent.ItemPickupEvent event) { logHelper.info("if i can read this then the event handler is working" + event.pickedUp); themrgmod.network.sendToAll(new speechPacket("hello i think im working",12,23,12,3)); } } first a note on sendToAll.... i tried sentToAllAround as that seems perfect for the end goal....but it wanted a target point and nothing i tried to use as the target was valid including event.player.getPlayerCoordinates() which would be the specific co-ords to use but it wasnt having it event.player was also not valid for send to specific player. anyway the above results in this when you pickup an item I did have an unknown function error before i added the blank method call (as advised to someone with the same issue i had) also i realise i have a redundent step, the packet is sent to the client side so i dont really need to use the proxy (that makes sure the code is only run on the client side) but i cant see that hurting it (unless im wrong).
  10. old field is initialized here https://github.com/mrgreaper/TwistedMod2-reboot/blob/master/src/main/java/com/mrgreaper/twistedmod2/handlers/TwistedEventHandler.java#L30 well...created, it gets a value when the player holds an item. the idea being that it is supposed to stop the sound being played multiple times as on the second tick the code should say "oh thats what you were holding last tick ok" in idea and ssp this works fine (infact with out it i get the same issue in ssp as smp) no errors in the console, nothing of any use in the console at all as original post, all sounds that play on holding an item are glitching. my code is untidy agreed but then this is more a hobby, a play about for me rather then anything serous, though this issue is bugging me, as for redundent checks, when it comes to things that should only be on one side a redundent check wont hurt things. player name is being added to the item name to make it unique so in the instance running on johns client it will be johnitemname and wont conflict with the instance on freds computer otherwise when one player holds the item it would then not play for any other players as there is no way to tell the difference between john holding the item or fred (maybe i have this wrong, im self taught after all) the onEntityPlay is one of the methods i use, its what im used to and as i say works great in ssp and in idea, if using playSoundAtEntity() is the fix i will use that but if its exactly the same then why use that rather then what i know to work (atleast in ssp) the atWorldPlace was a test it plays a sound at a set of cordinates i pass through to it rather then the other one that targets the entity, again though its not relevent to the issue the full sound handler file package com.mrgreaper.twistedmod2.handlers; import com.mrgreaper.twistedmod2.reference.Reference; import net.minecraft.entity.Entity; import net.minecraft.world.World; /** * Created by david on 04/07/2014. */ public class SoundHandler { //for when we want complete control public static void onEntityPlay(String name, World world, Entity entityName, float volume, float pitch) { world.playSoundAtEntity(entityName, (Reference.MODID + ":" + name), (float) volume, (float) pitch); } //test sound handler public static void atWorldplace(World worldObj, double xCord, double yCord, double zCord, String SoundName, float volume, float pitch) { worldObj.playSoundEffect((double) xCord, (double) yCord, (double) zCord, (Reference.MODID + ":" + SoundName), (float) volume, (float) pitch); } //mini call to save typing public static void miniSoundPlay(String soundName, Entity entityName) { World world = entityName.worldObj; world.playSoundAtEntity(entityName, (Reference.MODID + ":" + soundName), 1, 1); } } given the lack of replys im guessing its a bug with forge thats causing the sound system to mess up in smp and not ssp so when i get home from work ill try a newer forge version
  11. so heres the issue, when a player holds certain items in my mod a sound is played just once at thier location. In ssp and in idea tests it works perfectly.....however when in multiplayer it trys to play the sound every tick! resulting in a barrage of noise. this is from my event handler class @SubscribeEvent public void TwistedTickEvent(TickEvent.PlayerTickEvent event) { //LogHelper.info("the event is working : TwistedTickEvent"); ItemStack itemstack = event.player.getCurrentEquippedItem(); if (itemstack != null) { current = (event.player.getDisplayName() + itemstack.getItem().getUnlocalizedName()).toString(); }//should clear up npe when we try to get the itemstack details from null or nothing ...oops else { current = (event.player.getDisplayName() + "item.nothing"); } //LogHelper.info("current = : " + current); //LogHelper.info("condition test 1 : " + current.equals(old)); if (!current.equals(old) && !event.player.worldObj.isRemote) { //LogHelper.info("should only be seen on one side"); old = current; if (itemstack != null) {//have to check its not null first or BLAM there goes the server when it trys to look up the item //i could do these as arrays in the sound.json....that would make adding and removing new sounds much easier....hmmm //TODO move these to arrays in sound.json ...possibly if (itemstack.getItem() == FluidInfo.orphanTearsBucket && !event.player.worldObj.isRemote){ //SoundHandler.onEntityPlay("orphanCry", event.player.worldObj, event.player,1,1); SoundHandler.atWorldplace(event.player.worldObj, event.player.posX, event.player.posY, event.player.posZ, "orphanCry", 1, 1);//test other sound methods } if (itemstack.getItem() == ItemInfo.itemDeathOrb && !event.player.worldObj.isRemote){ SoundHandler.onEntityPlay("deathOrbStartup", event.player.worldObj, event.player, 1, 1); } if (itemstack.getItem() == ItemInfo.itemDeadBunny && !event.player.worldObj.isRemote){ int ran =ThreadLocalRandom.current().nextInt(5)+1; switch(ran){ case 1: SoundHandler.miniSoundPlay("evilvoice-IsItDead",event.player); break; case 2: SoundHandler.miniSoundPlay("evilvoice-BringToLife",event.player); break; case 3: SoundHandler.miniSoundPlay("evilvoice-WeakBringLife",event.player); break; case 4: SoundHandler.miniSoundPlay("evilvoice-NoPower",event.player); break; case 5: SoundHandler.miniSoundPlay("evilvoice-WorldTremble",event.player); } } if (itemstack.getItem() == ItemInfo.itemLivingBunny && !event.player.worldObj.isRemote){ int ran =ThreadLocalRandom.current().nextInt(7)+1; switch(ran){ case 1: SoundHandler.miniSoundPlay("evilvoice-Beautiful",event.player); break; case 2: SoundHandler.miniSoundPlay("evilvoice-BeCareful",event.player); break; case 3: SoundHandler.miniSoundPlay("evilvoice-BurnIt",event.player); break; case 4: SoundHandler.miniSoundPlay("evilvoice-LookCreated",event.player); break; case 5: SoundHandler.miniSoundPlay("evilvoice-NoseTwitch",event.player); break; case 6: SoundHandler.miniSoundPlay("evilvoice-ReleaseEvilCreature",event.player); break; case 7: SoundHandler.miniSoundPlay("evilvoice-ThePowerCalls",event.player); break; } } if (itemstack.getItem() == ItemInfo.itemOrphanLeg && !event.player.worldObj.isRemote){ int ran =ThreadLocalRandom.current().nextInt(3)+1; switch(ran){ case 1: SoundHandler.miniSoundPlay("evilvoice-Delicous",event.player); break; case 2: SoundHandler.miniSoundPlay("evilvoice-DoNotPityOrphan",event.player); break; case 3: SoundHandler.miniSoundPlay("evilvoice-Replant",event.player); break; case 4: //SoundHandler.miniSoundPlay("evilvoice-NoPower",event.player); break; case 5: //SoundHandler.miniSoundPlay("evilvoice-WorldTremble",event.player); } } if (itemstack.getItem() == ItemInfo.itemEnergizedBunny && !event.player.worldObj.isRemote) { int ran = ThreadLocalRandom.current().nextInt(5) + 1; switch (ran) { //use that number case 1: SoundHandler.onEntityPlay("bunnyBegA", event.player.worldObj, event.player, 1, 1); break; case 2: SoundHandler.onEntityPlay("bunnyBegB", event.player.worldObj, event.player, 1, 1); break; case 3: SoundHandler.onEntityPlay("bunnyBegC", event.player.worldObj, event.player, 1, 1); break; case 4: SoundHandler.onEntityPlay("bunnyBegD", event.player.worldObj, event.player, 1, 1); break; case 5: SoundHandler.onEntityPlay("bunnyBegE", event.player.worldObj, event.player, 1, 1); break; } } } } } and this is my sound handler public static void onEntityPlay(String name, World world, Entity entityName, float volume, float pitch) { world.playSoundAtEntity(entityName, (Reference.MODID + ":" + name), (float) volume, (float) pitch); } this is forge 1188 mc 1.7.10 any ideas why my mod is not working right in smp?
  12. indeed this^ i decided to take the cowards route and just make them seperate mods that include the same classes, given the package names will be different it shouldnt be too much of an issue, it would be better to have a core mod that my other mods use but my knowedge of java is just not there yet.
  13. Ok so heres the situation, my mod has parts of it people want to use seperate...and indeed i understand that as the main part of it is strange and dark humour. Looking at my code i can see that i essentialy have 3 distinct mods in one. So the easy solution? well split it up into 3 different mods... BUT i have handlers that are used by all of them, so i got to thinking how the professional modders do it, they have a core-mod (ok yeah thats a misleading name for it, but i cant think what to call it lol) I examined the libairies i use, and came on to this idea, i just want to know if im going the right way: im taking all the handlers from my mod, all the librairies it uses, all the sound files it uses(not sure if i should part the sound files or not yet). Im making that its own mod, once compiled i will put that in the libs folder of each of the mods i split from it my theory is that when im in the ide i will be able to reference the handlers just like i can when its all part of the mod, when i compile the mod the lib wont be included (i know how to include it ofcourse, but im thinking i shouldnt for the reasons below) so a player would need the compiled mod lib in thier mods folder and what ever of my mods they want so for example if a player wants my twisted mod and my security mod they would need core.jar twisted.jar security.jar ... but should they want just the twisted one they would simply not get the security.jar have i grasped that correctly? is thier a special way of doing this?
  14. ok after a lot of searching i found a method that takes an image and draws it at the co-ordinates you specify at the size you request //ok lets see x and y are the location of where the image will be placed, width and height are the size you want it ...zlevel? public static void drawTexturedQuadFit(double x, double y, double width, double height, double zLevel){ Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0,1); tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1); tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1,0); tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0); tessellator.draw(); } but it draws the WHOLE texture so heres my dilema i can have a tiny small part of the texture (not even the right part) OR have it the right size but all of the texture instead i could cut a whole in the texture for the gui and have the skin render under it positioned right, but that just seems ...wrong is there a way to tell this method to just use part of the texture? i looked at the tessellator.class but cant see anything that would help
  15. well this is the code i now have package com.mrgreaper.twistedmod2.gui; import com.mrgreaper.twistedmod2.handlers.ReaperHelper; import com.mrgreaper.twistedmod2.reference.Reference; import com.mrgreaper.twistedmod2.utility.LogHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; /** * Created by david on 10/07/2014. */ public class guiSecurityIdCard extends GuiScreen { private final EntityPlayer viewer; private final String accesscode; private String username; ResourceLocation bground = new ResourceLocation(Reference.MODID + ":" + "textures/gui/SecurityId.png"); private ResourceLocation ownerface; public final int xSize = 220; //the width of your texture public final int ySize = 152; //the height of our texture public final int faceXSize = 64; // the image we get for the face should always be the same size! public final int faceYsize=32; public final int faceStartX = 8; //where the face starts public final int faceStartY = 8; public final int faceOverlayStartX=40; //face is made of two parts public final int faceOverlayStartY=8;//not really needed as its ths same height as face start y but meh it keeps it neat private int guiLeft; private int guiTop; public guiSecurityIdCard(EntityPlayer player, String code, String user) { //hmmm really needed that to be the itemstack...gonna have to do some wierd stuff here this.viewer = player; this.accesscode = user;//yeah i got them the long way around and im being lazy this.username = code; this.ownerface = new ResourceLocation(ReaperHelper.getSkin(username)+""); } @Override public void drawScreen(int x, int y, float f) { drawDefaultBackground(); //draws default background (an overlay in the background) GL11.glColor4f(1f, 1f, 1f, 1f); //set the colour to black (yeah the method is missing a u but that seems common in minecraft this.guiLeft = (this.width - this.xSize) / 2; //so we can center the gui on the screen this.guiTop = (this.height - this.ySize) / 2; Minecraft.getMinecraft().getTextureManager().bindTexture(bground); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); Minecraft.getMinecraft().getTextureManager().bindTexture(ownerface); drawTexturedModalRect(guiLeft+30,guiTop+25,faceStartX,faceStartY,8,; drawTexturedModalRect(guiLeft+30,guiTop+25,faceOverlayStartX,faceOverlayStartY,8,; drawCenteredString(fontRendererObj, username, guiLeft + 145 - username.length(), guiTop + 30, 0x0055cc); LogHelper.info(ReaperHelper.getSkin(username)); if (viewer.getDisplayName().equals(username)) { drawCenteredString(fontRendererObj, accesscode, guiLeft + 155 - accesscode.length(), guiTop + 80, 0x66ff66); } else { drawCenteredString(fontRendererObj, EnumChatFormatting.OBFUSCATED + accesscode, guiLeft + 155 - accesscode.length(), guiTop + 80, 0xee0000); } //above sets the background texture super.drawScreen(x, y, f); } @Override public boolean doesGuiPauseGame() { return false; //dont pause the game } } the method you gave me i put into a handler class as it may be useful for other stuff too it gets the texture fine, in one test i made the whole gui background the skin so i could check it and it was there now if im right the texture it gets is the same as this one http://s3.amazonaws.com/MinecraftSkins/mrgreaper.png (as the username im passing on to it is mrgreaper) so that puts it at 64x32 with the face starting at 8,8 and being 8 across and 8 height the overlay for the face (as it is actually two parts of the texture) starts at 40,8 and is also 8 across by 8 high. so i bound those to variables (final as they should be the same for any skin download) and Minecraft.getMinecraft().getTextureManager().bindTexture(ownerface); drawTexturedModalRect(guiLeft+30,guiTop+25,faceStartX,faceStartY,8,; drawTexturedModalRect(guiLeft+30,guiTop+25,faceOverlayStartX,faceOverlayStartY,8,; should of placed first the face and then the overlay but the result is this that little tiny square....ok so the size makes sense, need some way to make it bigger(is that possible) but what doesnt make sense is its not the right part of the skin, i checked using paint.net and it all seems to tally up, however earlier when i tried using a higher res image for the background it too went wrong (i ofcourse adjusted my xSize and ySize) and indeed the only way to get the gui image to work right on this back ground was to adjust the xSize and zSize to a size beyond what it is (something wrong somewhere but) any ideas?
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.