Jump to content

How to use Keyhandler value in Entity


dhtpdud528

Recommended Posts

Hi, i'm 'dhtpdud528' from Korea

 

i'm do not well English :(, so please understand

 

==

 

I try if i press the 'F', EntitiyBoom will be explotion but it wasn't

(use keyhandler)

 

it's crash like this

 

2013-12-08 21:13:37 [정보] [sTDERR] net.minecraft.util.ReportedException: Ticking entity
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-12-08 21:13:37 [정보] [sTDERR] Caused by: java.lang.NullPointerException
2013-12-08 21:13:37 [정보] [sTDERR] 	at a_btoom.EntityTimerBIM.onUpdate(EntityTimerBIM.java:229)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2350)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:719)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.world.World.updateEntity(World.java:2311)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.world.World.updateEntities(World.java:2157)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:550)
2013-12-08 21:13:37 [정보] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:668)
2013-12-08 21:13:37 [정보] [sTDERR] 	... 4 more
2013-12-08 21:13:37 [심각] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking entity
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
at a_btoom.EntityTimerBIM.onUpdate(EntityTimerBIM.java:229)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2350)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:719)
at net.minecraft.world.World.updateEntity(World.java:2311)
at net.minecraft.world.World.updateEntities(World.java:2157)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:550)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:668)
... 4 more
2013-12-08 21:13:37 [심각] [Minecraft-Server] This crash report has been saved to: C:\Users\A50MS\Minecraft_mod\forge\mcp - btoom\jars\.\crash-reports\crash-2013-12-08_21.13.37-server.txt
2013-12-08 21:13:37 [정보] [Minecraft-Server] Stopping server
2013-12-08 21:13:37 [정보] [Minecraft-Server] Saving players
2013-12-08 21:13:37 [정보] [Minecraft-Server] Saving worlds
2013-12-08 21:13:37 [정보] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2013-12-08 21:13:37 [정보] [sTDOUT] ---- Minecraft Crash Report ----
2013-12-08 21:13:37 [정보] [sTDOUT] // Daisy, daisy...
2013-12-08 21:13:37 [정보] [sTDOUT] 
2013-12-08 21:13:37 [정보] [sTDOUT] Time: 13. 12. 8 오후 9:13
2013-12-08 21:13:37 [정보] [sTDOUT] Description: Ticking entity
2013-12-08 21:13:37 [정보] [sTDOUT] 
2013-12-08 21:13:37 [정보] [sTDOUT] java.lang.NullPointerException
2013-12-08 21:13:37 [정보] [sTDOUT] 	at a_btoom.EntityTimerBIM.onUpdate(EntityTimerBIM.java:229)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2350)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:719)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.World.updateEntity(World.java:2311)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.World.updateEntities(World.java:2157)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:550)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:668)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-12-08 21:13:37 [정보] [sTDOUT] 
2013-12-08 21:13:37 [정보] [sTDOUT] 
2013-12-08 21:13:37 [정보] [sTDOUT] A detailed walkthrough of the error, its code path and all known details is as follows:
2013-12-08 21:13:37 [정보] [sTDOUT] ---------------------------------------------------------------------------------------
2013-12-08 21:13:37 [정보] [sTDOUT] 
2013-12-08 21:13:37 [정보] [sTDOUT] -- Head --
2013-12-08 21:13:37 [정보] [sTDOUT] Stacktrace:
2013-12-08 21:13:37 [정보] [sTDOUT] 	at a_btoom.EntityTimerBIM.onUpdate(EntityTimerBIM.java:229)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2350)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:719)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.World.updateEntity(World.java:2311)
2013-12-08 21:13:37 [정보] [sTDOUT] 
2013-12-08 21:13:37 [정보] [sTDOUT] -- Entity being ticked --
2013-12-08 21:13:37 [정보] [sTDOUT] Details:
2013-12-08 21:13:37 [정보] [sTDOUT] 	Entity Type: BtooomMod.Timer BIM (a_btoom.EntityTimerBIM)
2013-12-08 21:13:37 [정보] [sTDOUT] 	Entity ID: 4
2013-12-08 21:13:37 [정보] [sTDOUT] 	Entity Name: entity.BtooomMod.Timer BIM.name
2013-12-08 21:13:37 [정보] [sTDOUT] 	Entity's Exact location: -484.32, 4.02, 696.71
2013-12-08 21:13:37 [정보] [sTDOUT] 	Entity's Block location: World: (-485,4,696), Chunk: (at 11,0,8 in -31,43; contains blocks -496,0,688 to -481,255,703), Region: (-1,1; contains chunks -32,32 to -1,63, blocks -512,0,512 to -1,255,1023)
2013-12-08 21:13:37 [정보] [sTDOUT] 	Entity's Momentum: 0.28, -0.45, 0.71
2013-12-08 21:13:37 [정보] [sTDOUT] Stacktrace:
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.World.updateEntities(World.java:2157)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:550)
2013-12-08 21:13:37 [정보] [sTDOUT] 
2013-12-08 21:13:37 [정보] [sTDOUT] -- Affected level --
2013-12-08 21:13:37 [정보] [sTDOUT] Details:
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level name: New World
2013-12-08 21:13:37 [정보] [sTDOUT] 	All players: 0 total; []
2013-12-08 21:13:37 [정보] [sTDOUT] 	Chunk stats: ServerChunkCache: 625 Drop: 0
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level seed: -8861550202755443363
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level generator: ID 01 - flat, ver 0. Features enabled: false
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level generator options: 
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level spawn location: World: (-496,4,691), Chunk: (at 0,0,3 in -31,43; contains blocks -496,0,688 to -481,255,703), Region: (-1,1; contains chunks -32,32 to -1,63, blocks -512,0,512 to -1,255,1023)
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level time: 4521 game time, 4521 day time
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level dimension: 0
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level storage version: 0x04ABD - Anvil
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level weather: Rain time: 52320 (now: false), thunder time: 91190 (now: false)
2013-12-08 21:13:37 [정보] [sTDOUT] 	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
2013-12-08 21:13:37 [정보] [sTDOUT] Stacktrace:
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:668)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484)
2013-12-08 21:13:37 [정보] [sTDOUT] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-12-08 21:13:37 [정보] [sTDOUT] 
2013-12-08 21:13:37 [정보] [sTDOUT] -- System Details --
2013-12-08 21:13:37 [정보] [sTDOUT] Details:
2013-12-08 21:13:37 [정보] [sTDOUT] 	Minecraft Version: 1.6.4
2013-12-08 21:13:37 [정보] [sTDOUT] 	Operating System: Windows 7 (x86) version 6.1
2013-12-08 21:13:37 [정보] [sTDOUT] 	Java Version: 1.7.0_45, Oracle Corporation
2013-12-08 21:13:37 [정보] [sTDOUT] 	Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
2013-12-08 21:13:37 [정보] [sTDOUT] 	Memory: 866363376 bytes (826 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
2013-12-08 21:13:37 [정보] [sTDOUT] 	JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
2013-12-08 21:13:37 [정보] [sTDOUT] 	AABB Pool Size: 84 (4704 bytes; 0 MB) allocated, 84 (4704 bytes; 0 MB) used
2013-12-08 21:13:37 [정보] [sTDOUT] 	Suspicious classes: FML and Forge are installed
2013-12-08 21:13:37 [정보] [sTDOUT] 	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
2013-12-08 21:13:37 [정보] [sTDOUT] 	FML: MCP v8.11 FML v6.4.45.953 Minecraft Forge 9.11.1.953 4 mods loaded, 4 mods active
2013-12-08 21:13:37 [정보] [sTDOUT] 	mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 21:13:37 [정보] [sTDOUT] 	FML{6.4.45.953} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 21:13:37 [정보] [sTDOUT] 	Forge{9.11.1.953} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 21:13:37 [정보] [sTDOUT] 	BtooomMod{1.6.4} [bTOOOM!] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
2013-12-08 21:13:37 [정보] [sTDOUT] 	Profiler Position: N/A (disabled)
2013-12-08 21:13:37 [정보] [sTDOUT] 	Vec3 Pool Size: 19 (1064 bytes; 0 MB) allocated, 19 (1064 bytes; 0 MB) used
2013-12-08 21:13:37 [정보] [sTDOUT] 	Player Count: 0 / 8; []
2013-12-08 21:13:37 [정보] [sTDOUT] 	Type: Integrated Server (map_client.txt)
2013-12-08 21:13:37 [정보] [sTDOUT] 	Is Modded: Definitely; Client brand changed to 'fml,forge'
2013-12-08 21:13:37 [정보] [sTDOUT] #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2013-12-08_21.13.37-server.txt

 

please help

 

 

KeyHandlerBTOOOM.java

 

package a_btoom;

import java.util.EnumSet;

import net.java.games.input.Keyboard;
import net.minecraft.client.settings.KeyBinding;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class KeyHandlerBTOOOM extends KeyHandler {
static KeyBinding kb1 = new KeyBinding("Timer", org.lwjgl.input.Keyboard.KEY_F);
public boolean timeron = false;
private int tick = 0;
public int timer = 10;

public KeyHandlerBTOOOM() {
	super(new KeyBinding[]{kb1}, new boolean[] {true});

}

@Override
public String getLabel() {

	return null;
}

@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb,
		boolean tickEnd, boolean isRepeat) {
	if(kb.keyCode == kb1.keyCode)
	{
		timeron = true;
		if(this.timeron)
		{
			++this.tick ;
			if(tick == 50)
			{
				this.tick = 0;
				System.out.println(timer);
				this.timer  -= 1;
			}
		}
	}
}

@Override
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {
	if(kb.keyCode == kb1.keyCode)
	{
		if(tickEnd)
		{
			System.out.println("up");
			this.timeron = false;
		}
	}

}

@Override
public EnumSet<TickType> ticks() {
	return EnumSet.of(TickType.CLIENT);
}

}

 

