Jump to content

Recommended Posts

Posted

Hey,

in eclipse all works fine.. When I try to run Minecraft 1.7 (not eclipse) it'll crash with this error:

 

 

---- Minecraft Crash Report ----

// Uh... Did I do that?

 

Time: 25.02.14 16:30

Description: There was a severe problem during mod loading that has caused the game to fail

 

cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: MyMod/blocks/MyModBlockPortal

at cpw.mods.fml.common.LoadController.transition(LoadController.java:163)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:497)

at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:201)

at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:498)

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:853)

at net.minecraft.client.main.Main.main(SourceFile:103)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

Caused by: java.lang.NoClassDefFoundError: MyMod/blocks/MyModBlockPortal

at MyMod.blocks.MyModBlocks.<init>(MyModBlocks.java:41)

at MyMod.MyMod.preInit(MyMod.java:103)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:536)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:209)

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:188)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47)

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

at com.google.common.eventbus.EventBus.post(EventBus.java:267)

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)

at cpw.mods.fml.common.Loader.loadMods(Loader.java:495)

... 10 more

Caused by: java.lang.ClassNotFoundException: MyMod.blocks.MyModBlockPortal

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:188)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 39 more

Caused by: java.lang.StackOverflowError

at java.util.HashMap.getEntry(Unknown Source)

at java.util.HashMap.get(Unknown Source)

at com.google.common.collect.AbstractMapBasedMultimap.get(AbstractMapBasedMultimap.java:304)

at com.google.common.collect.AbstractListMultimap.get(AbstractListMultimap.java:66)

at com.google.common.collect.ArrayListMultimap.get(ArrayListMultimap.java:66)

at cpw.mods.fml.common.patcher.ClassPatchManager.applyPatch(ClassPatchManager.java:72)

at cpw.mods.fml.common.patcher.ClassPatchManager.getPatchedResource(ClassPatchManager.java:60)

at cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.findAndMergeSuperMaps(FMLDeobfuscatingRemapper.java:368)

at cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.mergeSuperMaps(FMLDeobfuscatingRemapper.java:401)

at cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.findAndMergeSuperMaps(FMLDeobfuscatingRemapper.java:375)

at cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.mergeSuperMaps(FMLDeobfuscatingRemapper.java:401)

at cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.findAndMergeSuperMaps(FMLDeobfuscatingRemapper.java:375)

at cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.mergeSuperMaps(FMLDeobfuscatingRemapper.java:401)

at cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.findAndMergeSuperMaps(FMLDeobfuscatingRemapper.java:375)

at cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper.mergeSuperMaps(FMLDeobfuscatingRemapper.java:401) AND MUCH MORE OF THIS

 

 

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

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.7.2

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.7.0_51, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 24965200 bytes (23 MB) / 153858048 bytes (146 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx512M -Xmx1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML: MCP v9.01-pre FML v7.2.125.1034 Minecraft Forge 10.12.0.1034 4 mods loaded, 4 mods active

mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized

FML{7.2.125.1034} [Forge Mod Loader] (forge-1.7.2-10.12.0.1034.jar) Unloaded->Constructed->Pre-initialized

Forge{10.12.0.1034} [Minecraft Forge] (forge-1.7.2-10.12.0.1034.jar) Unloaded->Constructed->Pre-initialized

MyMod{3.1} [MyMod] (MyMod-3.1.jar) Unloaded->Constructed->Errored

 

 

 

MyModBlocks: Registry of my blocks..

 

 

public static Block Obsidian;

public static Block Portal;

 

Obsidian = new MyModBlockObsidian().setBlockName("Obsidian");

Portal = new MyModBlockPortal().setBlockName("Portal").setHardness(-1.0F).setLightLevel(0.75F);

 

GameRegistry.registerBlock(Obsidian, "Smaragdobsidian");

GameRegistry.registerBlock(Portal, "Portal");

 

 

 

MyModBlockObsidian: Same as BlockObsidian.

MyModBlockPortal: Same as BlockPortal (but with my blocks)

MyMod: Line 103: new MyModBlocks();

 

Thanks for help! :)

Posted

It just can be in my MyModBlockPortal class.

