Jump to content

Recommended Posts

Posted

So here's the problem, I made a cannon block that fires projectile when right click on it. The power of projectiles depend on how many iron blocks attached behind the cannon. Every thing works except when I reload the saved world and right click on that cannon block again, the game crashes. There will be no crash if I replace the old cannon block with a new one. And if I do not quit the game but just reload the world after quit, there will also be no crash. I suppose it has something to do with block state storage, but really don't know how to fix it. The crash report is as follow:

 

---- Minecraft Crash Report ----
// Shall we play a game?

Time: 6/5/18 2:57 AM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at com.ice2670.plasmacannon.blocks.BlockPlasmaCannon.onBlockActivated(BlockPlasmaCannon.java:92)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:455)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1933)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186)
    at net.minecraft.client.Minecraft.run(Minecraft.java:441)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
    at com.ice2670.plasmacannon.blocks.BlockPlasmaCannon.onBlockActivated(BlockPlasmaCannon.java:109)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:455)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['Player715'/523, l='MpServer', x=177.59, y=72.26, z=406.81]]
    Chunk stats: MultiplayerChunkCache: 584, 584
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: World: (280,64,278), Chunk: (at 8,4,6 in 17,17; contains blocks 272,0,272 to 287,255,287), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 34707 game time, 8697 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 77 total; [EntityZombie['Zombie'/2, l='MpServer', x=108.82, y=34.00, z=467.38], EntityBat['Bat'/3, l='MpServer', x=116.56, y=43.96, z=337.34], EntitySquid['Squid'/4, l='MpServer', x=113.16, y=52.46, z=411.36], EntityCreeper['Creeper'/5, l='MpServer', x=126.80, y=20.00, z=473.44], EntityZombie['Zombie'/6, l='MpServer', x=114.75, y=36.00, z=469.50], EntityZombie['Zombie'/7, l='MpServer', x=114.01, y=36.00, z=467.81], EntitySkeleton['Skeleton'/8, l='MpServer', x=135.24, y=12.00, z=463.46], EntityCreeper['Creeper'/9, l='MpServer', x=131.51, y=16.00, z=461.93], EntityCreeper['Creeper'/10, l='MpServer', x=132.46, y=12.00, z=463.02], EntityCreeper['Creeper'/11, l='MpServer', x=135.21, y=18.00, z=464.48], EntitySkeleton['Skeleton'/12, l='MpServer', x=131.12, y=17.00, z=464.70], EntityCreeper['Creeper'/13, l='MpServer', x=132.50, y=19.00, z=473.33], EntityBat['Bat'/14, l='MpServer', x=130.45, y=21.61, z=475.81], EntityZombie['Zombie'/15, l='MpServer', x=129.73, y=18.00, z=465.44], EntityCreeper['Creeper'/16, l='MpServer', x=150.20, y=15.00, z=392.56], EntitySkeleton['Skeleton'/17, l='MpServer', x=148.49, y=30.00, z=399.33], EntitySkeleton['Skeleton'/18, l='MpServer', x=149.45, y=26.00, z=394.75], EntityZombie['Zombie'/19, l='MpServer', x=145.51, y=26.00, z=402.73], EntitySkeleton['Skeleton'/20, l='MpServer', x=153.45, y=15.00, z=425.18], EntitySkeleton['Skeleton'/21, l='MpServer', x=149.55, y=14.00, z=422.52], EntityBat['Bat'/22, l='MpServer', x=144.03, y=16.06, z=414.03], EntityZombie['Zombie'/23, l='MpServer', x=149.70, y=14.02, z=423.41], EntityCreeper['Creeper'/24, l='MpServer', x=150.42, y=26.00, z=416.19], EntityCreeper['Creeper'/537, l='MpServer', x=110.51, y=26.00, z=480.68], EntityPig['Pig'/25, l='MpServer', x=146.45, y=64.00, z=424.51], EntityPlayerSP['Player715'/523, l='MpServer', x=177.59, y=72.26, z=406.81], EntitySkeleton['Skeleton'/26, l='MpServer', x=158.51, y=26.00, z=441.70], EntitySquid['Squid'/29, l='MpServer', x=163.99, y=47.42, z=344.22], EntityPig['Pig'/30, l='MpServer', x=174.20, y=67.00, z=452.69], EntityPig['Pig'/31, l='MpServer', x=164.76, y=65.00, z=472.19], EntityPig['Pig'/32, l='MpServer', x=174.27, y=64.00, z=475.67], EntityZombie['Zombie'/34, l='MpServer', x=186.45, y=20.00, z=371.24], EntityZombie['Zombie'/35, l='MpServer', x=184.54, y=20.00, z=369.65], EntityCreeper['Creeper'/36, l='MpServer', x=189.50, y=21.00, z=373.50], EntityPig['Pig'/37, l='MpServer', x=177.22, y=66.00, z=456.49], EntityPig['Pig'/38, l='MpServer', x=178.73, y=66.00, z=451.37], EntitySkeleton['Skeleton'/39, l='MpServer', x=203.75, y=49.00, z=346.44], EntityBat['Bat'/40, l='MpServer', x=201.44, y=48.65, z=342.77], EntitySheep['Sheep'/41, l='MpServer', x=201.55, y=67.00, z=354.70], EntityZombie['Zombie'/42, l='MpServer', x=195.50, y=61.00, z=412.50], EntityZombie['Zombie'/43, l='MpServer', x=204.50, y=55.00, z=428.79], EntityPig['Pig'/44, l='MpServer', x=197.24, y=63.00, z=475.62], EntityPig['Pig'/45, l='MpServer', x=194.55, y=55.00, z=473.68], EntityPig['Pig'/46, l='MpServer', x=193.31, y=63.00, z=477.49], EntityCreeper['Creeper'/52, l='MpServer', x=216.53, y=26.00, z=349.15], EntitySheep['Sheep'/53, l='MpServer', x=223.96, y=69.00, z=363.55], EntityChicken['Chicken'/54, l='MpServer', x=209.39, y=69.64, z=363.51], EntityPig['Pig'/55, l='MpServer', x=210.20, y=69.00, z=353.74], EntityItem['item.item.egg'/56, l='MpServer', x=216.13, y=72.00, z=360.83], EntityZombie['Zombie'/57, l='MpServer', x=210.50, y=56.00, z=396.50], EntitySkeleton['Skeleton'/58, l='MpServer', x=213.50, y=59.00, z=424.50], EntityZombie['Zombie'/59, l='MpServer', x=219.56, y=17.00, z=477.26], EntityCreeper['Creeper'/61, l='MpServer', x=224.50, y=55.00, z=387.50], EntityItem['item.tile.dirt.default'/62, l='MpServer', x=236.86, y=76.00, z=390.13], EntityCreeper['Creeper'/63, l='MpServer', x=236.50, y=58.00, z=422.50], EntitySpider['Spider'/575, l='MpServer', x=235.30, y=30.00, z=485.61], EntityCreeper['Creeper'/64, l='MpServer', x=235.18, y=72.00, z=429.54], EntityItem['item.tile.dirt.default'/65, l='MpServer', x=233.88, y=72.00, z=420.25], EntitySheep['Sheep'/66, l='MpServer', x=239.49, y=86.00, z=455.21], EntityCreeper['Creeper'/67, l='MpServer', x=225.10, y=15.00, z=471.95], EntityZombie['Zombie'/68, l='MpServer', x=225.72, y=14.00, z=468.65], EntityZombie['Zombie'/72, l='MpServer', x=242.94, y=22.01, z=348.35], EntitySkeleton['Skeleton'/73, l='MpServer', x=242.75, y=38.00, z=351.54], EntityChicken['Chicken'/75, l='MpServer', x=251.82, y=64.00, z=342.73], EntityBat['Bat'/76, l='MpServer', x=244.06, y=21.25, z=355.32], EntitySkeleton['Skeleton'/77, l='MpServer', x=245.50, y=38.00, z=358.50], EntityCreeper['Creeper'/78, l='MpServer', x=247.47, y=43.00, z=364.23], EntitySkeleton['Skeleton'/79, l='MpServer', x=256.29, y=59.00, z=363.50], EntityCreeper['Creeper'/81, l='MpServer', x=254.50, y=38.00, z=378.50], EntityCreeper['Creeper'/85, l='MpServer', x=243.47, y=76.00, z=388.49], EntitySkeleton['Skeleton'/87, l='MpServer', x=251.50, y=49.00, z=401.50], EntityBat['Bat'/95, l='MpServer', x=249.25, y=56.10, z=422.25], EntitySheep['Sheep'/100, l='MpServer', x=244.66, y=89.00, z=449.52], EntitySheep['Sheep'/101, l='MpServer', x=253.49, y=94.00, z=448.80], EntitySheep['Sheep'/102, l='MpServer', x=252.45, y=93.00, z=454.45], EntityZombie['Zombie'/106, l='MpServer', x=256.30, y=61.00, z=389.70], EntityBat['Bat'/115, l='MpServer', x=256.25, y=57.10, z=421.75]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2896)
    at net.minecraft.client.Minecraft.run(Minecraft.java:470)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_161, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 64696856 bytes (61 MB) / 811073536 bytes (773 MB) up to 1881145344 bytes (1794 MB)
    JVM Flags: 0 total; 
    IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
    FML: MCP 9.42 Powered by Forge 14.23.1.2581 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    | State     | ID            | Version      | Source                           | Signature |
    |:--------- |:------------- |:------------ |:-------------------------------- |:--------- |
    | UCHIJAAAA | minecraft     | 1.12.2       | minecraft.jar                    | None      |
    | UCHIJAAAA | mcp           | 9.42         | minecraft.jar                    | None      |
    | UCHIJAAAA | FML           | 8.0.99.99    | forgeSrc-1.12.2-14.23.1.2581.jar | None      |
    | UCHIJAAAA | forge         | 14.23.1.2581 | forgeSrc-1.12.2-14.23.1.2581.jar | None      |
    | UCHIJAAAA | plasmacannons | 0.1          | PlasmaCannon_2581_main           | None      |

    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'Intel' Version: '4.5.0 - Build 22.20.16.4749' Renderer: 'Intel(R) HD Graphics 620'
    Launched Version: 1.12.2
    LWJGL: 2.9.4
    OpenGL: Intel(R) HD Graphics 620 GL version 4.5.0 - Build 22.20.16.4749, Intel
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: 
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    CPU: 4x Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz

