
UntouchedWagons
Members-
Posts
156 -
Joined
-
Last visited
Everything posted by UntouchedWagons
-
In my item's onItemUse method, some data about the tile entity that the player has right clicked on while sneaking is saved to the itemstack. If a player right clicks the item while sneaking and not looking at anything, this data is cleared. However when the player sneak-right clicks the tile entity, the onItemUse method is called then onItemRightClick is called. I want to stop the later from happening. Is this controlled by the return value of onItemUse or something else?
-
When a player connects to the server, I want to send the PowerGridWorldSavedData object for that world to the client. I know that when the player logs in that the event fires because I see "Sending grid info" in the console output, and I know the client receives the message because I see "bytes received". The problem is that I never see "message received" in the console. I took another look at diesieben07's tutorial on the SimpleNetworkWrapper and nothing stands out as being wrong, yet there must be something I've done wrong.
-
Through the power of shotgun debugging and looking at what others have done I have finally got my model to render properly. This is what I have now to make it work: public void renderTileEntityAt(TileEntity te, double x, double y, double z, float partialTick) { GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); bindTexture(texture); GL11.glRotatef(180, 0F, 0F, 1F); model.render(null, 0, 0, 0, 0, 0, 0.0625F); GL11.glPopMatrix(); } The glTranslatef method allows you to moves the model around. The glRotatef method allows you to rotate the model which you'd want if you need to rotate your machine. The first parameter is the amount to rotate in degrees along the X axis, the second is the Y axis and the third is the Z axis. I don't know what the parameters for the render method do but in my model classes only the last parameter is ever used.
-
So like this: public void renderTileEntityAt(TileEntityLargePowerLine te, double x, double y, double z, float partialTick) { GL11.glPushMatrix(); //GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); bindTexture(new ResourceLocation("powerlines", "render/largePowerLine.png")); GL11.glRotatef(180, 0F, 0F, 1F); model.render(null, (float)x, (float)y, (float)z, 0, 0, partialTick); GL11.glPopMatrix(); } It doesn't seem right that I have to cast the doubles to floats, but what do I know? I'm basically a monkey at a keyboard when it comes to this rendering stuff.
-
Source code can be found in my git repo: https://github.com/UntouchedWagons/PowerLines My mod will add, among other things, a large power line like the ones you find outside. I've made a babby's first model using Tabula and have hacked together the rendering stuff using Mekanism as a point of reference. The large power line is supposed to look like this: http://i.imgur.com/na6ceWe.png but instead looks like this: http://i.imgur.com/qPOXbjC.png What did I do wrong? It's bound to be something stupidly simple. I know I screwed up the texture size.
-
When a player logs onto the server, I want my mod to send him/her a message (not a chat message but an IMessage using the network wrapper stuff). In my server proxy class I have this: @SubscribeEvent public void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) { } But in order to send a message to a particular player, I need an EntityPlayerMP object but event's player field is of type EntityPlayer. Am I using the wrong event? I don't want to send the message to everyone because I don't need to.
-
Question about the WorldEvent events
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
In that case I'd want to load the data when a save is loaded, not when a world is loaded. Is there an event for that? Actually nevermind, since my power lines won't be doing cross-dimensional transfer, saving the power grids per world will be fine. Thanks. -
Question about the WorldEvent events
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
Okay so by looking at this post by mew and your following post and copying a bit of code from your Questology mod I got this: package untouchedwagons.minecraft.powerlines.grids; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraft.world.WorldSavedData; public class PowerGridWorldData extends WorldSavedData { private static final String IDENTIFIER = "power-lines"; public PowerGridWorldData(String identifier) { super(identifier); } public PowerGridWorldData() { super(IDENTIFIER); } @Override public void readFromNBT(NBTTagCompound p_76184_1_) { } @Override public void writeToNBT(NBTTagCompound p_76187_1_) { } public static PowerGridWorldData get(World world) { PowerGridWorldData data = (PowerGridWorldData)world.mapStorage.loadData(PowerGridWorldData.class, IDENTIFIER); if (data == null) { data = new PowerGridWorldData(); world.mapStorage.setData(IDENTIFIER, data); } return data; } } My remaining question is in the WorldEvent events, does it mean World as in a single dimension or as in a save encompassing multiple dimensions? Also, is the Load event fired before chunks are loaded? -
Question about the WorldEvent events
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
In any case, how would I go about saving and loading data from a file when a save is loaded? -
Question about the WorldEvent events
UntouchedWagons replied to UntouchedWagons's topic in Modder Support
I suppose if a player wanted to transfer power 1000 blocks and a power line could be 50 blocks apart, that would be 20 chunks loaded which wouldn't be too bad. I'm looking at the ForgeChunkManager class now, the first parameter for the setForcedChunkLoadingCallback is an object named mod. I assume I pass the class that I have annotated with the @Mod annotation? -
I want to make a mod that adds power lines (like the ones in real life) to let you transmit RF large distances without the use of tesseracts or similar "magic" blocks. What I want to do is create power grids that multiple power lines are a part of, this would have the effect of not requiring the entire run of chunks to be loaded. To do this I need to be able to load data about the various power grids in the dimensions when a save is loaded. Thus my question is this: In the WorldEvent class it says, "WorldEvent is fired when an event involving the world occurs.". When it says "World", does this mean a save or a dimension? Also as a bonus question, how would I go about storing data structures to an external file? I'd need to create an NBT structure which I know how to do, but I don't know how to save it. In the World class I see the getSaveHandler method which returns an implementation of ISaveHandler which has a getWorldDirectory method.
-
I figured it out, it was my fault. In part of the upgrade process I commented out a line of code that tells the client about any changes to the tile entity and never replaced it with the new netty based network stuff. So I overrode the updateEntity method and send a message to the client about current energy levels and it works. I should probably check if the energy level has changed at all though.