EntityTimerBIM.java

 

package a_btoom;

import java.util.List;
import java.util.Random;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.enchantment.EnchantmentThorns;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet70GameEvent;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public class EntityTimerBIM extends Entity implements IProjectile
{
KeyHandlerBTOOOM keyhandler;

.
.
.

public void onUpdate()
    {
        super.onUpdate();

.
.
.

        if(keyhandler.timer <=0)
        {
        	this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float)this.power , flag);
            this.setDead();
        }

 

Link to comment
Share on other sites

Put the counter in the entity onUpdate().

Put a default constructor with World as parameter.

Use the keyhandler to send a packet to server side to start the entity counter.

You'll need a way to link the entity with a player...maybe his username when the entity is spawned ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Sometimes, tweaking load order or specific configs can also help ease those conflicts.
    • I have recently tired downloading forge so i can run mods for hypixel skyblock but whenever i download forge and do it the same way as videos and tutorials forge keeps downloading as log file and doesnt download the .jar file any help will be aprecciated.
    • So I have created a Create Mod Server with my friends and i to play everyone can join play except one of my friends because when he tries to launch the game from the CurseForge Launcher it will load but never open or give him a crash report, we have tried everything from deleting CF and reinstalling it to Updating his drivers, IDK what to do if anyone can help I would be very Grateful
    • I get this error when trying to start the server for forged mods. In the code below it mentions distant horizons but no matter what mod I put in (deleting distant horizons) it still gives an error and doesn't launch Crash Report UUID: 3e91d5c7-18a7-43c2-a935-a8d28de560d1 FML: 47.3 Forge: net.minecraftforge:47.3.10[23:33:47] [main/ERROR] [minecraft/Main]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [    Distant Horizons (distanthorizons) encountered an error during the sided_setup event phase§7java.lang.ExceptionInInitializerError: null]     at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:246) ~[fmlcore-1.20.1-47.3.10.jar%23104!/:?] {}     at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$20(ModLoader.java:210) ~[fmlcore-1.20.1-47.3.10.jar%23104!/:?] {}     at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}     at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:210) ~[fmlcore-1.20.1-47.3.10.jar%23104!/:?] {}     at net.minecraftforge.fml.ModLoader.lambda$loadMods$15(ModLoader.java:190) ~[fmlcore-1.20.1-47.3.10.jar%23104!/:?] {}     at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}     at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:190) ~[fmlcore-1.20.1-47.3.10.jar%23104!/:?] {}     at net.minecraft.server.loading.ServerModLoader.load(ServerModLoader.java:31) ~[forge-1.20.1-47.3.10-universal.jar%23108!/:?] {re:classloading}     at net.minecraft.server.Main.main(Main.java:125) ~[server-1.20.1-20230612.114412-srg.jar%23103!/:?] {re:classloading}     at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.3.10.jar%2369!/:?] {}     at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.lambda$run$1(CommonLaunchHandler.java:103) ~[fmlloader-1.20.1-47.3.10.jar%2369!/:?] {}     at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$makeService$0(CommonServerLaunchHandler.java:27) ~[fmlloader-1.20.1-47.3.10.jar%2369!/:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar%2355!/:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?] {}  
    • This error keeps coming up after player tries to join server, doesn't happen to anyone else.  Error: Internal Exception: io.netty.handler.codec.DecoderException: java.lang.ArrayIndexOutOfBoundsException: Index 17196645 out of bounds for length 13 Heres the latest.log https://pastebin.com/uaw3KC0K  Heres the debug.log https://drive.google.com/file/d/1QzqtCMUf7ps1Iz85AOsMM7W8QhbHjBeU/view?usp=sharing
  • Topics

×
×
  • Create New...

Important Information

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