Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

NBT's are not saving or saving too soon when the game is quit


kris91268
 Share

Recommended Posts

try
{
return (TileEntity)theTileEntityClass.newInstance();
}
    catch (Exception e)
{
throw new RuntimeException();
}

this seems overkill:

 

public class TileEntityGravityLift extends TileEntity

<-- cant you just

return new TileEntityGravityLift();

(if you know what you're doing, can i ask which different tile entity you intend to use for the same block, out of curiosity :P, also, if you are going to use more then 1 type of tile entity on the same block (weird but :P)

you coudl do something like this in your constructor:

public class BlockGravityLift extends BlockContainer implements BlockProxy{
    public TileEntity theTileEntityClass;

    public BlockGravityLift(int id, Class<? extends TileEntity> theClass){
        theTileEntityClass = theClass;
    }

    public TileEntity createTileEntity(World world, int meta){
        try{
            return theTileEntityClass.newInstance();
        }catch(Exception e){
            System.out.println("this will only print if the TileEntity doesn't have a 0 argument constructor");
        }
    }

}

because  Class<? extends TileEntity> mean that it will crash at compile time if its not a subclass of TileEntity

 

 

 

public class TileEntityGravityLift extends TileEntity
{
private String aString;
public Double height = new Double(0.0D);

are you using the Double object elsewhere? because you could probably use the primitive type "double" (without the capital)

 

protip, you can transform number into string by addign the empty string ("") to any primitive type:

double d = 5;
String dToString = d+"";

you still have to use the parse method to revert to primitive type

 

 

 

not code impacting at all, but your button have weird name:

private GuiButton decByPointZeroOne;//-0.01   this guy here 
private GuiButton decByPointOne;//-0.1
private GuiButton incByPointOne;//+0.1
private GuiButton incByOnePointZero;//+1.0

 

public void initGui()
{
	super.initGui();
	this.buttonList.clear();

in this case it doesnt matter but if you were extending someone else gui that was doing stuff in its initGui(), the method clear() would wipe all his changes

 

 

btw MineMaarten is right, you need to sendPacketToServer, not sendPacketToAllPlayers, you want to tell the SERVER that you have changed the tile entity

 

also send the x, y, z of the tile entity, the server doesnt know which block you're talking about

 

and finally you might want to also send the dimentionID to prevent a very rare vanilla bug from happening

 

i prefer to use Packet250CustomPayload // that only a matter of opinion, sorry :P

 

heres 2 tutorial i made that could help

 

synchronizing tile entities:

http://www.minecraftforge.net/wiki/Synchronizing_tile_entities

 

organising packer handlers:

http://www.minecraftforge.net/wiki/Organising_packet_handlers

 

warning, i dont explain basic java in there

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

update your code, not sure which version is the right one, also feel free to give a thank you to whoever helped you (i actually legit dont know what fixed your code, and who fixed it)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

You solved the problem why it wasn't writing to it's tile entity, so I gave you a thank you. However, I do believe that packet handling would be neccessary, so MineMarteen also helpedd solve this problem. The thing that solved it was I forgot to use the hasTileEntity(int meta) method in my block class. I'll experiment around with some stuff, let you know how the results turned out and if the block successfully reads the stored nbt.

 

Here is some code explained

 

I used a double object to store the height value in the tile entity class so I can call the .toString() method in the GuiGravityLift class. I didn't know you could do that with a primitive.

 

I intend to use the same tile entity for the gravity lift block, so saying which other tile entities I am using isn't neccessary

 

I do know java, quite well actually, but not fully how Minecraft and Forge works.

 

Thanks so much for your help, and MineMarteen's help with the packet handling

Link to comment
Share on other sites

I used a double object to store the height value in the tile entity class so I can call the .toString() method in the GuiGravityLift class. I didn't know you could do that with a primitive.

 

I intend to use the same tile entity for the gravity lift block, so saying which other tile entities I am using isn't neccessary

 

I do know java, quite well actually, but not fully how Minecraft and Forge works.

my tips were PURELLY informationnal btw, you are free to do wtv u want with them :P

 

and yes you are still required to send the change to the server because if you don't the server (the guy that decide everything) doesnt know that the TE values have changed

 

i beleive my 2 tutorial will help you :)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

I try to use the packet to send a message to the server to change it's tile entity when the buttons of the gui are clicked, but it crashes with a protocol exception when I try. I know I coded it to do this, but it was in the tutorial with advanced packet handling.

 

How would you suggest I send a packet to the server with the x y z coordinates when I click a button on the gui?

Link to comment
Share on other sites

well for 1 i suggest you use the packet read/write class i made, they are in this tutorial at the every begining

 

http://www.minecraftforge.net/wiki/Organising_packet_handlers

 

they make code much clearer

 

basicly all you have to do is

PacketWriteStream stream = new PacketWriteStream();

stream.put(tileEntityX);

stream.put(tileEntityY);

stream.put(tileEntityZ);

stream.put(height);

Packet p = stream.makePacket("channel");

 

PacketDispatcher.sendPacketToServer(p);

 

and server side:

 

PacketReadStream stream = new PacketReadStream(originalPacket);

int x = stream.readInt();

int y = stream.readInt();

int z = stream.readInt();

double height = stream.readDouble();

 

and then somethign like

World world = //get a world reference

world.getTileEntityAt(x, y, z).setHeight(height);

 

sry i gtg IRL gl (ill be there later so post question if you still need some help)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

I have made the PacketOutputStream and the PacketInputStream, but I don't understand where I should put the rest. Where should I declare a new PacketWriteStream object and put the tileEntity x, y, and z coordinates in it? Do I declare it in the gui file, or the PacketHandler file?

Link to comment
Share on other sites

Actually, I found that it is much easier just to use a packet already used in Minecraft, in this case, I use the Packet132TileEntityData packet since that is all I need, and I found it actually saves data. Thanks for the help everyone has given me.

Link to comment
Share on other sites

Packet132TileEntityData cannot be sent to server without causing the server to kick the client, but it can be send from server to client, but thats basicly what the method markBlockForUpdate do

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

In that case, what do you think I should do? How do you propose I implement the packet sending code.

 

Here is the files that I have changed

 

GuiGravityLift.java

package kris91268.lbd;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;

import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;

import cpw.mods.fml.common.network.PacketDispatcher;

import kris91268.lbd.Blocks.BlockGravityLift;
import kris91268.lbd.Packet.PacketBlockChange;
import kris91268.lbd.Tileentity.TileEntityGravityLift;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

/**
* 
* @author Arbiter
*
*/
public class GuiGravityLift extends GuiContainer
{
private static final ResourceLocation texture = new ResourceLocation("lbd:textures/gui/gravlift.png");
private GuiButton dnButton;
private GuiButton decByPointZeroOne;
private GuiButton decByPointOne;
private GuiButton incByPointOne;
private GuiButton incByOnePointZero;
private GuiTextField number;
public static String gravLiftHeight;
private TileEntityGravityLift tileEntity;

public GuiGravityLift(InventoryPlayer par1, TileEntityGravityLift par2)
{
	super(new ContainerGravityLift(par1, par2));
	tileEntity = par2;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
	fontRenderer.drawString("Gravity Lift", 8, 6, 4210752);
	fontRenderer.drawString("Inventory", 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
	this.mc.func_110434_K().func_110577_a(texture);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	int x = (width - xSize) / 2;
	int y = (height - ySize) / 2;
	this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
	this.number.drawTextBox();
}
@Override
public void initGui()
{
	super.initGui();
	Keyboard.enableRepeatEvents(true);
	this.buttonList.add(this.dnButton = new GuiButton(0, this.width / 2 - 25, this.height / 4 + 35, 50, 20, "Done"));
	this.buttonList.add(this.decByPointZeroOne = new GuiButton(1, this.width / 2 - 75, this.height / 4 + 0, 40, 20, "-0.1"));
	this.buttonList.add(this.decByPointOne = new GuiButton(2, this.width / 2 - 75, this.height / 4 + 25, 40, 20, "-1.0"));
	this.buttonList.add(this.incByPointOne = new GuiButton(3, this.width / 2 + 25, this.height / 4 + 0, 40, 20, "+0.1"));
	this.buttonList.add(this.incByOnePointZero = new GuiButton(4, this.width / 2 + 25, this.height / 4 + 25, 40, 20, "+1.0"));
	this.number = new GuiTextField(this.fontRenderer, this.width / 2 - 20, this.height / 4 + 1, 40, 20);
	this.number.setVisible(true);
	this.number.setCanLoseFocus(false);
	this.number.setFocused(true);
	if (tileEntity.height == null)
	{
		tileEntity.height = 0.0D;
		this.number.setText(tileEntity.height.toString());
		gravLiftHeight = tileEntity.height.toString();
	}
	else
	{
		this.number.setText(tileEntity.height.toString());
		gravLiftHeight = tileEntity.height.toString();
	}
}
public void onGuiClosed()
{
	Keyboard.enableRepeatEvents(false);
	Double theNumber = Double.parseDouble(gravLiftHeight);
	tileEntity.bindHeightToTileEntity(theNumber);
	String s = "gravlift";
	ByteArrayOutputStream out = new ByteArrayOutputStream();
	DataOutputStream dataOut = new DataOutputStream(out);
	try
	{
		dataOut.writeDouble(theNumber);
		this.mc.getNetHandler().addToSendQueue(new Packet250CustomPayload(s, out.toByteArray()));
		this.tileEntity.getDescriptionPacket();
		this.tileEntity.bindHeightToTileEntity(theNumber);
	}
	catch (Exception e)
	{
		e.printStackTrace();
	}
}
public boolean isAboveZero(String par1Str)
{
	Double theDouble = Double.parseDouble(par1Str);
	return theDouble >= 0.00 ? true : false;
}
public boolean isBelowFive(String par1Str)
{
	Double theDouble = Double.parseDouble(par1Str);
	return theDouble <= 5.00 ? true : false;
}
public void updateScreen()
{
	this.number.updateCursorCounter();
}
/**
public void mouseClicked(int par1, int par2, int par3)
{
	super.mouseClicked(par1, par2, par3);
	this.number.mouseClicked(par1, par2, par3);
}
public void keyTyped(char par1, int par2)
{
	this.number.textboxKeyTyped(par1, par2);
	((GuiButton)this.buttonList.get(0)).enabled = this.number.getText().trim().length() > 0;
	if (par2 == 28 || par2 == 156)
	{
		this.actionPerformed((GuiButton)this.buttonList.get(0));
	}
}**/
@Override
protected void actionPerformed(GuiButton guiButton)
{
	int x = tileEntity.xCoord;
	int y = tileEntity.yCoord;
	int z = tileEntity.zCoord;
	switch (guiButton.id)
	{
	case 0:
		this.mc.displayGuiScreen((GuiScreen)null);
		break;
	case 1:
		Double heightInDoubles = Double.parseDouble(gravLiftHeight);
		if (heightInDoubles != 0.0)
		{
			heightInDoubles -= 0.1;
		}
		gravLiftHeight = heightInDoubles.toString();
		number.setText(gravLiftHeight);
		PacketDispatcher.sendPacketToServer(new PacketBlockChange(heightInDoubles, tileEntity, x, y, z).makePacket());
		break;
	case 2:
		Double heightInDoubles1 = Double.parseDouble(gravLiftHeight);
		if (heightInDoubles1 < 1.0)
		{
			heightInDoubles1 = 0.0;
		}
		else
		{
			heightInDoubles1 -= 1.0;
		}
		gravLiftHeight = heightInDoubles1.toString();
		number.setText(gravLiftHeight);
		PacketDispatcher.sendPacketToServer(new PacketBlockChange(heightInDoubles1, tileEntity, x, y, z).makePacket());
		break;
	case 3:
		Double theHeight = Double.parseDouble(gravLiftHeight);
		if (theHeight != 5.0)
		{
			theHeight += 0.1;
		}
		gravLiftHeight = theHeight.toString();
		number.setText(gravLiftHeight);
		tileEntity.bindHeightToTileEntity(theHeight);
		PacketDispatcher.sendPacketToServer(new PacketBlockChange(theHeight, tileEntity, x, y, z).makePacket());
		break;
	case 4:
		Double theNumber = Double.parseDouble(gravLiftHeight);
		if (theNumber > 4.0)
		{
			theNumber = 5.0;
		}
		else
		{
			theNumber += 1.0;
		}
		gravLiftHeight = theNumber.toString();
		number.setText(gravLiftHeight);
		String s = "gravlift";
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		DataOutputStream dataOut = new DataOutputStream(out);
		try
		{
			dataOut.writeDouble(theNumber);
			this.mc.getNetHandler().addToSendQueue(new Packet250CustomPayload(s, out.toByteArray()));
			tileEntity.getDescriptionPacket();
			this.tileEntity.bindHeightToTileEntity(theNumber);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		default:
			break;
	}
}
}

 

TileEntityGravityLift.java

package kris91268.lbd.Tileentity;

import java.awt.List;

import kris91268.lbd.Blocks.BlockGravityLift;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

/**
* 
* @author Arbiter
*
*/
public class TileEntityGravityLift extends TileEntity implements IInventory
{
private String aString;
public Double height;		

public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
	super.readFromNBT(par1NBTTagCompound);
	height = par1NBTTagCompound.getDouble("height");
	System.out.println(height);
}
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
	super.writeToNBT(par1NBTTagCompound);
	par1NBTTagCompound.setDouble("height", height);
	System.out.println(height);
}
public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer)
{
	return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : 
		par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
}
public void something(String par1Str)
{
	this.aString = par1Str;
}
@Override
public String getInvName()
{
	return "Gravity Lift";
}
public void bindHeightToTileEntity(double theHeight)
{
	this.height = theHeight;
	worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public double getHeightLevel()
{
	return this.height; 
}
public Packet getDescriptionPacket()
{
	NBTTagCompound nbt = new NBTTagCompound();
	this.writeToNBT(nbt);
	return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 3, nbt);
}
@Override
public int getSizeInventory()
{		
	return 0;
}
@Override
public ItemStack getStackInSlot(int i) 
{
	return null;
}
@Override
public ItemStack decrStackSize(int i, int j)
{
	return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int i)
{
	return null;
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack)
{

}
@Override
public boolean isInvNameLocalized()
{
	return false;
}
@Override
public int getInventoryStackLimit()
{
	return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
	return true;
}
@Override
public void openChest()
{

}
@Override
public void closeChest()
{

}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
	return false;
}
}