The only func that I found is this:

 

 

    public boolean func_150000_e(World p_150000_1_, int p_150000_2_, int p_150000_3_, int p_150000_4_)

    {

        MyModBlockPortal.Size size = new MyModBlockPortal.Size(p_150000_1_, p_150000_2_, p_150000_3_, p_150000_4_, 1);

        MyModBlockPortal.Size size1 = new MyModBlockPortal.Size(p_150000_1_, p_150000_2_, p_150000_3_, p_150000_4_, 2);

 

        if (size.func_150860_b() && size.field_150864_e == 0)

        {

            size.func_150859_c();

            return true;

        }

        else if (size1.func_150860_b() && size1.field_150864_e == 0)

        {

            size1.func_150859_c();

            return true;

        }

        else

        {

            return false;

        }

    }

 

 

 

But there are many more in the part at the bottom IN this class:

 

 

    public static class Size

        {

            private final World field_150867_a;

            private final int field_150865_b;

            private final int field_150866_c;

            private final int field_150863_d;

            private int field_150864_e = 0;

            private ChunkCoordinates field_150861_f;

            private int field_150862_g;

            private int field_150868_h;

            private static final String __OBFID = "CL_00000285";

 

            public Size(World p_i45415_1_, int p_i45415_2_, int p_i45415_3_, int p_i45415_4_, int p_i45415_5_)

            {

                this.field_150867_a = p_i45415_1_;

                this.field_150865_b = p_i45415_5_;

                this.field_150863_d = MyModBlockPortal.field_150001_a[p_i45415_5_][0];

                this.field_150866_c = MyModBlockPortal.field_150001_a[p_i45415_5_][1];

 

                for (int i1 = p_i45415_3_; p_i45415_3_ > i1 - 21 && p_i45415_3_ > 0 && this.func_150857_a(p_i45415_1_.getBlock(p_i45415_2_, p_i45415_3_ - 1, p_i45415_4_)); --p_i45415_3_)

                {

                    ;

                }

 

                int j1 = this.func_150853_a(p_i45415_2_, p_i45415_3_, p_i45415_4_, this.field_150863_d) - 1;

 

                if (j1 >= 0)

                {

                    this.field_150861_f = new ChunkCoordinates(p_i45415_2_ + j1 * Direction.offsetX[this.field_150863_d], p_i45415_3_, p_i45415_4_ + j1 * Direction.offsetZ[this.field_150863_d]);

                    this.field_150868_h = this.func_150853_a(this.field_150861_f.posX, this.field_150861_f.posY, this.field_150861_f.posZ, this.field_150866_c);

 

                    if (this.field_150868_h < 2 || this.field_150868_h > 21)

                    {

                        this.field_150861_f = null;

                        this.field_150868_h = 0;

                    }

                }

 

                if (this.field_150861_f != null)

                {

                    this.field_150862_g = this.func_150858_a();

                }

            }

 

            protected int func_150853_a(int p_150853_1_, int p_150853_2_, int p_150853_3_, int p_150853_4_)

            {

                int j1 = Direction.offsetX[p_150853_4_];

                int k1 = Direction.offsetZ[p_150853_4_];

                int i1;

                Block block;

 

                for (i1 = 0; i1 < 22; ++i1)

                {

                    block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);

 

                    if (!this.func_150857_a(block))

                    {

                        break;

                    }

 

                    Block block1 = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_ - 1, p_150853_3_ + k1 * i1);

 

                    if (block1 != MyModBlocks.Obsidian)

                    {

                        break;

                    }

                }

 

                block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);

                return block == MyModBlocks.Obsidian ? i1 : 0;

            }

 

            protected int func_150858_a()

            {

                int i;

                int j;

                int k;

                int l;

                label56:

 

                for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)

                {

                    i = this.field_150861_f.posY + this.field_150862_g;

 

                    for (j = 0; j < this.field_150868_h; ++j)

                    {

                        k = this.field_150861_f.posX + j * Direction.offsetX[MyModBlockPortal.field_150001_a[this.field_150865_b][1]];

                        l = this.field_150861_f.posZ + j * Direction.offsetZ[MyModBlockPortal.field_150001_a[this.field_150865_b][1]];

                        Block block = this.field_150867_a.getBlock(k, i, l);

 

                        if (!this.func_150857_a(block))

                        {

                            break label56;

                        }

 

                        if (block == MyModBlocks.Portal)

                        {

                            ++this.field_150864_e;

                        }

 

                        if (j == 0)

                        {

                            block = this.field_150867_a.getBlock(k + Direction.offsetX[MyModBlockPortal.field_150001_a[this.field_150865_b][0]], i, l + Direction.offsetZ[MyModBlockPortal.field_150001_a[this.field_150865_b][0]]);

 

                            if (block != MyModBlocks.Obsidian)

                            {

                                break label56;

                            }

                        }

                        else if (j == this.field_150868_h - 1)

                        {

                            block = this.field_150867_a.getBlock(k + Direction.offsetX[MyModBlockPortal.field_150001_a[this.field_150865_b][1]], i, l + Direction.offsetZ[MyModBlockPortal.field_150001_a[this.field_150865_b][1]]);

 

                            if (block != MyModBlocks.Obsidian)

                            {

                                break label56;

                            }

                        }

                    }

                }

 

                for (i = 0; i < this.field_150868_h; ++i)

                {

                    j = this.field_150861_f.posX + i * Direction.offsetX[MyModBlockPortal.field_150001_a[this.field_150865_b][1]];

                    k = this.field_150861_f.posY + this.field_150862_g;

                    l = this.field_150861_f.posZ + i * Direction.offsetZ[MyModBlockPortal.field_150001_a[this.field_150865_b][1]];

 

                    if (this.field_150867_a.getBlock(j, k, l) != MyModBlocks.Obsidian)

                    {

                        this.field_150862_g = 0;

                        break;

                    }

                }

 

                if (this.field_150862_g <= 21 && this.field_150862_g >= 3)

                {

                    return this.field_150862_g;

                }

                else

                {

                    this.field_150861_f = null;

                    this.field_150868_h = 0;

                    this.field_150862_g = 0;

                    return 0;

                }

            }

 

            protected boolean func_150857_a(Block p_150857_1_)

            {

                return p_150857_1_.getMaterial() == Material.air || p_150857_1_ == MyModBlocks.Fire || p_150857_1_ == MyModBlocks.Portal;

            }

 

            public boolean func_150860_b()

            {

                return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21;

            }

 

            public void func_150859_c()

            {

                for (int i = 0; i < this.field_150868_h; ++i)

                {

                    int j = this.field_150861_f.posX + Direction.offsetX[this.field_150866_c] * i;

                    int k = this.field_150861_f.posZ + Direction.offsetZ[this.field_150866_c] * i;

 

                    for (int l = 0; l < this.field_150862_g; ++l)

                    {

                        int i1 = this.field_150861_f.posY + l;

                        this.field_150867_a.setBlock(j, i1, k, MyModBlocks.Portal, this.field_150865_b, 2);

                    }

                }

            }

        }

 

 

