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

Notunknown

Members
  • Posts

    156
  • Joined

  • Last visited

Everything posted by Notunknown

  1. Ok, so I am working on a mod which requires composite models (item models made from a set of sub-models joined together). Now, I am on track for getting a basic composite model which would fit my minimum requirements, but as I do not know enough at the moment about how models (and mostly quads) work, I am asking about some information regarding the power of models. Composite Models MUST have the following: *MUST be able to be formed from two or more models, the number and type of which are determiend by an input ItemStack. (This I believe I can do.) Composite Models SHOULD have the following: *SHOULD be able to define arbitrary rotations relative to "base" rotation, which is determined by the model determined by the input ItemStack. *SHOULD be able to define arbitrary translations relative to "base" translation, which is determined by the model determined by the input ItemStack. (This I believe I can do.) Composite Models MAY have the following: *MAY be able to define arbitrary scales relative to "base" scale, which is determined by the model determined by the input ItemStack. (This I believe I can do.) *MAY be able to define arbitrary rotations, translations and offsets relative to model relative rotation, translation and offset, which is determined by code determined by the input ItemStack. *MAY be able to specify a simple hierarchy within models, which is used to allow models to share with their parents relative rotation, translation and scale. For example, I might want to have a magical stone. The stone is made of three models, a core, a glyph and a ring. The core is the base model (determines the rotation, translation and scale relative to the hand), the glyph shares its rotation and translation with the core but has twice the scale (causing it to stick out) and the ring has the same translation and scale as the core but is rotated 90° to the core. The stone also gently floats above the players hand following a sine wave (giving it a floating effect), the core and glyph additionally slowly rotate clockwise at the same rate, and the ring rotates counter-clockwise at a faster rate (giving it a spinning effect). When right clicked the entire model would increase in scale, then decrease again, following a simple curve. So, before I waste time trying something which is impossible, which of those requirements are possible and which aren't?
  2. Ah - OK. I was not sure if the new system had made it impossible to do, rather than just discouraged.
  3. So, I know that you are not supposed to use code-based item rendering in 1.9, and instead use models. I respect that, and this is more of a hypothetical, but plausible, situation: A game has a spell system. Spells are objects which have a model for inventory and world, but when held in the hand is represented by the player's arm and a dynamic, GL-based effect (think ender dragon death animation/end portal animation). Is this at all possible in the new system?
  4. However - that does present a question: What methods are employed to prevent the resending of redundant information? Currently I have two boolean values which are set prior to marking it for an update and are true by default (and reset to true after sending it). I believe this should send the appropriate information.
  5. I know - I am now going to get it to only send the data which it needs to send - the entire point of this was GETTING it to send, which I have now achieved. Not quite sure how I did it, but I did it.
  6. Can't you make a packet to send to the clients telling them to change the fly speed with setFlySpeed? You can then have code which runs on the server to ensure that they do not move too quickly and kick them if needed (have a server config option for that). That is a solution.
  7. Apparently World#markAndNotifyBlock is what I wanted - I have no idea how to use it though. Why do I want to pass in the old IBlockState - or is that a supposed to be a blank object which will have its values copied onto by the IBlockState? Same goes for why I need to pass in a chunk object - is that the chunk the block is in? If so, why is that not calculated by the BlockPos I passed in? And as for the flags, no idea what to pass there. Checking the code just reveals a load of magic numbers - I just passed in Integer.MAX_VALUE to be safe. The one line comment is no help, either.
  8. Do you mean World#markAndNotifyBlock ? That requires a lot of stuff like a Chunk, two IBlockStates and integer flags, in addition to a BlockPos.
  9. Okay - got it working. Somehow. But now I have a strange issue: It will not update when I right click (I call this.markDirty() ), but will update whenever I left click in creative or survival (It wont break in creative)
  10. Yes - but it isn't. Although I removed it prior to posting, I printed out the value of tag before the return statement.
  11. So I am trying to make a TileEntity send data from the server to the client but when the packets arrive they are empty. I have registered the TileEntity, do I need to register anything to do with the network? The packets do, however, work when the TileEntity loads initially, it just doesn't work when updated. @Override public Packet<?> getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); if (this.hasStoredBlock()) { NBTTagCompound stored = new NBTTagCompound(); stored.setString("name", storedBlock.getItem().getRegistryName().toString()); stored.setInteger("meta", storedBlock.getItemDamage()); stored.setInteger("amount", storeAmount); tag.setTag("storedBlock", stored); } return new SPacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), tag); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { System.out.println(pkt.getNbtCompound().toString()); }
  12. Minecraft.getMinecraft().theWorld.getWorldTime() ?
  13. I am working on TileEntity and need to sync data between the client and the server. I think that I have gotten everything working, with one possible exception: I cannot get it to sync whenever the block changes. According to outdated information, I need to use World#markBlockForUpdate, which appears to no longer exist. What do I use to replace it? And is there a resource that I can use to find out where everything moves since outdated versions? I feel like I am missing some important trove of information. Edit: Aparantly I just need to call this.markDirty()..? Well, maybe. Aparantly I am now getting packets of some description. The packet contains NBT data which is valid when it leaves. Sadly the NBT is gone when it arrives. Code below @Override public Packet<?> getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); if (this.hasStoredBlock()) { NBTTagCompound stored = new NBTTagCompound(); stored.setString("name", storedBlock.getItem().getRegistryName().toString()); stored.setInteger("meta", storedBlock.getItemDamage()); stored.setInteger("amount", storeAmount); tag.setTag("storedBlock", stored); } return new SPacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), tag); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { System.out.println(pkt.getNbtCompound().toString()); }
  14. You can create and pass an ItemStack as an argument. I think it would be something like NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("Potion", "minecraft:night_vision"); ItemStack potion = new ItemStack(Items.potion); potion.setTagCompound(nbt); May be a couple of mistakes there, but I am sure you can fix any.
  15. You are the best. I actually had looked at that method but thought I was on the wrong track. Oops.
  16. Right, so how do I get a blocks model from the registry?
  17. I need to render the top of any full block in a TileEntitySpecialRenderer. How can I do this? Solved it with help from the people here and a bit of stealing from Forge's rendering code. Probably not the best method, but it works just fine for my purposes. Item itemBlock = SomeItemStack.getItem(); IBlockState blockState = Block.getBlockFromItem(itemBlock).getStateFromMeta(SomeItemStack.getItemDamage()); IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(blockState); if (model != null) { List<BakedQuad> quads = model.getQuads(blockState, EnumFacing.UP, 0); GlStateManager.pushMatrix(); GlStateManager.bindTexture(Minecraft.getMinecraft().getTextureMapBlocks().getGlTextureId()); GlStateManager.translate(x, y, z); GlStateManager.scale(1.0D, 1.0D, 1.0D); for (BakedQuad quad : quads) { int color = Minecraft.getMinecraft().getBlockColors().colorMultiplier(blockState, (IBlockAccess)null, (BlockPos)null, quad.getTintIndex()); VertexBuffer vertexbuffer = Tessellator.getInstance().getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.ITEM); vertexbuffer.addVertexData(quad.getVertexData()); vertexbuffer.putColorRGB_F4(((color >> 16) & 0xFF) / 255.0F, ((color >> & 0xFF) / 255.0F, (color & 0xFF) / 255.0F); } Tessellator.getInstance().draw(); GlStateManager.popMatrix(); }
  18. Although a thought had just crossed my mind: Do you think Forge will continue if an official modding API was to be released?
  19. Currently, ShapedRecipe is built for a 3x3 crafting table (no more). Now, whilst this is fine for the most part, if I wanted to add a 4x4 crafting table in my mod then all non-special shaped crafting recipes would need to be done in the top-left corner. Simply changing the 3s to inv.getWidth() and inv.getHeight() on lines 51 and 75, and 53 and 77, respectively, would fix the issues with the recipes.
  20. I am planning on making a mod set in a new dimension. Only it requires one rather unusual property in order to implement correctly: Sunlight needs to start at 0 and travel upwards, towards the bedrock ceiling at 255 (rather than starting at 255 and travelling downwards towards the bedrock floor at 0). Now, I do have an idea for an alternative, but it does require applying the "upside down" shader and somehow making players fall upwards, render upside down and have their eye level near the floor, which I am not quite sure if it is a good ideal
  21. I believe you spawn in a chunk, rather than at a fixed location, like in multiplayer.
  22. I... did not know about that. Is that new in 1.9? Still, I think that ItemAxe should be changed as not to error, or simply be final, so that people don't continuously make the same mistake that I did.
  23. Oh, I see. I was just assuming that "an Axe is determined as anything that extends ItemAxe". I take it I would have to simply override getToolClasses? I take it that this issue is why the constructor for ItemAxe is protected? However, I think that the ability to create an axe without needing to add any more classes would be reason enough to add a second, public constructor. At least make ItemAxe final, to prevent this sort of issue from happening.
  24. So, its better to add all the axes to the ore dictionary than to add an if statement/alternative constructor? What is the point of object-orientation if you are not going to use it? I fail to see how expecting to be able to have an axe extend ItemAxe, only to have it error is the fault of the modder, and not forge itself.
  25. It is all caused by ATTACK_DAMAGES[material.ordinal()], due to any custom tool material going of range of the 5-length array of vanilla materials.
×
×
  • Create New...

Important Information

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