Link to comment
Share on other sites

public Packet getDescriptionPacket()
{
	NBTTagCompound nbt = new NBTTagCompound();
	this.writeToNBT(nbt);
	return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 3, nbt);
}

This is the packet that will be sent when world.markBlockForUpdate(...) is called.

If you want to manage the receiving part of this packet, you can change it into a Packet250CustomPayload, add extra data, and send it through your channel.

Actually, you should change it. A Packet132TileEntityData with type 3 is assumed to come from a TileEntityBeacon.

Link to comment
Share on other sites

public Packet getDescriptionPacket()
{
	NBTTagCompound nbt = new NBTTagCompound();
	this.writeToNBT(nbt);
	return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 3, nbt);
}

This is the packet that will be sent when world.markBlockForUpdate(...) is called.

If you want to manage the receiving part of this packet, you can change it into a Packet250CustomPayload, add extra data, and send it through your channel.

Actually, you should change it. A Packet132TileEntityData with type 3 is assumed to come from a TileEntityBeacon.

 

no actually that's wrong, more then 1 tile entity in the game use it

 

beacon, command block, mob spawner and skull

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

no actually that's wrong, more then 1 tile entity in the game use it

 

beacon, command block, mob spawner and skull

Only with types being respectively, 3, 2, 1 and 4.

 