Posted

codes of cannon block and it's tile entity are as follow:

 

Block code:

public class BlockPlasmaCannon extends BlockBase implements ITileEntityProvider
{
    public static final PropertyDirection FACING = BlockHorizontal.FACING;
    TileEntity tileentity;
    TileEntityPlasmaCannon plasmacannon;


    public BlockPlasmaCannon(String name)
    {
        super(name, Material.IRON);
        setSoundType(SoundType.METAL);
        this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
    }

    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune)
    {
        return Item.getItemFromBlock(BlockInit.BLOCK_PLASMA_CANNON);
    }

    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta)
    {
        return new TileEntityPlasmaCannon();
    }

    @Override
    public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
    {
        return new ItemStack(BlockInit.BLOCK_PLASMA_CANNON);
    }


    @Override
    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
    {
        if (!worldIn.isRemote)
        {
            IBlockState north = worldIn.getBlockState(pos.north());
            IBlockState south = worldIn.getBlockState(pos.south());
            IBlockState west = worldIn.getBlockState(pos.west());
            IBlockState east = worldIn.getBlockState(pos.east());
            EnumFacing face = (EnumFacing)state.getValue(FACING);

            if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) face = EnumFacing.SOUTH;
            else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) face = EnumFacing.NORTH;
            else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) face = EnumFacing.EAST;
            else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) face = EnumFacing.WEST;
            worldIn.setBlockState(pos, state.withProperty(FACING, face), 2);
            this.tileentity = worldIn.getTileEntity(pos);
            if (this.tileentity instanceof TileEntityPlasmaCannon){
                this.plasmacannon = (TileEntityPlasmaCannon) tileentity;
            }
            plasmacannon.getstate(state);

        }
    }







    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
    {
        if (worldIn.isRemote){
        plasmacannon.fireplasma(worldIn, pos,playerIn);}
        return true;
    }





    @Override
    public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
    {
        return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
    }

    @Override
    public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
    {
        worldIn.setBlockState(pos, this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);
    }


    @Override
    public EnumBlockRenderType getRenderType(IBlockState state)
    {
        return EnumBlockRenderType.MODEL;
    }

    @Override
    public IBlockState withRotation(IBlockState state, Rotation rot)
    {
        return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
    }

    @Override
    public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
    {
        return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
    }

    @Override
    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {FACING});
    }

    @Override
    public IBlockState getStateFromMeta(int meta)
    {
        EnumFacing facing = EnumFacing.getFront(meta);
        if(facing.getAxis() == EnumFacing.Axis.Y) facing = EnumFacing.NORTH;
        return this.getDefaultState().withProperty(FACING, facing);
    }

    @Override
    public int getMetaFromState(IBlockState state)
    {
        return ((EnumFacing)state.getValue(FACING)).getIndex();
    }

}

 

