Jump to content

jeffryfisher

Members
  • Posts

    1283
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by jeffryfisher

  1. That's one of my own classes, but I so cleverly named it like a vanilla class that I forgot it was mine! The key line is in the constructor, "repeat = true;" Here's my code, from my shared package (shared among all of my mods): package jrfshare; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.audio.ITickableSound; import net.minecraft.client.audio.PositionedSound; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.util.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) abstract public class classContinuousPositionedSound extends PositionedSound implements ITickableSound { protected final Block anchor; protected final WorldClient wc; protected final BlockPos pos; protected boolean donePlaying = false; // Remains false until Block is invalid protected classContinuousPositionedSound(WorldClient wc, PositionedSound sound, Block b) { super (sound.getSoundLocation ()); this.wc = wc; pitch = sound.getPitch (); pos = new BlockPos (sound.getXPosF (), sound.getYPosF (), sound.getZPosF ()); xPosF = sound.getXPosF (); // Sound should already be centered yPosF = sound.getYPosF (); zPosF = sound.getZPosF (); repeat = true; anchor = b; } // Update pitch & volume using bs protected abstract void updatePV(IBlockState bs); @Override public void update() { // Called immediately after playing so that off-fan can be silenced if (donePlaying) return; // Nothing to hear here IBlockState bs = wc.getBlockState (pos); // See if my fan block is still there Block b = bs.getBlock (); if (b != anchor) { // Test if b is my anchor block donePlaying = true; return; } this.updatePV (bs); } public boolean isDonePlaying() { return donePlaying; } }
  2. Continuous sound requires a custom sound "renderer" on the client (@SideOnly). Extend classContinuousPositionedSound (or moving sound). Inside that class, override the update method to adjust volume, pitch etc based on the blockstate passed into it. Use your client-side sound event handler to instantiate the sound and inject it into the event. Here's the one I did for my blower: @SubscribeEvent public void onPlaySound(PlaySoundEvent e) { ResourceLocation r = e.sound.getSoundLocation (); if (r.equals (classBlockBlower.WHIRRLOC)) { // The resource is my sound, so act upon it WorldClient wc = Minecraft.getMinecraft ().theWorld; PositionedSound ps = (PositionedSound) e.sound; e.result = new classContinuousPositionedSoundFan (wc, ps); // Substitute with my continuous sound } }
  3. Firstly, you should be able to get your block to do this, so you might not need a TE (for this). Start your block "ticking" during placement. Set the tick period to 200 (10 seconds) and then, in the updateTick method, use world.play to initiate your sound where !world.isRemote (not remote). That may seem counter-intuitive (playing a sound on the server), but that's how the sound is communicated to all clients having players within range. Don't do anything client-side; the sound manager should get the message and do it for you (assuming your assets are in order). Note: My experience is in MC 1.8, so some of the names may have changed. However, I think the basic strategy is the same.
  4. For my clocks, I hang the frame and then put the clock into it. The clock then displays the time (sun position) on the wall. I hang them over most of my underground crafting tables. I have also made my own paintings mod by extending EntityPainting, which is an extension of entityHanging. The hard parts were to coax the render manager to use my custom renderer instead of vanilla, and to get away from the enum in EntityPainting. You'll also want to look into (and probably override) the setting of the bounding box for your entity. There's also a range of MC versions from late 1.7.10 thru early 1.8.x in which EntityHanging has a placement/centering bug that one must either work around or wait to go away. And, as D7 said, you need both an item to hold/store in inventory, and an entity to sit in the world after placing the item. Besides EntityHanging, you might also want to look at the way a sign on a wall works.
  5. Why don't you simply place your items into item frames? That's how I hang clocks in my games.
  6. Is this GL error repeatable? I get occasional GL crashes on my own machine, especially after switching contexts / full-screen mode etc. Restarting the launcher et al usually gets around the problem. Rebooting takes care of my more persistent conditions.
  7. Set a breakpoint on the call to execute BlazedGenerator.generate(...). First see how many times it is called. Also step into and through it to see what happens to your problem ores.
  8. Your "caused by" (Failed to select mappings directory, set it manually in the config) is a clue. However, it's probably a problem with how to use/develop Chicken Core, so you should search for help in one of its forums.
  9. If you set up a decompiled workspace, then you can also find vanilla assets in your project: <Forge Path>\build\tmp\recompSrc\assets
  10. That's his main class, not his block class. Then his main class needs a bunch of annotations and required FML event handlers, and that mesher ref could still get him into trouble.
  11. Just be aware that when you start overriding methods to start using metadata where vanilla has never used metadata before, you can run into bugs in vanilla code that only a mod could expose. For example (depending on Forge version), it is possible for some of your block's methods to be called in the midst of deletion after your block has been replaced by air at its coords. If vanilla never tried to get the blockstate at coords, but you do, then you blow up. Therefore, when you start testing, be sure to delete your block to see if it handles deletion correctly. If you get a crash report in a method called against an air block, then your method will need to check that the block at coords is not BlockAir (or is still an instance of your block) and handle the condition gracefully.
  12. A new system? Couldn't he use the stat system that's already in the game?
  13. 1) I see "render" and "mesher" refs in a class that is not side-only. 2) Why is your block class not descended from class Block? 3) For that matter, why does it not extend vanilla class BlockDirectional?
  14. Put some test values (esp edge cases) through this formula. Does it always yield the L-value you want?
  15. OK, If the login event doesn't have the time of the prior login, then that idea won't work. How about using an achievement / statistics mechanism? It might even be possible to make it work for multiple years.
  16. To see where the logic snapped, look back at the "canGiveGift" boolean in the tile entity. It was declared static to make it accessible in the event handler via the class name, but that means that there is one and only one boolean value shared by all of such tile entities, which defeats the purpose of creating a TE instance per person. Since the tile entity instance wouldn't come into existence until the block was finally placed, it would never be available (without some hack) to judge the giving in the first place (and the giving is an item-stack anyway; it doesn't make a block until placed). Happy was right to look at the player for per-player decision-making. I wonder if there might be a way to make the gifting decision based on vanilla player data. You know what date you want to give the gift. You might also set an expiration date when the gift would no longer be given. If you can see the prior login date and server system date, then you might be able to deduce the decision without creating an IEEP. What data is available to you in the login event?
  17. How does redstone dust behave when it has wire/devices on all four sides? Could you imitate that case, but without the power-drop?
  18. Do you really need 1024 distinct states, and do you need to store them in the world? Won't your blockstates file then have 1024 cases? Can you get away with having 16 cases? If you're doing some physics, can you translate 16 states into 16 representative int values?
  19. Is your fromBytes() method reliably getting the correct gun item by ID after you pass that integer in the message? Are all clients and servers guaranteed to use identical IDs for mod items?
  20. I suspect that your problem here is not quite solved the right way. How does the vanilla diode avoid a circular call? Minecraft has some non-intuitive labeling in places. However, my redstone modding was done in 1.8, so my experience doesn't align exactly. Go back to the diode (repeater) and imitate its naming/passing scheme as applicable, changing only the strengths to suit your goal.
  21. 1) Why is your only constructor declared as "protected"? 2) Can you be sure that you are testing an output side and not an input? Try applying a redstone signal (or assigning your ins and outs) in the opposite direction to see if power goes through. 3) Is your method being even being called when expected? Zero is such a trivial result that it could be coming from elsewhere entirely. Plant a print or break in there to convince yourself it is involved.
  22. Your mod is outdated. First, read other threads from those who've already discussed the pieces you see breaking. After fixing what you can, post remaining error messages and affected classes (using code brackets) here. PS: Google is better at searching this site than the site is at searching itself, especially when you limit results to the past year etc.
  23. I just looked at where vanilla MC makes its blocks, and none instantiate the parent Block class. I suspect that when you get to defining your marble's behavior, you'll want to override something, so you may as well start by subclassing Block or something like BlockStone (which would let you inherit stone material and behavior). Then you may set the harvest level either inside your constructor or after instantiation (inside is the natural place for such a property setting).
  24. And the error msg is??? Also: Why are you instantiating a new Block instead of something like BlockMarble? Don't you have a unique subclass for this new type of block? With a unique subclass, its constructor could set harvest level (and other properties).
  25. All of my bus registrations are in my post init handlers, but yours is in pre init. Try doing it in a later handler.
×
×
  • Create New...

Important Information

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