You can use whatever packet type indeed, but in this case, the tileentity needs to override like this:

@Override
onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
{
         this.readFromNBT(pkt.customParam1);
}

Link to comment
Share on other sites

I have been doing some work and following the Packet handling tutorial again, and I have successfully sended a packet to the tile entity, and it writes to it's nbt. That is all solved. However, when I collide with the block, it doesn't get the set height for the specific tile entity. How would I retrieve this for use in the block class. Here is the changed files

 

GuiGravityLift.java

package kris91268.lbd;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import kris91268.lbd.Blocks.BlockGravityLift;
import kris91268.lbd.Packet.PacketBlockChange;
import kris91268.lbd.Tileentity.TileEntityGravityLift;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

/**
* 
* @author Arbiter
*
*/
public class GuiGravityLift extends GuiContainer
{
private static final ResourceLocation texture = new ResourceLocation("lbd:textures/gui/gravlift.png");
private GuiButton dnButton;
private GuiButton decByPointZeroOne;
private GuiButton decByPointOne;
private GuiButton incByPointOne;
private GuiButton incByOnePointZero;
private GuiTextField number;
public static String gravLiftHeight;
private TileEntityGravityLift tileEntity;
public EntityPlayer player;

public GuiGravityLift(InventoryPlayer par1, TileEntityGravityLift par2, EntityPlayer player)
{
	super(new ContainerGravityLift(par1, par2));
	tileEntity = par2;
	this.player = player;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
	fontRenderer.drawString("Gravity Lift", 8, 6, 4210752);
	fontRenderer.drawString("Inventory", 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
	this.mc.func_110434_K().func_110577_a(texture);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	int x = (width - xSize) / 2;
	int y = (height - ySize) / 2;
	this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
	this.number.drawTextBox();
}
@Override
public void initGui()
{
	super.initGui();
	Keyboard.enableRepeatEvents(true);
	this.buttonList.add(this.dnButton = new GuiButton(0, this.width / 2 - 25, this.height / 4 + 35, 50, 20, "Done"));
	this.buttonList.add(this.decByPointZeroOne = new GuiButton(1, this.width / 2 - 75, this.height / 4 + 0, 40, 20, "-0.1"));
	this.buttonList.add(this.decByPointOne = new GuiButton(2, this.width / 2 - 75, this.height / 4 + 25, 40, 20, "-1.0"));
	this.buttonList.add(this.incByPointOne = new GuiButton(3, this.width / 2 + 25, this.height / 4 + 0, 40, 20, "+0.1"));
	this.buttonList.add(this.incByOnePointZero = new GuiButton(4, this.width / 2 + 25, this.height / 4 + 25, 40, 20, "+1.0"));
	this.number = new GuiTextField(this.fontRenderer, this.width / 2 - 20, this.height / 4 + 1, 40, 20);
	this.number.setVisible(true);
	this.number.setCanLoseFocus(false);
	this.number.setFocused(true);
	this.number.setText(tileEntity.height.toString());
	gravLiftHeight = tileEntity.height.toString();
}
public void onGuiClosed()
{
	Keyboard.enableRepeatEvents(false);
	Double theNumber = Double.parseDouble(gravLiftHeight);
}
public boolean isAboveZero(String par1Str)
{
	Double theDouble = Double.parseDouble(par1Str);
	return theDouble >= 0.00 ? true : false;
}
public boolean isBelowFive(String par1Str)
{
	Double theDouble = Double.parseDouble(par1Str);
	return theDouble <= 5.00 ? true : false;
}
public void updateScreen()
{
	this.number.updateCursorCounter();
}
/**
public void mouseClicked(int par1, int par2, int par3)
{
	super.mouseClicked(par1, par2, par3);
	this.number.mouseClicked(par1, par2, par3);
}
public void keyTyped(char par1, int par2)
{
	this.number.textboxKeyTyped(par1, par2);
	((GuiButton)this.buttonList.get(0)).enabled = this.number.getText().trim().length() > 0;
	if (par2 == 28 || par2 == 156)
	{
		this.actionPerformed((GuiButton)this.buttonList.get(0));
	}
}**/
@Override
protected void actionPerformed(GuiButton guiButton)
{
	int x = tileEntity.xCoord;
	int y = tileEntity.yCoord;
	int z = tileEntity.zCoord;
	switch (guiButton.id)
	{
	case 0:
		this.mc.displayGuiScreen((GuiScreen)null);
		break;
	case 1:
		Double heightInDoubles = Double.parseDouble(gravLiftHeight);
		if (heightInDoubles != 0.0)
		{
			heightInDoubles -= 0.1;
		}
		gravLiftHeight = heightInDoubles.toString();
		number.setText(gravLiftHeight);
		PacketDispatcher.sendPacketToServer(new PacketBlockChange(heightInDoubles, tileEntity, x, y, z).makePacket());
		break;
	case 2:
		Double heightInDoubles1 = Double.parseDouble(gravLiftHeight);
		if (heightInDoubles1 < 1.0)
		{
			heightInDoubles1 = 0.0;
		}
		else
		{
			heightInDoubles1 -= 1.0;
		}
		gravLiftHeight = heightInDoubles1.toString();
		number.setText(gravLiftHeight);
		PacketDispatcher.sendPacketToServer(new PacketBlockChange(heightInDoubles1, tileEntity, x, y, z).makePacket());
		break;
	case 3:
		Double theHeight = Double.parseDouble(gravLiftHeight);
		if (theHeight != 5.0)
		{
			theHeight += 0.1;
		}
		gravLiftHeight = theHeight.toString();
		number.setText(gravLiftHeight);
		tileEntity.bindHeightToTileEntity(theHeight);
		PacketDispatcher.sendPacketToServer(new PacketBlockChange(theHeight, tileEntity, x, y, z).makePacket());
		break;
	case 4:
		Double theNumber = Double.parseDouble(gravLiftHeight);
		if (theNumber > 4.0)
		{
			theNumber = 5.0;
		}
		else
		{
			theNumber += 1.0;
		}
		gravLiftHeight = theNumber.toString();
		number.setText(gravLiftHeight);
		ByteArrayOutputStream outputStream = new ByteArrayOutputStream(;
		DataOutputStream dataStream = new DataOutputStream(outputStream);
		try
		{
			dataStream.writeDouble(theNumber);
			dataStream.writeInt(tileEntity.xCoord);
			dataStream.writeInt(tileEntity.yCoord);
			dataStream.writeInt(tileEntity.zCoord);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		Packet250CustomPayload packet = new Packet250CustomPayload();
		packet.channel = "lbd";
		packet.data = outputStream.toByteArray();
		packet.length = outputStream.size();
		Side side = FMLCommonHandler.instance().getEffectiveSide();
		if (side == Side.SERVER)
		{
			EntityPlayerMP playerMP = (EntityPlayerMP)player;
		}
		else if (side == Side.CLIENT)
		{
			EntityClientPlayerMP clientPlayer = (EntityClientPlayerMP)player;
			clientPlayer.sendQueue.addToSendQueue(packet);
		}
		default:
			break;
	}
}
}

 

GuiGravityLiftHandler.java

package kris91268.lbd;

import kris91268.lbd.Tileentity.TileEntityGravityLift;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;

/**
* 
* @author Arbiter
*
*/
public class GuiGravLiftHandler implements IGuiHandler
{
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
	TileEntityGravityLift tileEntity = (TileEntityGravityLift)world.getBlockTileEntity(x, y, z);
	return new ContainerGravityLift(player.inventory, tileEntity);
}
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
	TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
	return tileEntity instanceof TileEntityGravityLift ? new GuiGravityLift(player.inventory, (TileEntityGravityLift)tileEntity, player) : null;
}
}

 

TileEntityGravityLift.java

package kris91268.lbd.Tileentity;

import java.awt.List;

import kris91268.lbd.Blocks.BlockGravityLift;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

/**
* 
* @author Arbiter
*
*/
public class TileEntityGravityLift extends TileEntity implements IInventory
{
private String aString;
public Double height = new Double(0.0D);			

public void readFromNBT(NBTTagCompound par1NBTTagCompound)
{
	super.readFromNBT(par1NBTTagCompound);
	height = par1NBTTagCompound.getDouble("height");
	System.out.println(height);
}
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
	super.writeToNBT(par1NBTTagCompound);
	par1NBTTagCompound.setDouble("height", height);
	System.out.println(height);
}
public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer)
{
	return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : 
		par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
}
public void something(String par1Str)
{
	this.aString = par1Str;
}
@Override
public String getInvName()
{
	return "Gravity Lift";
}
public void bindHeightToTileEntity(double theHeight)
{
	this.height = theHeight;
	worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public double getHeightLevel()
{
	return height; 
}
public Packet getDescriptionPacket()
{
	NBTTagCompound nbt = new NBTTagCompound();
	this.writeToNBT(nbt);
	return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 3, nbt);
}
@Override
public int getSizeInventory()
{		
	return 0;
}
@Override
public ItemStack getStackInSlot(int i) 
{
	return null;
}
@Override
public ItemStack decrStackSize(int i, int j)
{
	return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int i)
{
	return null;
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack)
{

}
@Override
public boolean isInvNameLocalized()
{
	return false;
}
@Override
public int getInventoryStackLimit()
{
	return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
	return true;
}
@Override
public void openChest()
{

}
@Override
public void closeChest()
{

}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
	return false;
}
}

 