tile entity code:

public class TileEntityPlasmaCannon extends TileEntity implements ITickable
{

    int powerfactor;
    EnumFacing enumfacing;

    public void getstate(IBlockState state)
    {
        this.enumfacing =(EnumFacing) state.getValue(FACING);
    }

    public void update()
    {
        int x = this.pos.getX();
        int y = this.pos.getY();
        int z = this.pos.getZ();

        if (!this.world.isRemote) {

            BlockPos pos2;
            if (enumfacing == EnumFacing.NORTH) {
                int i = 1;
                while (i < 71) {
                    pos2 = new BlockPos(x, y, z + i);
                    if (world.getBlockState(pos2).getBlock() == Blocks.IRON_BLOCK) {
                        i++;

                    } else {
                        this.powerfactor = i;
                        break;

                    }
                }
            }

            if (enumfacing == EnumFacing.SOUTH) {
                int i = 1;
                while (i < 71) {
                    pos2 = new BlockPos(x, y, z - i);
                    if (world.getBlockState(pos2).getBlock() == Blocks.IRON_BLOCK) {
                        i++;

                    } else {
                        this.powerfactor = i;
                        break;

                    }
                }
            }

            if (enumfacing == EnumFacing.EAST) {
                int i = 1;
                while (i < 71) {
                    pos2 = new BlockPos(x - i, y, z);
                    if (world.getBlockState(pos2).getBlock() == Blocks.IRON_BLOCK) {
                        i++;

                    } else {
                        this.powerfactor = i;
                        break;

                    }
                }
            }

            if (enumfacing == EnumFacing.WEST) {
                int i = 1;
                while (i < 71) {
                    pos2 = new BlockPos(x + i, y, z);
                    if (world.getBlockState(pos2).getBlock() == Blocks.IRON_BLOCK) {
                        i++;

                    } else {
                        this.powerfactor = i;
                        break;

                    }
                }
            }
        }

    }


    public void fireplasma(World worldIn, BlockPos pos, EntityPlayer playerIn) {

        //direction
        double d0 = pos.getX() + 0.5D + (float) enumfacing.getFrontOffsetX();
        double d1 = pos.getY() + 0.4D + (float) enumfacing.getFrontOffsetY();
        double d2 = pos.getZ() + 0.5D + (float) enumfacing.getFrontOffsetZ();



        if (enumfacing == EnumFacing.NORTH)
        {
            String str = Integer.toString(this.powerfactor);
            playerIn.sendMessage(new TextComponentString(str));
            EntityLargePlasmaBall entityplasmaball = new EntityLargePlasmaBall(worldIn, d0, d1, d2-1, powerfactor);

            entityplasmaball.shoot((double) enumfacing.getFrontOffsetX(), (double) enumfacing.getFrontOffsetY(), (double) enumfacing.getFrontOffsetZ(), 5, 0.01F);

            worldIn.spawnEntity(entityplasmaball);

        }

        if (enumfacing == EnumFacing.SOUTH)
        {
            String str = Integer.toString(this.powerfactor);
            playerIn.sendMessage(new TextComponentString(str));
            EntityLargePlasmaBall entityplasmaball = new EntityLargePlasmaBall(worldIn, d0, d1, d2+1, powerfactor);
            entityplasmaball.shoot((double) enumfacing.getFrontOffsetX(), (double) enumfacing.getFrontOffsetY(), (double) enumfacing.getFrontOffsetZ(), 5, 0.01F);

            worldIn.spawnEntity(entityplasmaball);

        }

        if (enumfacing == EnumFacing.EAST)
        {
            String str = Integer.toString(this.powerfactor);
            playerIn.sendMessage(new TextComponentString(str));
            EntityLargePlasmaBall entityplasmaball = new EntityLargePlasmaBall(worldIn, d0+1, d1, d2, powerfactor);
            entityplasmaball.shoot((double) enumfacing.getFrontOffsetX(), (double) enumfacing.getFrontOffsetY(), (double) enumfacing.getFrontOffsetZ(), 5, 0.01F);

            worldIn.spawnEntity(entityplasmaball);


        }

        if (enumfacing == EnumFacing.WEST)
        {
            String str = Integer.toString(this.powerfactor);
            playerIn.sendMessage(new TextComponentString(str));
            EntityLargePlasmaBall entityplasmaball = new EntityLargePlasmaBall(worldIn, d0-1, d1, d2, powerfactor);
            entityplasmaball.shoot((double) enumfacing.getFrontOffsetX(), (double) enumfacing.getFrontOffsetY(), (double) enumfacing.getFrontOffsetZ(), 5, 0.01F);

            worldIn.spawnEntity(entityplasmaball);


        } 
    }
}
Posted
4 hours ago, Ice2670 said:

