-
Forge 1.7.10 crashes after clicking multiplayer button in eclipse
I have same problem. Looks like trouble is in file eclipse/servers.dat If i remove file - it ok, but when i add new server - it's crashes
-
[1.3.2][SOLVED] Problem with saving/loading block's data in NBT
Bandayd, thanks for inchat debug. I can't use metadata - its used for skin. I've used metadata for storage rotation value, but here I cant =C DarkGuardsman, Thanks! It works! For history: TileEntity public class TileEntityFlag extends TileEntity implements IPacketReceiver { public int angle; public int type; public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setInteger("type", this.type); par1NBTTagCompound.setInteger("ang", this.angle); } public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); this.type = par1NBTTagCompound.getInteger("type"); this.angle = par1NBTTagCompound.getInteger("ang"); } public int getAngle() { return this.angle; } public void setValues(byte i, byte j) { this.type = i; this.angle = j; } public int getType() { return this.type; } //method used for getting packet from PacketManager public Packet getPacket() { int[] data = this.getSendLoadInt(); ; if(data == null) { data = new int[]{}; } return PacketManager.TECommonPacket(this, "UltimateExtender", 0, data); } public int[] getSendLoadInt() { return new int[] {angle,type}; //array that stores all int that need to be sent by packet make sure what is in here ir read in handlePacketData } //is it a standard method? public Packet getAuxillaryInfoPacket() { return getPacket(); } @Override public void handlePacketData(NetworkManager network, String channel, ByteArrayDataInput data) { try { this.angle = data.readInt(); this.type = data.readInt(); } catch (Exception e) { e.printStackTrace(); } } } PacketManager public class PacketManager implements IPacketHandler { //thanks to DarkGuardsman @Override public void onPacketData(NetworkManager network, Packet250CustomPayload packet, Player player) { try { ByteArrayDataInput data = ByteStreams.newDataInput(packet.data); int x = data.readInt(); int y = data.readInt(); int z = data.readInt(); //the following two are not used but can be for sorting packets by ID and restricting packet reading by lengths int id = data.readInt();//packet ID your welcome to set to zero int l = data.readInt(); //packet length a safety var to make sure only data is read. EntityPlayer ePlayer = (EntityPlayer) player; if(ePlayer != null) { TileEntity tileEntity = ePlayer.worldObj.getBlockTileEntity(x, y, z); if(tileEntity != null) { if(tileEntity instanceof IPacketReceiver) { ((IPacketReceiver) tileEntity). handlePacketData(network,packet.channel, data); } } } } catch(Exception e) { e.printStackTrace(); } } /** * * @param sender - TileEntity sending this packet * @param channelName - channel name "channelName" * @param id - packet id * @param sendData - list of Integers to be sent is read after main data * @param string - list of strings to be sent is read last * @return a constructed packet ready to be sent */ //If your looking for a better version check out Calclavia's PacketManager his is very well developed public static Packet TECommonPacket(TileEntity sender, String channelName,int id, int[] sendData) { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); DataOutputStream data = new DataOutputStream(bytes); try { data.writeInt(sender.xCoord); data.writeInt(sender.yCoord); data.writeInt(sender.zCoord); data.writeInt(id); data.writeInt(3+sendData.length); //Here we writes our data; for(int i =0; i < sendData.length; i++) { data.writeInt(sendData[i]); } } catch (IOException e) { e.printStackTrace(); } Packet250CustomPayload packet = new Packet250CustomPayload(); packet.channel = "UltimateExtender";//TODO change to registered channel for you mod packet.data = bytes.toByteArray(); packet.length = packet.data.length; packet.isChunkDataPacket = true; return packet; } } YAY!
-
[1.3.2][SOLVED] Problem with saving/loading block's data in NBT
Ok, maybe when i create TileEntity and change some values in createTileEntity(World world, int metadata) it works, but if I trying to change it from client side - it fails. That's why I must create proper packet exchange. So I looked in your code, made something that look pretty the same... but it fails again. So can you or someone that reads this help with this? Maybe manuals or something?
-
[1.3.2][SOLVED] Problem with saving/loading block's data in NBT
Thanks, I'll try. But I'm testing it in singleplayer and this value is saves and loads(after exit) propertly: and this is not:
-
[1.3.2][SOLVED] Problem with saving/loading block's data in NBT
I don't know why, but its not. In Render i'm trying to get angle from TileEntity is it right? public void renderFlag(TileEntity tileEntity, double d, double d1, double d2, float f) { TileEntityFlag myTile = (TileEntityFlag)tileEntity; //System.out.println(myTile.getSkin()); float deg = (float)(myTile.getAngle() * 360) / 16.0F; int i = myTile.getType(); int j = myTile.getBlockMetadata(); GL11.glPushMatrix(); GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F); GL11.glScalef(1.0F, 1.0F, 1.0F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(deg, 0.0F, 1.0F, 0.0F); bindTextureByName(getPath(i,j)); modelFlag.render(0.0625F); GL11.glPopMatrix(); }
-
[1.3.2][SOLVED] Problem with saving/loading block's data in NBT
Hello again. I have a problem with saving value of TileEntity. I have items and blocks with metadata, so I can't storage angle there. When I place block - it's OK. But, when i reenter - all blocks rotated at 0 angle. Maybe I missed something. Before: After: BlockFlag.java: public class BlockFlag extends Block { private byte flagType; private Class flagEntityClass; private byte angle; public BlockFlag(int i, Class class1) { super(i, Material.cloth); flagEntityClass = class1; setHardness(1.5F); setResistance(1.5F); setStepSound(Block.soundWoodFootstep); setBlockName("Minecraft Standart"); this.setTextureFile(getTextureFile()); blockIndexInTexture = 5; this.setRequiresSelfNotify(); this.isBlockContainer = true; } public void setValue(Item anItemDrop, byte aFlagType) { flagType = aFlagType; //flagMetadata = aFlagMetadata; } public TileEntity getBlockEntity() { try { return (TileEntity)flagEntityClass.newInstance(); } catch (Exception exception) { throw new RuntimeException(exception); } } public TileEntity createTileEntity(World world, int metadata) { TileEntityFlag myTile = new TileEntityFlag(); myTile.setValues(flagType); myTile.onInventoryChanged(); return myTile; } public TileEntity createNewTileEntity(World var1) { TileEntityFlag tileEntityFlag = new TileEntityFlag(); return tileEntityFlag; } public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { // NOT IMPORTANT } private boolean canPlaceFlagOn(World par1World, int par2, int par3, int par4) { // NOT IMPORTANT } protected int damageDropped(int par1) { return par1; } public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) { return canPlaceFlagOn(par1World, par2, par3 - 1, par4); } private boolean dropFlagIfCantStay(World par1World, int par2, int par3, int par4) { // NOT IMPORTANT } public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { // NOT IMPORTANT } public int idDropped(int i, Random random, int j) { return UltimateExtender.itemFlag.shiftedIndex; } @SideOnly(Side.CLIENT) /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) { // NOT IMPORTANT } public int quantityDropped(Random random) { return 1; } public int getRenderType() { return -1; } @Override public String getTextureFile() { return Params.TEXTURE_PATH_BLOCKS; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public void onBlockAdded(World par1World, int par2, int par3, int par4) { super.onBlockAdded(par1World, par2, par3, par4); TileEntityFlag myTile = (TileEntityFlag)this.createTileEntity(par1World, par1World.getBlockMetadata(par2, par3, par4)); par1World.setBlockTileEntity(par2, par3, par4, myTile); } public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLiving par5EntityLiving) { TileEntityFlag myTile = (TileEntityFlag)par1World.getBlockTileEntity(par2, par3, par4); this.angle = (byte) (MathHelper.floor_double((double)(par5EntityLiving.rotationYaw + 180.0F) * 16.0F / 360.0F) & 15); myTile.angle = this.angle; myTile.onInventoryChanged(); } public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { super.breakBlock(par1World, par2, par3, par4, par5, par6); par1World.removeBlockTileEntity(par2, par3, par4); } } ItemFlag.java public class ItemFlag extends Item { private int blockID; public static String[] flagNames = new String[]{"flag1","flag2","flag3","flag4","flag5","flag6","flag7","flag8", "flag9","flag10","flag11","flag12","flag13","flag14","flag15","flag16"}; public ItemFlag(int i, Block block) { super(i); blockID = block.blockID; this.setHasSubtypes(true); this.setMaxDamage(0); } public int getIconFromDamage(int par1) { int var2 = MathHelper.clamp_int(par1, 0, 15); return this.iconIndex + var2; } public String getItemNameIS(ItemStack par1ItemStack) { int var2 = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 15); return super.getItemName() + "." + flagNames[var2]; } @SideOnly(Side.CLIENT) /** * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) */ public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) { for (int var4 = 0; var4 < 16; ++var4) { par3List.add(new ItemStack(par1, 1, var4)); } } public int getMetadata(int par1) { return par1; } public int getBlockID() { return this.blockID; } public boolean tryPlaceIntoWorld(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { int var11 = par3World.getBlockId(par4, par5, par6); if (var11 == Block.snow.blockID) { par7 = 1; } else if (var11 != Block.vine.blockID && var11 != Block.tallGrass.blockID && var11 != Block.deadBush.blockID && (Block.blocksList[var11] == null || !Block.blocksList[var11].isBlockReplaceable(par3World, par4, par5, par6))) { if (par7 == 0) { --par5; } if (par7 == 1) { ++par5; } if (par7 == 2) { --par6; } if (par7 == 3) { ++par6; } if (par7 == 4) { --par4; } if (par7 == 5) { ++par4; } } if (par1ItemStack.stackSize == 0) { return false; } else if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6)) { return false; } else if (par5 == 255 && Block.blocksList[this.blockID].blockMaterial.isSolid()) { return false; } else if (par3World.canPlaceEntityOnSide(this.blockID, par4, par5, par6, false, par7, par2EntityPlayer)) { Block var12 = Block.blocksList[this.blockID]; if (placeBlockAt(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10)) { par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), var12.stepSound.getStepSound(), (var12.stepSound.getVolume() + 1.0F) / 2.0F, var12.stepSound.getPitch() * 0.8F); --par1ItemStack.stackSize; } return true; } else { return false; } } public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if (!world.setBlockAndMetadataWithNotify(x, y, z, this.blockID, this.getMetadata(stack.getItemDamage()))) { return false; } if (world.getBlockId(x, y, z) == this.blockID) { Block.blocksList[this.blockID].updateBlockMetadata(world, x, y, z, side, hitX, hitY, hitZ); Block.blocksList[this.blockID].onBlockPlacedBy(world, x, y, z, player); } return true; } } TileEntityFlag.java: public class TileEntityFlag extends TileEntity { public byte angle; private byte type; public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setByte("ang", this.angle); par1NBTTagCompound.setByte("type", this.type); } public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); this.type = par1NBTTagCompound.getByte("type"); this.angle = par1NBTTagCompound.getByte("ang"); } public void setAngle(byte i) { this.angle = i; } public int getAngle() { return this.angle; } public void setValues(byte i) { this.type = i; } public int getType() { return this.type; } }
-
[Solved]Problems with custom model render. (I guess so)
Why? When I changed Block on BlockContainer it's worked.
-
[Solved]Problems with custom model render. (I guess so)
public class BlockBones extends BlockContainer not public class BlockBones extends Block
-
[Solved]Problems with custom model render. (I guess so)
Forgot to attach Model file. ModelBones.java package ru.ulmc.ulex; import net.minecraft.src.Entity; import net.minecraft.src.ModelBase; import net.minecraft.src.ModelRenderer; public class ModelBones extends ModelBase { //fields ModelRenderer bone1; ModelRenderer skull; ModelRenderer bone2; ModelRenderer bone3; ModelRenderer bone5; ModelRenderer goldcoin; ModelRenderer backbone1; ModelRenderer verticalbone; public ModelBones() { textureWidth = 32; textureHeight = 16; bone1 = new ModelRenderer(this, 0, 14); bone1.addBox(0F, 0F, 0F, 9, 1, 1); bone1.setRotationPoint(-2F, 23F, -6F); bone1.setTextureSize(32, 16); bone1.mirror = true; setRotation(bone1, 0F, -0.2602503F, 0F); skull = new ModelRenderer(this, 0, 0); skull.addBox(0F, -6F, -3F, 6, 6, 6); skull.setRotationPoint(-3F, 23F, 0F); skull.setTextureSize(32, 16); skull.mirror = true; setRotation(skull, 0.1115358F, -0.2602503F, -0.3346075F); bone2 = new ModelRenderer(this, 0, 14); bone2.addBox(-5F, 0F, 0F, 10, 1, 1); bone2.setRotationPoint(0F, 23F, 5F); bone2.setTextureSize(32, 16); bone2.mirror = true; setRotation(bone2, 0F, 0.2602503F, 0F); bone3 = new ModelRenderer(this, 27, 0); bone3.addBox(0F, -7F, 0F, 1, 9, 1); bone3.setRotationPoint(1.866667F, 22.66667F, -1.333333F); bone3.setTextureSize(32, 16); bone3.mirror = true; setRotation(bone3, -1.449966F, 0F, 0F); bone5 = new ModelRenderer(this, 27, 0); bone5.addBox(0F, -10F, 0F, 1, 10, 1); bone5.setRotationPoint(-2F, 22F, 5F); bone5.setTextureSize(32, 16); bone5.mirror = true; setRotation(bone5, 0.1858931F, 1.115358F, 1.635859F); goldcoin = new ModelRenderer(this, 24, 13); goldcoin.addBox(0F, 0F, 0F, 2, 1, 2); goldcoin.setRotationPoint(4F, 23F, 3F); goldcoin.setTextureSize(32, 16); goldcoin.mirror = true; setRotation(goldcoin, 0F, 1.003822F, 0F); backbone1 = new ModelRenderer(this, 0, 14); backbone1.addBox(-6F, 0F, 0F, 9, 1, 1); backbone1.setRotationPoint(-4.6F, 23.26667F, -4.666667F); backbone1.setTextureSize(32, 16); backbone1.mirror = true; setRotation(backbone1, 1.245484F, 1.189716F, 0F); verticalbone = new ModelRenderer(this, 27, 0); verticalbone.addBox(0F, 0F, 0F, 1, 6, 1); verticalbone.setRotationPoint(-4.666667F, 18F, 3.866667F); verticalbone.setTextureSize(32, 16); verticalbone.mirror = true; setRotation(verticalbone, -0.0743572F, 0.4089647F, 0.1858931F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); bone1.render(f5); skull.render(f5); bone2.render(f5); bone3.render(f5); bone5.render(f5); goldcoin.render(f5); backbone1.render(f5); verticalbone.render(f5); } public void render(float f5) { bone1.render(f5); skull.render(f5); bone2.render(f5); bone3.render(f5); bone5.render(f5); goldcoin.render(f5); backbone1.render(f5); verticalbone.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { super.setRotationAngles(f, f1, f2, f3, f4, f5); } }
-
[Solved]Problems with custom model render. (I guess so)
Maybe i missed something, but: main file package ru.ulmc.ulex; import java.util.logging.Level; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Item; import net.minecraft.src.ItemStack; import net.minecraft.src.ModLoader; import net.minecraftforge.common.Configuration; import ru.ulmc.ulex.CommonProxy; @Mod(modid = "UltimateExtender", name = "Ultimate Extender", version = "In-Dev 1.0") @NetworkMod( channels = { "UltimateExtender" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class) public class UltimateExtender { @Instance public static UltimateExtender instance; @SidedProxy(clientSide = "ru.ulmc.ulex.ClientProxy", serverSide = "ru.ulmc.ulex.CommonProxy") public static CommonProxy proxy; // Blocks here public static BlockBones blockBones; // Items here public static ItemSkull itemSkull; // Череп // Configuration Values private int blockBonesID; @PreInit public void preInit(FMLPreInitializationEvent event) { // Loading in Configuration Data Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); proxy.registerRenderInformation(); //You have to call the methods in your proxy class try { cfg.load(); // Load Block IDs blockBonesID = cfg.getOrCreateBlockIdProperty("Bones", 1400).getInt(1400); // Load Item IDs NOT! } catch (Exception e) { FMLLog.log(Level.SEVERE, e, "UltimateExtender's configuration failed to load."); } finally { cfg.save(); } } @Init public void init(FMLInitializationEvent evt) { // Initialize Blocks ! blockBones = new BlockBones(blockBonesID, TileEntityBones.class); //Initialize Items part 1 itemSkull = new ItemSkull(2600, blockBones); //Creating Items proxy.CreateItem(itemSkull, 0, "Skull", "Череп", "Skull"); //Add Localization Data proxy.PrepareBlock(blockBones, "Груда костей", "Pile of bones"); // Register Blocks Recipes // registring blocks GameRegistry.registerBlock(blockBones); // Register Rendering Information GameRegistry.registerTileEntity(TileEntityBones.class, "TileEntityBones"); EntityRegistry.registerModEntity(EntityExplosiveStick.class, "EntityExplosiveStick", EntityRegistry.findGlobalUniqueEntityId(), this, 200, 30, false); proxy.registerTileEntitySpecialRenderer(); } @PostInit public void postInit(FMLPostInitializationEvent evt) { // TODO: Add Post-Initialization code such as mod hooks } } ClientProxy package ru.ulmc.ulex; import ru.ulmc.ulex.CommonProxy; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import net.minecraft.src.Block; import net.minecraft.src.CreativeTabs; import net.minecraft.src.Item; import net.minecraft.src.World; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.MinecraftForge; public class ClientProxy extends CommonProxy { @Override public void preInit() { MinecraftForgeClient.preloadTexture("/ru/ulmc/png/UltimateExtender.png"); MinecraftForgeClient.preloadTexture("/ru/ulmc/png/ulmcitems.png"); MinecraftForgeClient.preloadTexture("/ru/ulmc/png/bones.png"); MinecraftForge.EVENT_BUS.register(this); // Just in case. I don't know what it is. ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBones.class, new RenderBones()); } @Override public void registerTileEntitySpecialRenderer() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBones.class, new RenderBones()); } @Override public World getClientWorld() { return FMLClientHandler.instance().getClient().theWorld; } @Override public void CreateItem(Item anItem, int index, String name, String ru, String en) { anItem.setTabToDisplayOn(CreativeTabs.tabTransport); anItem.setIconIndex(index); anItem.setItemName(name); anItem.setTextureFile("/ru/ulmc/png/ulmcitems.png"); LanguageRegistry.instance().addStringLocalization(anItem.getItemName() + ".name", "ru_RU", ru); LanguageRegistry.instance().addStringLocalization(anItem.getItemName() + ".name", "en_US", en); } @Override public void PrepareBlock(Block aBlock, String ru, String en) { // Register Blocks //Localization LanguageRegistry.instance().addStringLocalization(aBlock.getBlockName() + ".name", "ru_RU", ru); LanguageRegistry.instance().addStringLocalization(aBlock.getBlockName() + ".name", "en_US", en); } }
-
[Solved]Problems with custom model render. (I guess so)
Hello. I have a problem with custom model render - no any errors, but in game i can't see my block model(it works fine, but block is invisible) only cubic frame. It's not a missing texture file. I'm looking for solution for a second day, you my last chance. And if anyone knows about good manual about classes and methods in minecraft, please give me a link, thank you. Here is my source: mod class BonesBlock.java RenderBones.java TileEntityBones.java CommonProxy.java - don't really need ClientProxy.java - don't really need
IPS spam blocked by CleanTalk.