
Kloonder
Members-
Posts
171 -
Joined
-
Last visited
Everything posted by Kloonder
-
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
Wie würde man sagen, bei dir ist Hopfen und Malz verloren. Dude, it's not possible to help you, wait, really, that could help you: Step 1: Learn English Step 2: Visit this site: https://www.thenewboston.com/videos.php?cat=31&video=17966 That was the site where I learned java. Step 3: Visit this site again and ask for help -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
lol -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
What did Minecraft print out? -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
Dude, I can't help you, because I don't understand what you are potatoing around, I thing even you don't know what you want. I mean this code @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int t, float fx, float fy, float fz) } return true; } This code does as much as: public static Object solveAllHumanProblems(Object...allProblems){ return 42; } Type this and put in your problems like this: @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int t, float fx, float fy, float fz){ int[] theSolutions = new int[3]; theSolutions[0] = (Integer) solveAllHumanProblems("L34rn_3ngl1sh"); theSolutions[1] = (Integer) solveAllHumanProblems("L3arn_J4v4"); theSolutions[2] = (Integer) solveAllHumanProblems(Math.sqrt(1337)); int theAbsSolution = 0; for(int i = 0; i < theSolutions.length; i++){ theAbsSolution += theSolutions[i]; } System.out.println(theAbsSolution); return true; } Its good code from year 2147 After doing this, tell me what Minecraft said, then I will tell you what to do next -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
الأرض لكم، الأرض لكم، هل يمكن أن نفهم لي، 1، 2، 3 اختبار اختبار -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
It is already or not sir ? Why want create it ? You need to USE the event, not create it, instantiate it, or anything else. You need to create a LISTENER. Draco, he just told me, that his problem is, that he places a block when he clicks on chest, and he doesn't want that to happen, but as I said, I don't think he can understand us -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
Dude, am I jesus? You are the guy with the IDE -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
So I still have no idea, what you are talking about, because I'm sure you can't understand what I'm potato here, but anyway, here is code: @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { player.openGui(ModArmMod.instance, ModArmMod.ArmorModifierGuiID, world, pos.getX(), pos.getY(), pos.getZ()); //So I'm not quite sure what you should return here, either true or false, one of them will do that what you want to return true; } -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
So if I understand your problem correctly, you have the problem, that when you rightClick your chest, you place a block, but you don't want that block to be placed? https://translate.google.de/ -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
https://translate.google.de/#en/ar/Where%20is%20DieSieben07%2C%20where%20is%20Draco%2C%20I%20think%20we%20have%20a%20competitor%20for%20a%20thread%20lock%2C%20before%20it%20gets%20stupid That may help, I translated for you in Arabic -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
Where is DieSieben07, where is Draco, I think we have a competitor for a thread lock, before it gets stupid -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
It is already or not sir ? Why want create it ? import net.minecraftforge.event.entity.player.PlayerInteractEvent; I think your main problem is not that you can't actually speak english, you also don't know java. How to do will give I excel like u ? Your excel most in world lol. http://upload.siamza.com/file_upload/modify/070915/2319286.jpg[/img] Well, I don't use excel, I prefer OpenOffice -
[1.7.2] I want right click blockchest during the sneak.
Kloonder replied to mrsunz's topic in Modder Support
I think your main problem is not that you can't actually speak english, you also don't know java. -
Well I did, but it doesn't work The player just dropps to ground, as I remember correctly, the motion handling is done by client?
-
Get extact MovingObjectPoition from the Player
Kloonder replied to Kloonder's topic in Modder Support
Well, taht doesn't seem to work, anyway, on server, it seems like the look is sometimes up to 2 blocks in x and z coords wrong, but why, maybe a minecraft problem itself, and if, how fix -
I have a question, it seems like you cant give a player any motion in this context, it works perfectly with a pig or something like that, but a player doen't want to fly away, thats weird @Override public void onLeftClick(World world, ItemStack stack, EntityLivingBase player) { NBTTagCompound nbt = stack.getTagCompound(); if(!world.isRemote){ Entity entity = null; if(nbt.getString("EntityID") != ""){ WorldServer server = (WorldServer) world; entity = server.getEntityFromUuid(UUID.fromString(nbt.getString("EntityID"))); } if(nbt.getBoolean("SomethingTaken")){ if(entity != null){ if(entity instanceof EntityNotFallingBlock){ EntityBlock entityBlock = new EntityBlock(world, player, ((EntityNotFallingBlock) entity).getBlock()); entityBlock.tileEntityData = ((EntityNotFallingBlock) entity).tileEntityData; entityBlock.posX = entity.posX; entityBlock.posY = entity.posY; entityBlock.posZ = entity.posZ; world.spawnEntityInWorld(entityBlock); stack.setTagCompound(new NBTTagCompound()); entity.setDead(); }else{ stack.setTagCompound(new NBTTagCompound()); float f = 2; if(entity instanceof EntityPlayer){ double motionX = (double)(-MathHelper.sin(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f); double motionZ = (double)(MathHelper.cos(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f); double motionY = (double)(-MathHelper.sin((player.rotationPitch / 180.0F * (float)Math.PI) * f)); MoreMinecraft.network.sendTo(new MessageToClient(1, motionX, motionY, motionZ), (EntityPlayerMP) player); }else{ entity.motionX = (double)(-MathHelper.sin(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f); entity.motionZ = (double)(MathHelper.cos(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f); entity.motionY = (double)(-MathHelper.sin((player.rotationPitch / 180.0F * (float)Math.PI) * f)); } } } } } } And yes the method gets called
-
Get extact MovingObjectPoition from the Player
Kloonder replied to Kloonder's topic in Modder Support
Well, I don't know if you perform magic to get your vec point, so used the one I already had, and that doen't work at all -
So I used this code, but its too inaccurate, and because I have only a very small idea what these cos and sin (I know that these return numbers wich are somehow working with the rotation to 360) methods are doing, I can't really change them, sorry for bad Math public static MovingObjectPosition getMovingObjectPositionFromPlayer(World world, EntityPlayer entityplayer, boolean flag, double reach) { float f = 1.0F; float playerPitch = entityplayer.prevRotationPitch + (entityplayer.rotationPitch - entityplayer.prevRotationPitch) * f; float playerYaw = entityplayer.prevRotationYaw + (entityplayer.rotationYaw - entityplayer.prevRotationYaw) * f; double playerPosX = entityplayer.prevPosX + (entityplayer.posX - entityplayer.prevPosX) * f; double playerPosY = (entityplayer.prevPosY + (entityplayer.posY - entityplayer.prevPosY) * f + 1.6200000000000001D) - entityplayer.getYOffset(); double playerPosZ = entityplayer.prevPosZ + (entityplayer.posZ - entityplayer.prevPosZ) * f; Vec3 vecPlayer = new Vec3(playerPosX, playerPosY, playerPosZ); float cosYaw = MathHelper.cos(-playerYaw * 0.01745329F - 3.141593F); float sinYaw = MathHelper.sin(-playerYaw * 0.01745329F - 3.141593F); float cosPitch = -MathHelper.cos(-playerPitch * 0.01745329F); float sinPitch = MathHelper.sin(-playerPitch * 0.01745329F); float pointX = sinYaw * cosPitch; float pointY = sinPitch; float pointZ = cosYaw * cosPitch; Vec3 vecPoint = vecPlayer.addVector(pointX * reach, pointY * reach, pointZ * reach); MovingObjectPosition movingobjectposition = world.rayTraceBlocks(vecPlayer, vecPoint, false, false, true); return movingobjectposition; } So I have no idea, I know there is a method in entity, but it is only Client side
-
I have here my entity, but the problem is, the server has teh falue of fallTile, but the client not, what should I add, that it will work? package de.intektor.moreminecraft.entity; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class EntityNotFallingBlock extends Entity{ public IBlockState fallTile; public NBTTagCompound tileEntityData; public EntityNotFallingBlock(World worldIn) { super(worldIn); } public EntityNotFallingBlock(World world, double posX, double posY, double posZ, IBlockState fallingBlockState) { super(world); this.posX = posX; this.posY = posY; this.posZ = posZ; this.fallTile = fallingBlockState; this.setSize(0.98f, 0.98f); } @Override protected void entityInit() { } @Override public void onUpdate() { super.onUpdate(); } public void writeEntityToNBT(NBTTagCompound tagCompound) { Block block = this.fallTile != null ? this.fallTile.getBlock() : Blocks.air; ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(block); tagCompound.setString("Block", resourcelocation == null ? "" : resourcelocation.toString()); tagCompound.setByte("Data", (byte)block.getMetaFromState(this.fallTile)); if (this.tileEntityData != null) { tagCompound.setTag("TileEntityData", this.tileEntityData); } super.writeToNBT(tagCompound); } public void readEntityFromNBT(NBTTagCompound tagCompund) { int i = tagCompund.getByte("Data") & 255; if (tagCompund.hasKey("Block", ) { this.fallTile = Block.getBlockFromName(tagCompund.getString("Block")).getStateFromMeta(i); } else if (tagCompund.hasKey("TileID", 99)) { this.fallTile = Block.getBlockById(tagCompund.getInteger("TileID")).getStateFromMeta(i); } else { this.fallTile = Block.getBlockById(tagCompund.getByte("Tile") & 255).getStateFromMeta(i); } Block block = this.fallTile.getBlock(); if (tagCompund.hasKey("TileEntityData", 10)) { this.tileEntityData = tagCompund.getCompoundTag("TileEntityData"); } if (block == null || block.getMaterial() == Material.air) { this.fallTile = Blocks.sand.getDefaultState(); } } public IBlockState getBlock() { return this.fallTile; } @SideOnly(Side.CLIENT) public World getWorldObj() { return this.worldObj; } }
-
So I'm trying to spawn a EntityFallingSand, but when I spawn it, it shows me for 1 milisec and then it instant despawns, so I have no idea why if(nbt.getString("EntityID") != ""){ if(!world.isRemote){ WorldServer serverWorld = (WorldServer) world; entity = serverWorld.getEntityFromUuid(UUID.fromString(nbt.getString("EntityID"))); if(entity != null){ if(entity instanceof EntityNotFallingBlock){ EntityFallingBlock efb = new EntityFallingBlock(world, (double)entity.posX + 0.5D, (double)entity.posY, (double)entity.posZ + 0.5D, ((EntityNotFallingBlock) entity).theBlock); efb.getEntityData().setInteger("Time", 1); world.spawnEntityInWorld(efb); } entity.setDead(); stack.setTagCompound(new NBTTagCompound()); } } }
-
Well, I think I found the problem now, jesus
-
Thats what I did, and no, it is not perisiten on Client
-
Yes it gets spawned on Client, so the problem is not the false registering of my entity right? What could it be hen, any ideas? Well, it gets spawned, but it won't get updated on client, becuase, I don't know, but it is: @EventHandler public void init(FMLInitializationEvent event){ BlockMover = new BlockMover(); // EntityRegistry.registerGlobalEntityID(EntityNotFallingBlock.class, modid + "Intektor_is_cool__" + "EntityNOTFallingBlock", 23413); EntityRegistry.registerModEntity(EntityNotFallingBlock.class, modid + "EntityNOTFallingBlock", 0, this, 64, 20, true); network = NetworkRegistry.INSTANCE.newSimpleChannel(MODID + "Network"); if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT){ RenderingRegistry.registerEntityRenderingHandler(EntityNotFallingBlock.class, new RenderNotFallingBlock(Minecraft.getMinecraft().getRenderManager())); } MinecraftForge.EVENT_BUS.register(new MoreMinecraftEventHandler()); network.registerMessage(MessageToServerHandler.class, MessageToServer.class, 0, Side.SERVER); network.registerMessage(MessageToClientHandler.class, MessageToClient.class, 1, Side.CLIENT); }
-
Well I have really no idea, either you explain me, what I don't expect, or I use onEntityjoindWorld Event, what I will do right now
-
wait, I never used breakpoint, let me google how to use them