BlockGravityLift.jaca

package kris91268.lbd.Blocks;

import java.util.Random;
import kris91268.lbd.GuiGravityLift;
import kris91268.lbd.ModLBD;
import kris91268.lbd.Tileentity.TileEntityGravityLift;
import cpw.mods.fml.common.registry.BlockProxy;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;

/**
* 
* @author Arbiter
*
*/
public class BlockGravityLift extends BlockContainer implements BlockProxy
{
public Class theTileEntityClass;

public BlockGravityLift(int par1, Class<? extends TileEntity> entityClass)
{
	super(par1, Material.iron);
	theTileEntityClass = entityClass;
	setHardness(1.5F);
	setResistance(1.0F);
	setStepSound(Block.soundMetalFootstep);
	setUnlocalizedName("lbd:gravityLift");
	func_111022_d("lbd:gravityLift");
	setCreativeTab(CreativeTabs.tabRedstone);
	setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3F, 1.0F);
}
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
	par5Entity.fallDistance = 0.0F;
	TileEntityGravityLift tileEntity = (TileEntityGravityLift)par1World.getBlockTileEntity(par2, par3, par4);
	double height = tileEntity.getHeightLevel();
	if (height <= 0.0D)
	{
		return;
	}
	if (par1World.isRemote)
	{
		if (par5Entity instanceof EntityPlayer)
		{
			par5Entity.setVelocity(0.0D, height / 2, 0.0D);
			par5Entity.moveEntity(0.0D, height, 0.0D);
		}
	}
	else
	{
		if (par5Entity instanceof EntityPlayerMP)
		{
			par5Entity.addVelocity(0.0D, height / 2, 0.0D);
			par5Entity.moveEntity(0.0D, height, 0.0D);
		}
	}
}
@Override
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
	super.onBlockAdded(par1World, par2, par3, par4);
	par1World.setBlockTileEntity(par2, par3, par4, new TileEntityGravityLift());
}
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer player, int metadata, float par7, float par8, float par9)
{
    if (!par1World.isRemote)
    {
    	TileEntityGravityLift tileEntity = (TileEntityGravityLift)par1World.getBlockTileEntity(par2, par3, par4);
    	if (tileEntity != null)
    	{
    		player.openGui(ModLBD.instance, 0, par1World, par2, par3, par4);
    	}
    }
    return true;
}
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
	double d0 = (double)((float)par2 + 0.5F);
	double d1 = (double)((float)par3 + 0.3F);
	double d2 = (double)((float)par4 + 0.5F);
	par1World.spawnParticle("portal", d0, d1, d2, 0.0D, 0.0D, 0.0D);
}
public boolean isOpaqueCube()
{
	return false;
}
public boolean renderAsNormalBlock()
{
	return false;
}
public int getRenderType()
{
	return -1;
}
@Override
public boolean hasTileEntity(int par1)
{
	return true;
}
public TileEntity createNewTileEntity(World par1World)
{
	try
	{
		return new TileEntityGravityLift();
	}
	catch (Exception e)
	{
		System.out.println("Error creating a new tile entity");
		return null;
	}
}
}

 