implements ITileEntityProvider

Problematic Code #4

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)

Don't use fields like these

    TileEntity tileentity;
    TileEntityPlasmaCannon plasmacannon;

in your block to assign a tile.... blocks are singletons so all blocks will use the same tile then... just use World#getTileEntity and cast it to TileEntityPlasmaCannon...

Edited by Terrails
Posted
5 hours ago, diesieben07 said:

Also, I seriously hope all those special cased directions are a joke. EnumFacing specifically exists so you can do for example BlockPos#offset(EnumFacing).

Would you please show me an example of how to use forge block.hasTileEntity to create tile entity?

Posted
Just now, Ice2670 said:

Would you please show me an example of how to use forge block.hasTileEntity to create tile entity?

Gasp. So easy.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

So I now use hasTileEntity instead of ITileEntityProvider, but the same issue still exist. I'm thinking maybe it's because I pass the block state to tile entity only when I place cannon block, so when I quit the game that state gets missing. So is it possible to let the world replace the old cannon block with a new one every time i reload the game?

 

---- Minecraft Crash Report ----
// My bad.

Time: 6/5/18 4:20 PM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at com.ice2670.plasmacannon.blocks.BlockPlasmaCannon.onBlockActivated(BlockPlasmaCannon.java:101)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:455)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1933)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186)
    at net.minecraft.client.Minecraft.run(Minecraft.java:441)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
    at com.ice2670.plasmacannon.blocks.BlockPlasmaCannon.onBlockActivated(BlockPlasmaCannon.java:101)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:455)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['Player778'/236, l='MpServer', x=175.41, y=71.40, z=408.59]]
    Chunk stats: MultiplayerChunkCache: 585, 585
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: World: (280,64,278), Chunk: (at 8,4,6 in 17,17; contains blocks 272,0,272 to 287,255,287), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 49862 game time, 8352 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 67 total; [EntityCreeper['Creeper'/7, l='MpServer', x=111.50, y=33.00, z=368.50], EntityCreeper['Creeper'/12, l='MpServer', x=105.15, y=39.00, z=470.40], EntitySquid['Squid'/14, l='MpServer', x=112.18, y=52.15, z=352.19], EntitySkeleton['Skeleton'/15, l='MpServer', x=119.50, y=32.00, z=410.50], EntityCreeper['Creeper'/16, l='MpServer', x=116.50, y=32.00, z=411.50], EntitySquid['Squid'/17, l='MpServer', x=126.83, y=58.44, z=437.18], EntitySquid['Squid'/18, l='MpServer', x=129.45, y=62.26, z=443.94], EntitySquid['Squid'/19, l='MpServer', x=128.14, y=56.79, z=465.10], EntitySquid['Squid'/20, l='MpServer', x=127.59, y=54.63, z=456.85], EntityZombie['Zombie'/21, l='MpServer', x=122.50, y=23.00, z=482.19], EntitySquid['Squid'/28, l='MpServer', x=141.42, y=53.76, z=347.68], EntitySquid['Squid'/29, l='MpServer', x=144.13, y=54.72, z=357.36], EntityZombie['Zombie'/30, l='MpServer', x=131.82, y=26.00, z=393.50], EntityCreeper['Creeper'/31, l='MpServer', x=139.50, y=13.00, z=458.50], EntityCreeper['Creeper'/32, l='MpServer', x=134.95, y=14.00, z=458.49], EntitySkeleton['Skeleton'/33, l='MpServer', x=129.47, y=19.00, z=471.74], EntityBat['Bat'/34, l='MpServer', x=130.69, y=13.99, z=462.49], EntityZombie['Zombie'/36, l='MpServer', x=147.50, y=14.00, z=374.50], EntitySquid['Squid'/37, l='MpServer', x=150.61, y=60.76, z=380.84], EntityZombie['Zombie'/38, l='MpServer', x=148.18, y=15.00, z=395.47], EntitySquid['Squid'/39, l='MpServer', x=158.00, y=62.60, z=379.93], EntitySkeleton['Skeleton'/40, l='MpServer', x=149.50, y=30.00, z=413.50], EntityCreeper['Creeper'/41, l='MpServer', x=146.36, y=16.00, z=412.03], EntityItem['item.tile.sapling.oak'/42, l='MpServer', x=156.82, y=70.00, z=431.56], EntitySquid['Squid'/43, l='MpServer', x=168.18, y=62.00, z=374.93], EntitySquid['Squid'/44, l='MpServer', x=164.75, y=60.45, z=391.34], EntityPig['Pig'/45, l='MpServer', x=170.88, y=67.00, z=457.41], EntityPig['Pig'/46, l='MpServer', x=166.62, y=66.00, z=465.54], EntityPig['Pig'/47, l='MpServer', x=171.03, y=66.00, z=463.92], EntityPig['Pig'/48, l='MpServer', x=170.23, y=66.00, z=464.92], EntitySkeleton['Skeleton'/50, l='MpServer', x=189.50, y=32.00, z=390.50], EntitySquid['Squid'/51, l='MpServer', x=172.50, y=57.48, z=415.44], EntityPig['Pig'/52, l='MpServer', x=191.88, y=63.00, z=462.54], EntityPig['Pig'/56, l='MpServer', x=197.72, y=67.00, z=357.50], EntitySheep['Sheep'/57, l='MpServer', x=192.52, y=67.00, z=363.00], EntityChicken['Chicken'/58, l='MpServer', x=196.40, y=68.00, z=361.69], EntitySkeleton['Skeleton'/59, l='MpServer', x=205.50, y=7.00, z=384.50], EntitySkeleton['Skeleton'/60, l='MpServer', x=204.26, y=34.00, z=453.47], EntityPig['Pig'/61, l='MpServer', x=197.49, y=55.00, z=461.78], EntitySheep['Sheep'/68, l='MpServer', x=213.72, y=72.00, z=369.55], EntityCreeper['Creeper'/69, l='MpServer', x=215.50, y=21.00, z=457.50], EntityCreeper['Creeper'/73, l='MpServer', x=230.50, y=34.00, z=334.50], EntityBat['Bat'/74, l='MpServer', x=230.71, y=39.29, z=350.31], EntityCreeper['Creeper'/75, l='MpServer', x=239.58, y=22.00, z=354.20], EntitySkeleton['Skeleton'/331, l='MpServer', x=242.47, y=28.00, z=485.73], EntityCreeper['Creeper'/76, l='MpServer', x=238.50, y=39.00, z=361.50], EntityItem['item.item.rottenFlesh'/77, l='MpServer', x=237.17, y=79.00, z=377.35], EntityCreeper['Creeper'/78, l='MpServer', x=237.50, y=49.00, z=412.50], EntityPig['Pig'/79, l='MpServer', x=228.50, y=66.00, z=469.31], EntityBat['Bat'/80, l='MpServer', x=244.30, y=24.10, z=351.52], EntityZombie['Zombie'/81, l='MpServer', x=240.50, y=27.00, z=341.50], EntityCreeper['Creeper'/82, l='MpServer', x=244.48, y=21.00, z=355.67], EntityBat['Bat'/83, l='MpServer', x=240.46, y=25.29, z=347.02], EntityCreeper['Creeper'/84, l='MpServer', x=246.50, y=38.00, z=362.50], EntityCreeper['Creeper'/85, l='MpServer', x=241.50, y=38.00, z=362.50], EntitySkeleton['Skeleton'/86, l='MpServer', x=246.66, y=56.00, z=364.50], EntityBat['Bat'/87, l='MpServer', x=249.30, y=52.02, z=377.66], EntityBat['Bat'/88, l='MpServer', x=245.66, y=25.97, z=370.32], EntityZombie['Zombie'/344, l='MpServer', x=231.50, y=30.54, z=486.45], EntitySkeleton['Skeleton'/89, l='MpServer', x=243.50, y=54.00, z=417.50], EntityBat['Bat'/345, l='MpServer', x=227.75, y=28.10, z=484.64], EntitySheep['Sheep'/91, l='MpServer', x=252.45, y=93.00, z=454.45], EntitySheep['Sheep'/92, l='MpServer', x=247.96, y=91.00, z=451.51], EntitySheep['Sheep'/93, l='MpServer', x=247.55, y=85.00, z=462.71], EntitySheep['Sheep'/94, l='MpServer', x=248.08, y=91.00, z=453.53], EntityPig['Pig'/111, l='MpServer', x=251.25, y=74.54, z=475.42], EntityPlayerSP['Player778'/236, l='MpServer', x=175.41, y=71.40, z=408.59]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2896)
    at net.minecraft.client.Minecraft.run(Minecraft.java:470)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_161, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 277529072 bytes (264 MB) / 994050048 bytes (948 MB) up to 1881145344 bytes (1794 MB)
    JVM Flags: 0 total; 
    IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
    FML: MCP 9.42 Powered by Forge 14.23.1.2581 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    | State     | ID            | Version      | Source                           | Signature |
    |:--------- |:------------- |:------------ |:-------------------------------- |:--------- |
    | UCHIJAAAA | minecraft     | 1.12.2       | minecraft.jar                    | None      |
    | UCHIJAAAA | mcp           | 9.42         | minecraft.jar                    | None      |
    | UCHIJAAAA | FML           | 8.0.99.99    | forgeSrc-1.12.2-14.23.1.2581.jar | None      |
    | UCHIJAAAA | forge         | 14.23.1.2581 | forgeSrc-1.12.2-14.23.1.2581.jar | None      |
    | UCHIJAAAA | plasmacannons | 0.1          | PlasmaCannon_2581_main           | None      |

    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'Intel' Version: '4.5.0 - Build 22.20.16.4749' Renderer: 'Intel(R) HD Graphics 620'
    Launched Version: 1.12.2
    LWJGL: 2.9.4
    OpenGL: Intel(R) HD Graphics 620 GL version 4.5.0 - Build 22.20.16.4749, Intel
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: 
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    CPU: 4x Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz

