Everything posted by Differentiation
- 
	
		
		DamageSource.getEntity() always null
		
		I don't understand what you are trying to say
 - 
	
		
		DamageSource.getEntity() always null
		
		Do you mean you want your mod only to run on Singleplayer and not on Multiplayer Servers?
 - 
	
		
		DamageSource.getEntity() always null
		
		Please clarify.
 - 
	
		
		DamageSource.getEntity() always null
		
		Steps for checking if an event is being fired: 1. Place this line of code in your event method: Log.info("check"); 2. Meet all the requirements in-game for the event to fire (i.e. be attacked by any other entity). 3. If [INFO] check doesn't show up on the console, you did NOT register your event. Or just simply use the debugger
 - 
	
		
		DamageSource.getEntity() always null
		
		It's firing perfectly for me, whenever the player is attacked by another entity.
 - 
	
		
		DamageSource.getEntity() always null
		
		Well then, you never called EventHandler::registerEvents(); in your Main class like I told you. Do any of your events even work? Try different ones and see if they work.
 - 
	
		
		[SOLVED] [1.11] Creating custom particles (java.lang.RuntimeException: Invalid call to Particle.setMiscTex)
		
		The solution is simply not to extend ParticleCloud and remove the overrided method.
 - 
	
		
		DamageSource.getEntity() always null
		
		But I do hope you're aware that LivingAttackEvent is fired whenever the EntityLivingBase is attacked by another EntityLivingBase. If you are trying to test this event out by taking fall damage, don't expect anything to work.
 - 
	
		
		DamageSource.getEntity() always null
		
		Good
 - 
	
		
		DamageSource.getEntity() always null
		
		My only conclusion is that LivingAttackEvent might not work on 1.9.4. Please update to 1.10.2 and above, since I use 1.10.2 and it works mighty fine for me.
 - 
	
		
		DamageSource.getEntity() always null
		
		Well then explain why it doesn't work.
 - 
	
		
		DamageSource.getEntity() always null
		
		Let me guide you. 1. Create a new class called EventHandler. 2. Create a method called registerEvents() in the class and register your event inside. Like so: public class EventHandler { public void registerEvents() { /* All your events will be registered here */ ... MinecraftForge.EVENT_BUS.register(new YourClassNameWhereTheEventIsFound()); ... } } 3. Call this method in your mod's initialization phase. MAIN CLASS: ...... EventHandler eventHandler = new EventHandler(); @EventHandler public void registerEvents(FMLInitializationEvent event) { ... eventHandler.init(); ... } ...... You may use these steps to guide you. I hope I helped.
 - 
	
		
		DamageSource.getEntity() always null
		
		Well, did you actually register the constructor where you register the event?
 - 
	
		
		DamageSource.getEntity() always null
		
		Below, I provided a direct example of how to get the attacker, target, etc. and how to use LivingAttackEvent. @SubscribeEvent public void onAttack(LivingAttackEvent event) { if (event.getEntity() instanceof EntityPlayer) { Entity attackerIn = event.getSource().getSourceOfDamage(); // this is your attacker instance, the entity attacking the target EntityPlayer targetIn = (EntityPlayer) event.getEntity(); // this is your target instance, the entity being attacked by the attacker /* * Here, you do whatever you want with your attacker and target. * You can make the target set on flame, add potion effects, etc. * Make sure you properly handle sides */ targetIn.worldObj.playSound((EntityPlayer) null, targetIn.getPosition(), SoundEvents.BLOCK_METAL_BREAK, SoundCategory.BLOCKS, 2.0F, 1.25F); // I play a sound in my attack event Random rand = worldIn.rand; // random instance for (int i = 0; i < 75; ++i) { /* my helper stuff, don't worry about it */ DinocraftServer.spawnParticle(EnumParticleTypes.BLOCK_CRACK, worldIn, targetIn.posX + (rand.nextDouble() - 0.5D) * (double)targetIn.width, targetIn.posY + rand.nextDouble() - (double)targetIn.getYOffset() + 0.25D, targetIn.posZ + (rand.nextDouble() - 0.5D) * (double)targetIn.width, Math.random() * 0.2D - 0.1D, Math.random() * 0.25D, Math.random() * 0.2D - 0.1D, Block.getIdFromBlock(Blocks.REDSTONE_BLOCK) ); // I spawn blood particles in my attack event } } } I don't even think LivingAttackEvent works on 1.9, last I heard, correct me if I'm wrong. I would recommend updating to at least 1.10.2, which is the version I used above.
 - 
	
		
		[Unsolved] Trouble with sound...
		
		As a summary, you are reaching across logical sides Packets, like aforementioned, will do the work. You must send a packet to tell the client that it needs to play a sound (using EntityPlayerMP). For more information about packets, click HERE. However, there is a server-side friendly method to play a sound (which I use all the time instead of sending a packet), which I have put for you below for your convenience. World worldIn = playerIn.world; worldIn.playSound(null, playerIn.getPosition(), /* your sound name */, /* your sound category */, 5.0F, 1.0F); I hope I helped. Happy modding!
 - 
	
		
		how to properly change the world from a client event?
		
		Comments for feedback: 1. Since you are handling block replacements, you need to use ServerChatEvent instead of ClientChatEvent. 2. You can just make a new command and register it. execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException method is executed in server-side. 3. Don't use Minecraft.getMinecraft() in server-side once you get the server to run the code, this might crash you or cause errors if on a server. 4. Don't use WorldClient, simply use playerIn.world once you have EntityPlayerMP through CommandBase in execute(...) method. Follow these tips and you'll be set! ... @Override public String getCommandName() { return "evanesco"; } @Override public void execute(MinecraftServer serverIn, ICommandSender senderIn, String[] args) throws CommandException { EntityPlayer playerIn = CommandBase.getCommandSenderAsPlayer(senderIn); RayTraceResult trace = PointingAt(); if (trace == null || trace.typeOfHit == RayTraceResult.Type.MISS) { SendStatus("§6Whiff!§r"); } else { BlockPos pos = trace.getBlockPos(); World worldIn = playerIn.world; worldIn.setBlockToAir(pos); worldIn.playSound(/* if you want sound to play for all players */ null /* else if only for this player, playerIn */, pos, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F); SendStatus("§5Shoop!§r"); CommandBase.notifyCommandListener("commands.evanesco.success", new Object[0]); } } ... I stripped the code for you, if you wish to use it, you may. I hope I helped. Happy modding!
 - 
	
		
		Why doesn't forget update mods
		
		Ambiguous.
 - 
	
		
		[SOLVED] [1.12.X] Crashing when building/running Minecraft
		
		extends ..........
 - 
	
		
		[Unsolved] Problem with ChatEvent
		
		Can I have some of those flowers too?
 - 
	
		
		[Unsolved] Problem with ChatEvent
		
		Please post your code.
 - 
	
		
		Detect entity you're looking at
		
		Yes, Entity entity = ray.entityHit; is the starting line that is wrong in his code that would lead to further errors. You're correct, that's the cause of the exception.
 - 
	
		
		Detect entity you're looking at
		
		This will throw a NullPointerException since there is (most of the time) no hit entity! You are running the item right click method...
 - 
	
		
		[1.7.10] Rendering Multiple Textures On One Face
		
		Minecraft Version 1.7.10 is no longer supported on this Forum.
 - 
	
		
		[1.12.2] [Solved] Event for connect to singlerplayer world, server world
		
		You mean this? Minecraft mc = Minecraft.getMinecraft(); EntityPlayer playerIn = mc.thePlayer; World worldIn = playerIn.world;
 - 
	
		
		Make item not wearable on offhand
		
		I used that long ago when I just started modding. But I recall it did give some crashes. I omitted the code loooong ago
 
IPS spam blocked by CleanTalk.