Should I edit the field at the top of the whole class?

public static final int[][] field_150001_a = new int[][] {new int[0], {3, 1}, {2, 0}};

Posted

The class in the MyModBlockPortal class? :D

 

 

 

    public static class Size

        {

            private final World world;

            private final int int1;

            private final int int2;

            private final int int3;

            private int int4 = 0;

            private ChunkCoordinates coords;

            private int int5;

            private int int6;

 

            public Size(World world, int par2, int par3, int par4, int par5)

            {

                this.world = world;

                this.int1 = par5;

                this.int3 = MyModBlockPortal.aField[par5][0];

                this.int2 = MyModBlockPortal.aField[par5][1];

 

                for (int i1 = par3; par3 > i1 - 21 && par3 > 0 && this.func_150857_a(world.getBlock(par2, par3 - 1, par4)); --par3)

                {

                    ;

                }

 

                int j1 = this.func_150853_a(par2, par3, par4, this.int3) - 1;

 

                if (j1 >= 0)

                {

                    this.coords = new ChunkCoordinates(par2 + j1 * Direction.offsetX[this.int3], par3, par4 + j1 * Direction.offsetZ[this.int3]);

                    this.int6 = this.func_150853_a(this.coords.posX, this.coords.posY, this.coords.posZ, this.int2);

 

                    if (this.int6 < 2 || this.int6 > 21)

                    {

                        this.coords = null;

                        this.int6 = 0;

                    }

                }

 

                if (this.coords != null)

                {

                    this.int5 = this.func_150858_a();

                }

            }

 

            protected int func_150853_a(int par1, int par2, int par3, int par4)

            {

                int j1 = Direction.offsetX[par4];

                int k1 = Direction.offsetZ[par4];

                int i1;

                Block block;

 

                for (i1 = 0; i1 < 22; ++i1)

                {

                    block = this.world.getBlock(par1 + j1 * i1, par2, par3 + k1 * i1);

 

                    if (!this.func_150857_a(block))

                    {

                        break;

                    }

 

                    Block block1 = this.world.getBlock(par1 + j1 * i1, par2 - 1, par3 + k1 * i1);

 

                    if (block1 != MyModBlocks.Obsidian)

                    {

                        break;

                    }

                }

 

                block = this.world.getBlock(par1 + j1 * i1, par2, par3 + k1 * i1);

                return block == MyModBlocks.Obsidian ? i1 : 0;

            }

 

            protected int func_150858_a()

            {

                int i;

                int j;

                int k;

                int l;

                label56:

 

                for (this.int5 = 0; this.int5 < 21; ++this.int5)

                {

                    i = this.coords.posY + this.int5;

 

                    for (j = 0; j < this.int6; ++j)

                    {

                        k = this.coords.posX + j * Direction.offsetX[MyModBlockPortal.aField[this.int1][1]];

                        l = this.coords.posZ + j * Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]];

                        Block block = this.world.getBlock(k, i, l);

 

                        if (!this.func_150857_a(block))

                        {

                            break label56;

                        }

 

                        if (block == MyModBlocks.Portal)

                        {

                            ++this.int4;

                        }

 

                        if (j == 0)

                        {

                            block = this.world.getBlock(k + Direction.offsetX[MyModBlockPortal.aField[this.int1][0]], i, l + Direction.offsetZ[MyModBlockPortal.aField[this.int1][0]]);

 

                            if (block != MyModBlocks.Obsidian)

                            {

                                break label56;

                            }

                        }

                        else if (j == this.int6 - 1)

                        {

                            block = this.world.getBlock(k + Direction.offsetX[MyModBlockPortal.aField[this.int1][1]], i, l + Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]]);

 

                            if (block != MyModBlocks.Obsidian)

                            {

                                break label56;

                            }

                        }

                    }

                }

 

                for (i = 0; i < this.int6; ++i)

                {

                    j = this.coords.posX + i * Direction.offsetX[MyModBlockPortal.aField[this.int1][1]];

                    k = this.coords.posY + this.int5;

                    l = this.coords.posZ + i * Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]];

 

                    if (this.world.getBlock(j, k, l) != MyModBlocks.Obsidian)

                    {

                        this.int5 = 0;

                        break;

                    }

                }

 

                if (this.int5 <= 21 && this.int5 >= 3)

                {

                    return this.int5;

                }

                else

                {

                    this.coords = null;

                    this.int6 = 0;

                    this.int5 = 0;

                    return 0;

                }

            }

 

            protected boolean func_150857_a(Block block)

            {

                return block.getMaterial() == Material.air || block == MyModBlocks.Fire || block == MyModBlocks.Portal;

            }

 

            public boolean func_150860_b()

            {

                return this.coords != null && this.int6 >= 2 && this.int6 <= 21 && this.int5 >= 3 && this.int5 <= 21;

            }

 

            public void func_150859_c()

            {

                for (int i = 0; i < this.int6; ++i)

                {

                    int j = this.coords.posX + Direction.offsetX[this.int2] * i;

                    int k = this.coords.posZ + Direction.offsetZ[this.int2] * i;

 

                    for (int l = 0; l < this.int5; ++l)

                    {

                        int i1 = this.coords.posY + l;

                        this.world.setBlock(j, i1, k, MyModBlocks.Portal, this.int1, 2);

                    }

                }

            }

        }

 

 