Posted (edited)
36 minutes ago, Terrails said:

Don't use fields like these


    TileEntity tileentity;
    TileEntityPlasmaCannon plasmacannon;

in your block to assign a tile.... blocks are singletons so all blocks will use the same tile then... just use World#getTileEntity and cast it to TileEntityPlasmaCannon...

Use World#getTileEntity in onBlockActivated... don't use instance fields

Edited by Terrails
Posted
5 minutes ago, Terrails said:

Use World#getTileEntity in onBlockActivated... don't use instance fields

Could you be more specific? I'm new to java and forge modding so I might lack of fundamental understanding on forge modding. By the way do you mean I should use  World#getTileEntity in onBlockAdded not onBlockActivated? cause I did not use instance fields in onBlockActivated.

Posted

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)

Thank you all for helping me! However none of the things you said fixes the problem. But after I insert 

if(this.plasmacannon == null)
{
    this.plasmacannon = (TileEntityPlasmaCannon) worldIn.getTileEntity(pos);
    plasmacannon.getstate(state);
}

in onBlockActivated, the game won't crash, but the tile entity stops updating. So the problem might be every time i reload saved world, my tileentityplasmacannon stops updating. But I really don't know how to fix that. Could this problem relates to tile entity registration? 

Edited by Ice2670
Posted (edited)

You are still using instance fields... you need something like this... all local variables

TileEntityPlasmaCannon tile = (TileEntityPlasmaCannon) worldIn.getTileEntity(pos);
tile.getstate(state);