PacketHandler.java

package kris91268.lbd.Packet;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.logging.Logger;

import kris91268.lbd.Packet.PacketBase.ProtocolException;
import kris91268.lbd.Tileentity.TileEntityGravityLift;

import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;

/**
* 
* @author Arbiter
*
*/
public class PacketHandler implements IPacketHandler
{
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
	if (packet.channel.equals("lbd"))
	{
		handleHeight(packet, player);
	}
}
private void handleHeight(Packet250CustomPayload packet, Player player)
{
	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
	double height;
	int x; 
	int y;
	int z;
	try
	{
		height = inputStream.readDouble();
		x = inputStream.readInt();
		y = inputStream.readInt();
		z = inputStream.readInt();
	}
	catch (IOException e)
	{
		e.printStackTrace();
		return;
	}
	EntityPlayer entityPlayer = (EntityPlayer)player;
	TileEntityGravityLift tileEntity = (TileEntityGravityLift)entityPlayer.worldObj.getBlockTileEntity(x, y, z);
	tileEntity.bindHeightToTileEntity(height);
}
}

Link to comment
Share on other sites

did you check that server really has the right value ?

 

i dont think you need to, but its always a good thing to resync from server to client

 

entityPlayer.worldObj.markBlockForUpdate(x, y, z); // or similar name

 

call this inside your packet handler AFTER youve made the changes to your TE

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

  • 2 weeks later...

OK, I have been doing some testing with other entities, and they seem to launch fine, even with different height settings set on the grav lift, its like it seems to work for everything, but the player. Why is this? (I have removed the code about the par5Entity instanceof EntityPlayer, e.t.c and just placed the methods to propel entites in the air).

Link to comment
Share on other sites

Join the conversation

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

