Jump to content

Einhaender

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Einhaender's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I've never used Arduino, but the Joystick probably has a setting so that it can emulate the WASD keys. If you can't get that to work you might want to try player.setVelocity(args) or player.addVelocity(args). Good luck!
  2. I'm trying to use events to detect when a player dies and then respawns: relevant parts of main mod class: package einhaender.modEin; //all the necessary imports @Mod(modid = ModEin.MODID, version = ModEin.VERSION) public class ModEin { @EventHandler public void postInit(FMLPostInitializationEvent event) { MinecraftForge.EVENT_BUS.register (new ListenerDeath ()); FMLCommonHandler.instance ().bus ().register (new ListenerDeath ()); } } the class with the listeners: package einhaender.modEin; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; public class ListenerDeath { @SubscribeEvent public void onLogin(PlayerLoggedInEvent event) { event.player.addChatComponentMessage (new ChatComponentText ("you just logged in!!!!!")); } @SubscribeEvent public void onSpawn(CheckSpawn event) { System.out.println ("Something just tried to spawn!!!"); if (event.entity instanceof EntityPlayer) ((EntityPlayer) event.entity).addChatComponentMessage (new ChatComponentText ("you just tried to spawn")); } @SubscribeEvent public void onLivingSpawn(LivingSpawnEvent event) { System.out.println ("A living just spawned."); if (!event.world.isRemote) { if (event.entityLiving instanceof EntityPlayer) { ((EntityPlayer) event.entityLiving).addChatMessage (new ChatComponentText ("you just spawned!!!")); } } } } When I enter a new world, a chat message "you just logged in" pops up, so I'm registering the listener properly. I just can't find any events that are executed when a player respawns. And I can't get the CheckSpawn or LivingSpawnEvent events to run at all. So, is LivingSpawnEvent just not run when a player/mob spawns, or am I doing something wrong in my code? Thanks for taking the time to read this! SOLUTION package einhaender.modEin; import java.util.ArrayList; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChatComponentText; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; public class ListenerDeath { ArrayList<EntityPlayer> deadPlayers = new ArrayList<EntityPlayer> (); @SubscribeEvent public void death(LivingDeathEvent event) { if (!event.entity.worldObj.isRemote) { if (event.entity instanceof EntityPlayer) { deadPlayers.add ((EntityPlayer) event.entity); } } } @SubscribeEvent public void entitySpawned (EntityJoinWorldEvent event) { if (!event.world.isRemote) { if (event.entity instanceof EntityPlayer) { if (deadPlayers.contains ((EntityPlayer) event.entity)) { EntityPlayer player = (EntityPlayer) event.entity; doStuffWithRespawnedPlayer (player); deadPlayers.remove (player); } } } } private void doStuffWithRespawnedPlayer(EntityPlayer player) { player.setPositionAndUpdate (8.5, 16, 8.5); } }
  3. Thanks for the reply coolboy4531, I've been messing around with my code and you were right, one of my (many) problems was that the code tried to remove blocks from adjacent chunks, forcing those chunks to generate and then repeating that process infinity. but it still crashes when I try to generate a world... my latest mod class: https://gist.github.com/anonymous/446ad3072b132fd63bed and the generator class: https://gist.github.com/anonymous/903da7919ed1dde12d79 crash report: https://gist.github.com/anonymous/a9612af3b09b2ee64477 I've tried several thing to figure out what's going wrong including: --making a block that calls the destroyChunk method when it is right clicked, and it works perfectly --it doesn't matter if I do setBlock (x, y, z, Blocks.air); or setBlockToAir (x, y, z); both crash --I have it print out what block it destroys, and for a while there was a pattern, the first (~5) times it crashed when it started destroying a new x coordinate. but then it crashed on the last x a couple times... and just now it crashed half way through... so idk what's going on there. I'm out of ideas on what could be going wrong with this, it's likely that I'm missing something because I'm new to modding... thanks for taking the time to read this everyone.
  4. not sure if it is important, but I discovered that if I change my world generator class to clear a specific chunk (rather than the one minecraft is actually generating), new worlds generate just fine... until that chunk is loaded. new skyblock generator class: https://gist.github.com/anonymous/d3ec08c85d1e16f50c0a latest crash report: https://gist.github.com/anonymous/7ad878d1e5b0dce20c83 I also noticed that in this latest crash report, none of my classes are mentioned in the stacktrace... again, any assistance would be appreciated.
  5. I'm new to modding, and after having made my first block and such, I decided to try out basic world generation. For my first attempt, I'm trying to get the overworld to be a void. My mod compiles, Minecraft loads, but when I try to generate a new world it crashes... crash report: https://gist.github.com/anonymous/1613a3baceb82c1670be relevent parts of my mod class: https://gist.github.com/anonymous/36a6b786e60cbb8c23e6 complete mod class: https://gist.github.com/anonymous/74181edcbb615935b727 and SkyblockGenerator class: https://gist.github.com/anonymous/1e9c7e16457af4f3f2a1 any insight to what I'm doing wrong would be greatly appreciated. (also, is there a more efficient way to make a chunk void?)
×
×
  • Create New...

Important Information

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