Jump to content

ScottehBoeh

Forge Modder
  • Posts

    68
  • Joined

  • Last visited

Everything posted by ScottehBoeh

  1. I've created a block "campfire" that should remove itself after a certain amount of times (As explained in the code below). However. Upon being removed and set to air, the tile entity still exists invisibly and prevents the player from walking through that air block. (As if it didn't actually set the block to air). @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random random) { ++ticksExisted; if (ticksExisted >= 100) { world.removeTileEntity(x, y, z); world.setBlockToAir(x, y, z); world.notifyBlockChange(x, y, z, Blocks.air); } } Could it be because its Client-side only? Should I create a new method that deletes the block instead of using randomDisplayTick?
  2. Imagine setting up an event handler that listens for Block Placement by the player. What would you consider the best code to cancel the event depending on the block being placed? (For example, stopping TNT from being placed) Can't wait to get answers :-)
  3. Never managed to work my way around the available loot system Spending all day looking into it, ofc. Gotta teach myself some more metadata crap.
  4. A string array list with concatenation between the ID and Amount could work. Picking a random from the index and returning it as an NBT in the block as a container.
  5. I'm wondering how possible it would be to set up a loot system (In which right-clicking blocks would return a custom inventory holding items from a set list.) Surely this should be possible with the use of NBT? (Would be interesting to have a conversation about this)
  6. Having a few issues when spawning in a custom Particle Entity. When particles spawn in, game crashes with an error like following: Reported exception thrown! net.minecraft.util.ReportedException: Ticking Particle at net.minecraft.client.particle.EffectRenderer.updateEffects(EffectRenderer.java:102) ~[EffectRenderer.class:?] at net.minecraft.client.Minecraft.runTick(Minecraft.java:2146) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:962) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_73] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_73] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_73] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_73] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] Caused by: java.lang.NullPointerException at net.minecraft.entity.Entity.moveEntity(Entity.java:692) ~[Entity.class:?] at net.minecraft.client.particle.EntityAuraFX.onUpdate(EntityAuraFX.java:37) ~[EntityAuraFX.class:?] at net.minecraft.client.particle.EffectRenderer.updateEffects(EffectRenderer.java:79) ~[EffectRenderer.class:?] ... 12 more [00:15:56] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ---- // Hey, that tickles! Hehehe! Event Handler to spawn in particles (Blood): public class DamageHandler { @SubscribeEvent public void playerTick(LivingHurtEvent event) { if (event.entity instanceof EntityPlayer) { EntityPlayer theEntity = (EntityPlayer) event.entity; double motionX = theEntity.worldObj.rand.nextGaussian() * 0.02D; double motionY = theEntity.worldObj.rand.nextGaussian() * 0.02D; double motionZ = theEntity.worldObj.rand.nextGaussian() * 0.02D; for (int i = 1; i < 4; i++) { EntityFX particleBlood = new EntityParticleBlood(theEntity.worldObj, theEntity.posX + theEntity.worldObj.rand.nextFloat() * theEntity.width * 2.0F - theEntity.width, theEntity.posY + 0.5D + theEntity.worldObj.rand.nextFloat() * theEntity.height, theEntity.posZ + theEntity.worldObj.rand.nextFloat() * theEntity.width * 2.0F - theEntity.width, motionX, motionY, motionZ); Minecraft.getMinecraft().effectRenderer.addEffect(particleBlood); } } if (event.entity instanceof EntityInfected) { EntityInfected theEntity = (EntityInfected) event.entity; double motionX = theEntity.worldObj.rand.nextGaussian() * 0.02D; double motionY = theEntity.worldObj.rand.nextGaussian() * 0.02D; double motionZ = theEntity.worldObj.rand.nextGaussian() * 0.02D; for (int i = 1; i < 4; i++) { EntityFX particleInfectedBlood = new EntityParticleInfectedBlood(theEntity.worldObj, theEntity.posX + theEntity.worldObj.rand.nextFloat() * theEntity.width * 2.0F - theEntity.width, theEntity.posY + 0.5D + theEntity.worldObj.rand.nextFloat() * theEntity.height, theEntity.posZ + theEntity.worldObj.rand.nextFloat() * theEntity.width * 2.0F - theEntity.width, motionX, motionY, motionZ); Minecraft.getMinecraft().effectRenderer.addEffect(particleInfectedBlood); } } } } Actual Particle Entity: public class EntityParticleInfectedBlood extends EntityAuraFX { public EntityParticleInfectedBlood(World parWorld, double parX, double parY, double parZ, double parMotionX, double parMotionY, double parMotionZ) { super(parWorld, parX, parY, parZ, parMotionX, parMotionY, parMotionZ); setParticleTextureIndex(80); // same as happy villager particleScale = 2.0F; particleGravity = 5.5F; motionY = -0.2D; setRBGColorF(0x88, 0x00, 0x88); noClip = false; } } Event Handler is registered under preInit stage: if (event.getSide() == Side.CLIENT) { this.keyHandler = new InputHandler(); FMLCommonHandler.instance().bus().register((Object)this.keyHandler); FMLCommonHandler.instance().bus().register(new DamageHandler()); MinecraftForge.EVENT_BUS.register(new DamageHandler()); } If anyone knows how to fix this error, please let me know. Thanks
  7. Ah I understand now. Thankyou :-) And I apologise for showing 1.7.10 code without informing it in the title.
  8. Thanks for the reply. :-) I've made sure that the handler is now running only server-side. I've also changed the code on my damage handler, however I'm not quite sure on how to set up the handler, now. Any chance you or someone else knows a good way to set up the server-side handler?
  9. Having issues setting up a Handler that sends a packet when the player is hurt. This packet then creates red particle effects at the player. (Basically blood). Sadly the event handler does not pick up when the player is hurt, and I'm having troubles with finding out why its not detecting damage. Any chance someone can have a crack at this code? My Damage Event Handler: public class DamageHandler { public boolean PlayerHurt = false; @SubscribeEvent public void Hurt(LivingHurtEvent event) { System.out.println("Hurt"); if(event.entity instanceof EntityPlayer) { PlayerHurt = false; System.out.println("Damage Taken"); } } @SubscribeEvent public void playerTick(TickEvent.PlayerTickEvent event) { if(PlayerHurt == true) { System.out.println("Sent Bleed Packet"); PacketHandler.INSTANCE.sendToServer((IMessage)new MessageBleed(event.player.lastTickPosX, event.player.lastTickPosY, event.player.lastTickPosZ)); PlayerHurt = false; return; } } } My Packet/Message Sent: public class MessageBleed implements IMessage, IMessageHandler<MessageBleed, IMessage> { private Random rand = new Random(); private double x; private double y; private double z; public MessageBleed() { } public MessageBleed(double posX, double posY, double posZ) { this.x = posX; this.y = posY; this.z = posZ; } public void fromBytes(ByteBuf buf) { this.x = buf.readDouble(); this.y = buf.readDouble(); this.z = buf.readDouble(); } public void toBytes(ByteBuf buf) { buf.writeDouble(this.x); buf.writeDouble(this.y); buf.writeDouble(this.z); } public IMessage onMessage(MessageBleed message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().playerEntity; player.worldObj.spawnParticle("reddust", player.posX, player.posY, player.posZ, 0, 0, 0); System.out.println("Spawned Blood"); return null; } } Could it be that I'm setting/registering my packets wrong? How my packet messages are registered: public class PacketHandler { public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel("ctx"); public static void init() { INSTANCE.registerMessage((Class)MessageWhistle.class, (Class)MessageWhistle.class, 0, Side.SERVER); INSTANCE.registerMessage((Class)MessageBleed.class, (Class)MessageBleed.class, 1, Side.SERVER); } } (The other packet plays a whistle sound when the player presses F. That works perfectly fine.)
  10. That's one thing I noticed, being able to increase the Y axis. Wish it'd work for X/Z axis, but oh well.
  11. Ah, I see. :-) Thanks, I'll see about setting up multiple boundingboxes
  12. I'm developing my Apocalypse mod, as many people know, and I'm having issus with setting up a bounding box around one of our map objects: I've created a rediculous 8x8 bound box on the block class file: BlockBuilding_Shop1.class: public class BlockBuilding_Shop1 extends BlockContainer { public BlockBuilding_Shop1() { super(Material.wood); this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F); } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack){ int rotation = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (rotation == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if (rotation == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if (rotation == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if (rotation == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } } public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){ int meta = world.getBlockMetadata(x, y, z); if(meta==2) this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F); if(meta==5) this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F); if(meta==3) this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F); if(meta==4) this.setBlockBounds(0.0F, 0.0F, 0.0F, 8.0F, 6.0F, 8.0F); } @Override public TileEntity createNewTileEntity(World world, int var1) { return new EntityBuilding_Shop1(); } @Override public int getRenderType() { return -1; } @Override public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } } Anyone know why players can still enter through the sides/walls of the building apart from one 1x1 block area? Thanks, Forge Community!
  13. I've created 2 classes, KeyBindings and KeyHandler (Both of which are declared in the PreInit stage). I've set up the key "F" to be pressed and wish for it to play a sound at the players location. KeyBindings.java: import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; import net.mcdecimation.blocks.DecimationBlocks; import net.mcdecimation.blocks.References; import net.mcdecimation.blocks.packet.OpenGuiPacket; import net.minecraft.client.gui.GuiChat; import net.minecraft.client.settings.KeyBinding; import org.lwjgl.input.Keyboard; /** * Created by ScottehBoeh on 07/07/2016. */ public class KeyBindings { public static KeyBinding whistle; public static void init() { //Define the Whistle Key "F" including Description and Category whistle = new KeyBinding("key.Decimation.whistle.desc", Keyboard.KEY_F, "key.Decimation.category"); ClientRegistry.registerKeyBinding(whistle); } } KeyHandler.java: import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; import net.mcdecimation.blocks.ItemSupplyDropRadio; /** * Created by ScottehBoeh on 07/07/2016. */ public class KeyHandler { @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if(KeyBindings.whistle.isPressed()) System.out.println("*whistle*"); } } What code should I implement to have a sound play on the players location? I tried this: @SubscribeEvent public void onKeyInput(World world, EntityPlayer player, InputEvent.KeyInputEvent event) { if(KeyBindings.whistle.isPressed()) world.playSoundAtEntity(player, "mcdb:item.supplydropradio.radio", 3, 1.0F); } But my game crashed before even getting to the main menu. Any ideas? Thanks! :-)
  14. Latest is best, probably. From experience, when creating the NamCraft mod (Which I plan on tutorialising), I noticed that it got almost no popularity at all since I used 1.7.10 instead of the latest 1.8 or 1.9. Most people would end up sending me spam asking to update it. Couldn't be assed, tbh.
  15. Best thing to do would be simply [glow=green,2,300]backup the map and try it out[/glow]. If it doesn't work or you're not happy with the aftermath, restore the map from backup onto your initial version. :-) I've had times where mods just instantly break, For example when using carpenters blocks, the air block was glitching and replaced with carpenters blocks, Logs with Mail boxes and grass with some sort of liquid.
  16. Could you possibly have an issue with downloading and installing all required files? [glow=green,2,300]Try re-downloading the installer[/glow]. It could be that the download servers had a little bump and decided to skip a few essential files that represent the forge installation as an independent version. :-) I also noticed that you're running Liteloader. As I've said before to many players, that's not a problem, but can be glitchy at times.
  17. My best bets for you is to either [glow=green,2,300]reinstall all mods completely[/glow] using the latest version of Forge and Mod version, aswell as [glow=green,2,300]make sure that your server is also running the latest server-side software[/glow] (Suggested or Latest, your choice) Another thing I want to ask is, have you made sure that you've got VBOS=true in your video settings? If not, [glow=green,2,300]set "Use Vbos" to True in your Video Settings[/glow]. This'll make sure that your client is running using all possible video-card power available instead of just processor power. :-)
  18. "java -Xmx4096M -Xms4096M -jar forge-1.8.9-11.15.1.1902-1.8.9-universal.jar nogui PAUSE" That's not allocating 7GB of ram. You must chance "-Xmx4096M" to "-Xmx7G". Otherwise your launcher will be running with 4096MB of RAM instead of 7GB.
  19. Seems like the blocks from the LOTR Blocks mod seem to be glitched on your map. Any chance you could run the map on vanilla 1.7.10, just to remove the modded blocks? That could potentially fix the issue.
  20. Could your computer be slightly incapable of running a Forge 1.8 server locally? Could I get your PC specs?
  21. Could your computer be slightly incapable of running a Forge 1.8 server locally? Could I get your PC specs?
  22. Is there a code I can use to initiate a server stop? I'm setting up a matchEnd event and I'm running a script to instantly restart the server when it closes. Now all I need to do is actually make the server close after a game.
  23. Is there a code I can use to initiate a server stop? I'm setting up a matchEnd event and I'm running a script to instantly restart the server when it closes. Now all I need to do is actually make the server close after a game.
  24. Can I ask what OS you're using? Could I also ask for you to provide your Java version? I've never seen the MinecraftLauncher.exe NOT work and the jar file WORK, the usual case is that the .exe works but the .jar doesn't.
  25. Can I ask what OS you're using? Could I also ask for you to provide your Java version? I've never seen the MinecraftLauncher.exe NOT work and the jar file WORK, the usual case is that the .exe works but the .jar doesn't.
×
×
  • Create New...

Important Information

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