Guest
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • What I get is Error Game Crashed The game crashed whilst initializing game Error: org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered Exit Code: -1 ---------------- Once I press "view crash report" I get   ---- Minecraft Crash Report ---- // Daisy, daisy... Time: 12/3/21, 10:14 PM Description: Initializing game org.spongepowered.asm.mixin.transformer.throwables.MixinTransformerError: An unexpected critical error was encountered     at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:392) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:156) ~[modlauncher-9.0.7.jar:9.0.7+91+master.8569cdf] {}     at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88) ~[modlauncher-9.0.7.jar:?] {}     at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-9.0.7.jar:?] {}     at cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50) ~[modlauncher-9.0.7.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:110) ~[securejarhandler-0.9.54.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.lambda$findClass$16(ModuleClassLoader.java:213) ~[securejarhandler-0.9.54.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:223) ~[securejarhandler-0.9.54.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:213) ~[securejarhandler-0.9.54.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:130) ~[securejarhandler-0.9.54.jar:?] {}     at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {}     at net.minecraft.client.Minecraft.<init>(Minecraft.java:517) ~[client-1.18-20211130.085255-srg.jar%2371!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:169) ~[client-1.18-20211130.085255-srg.jar%2371!:?] {re:classloading,pl:runtimedistcleaner:A}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:45) ~[fmlloader-1.18-38.0.14.jar%2322!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {} Caused by: org.spongepowered.asm.mixin.throwables.ClassMetadataNotFoundException: net.minecraft.client.entity.player.ClientPlayerEntity     at org.spongepowered.asm.mixin.transformer.MixinPreProcessorStandard.transformMethod(MixinPreProcessorStandard.java:754) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.MixinPreProcessorStandard.transform(MixinPreProcessorStandard.java:739) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.MixinPreProcessorStandard.attach(MixinPreProcessorStandard.java:310) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.MixinPreProcessorStandard.createContextFor(MixinPreProcessorStandard.java:280) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.MixinInfo.createContextFor(MixinInfo.java:1288) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:292) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.TargetClassContext.apply(TargetClassContext.java:383) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:365) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     ... 28 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:392) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:250) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.service.modlauncher.MixinTransformationHandler.processClass(MixinTransformationHandler.java:131) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at org.spongepowered.asm.launch.MixinLaunchPluginLegacy.processClass(MixinLaunchPluginLegacy.java:131) ~[mixin-0.8.5.jar:0.8.5+Jenkins-b310.git-155314e6e91465dad727e621a569906a410cd6f4] {}     at cpw.mods.modlauncher.serviceapi.ILaunchPluginService.processClassWithFlags(ILaunchPluginService.java:156) ~[modlauncher-9.0.7.jar:9.0.7+91+master.8569cdf] {}     at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88) ~[modlauncher-9.0.7.jar:?] {}     at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-9.0.7.jar:?] {}     at cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50) ~[modlauncher-9.0.7.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:110) ~[securejarhandler-0.9.54.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.lambda$findClass$16(ModuleClassLoader.java:213) ~[securejarhandler-0.9.54.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:223) ~[securejarhandler-0.9.54.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:213) ~[securejarhandler-0.9.54.jar:?] {}     at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:130) ~[securejarhandler-0.9.54.jar:?] {}     at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {}     at net.minecraft.client.Minecraft.<init>(Minecraft.java:517) ~[client-1.18-20211130.085255-srg.jar%2371!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A} -- Initialization -- Details:     Modules:          ADVAPI32.dll:Advanced Windows 32 Base API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         COMCTL32.dll:User Experience Controls Library:6.10 (WinBuild.160101.0800):Microsoft Corporation         CRYPT32.dll:Crypto API32:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         CRYPTBASE.dll:Base cryptographic API DLL:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         CRYPTSP.dll:Cryptographic Service Provider API:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         ColorAdapterClient.dll:Microsoft Color Adapter Client:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         CoreMessaging.dll:Microsoft CoreMessaging Dll:10.0.19041.746:Microsoft Corporation         CoreUIComponents.dll:Microsoft Core UI Components Dll:10.0.19041.546:Microsoft Corporation         DBGHELP.DLL:Windows Image Helper:10.0.19041.867 (WinBuild.160101.0800):Microsoft Corporation         DEVOBJ.dll:Device Information Set DLL:10.0.19041.1151 (WinBuild.160101.0800):Microsoft Corporation         DNSAPI.dll:DNS Client API DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         GDI32.dll:GDI Client DLL:10.0.19041.1202 (WinBuild.160101.0800):Microsoft Corporation         GLU32.dll:OpenGL Utility Library DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         HID.DLL:Hid User Library:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         IMM32.DLL:Multi-User Windows IMM32 API Client DLL:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         IPHLPAPI.DLL:IP Helper API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         KERNEL32.DLL:Windows NT BASE API Client DLL:10.0.19041.1348 (WinBuild.160101.0800):Microsoft Corporation         KERNELBASE.dll:Windows NT BASE API Client DLL:10.0.19041.1348 (WinBuild.160101.0800):Microsoft Corporation         MMDevApi.dll:MMDevice API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         MSACM32.dll:Microsoft ACM Audio Filter:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         MSASN1.dll:ASN.1 Runtime APIs:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         MSCTF.dll:MSCTF Server DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         NLAapi.dll:Network Location Awareness 2:10.0.19041.1151 (WinBuild.160101.0800):Microsoft Corporation         NSI.dll:NSI User-mode interface DLL:10.0.19041.610 (WinBuild.160101.0800):Microsoft Corporation         NTASN1.dll:Microsoft ASN.1 API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         Ole32.dll:Microsoft OLE for Windows:10.0.19041.1320 (WinBuild.160101.0800):Microsoft Corporation         OleAut32.dll:OLEAUT32.DLL:10.0.19041.985 (WinBuild.160101.0800):Microsoft Corporation         OpenAL.dll         PROPSYS.dll:Microsoft Property System:7.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         PSAPI.DLL:Process Status Helper:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         Pdh.dll:Windows Performance Data Helper DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         RPCRT4.dll:Remote Procedure Call Runtime:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         SAPIWrapper_x64.dll         SETUPAPI.DLL:Windows Setup API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         SHCORE.dll:SHCORE:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         SHELL32.dll:Windows Shell Common Dll:10.0.19041.964 (WinBuild.160101.0800):Microsoft Corporation         USER32.dll:Multi-User Windows USER API Client DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         USERENV.dll:Userenv:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         VCRUNTIME140.dll:Microsoft® C Runtime Library:14.29.30133.0 built by: vcwrkspc:Microsoft Corporation         VERSION.dll:Version Checking and File Installation Libraries:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         WINHTTP.dll:Windows HTTP Services:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         WINMM.dll:MCI API DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         WINTRUST.dll:Microsoft Trust Verification APIs:10.0.19041.1266 (WinBuild.160101.0800):Microsoft Corporation         WS2_32.dll:Windows Socket 2.0 32-Bit DLL:10.0.19041.1081 (WinBuild.160101.0800):Microsoft Corporation         WSOCK32.dll:Windows Socket 32-Bit DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         Wldp.dll:Windows Lockdown Policy:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         amsi.dll:Anti-Malware Scan Interface:10.0.19041.746 (WinBuild.160101.0800):Microsoft Corporation         atcuf64.dll:Bitdefender Active Threat Control Usermode Filter:1.42.307.0 #0xf81500a12:Bitdefender S.R.L. Bucharest, ROMANIA         atiadlxx.dll:ADL:7.20.40.1402:Advanced Micro Devices, Inc.         atig6pxx.dll:atiglpxx.dll:8.14.01.6564:Advanced Micro Devices, Inc.          atig6txx.dll:atigktxx.dll:8.14.01.6564:Advanced Micro Devices, Inc.          atio6axx.dll:AMD OpenGL driver:8.14.11000.14756:Advanced Micro Devices, Inc.         bcrypt.dll:Windows Cryptographic Primitives Library:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         bcryptPrimitives.dll:Windows Cryptographic Primitives Library:10.0.19041.1348 (WinBuild.160101.0800):Microsoft Corporation         cfgmgr32.dll:Configuration Manager DLL:10.0.19041.1151 (WinBuild.160101.0800):Microsoft Corporation         clbcatq.dll:COM+ Configuration Catalog:2001.12.10941.16384 (WinBuild.160101.0800):Microsoft Corporation         combase.dll:Microsoft COM for Windows:10.0.19041.1320 (WinBuild.160101.0800):Microsoft Corporation         dbgcore.DLL:Windows Core Debugging Helpers:10.0.19041.789 (WinBuild.160101.0800):Microsoft Corporation         dhcpcsvc.DLL:DHCP Client Service:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         dhcpcsvc6.DLL:DHCPv6 Client:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         dinput8.dll:Microsoft DirectInput:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         dwmapi.dll:Microsoft Desktop Window Manager API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         dxcore.dll:DXCore:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         dxva2.dll:DirectX Video Acceleration 2.0 DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         fastprox.dll:WMI Custom Marshaller:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         fwpuclnt.dll:FWP/IPsec User-Mode API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         gdi32full.dll:GDI Client DLL:10.0.19041.1110 (WinBuild.160101.0800):Microsoft Corporation         glfw.dll         icm32.dll:Microsoft Color Management Module (CMM):10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         inputhost.dll:InputHost:10.0.19041.906 (WinBuild.160101.0800):Microsoft Corporation         java.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         javaw.exe:OpenJDK Platform binary:17.0.1.0:Microsoft         jemalloc.dll         jimage.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         jli.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         jna7138277671719183896.dll:JNA native library:6.1.1:Java(TM) Native Access (JNA)         jvm.dll:OpenJDK 64-Bit server VM:17.0.1.0:Microsoft         kernel.appcore.dll:AppModel API Host:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         lwjgl.dll         lwjgl_opengl.dll         lwjgl_stb.dll         management.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         management_ext.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         mscms.dll:Microsoft Color Matching System DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         msdmo.dll:DMO Runtime:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         msvcp140.dll:Microsoft® C Runtime Library:14.29.30133.0 built by: vcwrkspc:Microsoft Corporation         msvcp_win.dll:Microsoft® C Runtime Library:10.0.19041.789 (WinBuild.160101.0800):Microsoft Corporation         msvcrt.dll:Windows NT CRT DLL:7.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         mswsock.dll:Microsoft Windows Sockets 2.0 Service Provider:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         napinsp.dll:E-mail Naming Shim Provider:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         ncrypt.dll:Windows NCrypt Router:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         net.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         nio.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         ntdll.dll:NT Layer DLL:10.0.19041.1023 (WinBuild.160101.0800):Microsoft Corporation         ntmarta.dll:Windows NT MARTA provider:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         opengl32.dll:OpenGL Client DLL:10.0.19041.1081 (WinBuild.160101.0800):Microsoft Corporation         perfos.dll:Windows System Performance Objects DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         pnrpnsp.dll:PNRP Name Space Provider:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         profapi.dll:User Profile Basic API:10.0.19041.844 (WinBuild.160101.0800):Microsoft Corporation         rasadhlp.dll:Remote Access AutoDial Helper:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         rsaenh.dll:Microsoft Enhanced Cryptographic Provider:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         sapi.dll:Speech API:5.3.24006.00 (WinBuild.160101.0800):Microsoft Corporation         sechost.dll:Host for SCM/SDDL/LSA Lookup APIs:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         shlwapi.dll:Shell Light-weight Utility Library:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         sunmscapi.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         svml.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         textinputframework.dll:"TextInputFramework.DYNLINK":10.0.19041.1320 (WinBuild.160101.0800):Microsoft Corporation         ucrtbase.dll:Microsoft® C Runtime Library:10.0.19041.789 (WinBuild.160101.0800):Microsoft Corporation         uxtheme.dll:Microsoft UxTheme Library:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         vcruntime140_1.dll:Microsoft® C Runtime Library:14.29.30133.0 built by: vcwrkspc:Microsoft Corporation         verify.dll:OpenJDK Platform binary:17.0.1.0:Microsoft         wbemcomn.dll:WMI:10.0.19041.1081 (WinBuild.160101.0800):Microsoft Corporation         wbemprox.dll:WMI:10.0.19041.1320 (WinBuild.160101.0800):Microsoft Corporation         wbemsvc.dll:WMI:10.0.19041.1320 (WinBuild.160101.0800):Microsoft Corporation         win32u.dll:Win32u:10.0.19041.1320 (WinBuild.160101.0800):Microsoft Corporation         windows.storage.dll:Microsoft WinRT Storage API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         winmmbase.dll:Base Multimedia Extension API DLL:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         winrnr.dll:LDAP RnR Provider DLL:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         wintypes.dll:Windows Base Types DLL:10.0.19041.1320 (WinBuild.160101.0800):Microsoft Corporation         wshbth.dll:Windows Sockets Helper DLL:10.0.19041.546 (WinBuild.160101.0800):Microsoft Corporation         xinput1_4.dll:Microsoft Common Controller API:10.0.19041.1 (WinBuild.160101.0800):Microsoft Corporation         zip.dll:OpenJDK Platform binary:17.0.1.0:Microsoft Stacktrace:     at net.minecraft.client.main.Main.main(Main.java:169) ~[client-1.18-20211130.085255-srg.jar%2371!:?] {re:classloading,pl:runtimedistcleaner:A}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}     at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}     at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:45) ~[fmlloader-1.18-38.0.14.jar%2322!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%235!:?] {}     at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {} -- System Details -- Details:     Minecraft Version: 1.18     Minecraft Version ID: 1.18     Operating System: Windows 10 (amd64) version 10.0     Java Version: 17.0.1, Microsoft     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Microsoft     Memory: 623097272 bytes (594 MiB) / 1442840576 bytes (1376 MiB) up to 2147483648 bytes (2048 MiB)     CPUs: 16     Processor Vendor: AuthenticAMD     Processor Name: AMD Ryzen 9 5900HS with Radeon Graphics             Identifier: AuthenticAMD Family 25 Model 80 Stepping 0     Microarchitecture: Zen 3     Frequency (GHz): 3.29     Number of physical packages: 1     Number of physical CPUs: 8     Number of logical CPUs: 16     Graphics card #0 name: AMD Radeon(TM) Graphics     Graphics card #0 vendor: Advanced Micro Devices, Inc. (0x1002)     Graphics card #0 VRAM (MB): 512.00     Graphics card #0 deviceId: 0x1638     Graphics card #0 versionInfo: DriverVersion=27.20.14044.2001     Graphics card #1 name: NVIDIA GeForce RTX 3070 Laptop GPU     Graphics card #1 vendor: NVIDIA (0x10de)     Graphics card #1 VRAM (MB): 4095.00     Graphics card #1 deviceId: 0x249d     Graphics card #1 versionInfo: DriverVersion=27.21.14.6213     Memory slot #0 capacity (MB): 8192.00     Memory slot #0 clockSpeed (GHz): 3.20     Memory slot #0 type: DDR4     Memory slot #1 capacity (MB): 8192.00     Memory slot #1 clockSpeed (GHz): 3.20     Memory slot #1 type: DDR4     Virtual memory max (MB): 18208.38     Virtual memory used (MB): 10540.94     Swap memory total (MB): 2432.00     Swap memory used (MB): 29.15     JVM Flags: 9 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xss1M -Xmx2G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M     Launched Version: 1.18-forge-38.0.14     Backend library: LWJGL version 3.2.2 SNAPSHOT     Backend API: AMD Radeon(TM) Graphics GL version 3.2.14756 Core Profile Forward-Compatible Context 20.40.44.02 27.20.14044.2001, ATI Technologies Inc.     Window size: <not initialized>     GL Caps: Using framebuffer using OpenGL 3.2     GL debug messages:      Using VBOs: Yes     Is Modded: Definitely; Client brand changed to 'forge'     Type: Client (map_client.txt)     CPU: 16x AMD Ryzen 9 5900HS with Radeon Graphics      ModLauncher: 9.0.7+91+master.8569cdf     ModLauncher launch target: forgeclient     ModLauncher naming: srg     ModLauncher services:           mixin PLUGINSERVICE           eventbus PLUGINSERVICE           object_holder_definalize PLUGINSERVICE           runtime_enum_extender PLUGINSERVICE           capability_token_subclass PLUGINSERVICE           accesstransformer PLUGINSERVICE           runtimedistcleaner PLUGINSERVICE           mixin TRANSFORMATIONSERVICE           fml TRANSFORMATIONSERVICE      FML Language Providers:          minecraft@1.0         javafml@null     Mod List:          client-1.18-20211130.085255-srg.jar               |Minecraft                     |minecraft                     |1.18                |NONE      |Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f         forge-1.18-38.0.14-universal.jar                  |Forge                         |forge                         |38.0.14             |NONE      |Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90
    • Join the newly started Battle Vortex Lifesteal SMP. we need new players to participate in the upcoming base wars. Newbies are welcome Veterans are appreciated. No swearing..... or atleast censor it a little. you can apply to join through this discord link: https://discord.gg/r3DBuvwQ
    • BATTLE VORTEX is a new lifesteal SMP we need new players so join today and take part in the upcoming base wars. Newbies are welcome. Veterans are appreciated. NO SWEARING......or atleast censor it a little. You can apply to join through this discord link(its me): https://discord.gg/r3DBuvwQ
    • It doesn't work even if I remove every mod Please help
    • Hi, so I was making an item that sends info to the server to do some work, and I want the server to send the client back the results? How do I do that? Here is my code:   The snippet that sends the packet to the server SimpleChannelNetwork.CHANNEL.sendToServer(new CreateStructureCompass("fortress"));   The file that manage the traffic package io.github.bossmania.NetherandEndMaps.core.network; import io.github.bossmania.NetherandEndMaps.NetherandEndMaps; import io.github.bossmania.NetherandEndMaps.core.network.message.CreateStructureCompass; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.network.NetworkRegistry; import net.minecraftforge.fml.network.simple.SimpleChannel; public class SimpleChannelNetwork { public static final String NETWORK_VERSION = "0.1.0"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(NetherandEndMaps.MOD_ID, "network"), () -> NETWORK_VERSION, version -> version.equals(NETWORK_VERSION), version -> version.equals(NETWORK_VERSION)); public static void init() { CHANNEL.registerMessage(0, CreateStructureCompass.class ,CreateStructureCompass::encode, CreateStructureCompass::decode, CreateStructureCompass::handle); } }   the code that handle the packet receive and where I want the server to send back a packet to the client package io.github.bossmania.NetherandEndMaps.core.network.message; import java.util.function.Supplier; import io.github.bossmania.NetherandEndMaps.common.items.TemporaryItem; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.fml.network.NetworkEvent; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; public class CreateStructureCompass { public String structureType; public CreateStructureCompass() { } //create the constructor and store the structureType public CreateStructureCompass(String structureType) { this.structureType = structureType; } //encode the message public static void encode(CreateStructureCompass message, PacketBuffer buffer) { buffer.writeString(message.structureType); } //decode the message public static CreateStructureCompass decode(PacketBuffer buffer) { return new CreateStructureCompass(buffer.readString()); } //execute function when message is sent to server public static void handle(CreateStructureCompass message, Supplier<NetworkEvent.Context> contextSupplier) { NetworkEvent.Context context = contextSupplier.get(); context.enqueueWork(() -> { //get the player and the server ServerPlayerEntity player = context.getSender(); ServerWorld SEWorld = player.getServerWorld(); //get the location of the structure BlockPos structureLocation = SEWorld.func_241117_a_(Structure.FORTRESS, player.getPosition(),100, false); //this is where I want the server to send structureLocation back to the player }); context.setPacketHandled(true); } }  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.