Jump to content

TominoCZ

Members
  • Posts

    117
  • Joined

  • Last visited

Posts posted by TominoCZ

  1. this is what I edited in EntityDiggingFX.class(yes, I'm doing this in MCP):

     

    public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_)
        {
            float var8 = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
            float var9 = var8 + 0.015609375F;
            float var10 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
            float var11 = var10 + 0.015609375F;
            float var12 = 0.1F * this.particleScale;
    
            if (this.particleIcon != null)
            {
            	var8 = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
                var9 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
                var10 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
                var11 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
            }
    
            float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)p_70539_2_ - interpPosX);
            float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)p_70539_2_ - interpPosY) - var12 / 2;
            float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)p_70539_2_ - interpPosZ);
            p_70539_1_.setColorOpaque_F(1F, 1F, 1F);
            //TODO
            
            //var8, var9 - X U
            //var 10, var 11 - Y V
            
            //front
            
            p_70539_1_.addVertexWithUV(var13,         var14,         var15, (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13,         var14 + var12, var15, (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15, (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14,         var15, (double)var9, (double)var10);
          
            //back
            p_70539_1_.addVertexWithUV(var13 + var12, var14,         var15 + var12, (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15 + var12, (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13,         var14 + var12, var15 + var12, (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13,         var14,         var15 + var12, (double)var9, (double)var10);
            
            //left
            p_70539_1_.addVertexWithUV(var13, var14,         var15 + var12, (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13, var14 + var12, var15 + var12, (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13, var14 + var12, var15,         (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13, var14,         var15,         (double)var9, (double)var10);
            
            //right
            p_70539_1_.addVertexWithUV(var13 + var12, var14,         var15,         (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15,         (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15 + var12, (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14,         var15 + var12, (double)var9, (double)var10);
            
            //top
            p_70539_1_.addVertexWithUV(var13,         var14 + var12, var15,         (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13,         var14 + var12, var15 + var12, (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15 + var12, (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15,         (double)var9, (double)var10);
            
            //bottom
            p_70539_1_.addVertexWithUV(var13,         var14, var15 + var12, (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13,         var14, var15,         (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14, var15,         (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14, var15 + var12, (double)var9, (double)var10);
    
        }

     

    now how do I make the cube rotate randomly while falling? By adding some code to the onUpdate method in EntityFX perhabs?

  2. I tried to do this many times.. searched on google, even followed this tutorial: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing

    but still I have no damn idea how it works and how to do it.

    I basically what to do this: https://www.youtube.com/watch?v=6osH9bUVpsU work with forge (I made this in MCP 1.7.10)

    Is there any easier way to do this?

     

    if not, let's say I want to replace a method using Class.getClass().getMethod() maybe?

     

    Also the class' name after reobfuscating (using MCP) is bld.class...

  3. Ok.. I did a little bit of research and learned how the vertexes with UV work nad played with it in MCP for a while(not forge, an internal mod - modified base class). This is the result: https://www.youtube.com/watch?v=6osH9bUVpsU

    Now all I need is to make this work with forge. And that is by making this a core mod. Just like the NotEnoughItems mod.. But I just couldn't figure out how.

     

    thanks  to this method I changed in EntityDiggingFX.class[MCP]:

    public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_)
        {
            float var8 = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
            float var9 = var8 + 0.015609375F;
            float var10 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
            float var11 = var10 + 0.015609375F;
            float var12 = 0.1F * this.particleScale;
    
            if (this.particleIcon != null)
            {
            	var8 = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
                var9 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
                var10 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
                var11 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
            }
    
            float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)p_70539_2_ - interpPosX);
            float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)p_70539_2_ - interpPosY) - var12 / 2;
            float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)p_70539_2_ - interpPosZ);
            p_70539_1_.setColorOpaque_F(1F, 1F, 1F); 
            //TODO
            
            //var8, var9 - X U
            //var 10, var 11 - Y V
            
            //front face
            p_70539_1_.addVertexWithUV(var13,         var14,         var15, (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13,         var14 + var12, var15, (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15, (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14,         var15, (double)var9, (double)var10);
          
            //back face
            p_70539_1_.addVertexWithUV(var13 + var12, var14,         var15 + var12, (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15 + var12, (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13,         var14 + var12, var15 + var12, (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13,         var14,         var15 + var12, (double)var9, (double)var10);
            
            //left face
            p_70539_1_.addVertexWithUV(var13, var14,         var15 + var12, (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13, var14 + var12, var15 + var12, (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13, var14 + var12, var15,         (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13, var14,         var15,         (double)var9, (double)var10);
            
            //right face
            p_70539_1_.addVertexWithUV(var13 + var12, var14,         var15,         (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15,         (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15 + var12, (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14,         var15 + var12, (double)var9, (double)var10);
            
            //top face
            p_70539_1_.addVertexWithUV(var13,         var14 + var12, var15,         (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13,         var14 + var12, var15 + var12, (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15 + var12, (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14 + var12, var15,         (double)var9, (double)var10);
            
            //bottom face
            p_70539_1_.addVertexWithUV(var13,         var14, var15 + var12, (double)var8, (double)var10);
            p_70539_1_.addVertexWithUV(var13,         var14, var15,         (double)var8, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14, var15,         (double)var9, (double)var11);
            p_70539_1_.addVertexWithUV(var13 + var12, var14, var15 + var12, (double)var9, (double)var10);
    
        }

     

    For forge, you add this piece of code to a new class extending EntityFX or EntityDiggingFX...

    Spawn it with Minecraft.getMinecraft().addEffect.effectRenderer(new [your Particle Class]([params]))

  4. well since I don't really play any modpacks, I think it'll be ok with just block particles(breaking, and sprinting particles of the block you sprint on) :D

    And another thing is that I don't know how to register the class with the effects and make it a core mod......

    Also about that video.. that modpack runs on a minecraft client, that is customized including it'd LWJGL libraries....

     

    I looked into the source code of the minecraft.jar file (the menu says  it's MC1.8 though) and they use Vector3 and such.. which I don't know how to use here.... one of my friends actually did make 3D particles but not using a core mod(they didn't replace the original ones..). I asked him for the code so I'm still waiting for response..

  5. I want to make my block spawn 3D little cube particles that look similar to this:

    (craftland.org custom minecraft client with custom aether mod, multiplayer only).

     

    I use a tessellator to draw.

     

    here's my FX class:

     

    package com.fancyparticles.mod;
    import static org.lwjgl.opengl.GL11.GL_BLEND;
    import static org.lwjgl.opengl.GL11.GL_GREATER;
    import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
    import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
    import static org.lwjgl.opengl.GL11.glAlphaFunc;
    import static org.lwjgl.opengl.GL11.glBlendFunc;
    import static org.lwjgl.opengl.GL11.glDepthMask;
    import static org.lwjgl.opengl.GL11.glDisable;
    
    import java.util.Random;
    
    import org.lwjgl.opengl.GL11;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.particle.EntityFX;
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;
    
    public class EntityBreakFX extends EntityFX{
    
    Random r = new Random();
    
    static final ResourceLocation texture = new ResourceLocation(Main.MODID, "textures/particle/texture.png");
    
    protected EntityBreakFX(World world, double x, double y, double z) 
    {
    	super(world, x, y, z);
    	setGravity(1);
    	setScale(1);
    	setMaxAge(100);
    }
    
    @Override
    public void renderParticle(Tessellator tess, float partialTicks, float par3, float par4, float par5, float par6, float par7)
    {
    	Minecraft.getMinecraft().renderEngine.bindTexture(texture);
    	GL11.glDepthMask(false);
    	GL11.glEnable(GL_BLEND);
    	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    	glAlphaFunc(GL_GREATER, 0.003921569F);
    	tess.startDrawingQuads();
    	tess.setBrightness(getBrightnessForRender(partialTicks));
    	float scale = 0.0125F * particleScale;
    	float x = (float) (prevPosX + (posX - prevPosX) * partialTicks - interpPosX);
    	float y = (float) (prevPosY + (posY - prevPosY) * partialTicks - interpPosY);
    	float z = (float) (prevPosZ + (posZ - prevPosZ) * partialTicks - interpPosZ);
    
                    //here used to be the part where it was drawing vertexes with UVs. that's 2D. How can I make it 3D?
    
                    //here's my first attempt to render a cube (I was too lazy to keep trying to invert the inverted normal maps...... so they're not translucent...):
                    /*
                    //Front
    	tess.addVertex(x + 1, y + 1, z + 1);
    	tess.addVertex(x, y + 1, z + 1);
    	tess.addVertex(x, y, z + 1);
    	tess.addVertex(x + 1, y, z + 1);
    
    	//Back
    	tess.addVertex(x + 1, y + 1, z + 1);
    	tess.addVertex(x, y + 1, z + 1);
    	tess.addVertex(x, y, z + 1);
    	tess.addVertex(x + 1, y, z + 1);
    
    	//Bottom
    	tess.addVertex(x + 1, y, z);
    	tess.addVertex(x, y, z);
    	tess.addVertex(x, y, z + 1);
    	tess.addVertex(x + 1, y, z + 1);
    
    	//Top
    	tess.addVertex(x, y + 1, z);
    	tess.addVertex(x, y + 1, z + 1);
    	tess.addVertex(x + 1, y + 1, z + 1);
    	tess.addVertex(x + 1, y + 1, z);
    
    	//Left
    	tess.addVertex(x, y + 1, z + 1);
    	tess.addVertex(x, y, z + 1);
    	tess.addVertex(x, y, z);
    	tess.addVertex(x, y + 1, z);
    
    	//Right
    	tess.addVertex(x + 1, y + 1, z + 1);
    	tess.addVertex(x + 1, y + 1, z);
    	tess.addVertex(x + 1, y, z);
    	tess.addVertex(x + 1, y, z + 1);
                    */
    
    	tess.draw();
    	glDisable(GL_BLEND);
    	glDepthMask(true);
    	glAlphaFunc(GL_GREATER, 0.1F);
    }
    
    public int getFXLayer()
    {
    	return 3;
    }
    
    public EntityBreakFX setMaxAge (int maxAge)
    {
    	particleMaxAge = maxAge;
    	return this;
    }
    
    public EntityBreakFX setGravity (int gravity)
    {
    	particleGravity = gravity;
    	return this;
    }
    
    public EntityBreakFX setScale (int scale)
    {
    	particleScale = scale;
    	return this;
    }
    }

     

    Is it possible?

  6. I did what Failander(or whatever his name is) told me to do and I'm having the exact same problem as I was having before.

    My IMessageHandler class:

     

     

    public class PacketHandler implements IMessageHandler<Packet, IMessage> {
    
    public static World world;
    
    @Override
    public IMessage onMessage(Packet message, MessageContext ctx) {
    	world = ctx.getServerHandler().playerEntity.worldObj;
    	return null;
    }
    
    }

     

     

    My Block class:

     

    public class LobbyBlock1 extends Block {
    
    public LobbyBlock1(Material rock) {
    	super(rock);
    	this.setBlockName("LobbyBlock1");
    	this.setBlockTextureName(Main.MODID + ":" + "1");
    	this.setLightLevel(1F);
    	this.setLightOpacity(2555);
    }
    
    public TileEntity createTileEntity(World world, int metadata) {
    	return new TileEntityData();
    }
    
    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
    		float par8, float par9) {
    	TileEntityData tile = (TileEntityData) world.getTileEntity(x, y, z);
    
    	try {
    		Main.snw.sendTo(new Packet(x, y, z, new Packet().players), (EntityPlayerMP) player);
    	} catch (Exception e) {
    		GuiLobbyJoined.blockPosX = x;
    		GuiLobbyJoined.blockPosY = y;
    		GuiLobbyJoined.blockPosZ = z;
    		GuiLobbyJoined.player = player;
    		GuiLobbyJoined.world = world;
    
    		GuiLobbyHosted.blockPosX = x;
    		GuiLobbyHosted.blockPosY = y;
    		GuiLobbyHosted.blockPosZ = z;
    		GuiLobbyHosted.player = player;
    		GuiLobbyHosted.world = world;
    
    		GuiLobbyHost.blockPosX = x;
    		GuiLobbyHost.blockPosY = y;
    		GuiLobbyHost.blockPosZ = z;
    		GuiLobbyHost.player = player;
    		GuiLobbyHost.world = world;
    	}
    
    	NBTTagCompound tag = player.getEntityData();
    
    	if (tile.Host == player.getDisplayName())
    		FMLNetworkHandler.openGui(player, Main.instance, 2, world, x, y, z);
    	else {
    		if (tag.getBoolean("IsJoined") == false)
    			FMLNetworkHandler.openGui(player, Main.instance, 1, world, x, y, z);
    		else
    			FMLNetworkHandler.openGui(player, Main.instance, 3, world, x, y, z);
    	}
    
    	return true;
    }
    }

     

     

    And when you click the block, a gui opens, the Gui class:

     

    public class GuiLobbyHost extends GuiScreen {
    
    public static int blockPosX;
    public static int blockPosY;
    public static int blockPosZ;
    public static EntityPlayer player;
    public static World world = PacketHandler.world;
    
    public GuiLobbyHost() {
    	if (blockPosX == 0 && blockPosY == 0 && blockPosZ == 0) {
    		Packet packet = new Packet();
    
    		blockPosX = packet.x;
    		blockPosY = packet.y;
    		blockPosZ = packet.z;
    	}
    }
    
    public boolean doesGuiPauseGame() {
    	return false;
    }
    
    int guiWidth = 256;
    int guiHeight = 168;
    
    @Override
    public void drawScreen(int x, int y, float ticks) {
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    	this.buttonList.clear();
    	this.buttonList.add(new GuiButton(0, guiX + 5, guiY + 5, 98, 20, I18n.format("DISCONNECT", new Object[0])));
    	this.buttonList.add(new GuiButton(1, guiX + 5, guiY + 45, 98, 20, I18n.format("START GAME", new Object[0])));
    
    	GL11.glColor4f(1, 1, 1, 1);
    	drawDefaultBackground();
    	mc.renderEngine.bindTexture(new ResourceLocation(Main.MODID + ":" + "textures/gui/Lobby.png"));
    	drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
    
    	super.drawScreen(x, y, ticks);
    }
    
    @Override
    protected void keyTyped(char letter, int number) {
    	switch (number) {
    	case 1:
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    		break;
    	}
    
    	switch (letter) {
    	case 'e':
    	case 'E':
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    		break;
    	}
    }
    
    @Override
    protected void actionPerformed(GuiButton button) {
    	if (button.id == 0) {
    		world.setBlock(blockPosX, blockPosY, blockPosZ, Blocks.LobbyBlock);
    
    		try {
    			Main.snw.sendToServer(new Packet(0, 0, 0, 0));
    		} catch (Exception e) {
    
    		}
    
    		NBTTagCompound tag = player.getEntityData();
    		tag.setBoolean("IsJoined", false);
    
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    	}
    	if (button.id == 1) {
    		NBTTagCompound tag = player.getEntityData();
    	}
    }
    }
    

     

     

    As I already mentioned, the block is visible only for the client on the server, until you activate(right-click) it.

    What I need to do is set a block in the server's world not in the client's one.. Because the Gui class is clientside only, it places the block clientside(on a server) aswell.

     

    EDIT:

    Uploaded a video: https://youtu.be/QwC14FKs0AM

  7. you cant and you dont need. if you want to change the world the player is currently in simply go and get the worldObj from the player.

    the handleMessage of the imessagehandler gives u an context ctx. so just go ctx.getServerHandler().playerEntity.worldObj. I might be wrong with some naming here, search ur ide

     

    So I have to make a public variable in the messagehandler/packethandler?

  8. BUT You can't read the variable..

    cuz this is in my Packet right now:

     

    public class Packet implements IMessage {
    public int players;
    public int x;
    public int y;
    public int z;
    public World world;
    
    public Packet() {}
    
    public Packet(int X, int Y, int Z, World World, int Players) {
    	this.players = Players;
            this.x = X;
            this.y = Y;
            this.z = Z;
        }
    
    @Override
    public void toBytes(ByteBuf buf) {
    	buf.[writeWorld?](world)
    	buf.writeInt(players);
    	buf.writeInt(x);
    	buf.writeInt(y);
    	buf.writeInt(z);
    }
    
    @Override
    public void fromBytes(ByteBuf buf) {
    	this.x = buf.readInt();
    	this.y = buf.readInt();
    	this.z = buf.readInt();
    	this.world = buf.[readWorld?]();
    	this.players = buf.readInt();
    }
    }

     

     

    So how can I store a world variable?

  9. Well the you can see the block on the server, but when you click it, its not there anymore.. That's because the block is only placed on the Client side world.. but how do I set the block Server Side from a client?

     

    My Gui class:

     

    package com.tominocz.PAYDAY2.gui;
    
    import org.lwjgl.opengl.GL11;
    
    import com.tominocz.PAYDAY2.Blocks;
    import com.tominocz.PAYDAY2.Main;
    import com.tominocz.PAYDAY2.packet.Packet;
    
    import cpw.mods.fml.relauncher.Side;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.gui.GuiButton;
    import net.minecraft.client.gui.GuiScreen;
    import net.minecraft.client.resources.I18n;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;
    
    public class GuiLobbyHost extends GuiScreen {
    
    public static int blockPosX;
    public static int blockPosY;
    public static int blockPosZ;
    public static EntityPlayer player;
    public static World world;
    
    GuiButton b1;
    GuiButton b2;
    
    public GuiLobbyHost() {
    	if (blockPosX == 0 && blockPosY == 0 && blockPosZ == 0) {
    		Packet packet = new Packet();
    		blockPosX = packet.x;
    		blockPosY = packet.y;
    		blockPosZ = packet.z;
    	}
    }
    
    public boolean doesGuiPauseGame() {
    	return false;
    }
    
    int guiWidth = 256;
    int guiHeight = 168;
    
    @Override
    public void drawScreen(int x, int y, float ticks) {
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    	this.buttonList.clear();
    	b1 = new GuiButton(0, guiX + 5, guiY + 5, 98, 20, I18n.format("DISCONNECT", new Object[0]));
    
    	b2 = new GuiButton(1, guiX + 5, guiY + 45, 98, 20, I18n.format("START GAME", new Object[0]));
    	this.buttonList.add(b1);
    	this.buttonList.add(b2);
    
    	GL11.glColor4f(1, 1, 1, 1);
    	drawDefaultBackground();
    	mc.renderEngine.bindTexture(new ResourceLocation(Main.MODID + ":" + "textures/gui/Lobby.png"));
    	drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
    
    	super.drawScreen(x, y, ticks);
    }
    
    @Override
    protected void keyTyped(char letter, int number) {
    	switch (number) {
    	case 1:
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    		break;
    	}
    
    	switch (letter) {
    	case 'e':
    	case 'E':
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    		break;
    	}
    }
    
    @Override
    protected void actionPerformed(GuiButton button) {
    	if (button.id == 0) {
    		world.setBlock(blockPosX, blockPosY, blockPosZ, Blocks.LobbyBlock);
    
    		try {
    			Main.snw.sendToServer(new Packet(0, 0, 0, 0));
    		} catch (Exception e) {
    
    		}
    
    		NBTTagCompound tag = player.getEntityData();
    		tag.setBoolean("IsJoined", false);
    
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    	}
    	if (button.id == 1) {
    		NBTTagCompound tag = player.getEntityData();
    	}
    }
    }
    

     

     

    My Block class:

     

    package com.tominocz.PAYDAY2.block;
    
    import com.tominocz.PAYDAY2.Main;
    import com.tominocz.PAYDAY2.TileEntityData;
    import com.tominocz.PAYDAY2.gui.GuiLobbyHost;
    import com.tominocz.PAYDAY2.gui.GuiLobbyHosted;
    import com.tominocz.PAYDAY2.gui.GuiLobbyJoined;
    import com.tominocz.PAYDAY2.packet.Packet;
    
    import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.EntityPlayerMP;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.world.World;
    
    public class LobbyBlock1 extends Block {
    
    public LobbyBlock1(Material rock) {
    	super(rock);
    	this.setBlockName("LobbyBlock1");
    	this.setBlockTextureName(Main.MODID + ":" + "1");
    	this.setLightLevel(1F);
    	this.setLightOpacity(2555);
    }
    
    public TileEntity createTileEntity(World world, int metadata) {
    	return new TileEntityData();
    }
    
    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
    		float par8, float par9) {
    	TileEntityData tile = (TileEntityData) world.getTileEntity(x, y, z);
    
    	try {
    		Main.snw.sendTo(new Packet(x, y, z, new Packet().Players), (EntityPlayerMP) player);
    	} catch (Exception e) {
    		GuiLobbyJoined.blockPosX = GuiLobbyHosted.blockPosX = GuiLobbyHost.blockPosX = x;
    		GuiLobbyJoined.blockPosY = GuiLobbyHosted.blockPosY = GuiLobbyHost.blockPosY = y;
    		GuiLobbyJoined.blockPosZ = GuiLobbyHosted.blockPosZ = GuiLobbyHost.blockPosZ = z;
    		GuiLobbyJoined.player = GuiLobbyHosted.player = GuiLobbyHost.player = player;
    		GuiLobbyJoined.world = GuiLobbyHosted.world = GuiLobbyHost.world = world;
    	}
    
    	NBTTagCompound tag = player.getEntityData();
    
    	if (tile.Host == player.getDisplayName())
    		FMLNetworkHandler.openGui(player, Main.instance, 2, world, x, y, z);
    	else {
    		if (tag.getBoolean("IsJoined") == false)
    			FMLNetworkHandler.openGui(player, Main.instance, 1, world, x, y, z);
    		else
    			FMLNetworkHandler.openGui(player, Main.instance, 3, world, x, y, z);
    	}
    
    	return true;
    }
    }

     

     

    So how can I do this?

  10. My Block class:

     

    public class LobbyBlock extends Block {
    
    public LobbyBlock(Material rock) {
    	super(rock);
    	this.setBlockName("LobbyBlock");
    	this.setBlockTextureName(Main.MODID + ":" + "0");
    	this.setCreativeTab(Tabs.CreativeTab);
    	this.setLightLevel(1F);
    	this.setLightOpacity(2555);
    }
    
    public TileEntity createTileEntity(World world, int metadata) {
    	return new TileEntityData();
    }
    
    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7,
    		float par8, float par9) {
    
    	GuiLobby.blockPosX = x;
    	GuiLobby.blockPosY = y;
    	GuiLobby.blockPosZ = z;
    	GuiLobby.player = player;
    	GuiLobby.world = world;
    
    	TileEntityData tile = (TileEntityData) world.getTileEntity(x, y, z);
    
    	if (tile.IsGuiOpen == false) {
    		tile.IsGuiOpen = true;
    		FMLNetworkHandler.openGui(player, Main.instance, 0, world, x, y, z);
    	}
    
    	return true;
    }
    }

     

    My Gui class:

     

    public class GuiLobby extends GuiScreen {
    
    public static int blockPosX;
    public static int blockPosY;
    public static int blockPosZ;
    public static EntityPlayer player;
    public static World world;
    
    public boolean doesGuiPauseGame() {
    	return false;
    }
    
    int guiWidth = 256;
    int guiHeight = 168;
    
    @Override
    public void drawScreen(int x, int y, float ticks) {
    	int guiX = (width - guiWidth) / 2;
    	int guiY = (height - guiHeight) / 2;
    
    	this.buttonList.clear();
    	this.buttonList.add(new GuiButton(0, guiX + 5, guiY + 5, 98, 20, I18n.format("Host Game", new Object[0])));
    
    	GL11.glColor4f(1, 1, 1, 1);
    	drawDefaultBackground();
    	mc.renderEngine.bindTexture(new ResourceLocation(Main.MODID + ":" + "textures/gui/Lobby.png"));
    	drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
    
    	super.drawScreen(x, y, ticks);
    }
    
    @Override
    protected void keyTyped(char letter, int number) {
    	switch (number) {
    	case 1:
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    		TileEntityData tile = (TileEntityData) world.getTileEntity(blockPosX, blockPosY, blockPosZ);
    		tile.IsGuiOpen = false;
    		break;
    	}
    
    	switch (letter) {
    	case 'e':
    	case 'E':
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    		TileEntityData tile = (TileEntityData) world.getTileEntity(blockPosX, blockPosY, blockPosZ);
    		tile.IsGuiOpen = false;
    		break;
    	}
    }
    
    @Override
    protected void actionPerformed(GuiButton button) {
    	if (button.id == 0) {
    
    		TileEntityData tile = (TileEntityData) world.getTileEntity(blockPosX, blockPosY, blockPosZ);
    		tile.Name = player.getDisplayName();
    
    		world.setBlock(blockPosX, blockPosY, blockPosZ, Blocks.LobbyBlock1);
    
    		this.mc.displayGuiScreen((GuiScreen) null);
    		this.mc.setIngameFocus();
    	}
    }
    
    @Override
    public void onGuiClosed() {
    	TileEntityData tile = (TileEntityData) world.getTileEntity(blockPosX, blockPosY, blockPosZ);
    	tile.IsGuiOpen = false;
    }
    }
    

     

    My Main class:

     

    @Mod(modid = Main.MODID, name = Main.NAME, version = "PreAlpha 0.0.3")
    public class Main {
    @Instance(Main.MODID)
    public static Main instance;
    
    public static final String MODID = "PAYDAY2";
    public static final String NAME = "PAYDAY 2";
    public static final String VERSION = "PreAlpha 0.0.3";
    
    public Main() {
    
    }
    
    @EventHandler
    @SideOnly(Side.CLIENT)
    public void preInit(FMLPreInitializationEvent event) {
    	FMLCommonHandler.instance().bus().register(new Events());
    	Events.init();
    }
    
    @EventHandler
    public void Init(FMLInitializationEvent event) {
    	NetworkRegistry.INSTANCE.registerGuiHandler(Main.instance, new GuiHandler());
    	GameRegistry.registerTileEntity(TileEntityData.class, "Host");
    	GameRegistry.registerTileEntity(TileEntityData.class, "IsGuiOpen");
    	Blocks.registerBlocks();
    	Items.registerItems();
    	Recipes.initShapedRecipes();
    	Recipes.initShalessRecipes();
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
    
    }
    }

     

    My GuiHandler class:

     

    public class GuiHandler implements IGuiHandler {
    
    public GuiHandler() {
    }
    
    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    	if (ID == 0) {
    		return new GuiLobby();
    	}
    	if (ID == 1) {
    		return new GuiLobbyHosted();
    	}
    	if (ID == 2) {
    		return new GuiLobbyHost();
    	}
    	return null;
    }
    
    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    	// TODO Auto-generated method stub
    	return null;
    }
    }

     

    And the class I register blocks with:

     

    public class Blocks {
    public static Block LobbyBlock = new LobbyBlock(Material.rock);
    public static Block LobbyBlock1 = new LobbyBlock1(Material.rock);
    public static Block LobbyBlock2 = new LobbyBlock2(Material.rock);
    public static Block LobbyBlock3 = new LobbyBlock3(Material.rock);
    public static Block LobbyBlock4 = new LobbyBlock4(Material.rock);
    public static Block LobbyBlockHosted = new LobbyBlockHosted(Material.rock);
    public static Block LobbyBlockOccupied = new LobbyBlockOccupied(Material.rock);
    
    public static List<Block> blockList = new ArrayList<Block>();
    
    public static void registerBlocks() {
    	blockList.add(LobbyBlock.setCreativeTab(Tabs.CreativeTab));
    	blockList.add(LobbyBlock1);
    	blockList.add(LobbyBlock2);
    	blockList.add(LobbyBlock3);
    	blockList.add(LobbyBlock4);
    	blockList.add(LobbyBlockHosted);
    	blockList.add(LobbyBlockOccupied);
    
    	for (Block block : blockList) {
    		GameRegistry.registerBlock(block, block.getUnlocalizedName());
    	}
    }
    }

     

    What I want is to change the blockPosX, blockPosY, blockPosZ, player and world variables that are in the GuiLobby class from the LobbyBlock class ON THE SERVER.

     

    Here you have the crash log:

     

    ---- Minecraft Crash Report ----

    // Shall we play a game?

     

    Time: 9.9.15 17:13

    Description: Exception in server tick loop

     

    java.lang.NoClassDefFoundError: com/tominocz/PAYDAY2/gui/GuiLobby

    at com.tominocz.PAYDAY2.blocks.LobbyBlock.onBlockActivated(LobbyBlock.java:34)

    at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)

    at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593)

    at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

    at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

    at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

    at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)

    at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:349)

    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)

    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)

    at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

    Caused by: java.lang.ClassNotFoundException: com.tominocz.PAYDAY2.gui.GuiLobby

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

    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

    ... 12 more

    Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/gui/GuiScreen

    at java.lang.ClassLoader.defineClass1(Native Method)

    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)

    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

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

    ... 14 more

    Caused by: java.lang.ClassNotFoundException: net.minecraft.client.gui.GuiScreen

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

    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

    ... 18 more

     

     

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

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

     

    -- System Details --

    Details:

    Minecraft Version: 1.7.10

    Operating System: Windows 10 (amd64) version 10.0

    Java Version: 1.8.0_60, Oracle Corporation

    Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

    Memory: 929853040 bytes (886 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

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

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

    FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1492 4 mods loaded, 4 mods active

    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

    UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)

    UCHIJAAAA Forge{10.13.4.1492} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1492-1.7.10.jar)

    UCHIJAAAA PAYDAY2{PreAlpha 0.0.3} [PAYDAY 2] (bin)

    Profiler Position: N/A (disabled)

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

    Player Count: 1 / 20; [EntityPlayerMP['Player32'/365, l='world', x=128,50, y=67,00, z=246,50]]

    Is Modded: Definitely; Server brand changed to 'fml,forge'

    Type: Dedicated Server (map_server.txt)

     

×
×
  • Create New...

Important Information

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