I'll try to explain singletons a bit... I don't know if everything will be correct but basically... a singleton is only one instance of a class, which means that all blocks only use that one instance instead of a new instance for each block, so all instance fields (the variables of the class) are shared between blocks, for example in your code... you're assigning the tile entity of only one block to the field... which means all the other blocks would use that same tile entity since they share all instance fields, thats why you have to do everything in the methods you override. So when you place another block, that tile entity field would be changed and the block placed before wouldn't function correctly.

Edited by Terrails
Posted (edited)
19 minutes ago, Terrails said:

You are still using instance fields... you need something like this... all local variables


TileEntityPlasmaCannon tile = (TileEntityPlasmaCannon) worldIn.getTileEntity(pos);
tile.getstate(state);

 

if i make TileEntityPlasmaCannon tile local, than i will have to make another tile in onBlockAdded and that will crash the game. so i cannot use 2 different local tile in onBlockAdded and onBlockActivated.

Edited by Ice2670
Posted
4 minutes ago, Terrails said:

it will not crash the game... you're just getting the tile from that location, the tile was already created before onBlockAdded, onBlockActivated... etc

I don't understand how is the tile already created before onBlockAdded, onBlockActivated? I mean you cannot create tile without pos but the only 2 methods that have pos are onBlockAdded and onBlockActivated. And by the way, I already tried make the tile all local, and when i right click on the block the game crashes.

Posted (edited)

its something with your fireplasma method then... need a crash report. Tile gets created together with the block. what you’re doing with World#getTileEntity is just getting the tile entity that is on that pos

Edited by Terrails
Posted
Just now, Terrails said:

its something with your fireplasma method then... need a crash report

here

 

---- Minecraft Crash Report ----
// I just don't know what went wrong :(