Posted

Sorry :D. But could you say to me which these 6 func_* methods do?

 

 

 

    public boolean func_150000_e(World world, int x, int y, int z)

    {

        MyModBlockPortal.Size size = new MyModBlockPortal.Size(world, x, y, z, 1);

        MyModBlockPortal.Size size1 = new MyModBlockPortal.Size(world, x, y, z, 2);

 

        if (size.func_150860_b() && size.int4 == 0)

        {

            size.func_150859_c();

            return true;

        }

        else if (size1.func_150860_b() && size1.int4 == 0)

        {

            size1.func_150859_c();

            return true;

        }

        else

        {

            return false;

        }

    }

 

 

 

 

 

    public static class Size

        {

            private final World world;

            private final int int1;

            private final int int2;

            private final int int3;

            private int int4 = 0;

            private ChunkCoordinates coords;

            private int int5;

            private int int6;

 

            public Size(World world, int par2, int par3, int par4, int par5)

            {

                this.world = world;

                this.int1 = par5;

                this.int3 = MyModBlockPortal.aField[par5][0];

                this.int2 = MyModBlockPortal.aField[par5][1];

 

                for (int i1 = par3; par3 > i1 - 21 && par3 > 0 && this.func_150857_a(world.getBlock(par2, par3 - 1, par4)); --par3)

                {

                    ;

                }

 

                int j1 = this.func_150853_a(par2, par3, par4, this.int3) - 1;

 

                if (j1 >= 0)

                {

                    this.coords = new ChunkCoordinates(par2 + j1 * Direction.offsetX[this.int3], par3, par4 + j1 * Direction.offsetZ[this.int3]);

                    this.int6 = this.func_150853_a(this.coords.posX, this.coords.posY, this.coords.posZ, this.int2);

 

                    if (this.int6 < 2 || this.int6 > 21)

                    {

                        this.coords = null;

                        this.int6 = 0;

                    }

                }

 

                if (this.coords != null)

                {

                    this.int5 = this.func_150858_a();

                }

            }

 

            protected int func_150853_a(int par1, int par2, int par3, int par4)

            {

                int j1 = Direction.offsetX[par4];

                int k1 = Direction.offsetZ[par4];

                int i1;

                Block block;

 

                for (i1 = 0; i1 < 22; ++i1)

                {

                    block = this.world.getBlock(par1 + j1 * i1, par2, par3 + k1 * i1);

 

                    if (!this.func_150857_a(block))

                    {

                        break;

                    }

 

                    Block block1 = this.world.getBlock(par1 + j1 * i1, par2 - 1, par3 + k1 * i1);

 

                    if (block1 != MyModBlocks.Obsidian)

                    {

                        break;

                    }

                }

 

                block = this.world.getBlock(par1 + j1 * i1, par2, par3 + k1 * i1);

                return block == MyModBlocks.Obsidian ? i1 : 0;

            }

 

            protected int func_150858_a()

            {

                int i;

                int j;

                int k;

                int l;

                label56:

 

                for (this.int5 = 0; this.int5 < 21; ++this.int5)

                {

                    i = this.coords.posY + this.int5;

 

                    for (j = 0; j < this.int6; ++j)

                    {

                        k = this.coords.posX + j * Direction.offsetX[MyModBlockPortal.aField[this.int1][1]];

                        l = this.coords.posZ + j * Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]];

                        Block block = this.world.getBlock(k, i, l);

 

                        if (!this.func_150857_a(block))

                        {

                            break label56;

                        }

 

                        if (block == MyModBlocks.Portal)

                        {

                            ++this.int4;

                        }

 

                        if (j == 0)

                        {

                            block = this.world.getBlock(k + Direction.offsetX[MyModBlockPortal.aField[this.int1][0]], i, l + Direction.offsetZ[MyModBlockPortal.aField[this.int1][0]]);

 

                            if (block != MyModBlocks.Obsidian)

                            {

                                break label56;

                            }

                        }

                        else if (j == this.int6 - 1)

                        {

                            block = this.world.getBlock(k + Direction.offsetX[MyModBlockPortal.aField[this.int1][1]], i, l + Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]]);

 

                            if (block != MyModBlocks.Obsidian)

                            {

                                break label56;

                            }

                        }

                    }

                }

 

                for (i = 0; i < this.int6; ++i)

                {

                    j = this.coords.posX + i * Direction.offsetX[MyModBlockPortal.aField[this.int1][1]];

                    k = this.coords.posY + this.int5;

                    l = this.coords.posZ + i * Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]];

 

                    if (this.world.getBlock(j, k, l) != MyModBlocks.Obsidian)

                    {

                        this.int5 = 0;

                        break;

                    }

                }

 

                if (this.int5 <= 21 && this.int5 >= 3)

                {

                    return this.int5;

                }

                else

                {

                    this.coords = null;

                    this.int6 = 0;

                    this.int5 = 0;

                    return 0;

                }

            }

 

            protected boolean func_150857_a(Block block)

            {

                return block.getMaterial() == Material.air || block == MyModBlocks.Fire || block == MyModBlocks.Portal;

            }

 

            public boolean func_150860_b()

            {

                return this.coords != null && this.int6 >= 2 && this.int6 <= 21 && this.int5 >= 3 && this.int5 <= 21;

            }

 

            public void func_150859_c()

            {

                for (int i = 0; i < this.int6; ++i)

                {

                    int j = this.coords.posX + Direction.offsetX[this.int2] * i;

                    int k = this.coords.posZ + Direction.offsetZ[this.int2] * i;

 

                    for (int l = 0; l < this.int5; ++l)

                    {

                        int i1 = this.coords.posY + l;

                        this.world.setBlock(j, i1, k, MyModBlocks.Portal, this.int1, 2);

                    }

                }

            }

        }

 

 

