Jump to content

3059673

Members
  • Posts

    52
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

3059673's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. Player NBT data is not sent from server to client on join, client receives data only after data has been changed 1 time. How to sync player data on join ?
  2. Well, movement with WASD only allows forward, backward, and strafe left and right. Turning and looking up/down/right/left requires a captive mouse, so you cannot have both at the same time. At least without a major rework of the movement code. If you want to get into that, I can't help. But, I'd advise against it because users may become very disoriented. Im working on thaumcraft addon(for now just for private uses). Im remaking the foci switching system (pressing F when you have dosens of them may be confusing). So far ive made a working quick-change system. But what if you are escaping some monsters chasing you and you want to quickly change the focus and run at the same time ? Thats it ! I looked at ichuns morph source, he actually does what i need but he uses his own HUD not smth like a furnace gui. Thats the problem
  3. I mean "furnace inventory" I have an item. When i rightclick, inventory opens (container) . All player movement is normally blocked. But i need it to be not blocked. I know i could make smth like a HUD that shows on rightclick, but i want vanilla to maintain all container/gui, mouse clicking, itemstack grabbing stuff .............., it's too hard to make !
  4. I need to make GUI that would not block player movement (W,S,A,D) . How can I do that ?
  5. Where should i call FMLNetworkHandler.openGui/EntityPlayer.openGui on SERVER or on CLIENT ?
  6. TickHandler - Server - player //ThaumicWheelProject if(utils.isKeyPressed("V",player.username) && player.getCurrentEquippedItem()!= null && player.getCurrentEquippedItem().getItem() instanceof ItemWandCasting && (!player.getEntityData().hasKey(ThaumicWheelUtils.isOpenedForNBT) || !player.getEntityData().getBoolean(ThaumicWheelUtils.isOpenedForNBT))){ player.getEntityData().setBoolean(ThaumicWheelUtils.isOpenedForNBT, true); new SimplePacket().openNewThaumicWheelGUI(player); } else if(!utils.isKeyPressed("V",player.username) && (player.getEntityData().hasKey(ThaumicWheelUtils.isOpenedForNBT) || player.getEntityData().getBoolean(ThaumicWheelUtils.isOpenedForNBT))){ player.getEntityData().setBoolean(ThaumicWheelUtils.isOpenedForNBT, false); if(ThaumicWheelUtils.GUIs.containsKey(player)) player.closeScreen(); ThaumicWheelUtils.GUIs.remove(player); } //................ In packethandler FMLNetworkHandler.openGui is used. Container public class ThaumicWheelContainer extends Container{ public World world; public EntityPlayer player; public int posX,posY,posZ; public ItemStack pouch; public int pouchSlot = -1; public IInventory inv = new FocusPouchINV(); public ThaumicWheelContainer(EntityPlayer player,World par2World, int par3, int par4, int par5) { this.world = par2World; this.posX = par3; this.posY = par4; this.posZ = par5; this.player = player; this.pouch = ThaumicWheelUtils.playerGetPouch(player); this.pouchSlot = ThaumicWheelUtils.playerGetPouchSlot(player); ThaumicWheelUtils.GUIs.put(player, this); for (int a = 0; a < 18; a++) { this.addSlotToContainer(new RestrictedSlot(inv, a, 37 + a % 6 * 18, 60 + a / 6 * 18,IWandFocus.class)); } ItemFocusPouch p = (ItemFocusPouch) ConfigItems.itemFocusPouch; if(pouch != null && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemWandCasting){ ItemStack[] fs = p.getInventory(pouch); for(int i = 0;i<fs.length;i++){ inv.setInventorySlotContents(i, fs[i]); } }else{ player.closeScreen(); player.getEntityData().setBoolean(ThaumicWheelUtils.isOpenedForNBT, false); if(ThaumicWheelUtils.GUIs.containsKey(player)) player.closeScreen(); ThaumicWheelUtils.GUIs.remove(player); } } @Override public boolean canInteractWith(EntityPlayer entityplayer) { return true; } public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer){ new SimplePacket().changeWandFoci(par4EntityPlayer,par1); return (((Slot)this.inventorySlots.get(par1)) != null) ? ((Slot)this.inventorySlots.get(par1)).getStack() : null; } } GuiContainer public class ThaumicWheelGUI extends GuiContainer{ public EntityPlayer player; public ItemStack wand; public ThaumicWheelGUI(EntityPlayer player,World world,int x, int y,int z){ super(new ThaumicWheelContainer(player,world,x,y,z)); this.player = player; this.wand = player.getCurrentEquippedItem(); } public boolean doesGuiPauseGame() { return false; } public void drawScreen(int par1, int par2, float par3) { super.drawScreen(par1, par2, par3); } @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { UtilsFX.drawTag(50, 50, Aspect.AIR); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("thaumcraft","textures/gui/gui_focuspouch.png")); int x = (this.width-175)/2; int y = (this.height-142)/2; GL11.glEnable(3042); this.drawTexturedModalRect(x, y, 0, 0, 175, 142); GL11.glDisable(3042); } }
  7. My custom container slots are overlaying player's invetory slots (not visually). When i click on slots in my container, it somehow clicks on the respective slot in player's inventory and swaps/puts/takes items from it . How do i manage that ? In my container constructor i didn't add any player's inventory slots, i don't need them.
  8. Normally, in vanila minecraft when a player walks any item in his hand is rendrering with "walking" animation. When i walk with my custom modeled item in hand, item "walks" too much . How to reduce the "walking" amimation ? Im pretty sure that the causes are incorrect gl translations, rotations or scales.
  9. Thanks that solved the problem; -dx,-dy,-dz is ok
  10. When i do GL11.glRotatef(angle, axisX, axisY, axisZ) it doesn't rotate around its center . If you know EnderStorage mod's Ender tank I want to rotate a valve similar to its one . My one rotates incorrectly , around some other point, not center
  11. How to rotate an object (IModelCustom part in my case) around its center and specified axis ?
  12. I have some kind of modular Block that saves its upgrades/modules in its NBT + owner's username. But how would i make a recipe if its nbt is always different: players are different, upgrades are different . THAUMCRAFT RECIPES ARE NBT SENSETIVE !!! If i place already modified block, recipe is not going to work !
  13. I'm making a custom recipe for thaumcraft. So i obviously can't use any custom recipe managers or handlers. What do i need : basicly have some ItemStacks for input and take one of them, change its NBT and then pass it to the output. Thaumcraft recipe handler works like original minecraft one ("xyx","zzz","bbb",'z',stack,'y',stack2.....) and thaum recipe handler is NBT sensetive on input. Any ideas ?
  14. I found the mistake. I used getPickBlock method to specify the output ItemStack @Override public ItemStack getPickBlock(MovingObjectPosition mop, World world, int x, int y, int z) { RussyPeripheral tile = (RussyPeripheral) world.getBlockTileEntity(x, y, z); ItemStack stack = new ItemStack(this,1); if(!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound()); stack.getTagCompound().setString("owner", tile.Username); stack.getTagCompound().setBoolean("canWaitForKey",tile.canWaitForKey); if(tile.eniquepass != null) stack.getTagCompound().setString("pass", tile.eniquepass); stack.getTagCompound().setInteger("valve1Active", tile.valve1state); stack.getTagCompound().setBoolean(tile.RVALVE_UPGRADE, tile.rightValveUpgrade); for(int i = 0;i<MyTickHandler.loadedRussyTiles.size();i++){ if(MyTickHandler.loadedRussyTiles.get(i).xCoord == tile.xCoord && MyTickHandler.loadedRussyTiles.get(i).yCoord == tile.yCoord && MyTickHandler.loadedRussyTiles.get(i).zCoord == tile.zCoord){ MyTickHandler.loadedRussyTiles.remove(i); } } return stack; } But I should have used getBlockDropped method for it . Thank you for your responses ! SOLVED
  15. I have created an ItemBlock to save NBT data to it then someone breaks its block. Block : public class ChairBlock extends BlockContainer{ int renderType ; private int x,y,z; public ChairBlock(int par1, Material par2Material ) { super(par1, par2Material); this.setResistance(120F); this.setHardness(120F); this.setBlockUnbreakable(); } @Override public boolean renderAsNormalBlock() { return false; } public void registerIcons(IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("rs:Peripheral"); } public boolean hasTileEntity(){ return true; } public boolean isOpaqueCube(){ return false; } @Override public boolean isBlockSolid(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { return true; } @Override public int getRenderType() { return renderType; } public void setRenderType(int id){ this.renderType = id; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(world.isRemote) return true; MovingObjectPosition hit = RayTracer.retraceBlock(world, player, x, y, z); RussyPeripheral tile = (RussyPeripheral) world.getBlockTileEntity(x, y, z); if(!player.isSneaking()){ if(hit == null) return false; if(Utils.isHoldingUsableWrench(player) && tile.Username.equals(player.username)){ if(tile.blockMetadata + 1 > 3){ world.setBlockMetadataWithNotify(x, y, z, 0, 2); }else{ world.setBlockMetadataWithNotify(x, y, z, tile.blockMetadata+1, 2); } return true; } if(hit.subHit == 1 && tile.getInstalledUpgrades().contains(tile.RVALVE_UPGRADE)){ tile.setValve1Activated(); } }else{ if(Utils.isHoldingUsableWrench(player) && tile.Username.equals(player.username) && !player.capabilities.isCreativeMode){ this.removeBlockByPlayer(world, player, x, y, z); } } return true; } @Override public ItemStack getPickBlock(MovingObjectPosition mop, World world, int x, int y, int z) { RussyPeripheral tile = (RussyPeripheral) world.getBlockTileEntity(x, y, z); ItemStack stack = new ItemStack(this,1); if(!stack.hasTagCompound()) stack.setTagCompound(new NBTTagCompound()); stack.getTagCompound().setString("owner", tile.Username); stack.getTagCompound().setBoolean("canWaitForKey",tile.canWaitForKey); if(tile.eniquepass != null) stack.getTagCompound().setString("pass", tile.eniquepass); stack.getTagCompound().setInteger("valve1Active", tile.valve1state); stack.getTagCompound().setBoolean(tile.RVALVE_UPGRADE, tile.rightValveUpgrade); for(int i = 0;i<MyTickHandler.loadedRussyTiles.size();i++){ if(MyTickHandler.loadedRussyTiles.get(i).xCoord == tile.xCoord && MyTickHandler.loadedRussyTiles.get(i).yCoord == tile.yCoord && MyTickHandler.loadedRussyTiles.get(i).zCoord == tile.zCoord){ MyTickHandler.loadedRussyTiles.remove(i); } } return stack; } @Override public TileEntity createNewTileEntity(World world){ RussyPeripheral tile = new RussyPeripheral(); tile.setUsername("NONE"); MyTickHandler.loadedRussyTiles.add(tile); return tile; } public TileEntity createTileEntity(World world, int metadata) { RussyPeripheral tile = new RussyPeripheral(); tile.setUsername("NONE"); MyTickHandler.loadedRussyTiles.add(tile); return tile; } @Override public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) { if(!player.capabilities.isCreativeMode && !world.isRemote) dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); return true; } public void onBlockPlacedBy(World par1World, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack stack){ } public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) { RussyPeripheral tile = (RussyPeripheral) par1World.getBlockTileEntity(par2, par3, par4); int ro = 0; if(tile.worldObj != null){ ro = tile.getBlockMetadata(); } float xMin,yMin,zMin,xMax,yMax,zMax; xMin = 0.12500001F; yMin = 0.0F; zMin = 0.10500001F; xMax = 0.9049993F; yMax = 0.8949993F; zMax = 0.88999933F; if(ro == 1){ this.setBlockBounds(0.12500001F, 0.0F,0.10500001F, 0.9049993F, 0.8949993F, 0.88999933F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); if(tile.getInstalledUpgrades().contains(tile.RVALVE_UPGRADE)){ this.setBlockBounds(0.034999996F, 0.17499997F, 0.54999965F, 0.13500002F, 0.39999977F, 0.7949994F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); } }else if(ro == 2){ this.setBlockBounds(0.105000004F, 0.0F, 0.13000001F, 0.88999933F, 0.8949993F, 0.9149993F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); if(tile.getInstalledUpgrades().contains(tile.RVALVE_UPGRADE)){ this.setBlockBounds(0.19999994F, 0.16499998F, 0.044999994F, 0.44999975F, 0.39999977F, 0.145000001F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); } }else if(ro == 3){ this.setBlockBounds(0.085F, 0.0F, 0.10500001F, 0.87499934F, 0.8949993F, 0.8949993F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); if(tile.getInstalledUpgrades().contains(tile.RVALVE_UPGRADE)){ this.setBlockBounds(0.85499936F, 0.16499998F, 0.19999999F, 0.95499927F, 0.3949998F, 0.44999975F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); } }else if(ro == 0){ this.setBlockBounds(0.11000001F, 0.0F, 0.095F, 0.88999933F, 0.8949993F, 0.87999934F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); if(tile.getInstalledUpgrades().contains(tile.RVALVE_UPGRADE)){ this.setBlockBounds(0.54999965F, 0.16499998F, 0.86499935F, 0.7999994F, 0.39999977F, 0.96499926F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); } } this.setBlockBounds(0, 0, 0, 1, 1, 1); } public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 start, Vec3 end) { RussyPeripheral theTile = (RussyPeripheral)world.getBlockTileEntity(x, y, z); if (theTile == null) { return null; } List cuboids = new LinkedList(); theTile.addTraceableCuboids(cuboids); return RayTracer.instance().rayTraceCuboids(new Vector3(start), new Vector3(end), cuboids, new BlockCoord(x, y, z), this); } @SideOnly(Side.CLIENT) @ForgeSubscribe public void onBlockHighlight(DrawBlockHighlightEvent event) { if ((event.target.typeOfHit == EnumMovingObjectType.TILE) && (event.player.worldObj.getBlockTileEntity(event.target.blockX, event.target.blockY, event.target.blockZ) instanceof RussyPeripheral)) { RayTracer.retraceBlock(event.player.worldObj, event.player, event.target.blockX, event.target.blockY, event.target.blockZ); } } public AxisAlignedBB getSelectedBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return super.getSelectedBoundingBoxFromPool(par1World, par2, par3, par4); } } ItemBlock public class RussyPeripheralAsItem extends ItemBlock{ public RussyPeripheralAsItem(int par1) { super(par1); this.setHasSubtypes(false); this.setUnlocalizedName(StatCollector.translateToLocal("rs.item.RussyP")); this.setFull3D(); } @Override public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { if(super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata)) { int rotation = MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) + 2.5D) & 3; world.setBlock(x, y, z, this.itemID, rotation, 2); RussyPeripheral tile = (RussyPeripheral) world.getBlockTileEntity(x, y, z); if(player instanceof EntityPlayer){ tile.Username = player.username; } if(stack.stackTagCompound != null){ tile.readFromNBT(stack.stackTagCompound); } player.setCurrentItemOrArmor(0, null); } return false; } @SideOnly(Side.CLIENT) @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean extended) { if(!StringHelper.isShiftKeyDown()){ list.add(StringHelper.shiftForInfo); }else{ if(stack.hasTagCompound()){ String Username = EnumChatFormatting.YELLOW+stack.stackTagCompound.getString("owner"); String eniquepass = EnumChatFormatting.YELLOW+stack.stackTagCompound.getString("pass"); boolean rightValveUpgrade = stack.stackTagCompound.getBoolean(RussyPeripheral.RVALVE_UPGRADE); list.add(EnumChatFormatting.AQUA+"Owner: "+Username); list.add(EnumChatFormatting.AQUA+"Eniquepass: "+eniquepass); list.add(EnumChatFormatting.AQUA+"Installed modules:"); if(rightValveUpgrade) list.add(EnumChatFormatting.RED+" - Right Valve"); } } } } But then I try to break my block, my itemBlock drops well, but its NBT is empty. (I check NBT ingame with NBTEditor) What am I doing wrong ?
×
×
  • Create New...

Important Information

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