Time: 6/5/18 6:24 PM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at com.ice2670.plasmacannon.tileentities.TileEntityPlasmaCannon.fireplasma(TileEntityPlasmaCannon.java:106)
    at com.ice2670.plasmacannon.blocks.BlockPlasmaCannon.onBlockActivated(BlockPlasmaCannon.java:94)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:455)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1933)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186)
    at net.minecraft.client.Minecraft.run(Minecraft.java:441)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
    at com.ice2670.plasmacannon.tileentities.TileEntityPlasmaCannon.fireplasma(TileEntityPlasmaCannon.java:106)
    at com.ice2670.plasmacannon.blocks.BlockPlasmaCannon.onBlockActivated(BlockPlasmaCannon.java:94)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:455)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['Player993'/247, l='MpServer', x=174.83, y=71.96, z=407.37]]
    Chunk stats: MultiplayerChunkCache: 585, 585
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: World: (280,64,278), Chunk: (at 8,4,6 in 17,17; contains blocks 272,0,272 to 287,255,287), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 59578 game time, 3631 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 102 total; [EntityCreeper['Creeper'/2, l='MpServer', x=99.42, y=24.00, z=442.50], EntityZombieVillager['Zombie Villager'/3, l='MpServer', x=108.50, y=48.00, z=365.50], EntityCreeper['Creeper'/4, l='MpServer', x=109.50, y=18.00, z=405.50], EntityBat['Bat'/5, l='MpServer', x=104.63, y=20.42, z=407.48], EntityBat['Bat'/6, l='MpServer', x=99.29, y=41.09, z=406.64], EntitySkeleton['Skeleton'/7, l='MpServer', x=111.54, y=27.00, z=450.72], EntitySquid['Squid'/9, l='MpServer', x=121.49, y=55.07, z=354.75], EntityZombie['Zombie'/10, l='MpServer', x=127.50, y=25.00, z=408.50], EntityCreeper['Creeper'/11, l='MpServer', x=122.50, y=16.00, z=408.50], EntityPig['Pig'/267, l='MpServer', x=157.69, y=64.00, z=480.48], EntityZombie['Zombie'/12, l='MpServer', x=122.77, y=11.00, z=463.45], EntityZombie['Zombie'/13, l='MpServer', x=112.50, y=32.00, z=450.50], EntityBat['Bat'/14, l='MpServer', x=128.49, y=38.10, z=462.52], EntityBat['Bat'/270, l='MpServer', x=238.34, y=28.92, z=485.37], EntitySkeleton['Skeleton'/15, l='MpServer', x=141.50, y=32.00, z=350.50], EntityZombie['Zombie'/271, l='MpServer', x=235.19, y=30.00, z=484.81], EntitySquid['Squid'/16, l='MpServer', x=139.46, y=59.25, z=344.96], EntitySquid['Squid'/17, l='MpServer', x=142.82, y=55.99, z=353.74], EntitySquid['Squid'/18, l='MpServer', x=132.87, y=62.29, z=351.17], EntitySkeleton['Skeleton'/19, l='MpServer', x=134.50, y=36.00, z=357.50], EntitySquid['Squid'/20, l='MpServer', x=142.72, y=60.99, z=385.50], EntitySquid['Squid'/21, l='MpServer', x=132.13, y=62.47, z=402.72], EntityZombie['Zombie'/22, l='MpServer', x=128.50, y=25.00, z=408.50], EntityWitch['Witch'/23, l='MpServer', x=139.07, y=18.00, z=413.49], EntityZombie['Zombie'/24, l='MpServer', x=128.90, y=17.00, z=411.51], EntityZombie['Zombie'/25, l='MpServer', x=139.50, y=17.00, z=408.50], EntityBat['Bat'/26, l='MpServer', x=121.75, y=16.67, z=411.65], EntityBat['Bat'/27, l='MpServer', x=128.56, y=42.02, z=417.42], EntitySquid['Squid'/28, l='MpServer', x=129.72, y=62.32, z=435.01], EntitySquid['Squid'/29, l='MpServer', x=133.60, y=62.06, z=430.65], EntitySquid['Squid'/30, l='MpServer', x=129.34, y=57.22, z=439.01], EntitySquid['Squid'/31, l='MpServer', x=125.24, y=61.60, z=441.04], EntityCreeper['Creeper'/32, l='MpServer', x=135.49, y=14.00, z=457.84], EntityCreeper['Creeper'/33, l='MpServer', x=132.30, y=15.00, z=460.43], EntityWitch['Witch'/34, l='MpServer', x=130.50, y=17.00, z=462.50], EntitySquid['Squid'/37, l='MpServer', x=162.98, y=59.51, z=343.54], EntitySkeleton['Skeleton'/38, l='MpServer', x=158.50, y=35.00, z=352.50], EntitySkeleton['Skeleton'/39, l='MpServer', x=147.02, y=14.00, z=394.61], EntitySkeleton['Skeleton'/40, l='MpServer', x=145.50, y=15.00, z=391.50], EntitySkeleton['Skeleton'/41, l='MpServer', x=149.50, y=30.00, z=410.50], EntityPlayerSP['Player993'/247, l='MpServer', x=174.83, y=71.96, z=407.37], EntityZombie['Zombie'/42, l='MpServer', x=146.50, y=30.00, z=402.50], EntityZombie['Zombie'/43, l='MpServer', x=150.50, y=18.00, z=415.76], EntityBat['Bat'/44, l='MpServer', x=156.32, y=41.10, z=414.39], EntitySkeleton['Skeleton'/45, l='MpServer', x=147.50, y=30.00, z=424.50], EntityZombie['Zombie'/46, l='MpServer', x=145.50, y=17.00, z=420.50], EntitySkeleton['Skeleton'/47, l='MpServer', x=158.50, y=26.00, z=429.50], EntityCreeper['Creeper'/48, l='MpServer', x=154.50, y=26.00, z=433.50], EntityBat['Bat'/49, l='MpServer', x=155.75, y=35.10, z=451.67], EntityPig['Pig'/50, l='MpServer', x=157.77, y=64.00, z=463.52], EntityBat['Bat'/51, l='MpServer', x=156.40, y=19.88, z=472.60], EntitySkeleton['Skeleton'/54, l='MpServer', x=165.50, y=22.00, z=367.50], EntityBat['Bat'/55, l='MpServer', x=160.25, y=33.10, z=364.75], EntityCreeper['Creeper'/56, l='MpServer', x=166.50, y=20.00, z=383.50], EntityPig['Pig'/57, l='MpServer', x=163.74, y=65.00, z=468.54], EntityCreeper['Creeper'/59, l='MpServer', x=180.50, y=23.00, z=335.50], EntityZombie['Zombie'/60, l='MpServer', x=188.50, y=10.00, z=371.50], EntityCreeper['Creeper'/61, l='MpServer', x=186.50, y=20.00, z=372.50], EntityEnderman['Enderman'/62, l='MpServer', x=183.61, y=20.00, z=369.50], EntityZombie['Zombie'/63, l='MpServer', x=187.19, y=52.00, z=397.44], EntityPig['Pig'/64, l='MpServer', x=181.51, y=65.00, z=451.22], EntityPig['Pig'/65, l='MpServer', x=181.31, y=63.00, z=476.78], EntityBat['Bat'/66, l='MpServer', x=186.37, y=54.07, z=481.72], EntityZombie['Zombie'/67, l='MpServer', x=201.78, y=17.00, z=342.52], EntitySpider['Spider'/68, l='MpServer', x=206.50, y=14.00, z=339.50], EntityPig['Pig'/69, l='MpServer', x=193.70, y=68.00, z=366.49], EntitySheep['Sheep'/70, l='MpServer', x=202.50, y=68.00, z=362.77], EntityPig['Pig'/71, l='MpServer', x=198.49, y=55.00, z=460.78], EntityEnderman['Enderman'/83, l='MpServer', x=217.30, y=27.00, z=342.30], EntitySkeleton['Skeleton'/84, l='MpServer', x=217.96, y=27.00, z=342.70], EntitySheep['Sheep'/85, l='MpServer', x=216.28, y=72.00, z=380.18], EntityChicken['Chicken'/86, l='MpServer', x=210.14, y=70.00, z=368.50], EntitySkeleton['Skeleton'/87, l='MpServer', x=223.50, y=32.00, z=409.50], EntityPig['Pig'/88, l='MpServer', x=223.69, y=64.00, z=466.47], EntityZombie['Zombie'/93, l='MpServer', x=234.50, y=45.00, z=350.50], EntitySkeleton['Skeleton'/94, l='MpServer', x=239.50, y=24.00, z=355.50], EntitySkeleton['Skeleton'/95, l='MpServer', x=238.50, y=39.00, z=362.50], EntityCreeper['Creeper'/96, l='MpServer', x=225.50, y=20.00, z=378.50], EntitySkeleton['Skeleton'/97, l='MpServer', x=226.50, y=59.00, z=439.50], EntitySkeleton['Skeleton'/98, l='MpServer', x=225.50, y=15.00, z=467.50], EntityZombie['Zombie'/99, l='MpServer', x=236.50, y=38.00, z=464.50], EntityZombie['Zombie'/100, l='MpServer', x=232.43, y=38.00, z=466.75], EntityZombie['Zombie'/102, l='MpServer', x=241.50, y=21.00, z=356.50], EntityZombie['Zombie'/103, l='MpServer', x=244.81, y=20.17, z=361.49], EntityEnderman['Enderman'/104, l='MpServer', x=241.50, y=43.00, z=365.50], EntityZombie['Zombie'/105, l='MpServer', x=241.01, y=43.00, z=358.70], EntityZombie['Zombie'/106, l='MpServer', x=240.30, y=43.00, z=358.43], EntityZombie['Zombie'/107, l='MpServer', x=252.49, y=59.00, z=365.24], EntityCreeper['Creeper'/108, l='MpServer', x=245.50, y=29.00, z=378.50], EntityCreeper['Creeper'/110, l='MpServer', x=251.50, y=22.00, z=378.50], EntityCreeper['Creeper'/111, l='MpServer', x=251.50, y=22.00, z=379.50], EntitySkeleton['Skeleton'/114, l='MpServer', x=244.51, y=38.00, z=370.67], EntitySkeleton['Skeleton'/115, l='MpServer', x=253.06, y=38.00, z=383.43], EntityZombie['Zombie'/116, l='MpServer', x=249.48, y=38.00, z=367.67], EntityBat['Bat'/117, l='MpServer', x=250.73, y=23.73, z=377.47], EntitySkeleton['Skeleton'/119, l='MpServer', x=250.54, y=64.00, z=424.50], EntityBat['Bat'/121, l='MpServer', x=243.25, y=30.10, z=460.75], EntityCreeper['Creeper'/122, l='MpServer', x=246.56, y=69.00, z=460.43], EntityPig['Pig'/123, l='MpServer', x=251.16, y=74.00, z=474.32], EntitySheep['Sheep'/124, l='MpServer', x=251.74, y=82.00, z=465.46], EntitySheep['Sheep'/130, l='MpServer', x=254.44, y=94.00, z=451.24], EntityPig['Pig'/255, l='MpServer', x=173.26, y=65.00, z=484.53]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2896)
    at net.minecraft.client.Minecraft.run(Minecraft.java:470)
    at net.minecraft.client.main.Main.main(Main.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:25)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_161, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 421376640 bytes (401 MB) / 787480576 bytes (751 MB) up to 1881145344 bytes (1794 MB)
    JVM Flags: 0 total; 
    IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
    FML: MCP 9.42 Powered by Forge 14.23.1.2581 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    | State     | ID            | Version      | Source                           | Signature |
    |:--------- |:------------- |:------------ |:-------------------------------- |:--------- |
    | UCHIJAAAA | minecraft     | 1.12.2       | minecraft.jar                    | None      |
    | UCHIJAAAA | mcp           | 9.42         | minecraft.jar                    | None      |
    | UCHIJAAAA | FML           | 8.0.99.99    | forgeSrc-1.12.2-14.23.1.2581.jar | None      |
    | UCHIJAAAA | forge         | 14.23.1.2581 | forgeSrc-1.12.2-14.23.1.2581.jar | None      |
    | UCHIJAAAA | plasmacannons | 0.1          | PlasmaCannon_2581_main           | None      |

    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'Intel' Version: '4.5.0 - Build 22.20.16.4749' Renderer: 'Intel(R) HD Graphics 620'
    Launched Version: 1.12.2
    LWJGL: 2.9.4
    OpenGL: Intel(R) HD Graphics 620 GL version 4.5.0 - Build 22.20.16.4749, Intel
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: 
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    CPU: 4x Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz

