
Notunknown
Members-
Posts
156 -
Joined
-
Last visited
Everything posted by Notunknown
-
[1.9] Code-based item rendering for when held in hand
Notunknown replied to Notunknown's topic in Modder Support
Ah - OK. I was not sure if the new system had made it impossible to do, rather than just discouraged. -
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?
-
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.
-
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.
-
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.
-
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.
-
Do you mean World#markAndNotifyBlock ? That requires a lot of stuff like a Chunk, two IBlockStates and integer flags, in addition to a BlockPos.
-
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)
-
Yes - but it isn't. Although I removed it prior to posting, I printed out the value of tag before the return statement.
-
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()); }
-
Minecraft.getMinecraft().theWorld.getWorldTime() ?
-
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()); }
-
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.
-
[1.9] [Solved] Render top of Block in Tile Entity
Notunknown replied to Notunknown's topic in Modder Support
You are the best. I actually had looked at that method but thought I was on the wrong track. Oops. -
[1.9] [Solved] Render top of Block in Tile Entity
Notunknown replied to Notunknown's topic in Modder Support
Right, so how do I get a blocks model from the registry? -
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(); }
-
Why isn't Forge the "Official" mod loader for Minecraft
Notunknown replied to Mystara's topic in General Discussion
Although a thought had just crossed my mind: Do you think Forge will continue if an official modding API was to be released? -
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.
-
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
-
I believe you spawn in a chunk, rather than at a fixed location, like in multiplayer.
-
[1.9] ItemAxe ArrayOutOfBoundsException
Notunknown replied to Notunknown's topic in Support & Bug Reports
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. -
[1.9] ItemAxe ArrayOutOfBoundsException
Notunknown replied to Notunknown's topic in Support & Bug Reports
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. -
[1.9] ItemAxe ArrayOutOfBoundsException
Notunknown replied to Notunknown's topic in Support & Bug Reports
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. -
[1.9] ItemAxe ArrayOutOfBoundsException
Notunknown replied to Notunknown's topic in Support & Bug Reports
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. -
[1.9] ItemAxe ArrayOutOfBoundsException
Notunknown replied to Notunknown's topic in Support & Bug Reports
But swords, pickaxes and shovels all work fine with the custom tool material, and the axe works fine if I substitute ToolMaterial.IRON there.