Thanks.

Posted

Your Size class does not extend or implement anything. How on earth could any of the methods in there override anything? This is basic java!

And for the other class: Use your IDE. In Intellij IDEA you can see it an overridden method by the small symbol on the left:

vdOp86f.png

 

Eclipse doesn't have that, but if you hold Ctrl down and hover over the method name you can see this:

4etBmor.png

if the method is overridden.

Actually, eclipse has a icon like that. When you have a green arrow pointing up in that sidebar, you can see what that method does, in my case

W5vJ3Gh.png

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

 

 

    public boolean tryToCreatePortal(World world, int x, int y, int z) <---Is used in Fireclass!

    {

        MyModBlockPortal.Size size = new MyModBlockPortal.Size(world, x, y, z, 1);

      MyModBlockPortal.Size size1 = new MyModBlockPortal.Size(world, x, y, z, 2);

 

        if (size.something3() && size.int4 == 0)

        {

            size.something5();

            return true;

        }

        else if (size1.something3() && size1.int4 == 0)

        {

            size1.something5();

            return true;

        }

        else

        {

            return false;

        }

    }

    public static class Size

        {

            private final World world;

            private final int int1;

            private final int int2;

            private final int int3;

            private int int4 = 0;

            private ChunkCoordinates coords;

            private int int5;

            private int int6;

 

            public Size(World world, int par2, int par3, int par4, int par5)

            {

            super();

                this.world = world;

                this.int1 = par5;

                this.int3 = MyModBlockPortal.aField[par5][0];

                this.int2 = MyModBlockPortal.aField[par5][1];

 

                for (int i1 = par3; par3 > i1 - 21 && par3 > 0 && this.something4(world.getBlock(par2, par3 - 1, par4)); --par3)

                {

                    ;

                }

 

                int j1 = this.something1(par2, par3, par4, this.int3) - 1;

 

                if (j1 >= 0)

                {

                    this.coords = new ChunkCoordinates(par2 + j1 * Direction.offsetX[this.int3], par3, par4 + j1 * Direction.offsetZ[this.int3]);

                    this.int6 = this.something1(this.coords.posX, this.coords.posY, this.coords.posZ, this.int2);

 

                    if (this.int6 < 2 || this.int6 > 21)

                    {

                        this.coords = null;

                        this.int6 = 0;

                    }

                }

 

                if (this.coords != null)

                {

                    this.int5 = this.something2();

                }

            }

 

            protected int something1(int par1, int par2, int par3, int par4)

            {

                int j1 = Direction.offsetX[par4];

                int k1 = Direction.offsetZ[par4];

                int i1;

                Block block;

 

                for (i1 = 0; i1 < 22; ++i1)

                {

                    block = this.world.getBlock(par1 + j1 * i1, par2, par3 + k1 * i1);

 

                    if (!this.something4(block))

                    {

                        break;

                    }

 

                    Block block1 = this.world.getBlock(par1 + j1 * i1, par2 - 1, par3 + k1 * i1);

 

                    if (block1 != MyModBlocks.Obsidian)

                    {

                        break;

                    }

                }

 

                block = this.world.getBlock(par1 + j1 * i1, par2, par3 + k1 * i1);

                return block == MyModBlocks.Obsidian ? i1 : 0;

            }

 

            protected int something2()

            {

                int i;

                int j;

                int k;

                int l;

                label56:

 

                for (this.int5 = 0; this.int5 < 21; ++this.int5)

                {

                    i = this.coords.posY + this.int5;

 

                    for (j = 0; j < this.int6; ++j)

                    {

                        k = this.coords.posX + j * Direction.offsetX[MyModBlockPortal.aField[this.int1][1]];

                        l = this.coords.posZ + j * Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]];

                        Block block = this.world.getBlock(k, i, l);

 

                        if (!this.something4(block))

                        {

                            break label56;

                        }

 

                        if (block == MyModBlocks.Portal)

                        {

                            ++this.int4;

                        }

 

                        if (j == 0)

                        {

                            block = this.world.getBlock(k + Direction.offsetX[MyModBlockPortal.aField[this.int1][0]], i, l + Direction.offsetZ[MyModBlockPortal.aField[this.int1][0]]);

 

                            if (block != MyModBlocks.Obsidian)

                            {

                                break label56;

                            }

                        }

                        else if (j == this.int6 - 1)

                        {

                            block = this.world.getBlock(k + Direction.offsetX[MyModBlockPortal.aField[this.int1][1]], i, l + Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]]);

 

                            if (block != MyModBlocks.Obsidian)

                            {

                                break label56;

                            }

                        }

                    }

                }

 

                for (i = 0; i < this.int6; ++i)

                {

                    j = this.coords.posX + i * Direction.offsetX[MyModBlockPortal.aField[this.int1][1]];

                    k = this.coords.posY + this.int5;

                    l = this.coords.posZ + i * Direction.offsetZ[MyModBlockPortal.aField[this.int1][1]];

 

                    if (this.world.getBlock(j, k, l) != MyModBlocks.Obsidian)

                    {

                        this.int5 = 0;

                        break;

                    }

                }

 

                if (this.int5 <= 21 && this.int5 >= 3)

                {

                    return this.int5;

                }

                else

                {

                    this.coords = null;

                    this.int6 = 0;

                    this.int5 = 0;

                    return 0;

                }

            }

           

            public boolean something3()

            {

                return this.coords != null && this.int6 >= 2 && this.int6 <= 21 && this.int5 >= 3 && this.int5 <= 21;

            }

 

            protected boolean something4(Block block)

            {

                return block.getMaterial() == Material.air || block == MyModBlocks.Fire || block == MyModBlocks.Portal;

            }

 

            public void something5()

            {

                for (int i = 0; i < this.int6; ++i)

                {

                    int j = this.coords.posX + Direction.offsetX[this.int2] * i;

                    int k = this.coords.posZ + Direction.offsetZ[this.int2] * i;

 

                    for (int l = 0; l < this.int5; ++l)

                    {

                        int i1 = this.coords.posY + l;

                        this.world.setBlock(j, i1, k, MyModBlocks.Portal, this.int1, 2);

                    }

                }

            }

        }

}

 

 

Posted

There's my Portal class. In there is another class called 'Size'. 1 func_* was in my Portal class and was in 1.6.4 named 'tryToCreatePortal' (It named it to this). In the Size class (in my Portal class) are 5 more func_* methods, which I renamed to 'something1,2,3,4 or 5'.

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

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

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