Posted
2 minutes ago, Terrails said:

its something with your fireplasma method then... need a crash report

and here's fireplasma

 

public void fireplasma(World worldIn, BlockPos pos, EntityPlayer playerIn) {

    //direction
    double d0 = pos.getX() + 0.5D + (float) enumfacing.getFrontOffsetX();
    double d1 = pos.getY() + 0.4D + (float) enumfacing.getFrontOffsetY();
    double d2 = pos.getZ() + 0.5D + (float) enumfacing.getFrontOffsetZ();



    if (enumfacing == EnumFacing.NORTH)
    {
        String str = Integer.toString(this.powerfactor);
        playerIn.sendMessage(new TextComponentString(str));
        EntityLargePlasmaBall entityplasmaball = new EntityLargePlasmaBall(worldIn, d0, d1, d2-1, powerfactor);

        entityplasmaball.shoot((double) enumfacing.getFrontOffsetX(), (double) enumfacing.getFrontOffsetY(), (double) enumfacing.getFrontOffsetZ(), 5, 0.01F);

        worldIn.spawnEntity(entityplasmaball);

    }

    if (enumfacing == EnumFacing.SOUTH)
    {
        String str = Integer.toString(this.powerfactor);
        playerIn.sendMessage(new TextComponentString(str));
        EntityLargePlasmaBall entityplasmaball = new EntityLargePlasmaBall(worldIn, d0, d1, d2+1, powerfactor);
        entityplasmaball.shoot((double) enumfacing.getFrontOffsetX(), (double) enumfacing.getFrontOffsetY(), (double) enumfacing.getFrontOffsetZ(), 5, 0.01F);

        worldIn.spawnEntity(entityplasmaball);

    }

    if (enumfacing == EnumFacing.EAST)
    {
        String str = Integer.toString(this.powerfactor);
        playerIn.sendMessage(new TextComponentString(str));
        EntityLargePlasmaBall entityplasmaball = new EntityLargePlasmaBall(worldIn, d0+1, d1, d2, powerfactor);
        entityplasmaball.shoot((double) enumfacing.getFrontOffsetX(), (double) enumfacing.getFrontOffsetY(), (double) enumfacing.getFrontOffsetZ(), 5, 0.01F);

        worldIn.spawnEntity(entityplasmaball);


    }

    if (enumfacing == EnumFacing.WEST)
    {
        String str = Integer.toString(this.powerfactor);
        playerIn.sendMessage(new TextComponentString(str));
        EntityLargePlasmaBall entityplasmaball = new EntityLargePlasmaBall(worldIn, d0-1, d1, d2, powerfactor);
        entityplasmaball.shoot((double) enumfacing.getFrontOffsetX(), (double) enumfacing.getFrontOffsetY(), (double) enumfacing.getFrontOffsetZ(), 5, 0.01F);

        worldIn.spawnEntity(entityplasmaball);


    }
}
Posted
19 minutes ago, Terrails said:

its something with your fireplasma method then... need a crash report

I still think whether the tile is local or not is not the problem, it's just every time I reload the saved world, the update method in TileEntityPlasmaCannon will stop working. Because even if i do not quit the game, reloading the saved world will make powerfactor unchangeable. 

Posted

Because your instance fields are not saved. Because they shouldn't exist at all. 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
1 minute ago, Draco18s said:

Because your instance fields are not saved. Because they shouldn't exist at all. 

but if i do not make it instance there will be other problems. is there a way to create this instance field every time the game is reloaded?

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



×
×
  • Create New...

Important Information

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