
Mew
Members-
Posts
567 -
Joined
-
Last visited
Everything posted by Mew
-
Setting Variable Values When Using A Class That Extends IExtendEntityProperties
Mew replied to Mew's topic in Modder Support
I don't just, "Copy and Paste". I actually build my own (even if it does look similar) and read through accesible files to find out what everything does. but it still doesn't really seem to help me. -
Also, try putting a file system like this: /mods/%MODID%/textures/(items or blocks depending)/%FILENAME%.png into mcp/eclipse/bin/ That is where I put my textures whilst developing mods
-
Animated block/item textures are fairly simple. They require no code at all. To animate a texture, you have to make a image that has all the frames for the animation in it. Example image: then, in the textures folder, you have a text file under the same name as the texture you want animated. So say my image was called awesomeSword.png, i would call the text file awesomeSword.txt. Now if you left it blank, the frames would be played through one after the other, with no breaks. Look at this quote to see more about changing the speed of the animation: http://www.minecraftforum.net/topic/1722368-15-icons-and-block-textures/page__st__140#entry21778101
-
Adding custom blocks to biomes is a sinch! What you need is a config file. Then using configVariableName.getTerrainBlock(Paramaters...).getInt(); that will make sure that the block ID is UNDER 255, because what you set the ID to is not the actual ID when it comes to loading... And also, inside the chunk manager you can set the top/filler block without needing a biome. see here: https://github.com/haydenf96/Spazzysmod/blob/master/Spazzysmod/spazzysmod_common/Spazzysmod/world/chunk/ChunkManagerMoon.java Thats some chunk manager code for a mod I help make. [EDIT] Also, feel free to look at the code for the dimensions. It is found in the world package which is here: https://github.com/haydenf96/Spazzysmod/tree/master/Spazzysmod/spazzysmod_common/Spazzysmod/world Look through that and you will find everything you need for a dimension.
-
Thanks! But what I really wanted was something to do with IExtendedEntityProperties... Is there a tutorial on that?
-
Like the title states, how? I want to set my own .dat file or something like that with custom information stored in it. How would I go about doing this?
-
Try this config code: In a class called ModNameConfig: static int tauriteID; static int tauriteClothID; public static Item taurite; public static Item tauriteCloth; public static Configuration config; public static void load(Configuration config) { config = configuration; config.load(); tauriteID = config.get(Configuration.CATEGORY_ITEM, "Taurite ID", 1100) .getInt(); tauriteClothID = config.get(Configuration.CATEGORY_ITEM, "Taurite Cloth ID", 1101).getInt(); taurite = new ItemTaurite(tauriteID, "taurite") .setCreativeTab(CreativeTabs.tabMaterials); tauriteCloth = new ItemTauriteCloth(tauriteClothID, "tauriteCloth") .setCreativeTab(CreativeTabs.tabMaterials); config.save(); } In your base class in the pre init method: ModNameConfig.loadConfig(new Configuration(event .getSuggestedConfigurationFile()));
-
How to keep the Client and Server synced using packets.
Mew replied to Mew's topic in Modder Support
I think this is more of a problem with the Player Extended data file... I'm not sure. all I know is that the data hasn't been saved properly and I got told to use packets for it -
Everyone has to start somewhere. I have literally thrown myself into the deep end quite a few times, and in the end I have learned ALOT. As long as you can find someone to guide you, GO FOR IT!!
-
I know diesieben07 has done something similar. Here is his code on this matter: https://github.com/diesieben07/Questology/blob/master/source/demonmodders/questology/QuestologyWorldData.java Don't ask me how he does it.. As you know I am trying to figure this out but with Player data
-
How to keep the Client and Server synced using packets.
Mew replied to Mew's topic in Modder Support
I have a tiny packet handler. I use that instead. -
How to keep the Client and Server synced using packets.
Mew replied to Mew's topic in Modder Support
eh heh heh... oops... What I MEANT to say was that I don't know HOW to send the packet so that it actually saves... Here is the packet code: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/network/packet/PacketPlayerInfo.java I don't really know when or how to send the packet so that the information is saved -
How would I go about this? I really need help with it... I have a packet that send Extended Player Information that I want to save, but it doesn't save the data. The code is here: Packet: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/network/packet/PacketPlayerInfo.java The class that has the data that needs saving etc: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/playerinfo/PlayerInformation.java
-
I ran some debug messages through and they are saving and reading the data, its just not the correct data.
-
Oh shoot. How would I do this? I knew I had missed some sort of syncing issues... And what do you mean, "Debug messages"? a system.out line? -Mew
-
I have a PlayerInformation class that extends IExtendedEntityProperties, but whenever I log off a world, and then open it again, the data that should have been stored hasn't been. Now I am not sure if it is the reading, the writing, or both, or if I am doing it wrong.. So could I please have some help? Link to code: https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/playerinfo/PlayerInformation.java -Mew
-
Setting Variable Values When Using A Class That Extends IExtendEntityProperties
Mew replied to Mew's topic in Modder Support
Yes they are. Check out the github repo at https://github.com/ModderPenguin/MinePG, it has all my code for my mod... -
Setting Variable Values When Using A Class That Extends IExtendEntityProperties
Mew replied to Mew's topic in Modder Support
Never mind.. I am such an idiot. I was tired after all. Although now it seems to reset the data on re-entry to the world... -
Setting Variable Values When Using A Class That Extends IExtendEntityProperties
Mew replied to Mew's topic in Modder Support
sorry... -
As the title states, I can't seem to do this. Either I am extremely tired and should try later, or I have just gone noob mode. I hope its the first option. And before you do start on the latter, I have getter/setter methods for the variables and they don't seem to work. Therefore I am lost. Thanks for any help that may or may not come. PlayerInformation class, the one that extends IExtendedEntityProperties: package rpg.playerinfo; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; public final class PlayerInformation implements IExtendedEntityProperties { public static final String IDENTIFIER = "minpg_playerinfo"; public static PlayerInformation forPlayer(Entity player) { return (PlayerInformation)player.getExtendedProperties(IDENTIFIER); } // called by the ASM hook in EntityPlayer.clonePlayer public static void handlePlayerClone(EntityPlayer source, EntityPlayer target) { target.registerExtendedProperties(IDENTIFIER, source.getExtendedProperties(IDENTIFIER)); } public static final int MAX_KARMA_VALUE = 99999999; public boolean dirty = true; public boolean hasClassBeenChosen = false; public float karma = 0; public byte[] eventAmounts = new byte[PlayerInformation.CountableKarmaEvent.values().length]; public String playersClass; public int danris = 0; private final EntityPlayer player; public PlayerInformation(EntityPlayer player) { this.player = player; } @Override public void init(Entity entity, World world) { // nothing for now } @Override public void saveNBTData(NBTTagCompound nbtPlayer) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("playersClass", playersClass); nbt.setBoolean("hasClassBeenChosen", hasClassBeenChosen); nbt.setInteger("danris", danris); nbt.setFloat("karma", karma); NBTTagList eventList = new NBTTagList(); for (int i = 0; i < eventAmounts.length; i++) { NBTTagCompound evtInfo = new NBTTagCompound(); evtInfo.setByte("id", (byte)i); evtInfo.setByte("value", eventAmounts[i]); eventList.appendTag(evtInfo); } nbt.setTag("events", eventList); //nbtPlayer.setCompoundTag(IDENTIFIER, nbt); nbtPlayer.setCompoundTag(IDENTIFIER, player.getEntityData()); } @Override public void loadNBTData(NBTTagCompound playerNbt) { NBTTagCompound nbt = playerNbt.getCompoundTag(IDENTIFIER); playersClass = nbt.getString("playersClass"); hasClassBeenChosen = nbt.getBoolean("hasClassBeenChosen"); danris = nbt.getInteger("danris"); karma = nbt.getFloat("karma"); NBTTagList eventList = nbt.getTagList("events"); for (int i = 0; i < eventList.tagCount(); i++) { NBTTagCompound evtInfo = (NBTTagCompound)eventList.tagAt(i); byte eventId = evtInfo.getByte("id"); if (eventId >= 0 && eventId < eventAmounts.length) { eventAmounts[eventId] = evtInfo.getByte("value"); } } } public boolean getHasClassBeenChosen() { return hasClassBeenChosen; } public boolean setHasClassBeenChosen(boolean hasClassBeenChosen) { if(this.hasClassBeenChosen != hasClassBeenChosen) { this.hasClassBeenChosen = hasClassBeenChosen; setDirty(); } return this.hasClassBeenChosen; } public String getPlayersClass() { return playersClass; } public String setPlayersClass(String playersClass) { if(this.playersClass != playersClass) { this.playersClass = playersClass; setDirty(); } return this.playersClass; } public String modifyPlayersClass(String classChangingTo) { return setPlayersClass(classChangingTo); } public float getKarma() { return karma; } public float setKarma(float karma) { if (this.karma != karma) { this.karma = karma; if (this.karma > MAX_KARMA_VALUE) { this.karma = MAX_KARMA_VALUE; } if (this.karma < -MAX_KARMA_VALUE) { this.karma = -MAX_KARMA_VALUE; } setDirty(); } return this.karma; } public float modifyKarma(float modifier) { player.worldObj.playSoundAtEntity(player, "minepgkarma.karma" + (modifier < 0 ? "down" : "up"), 1, 1); return setKarma(karma + modifier); } public float modifyKarmaWithMax(float modifier, float max) { if (karma < max) { modifyKarma(modifier); } return karma; } public float modifyKarmaWithMin(float modifier, float min) { if (karma > min) { modifyKarma(modifier); } return karma; } public byte getEventAmount(CountableKarmaEvent event) { return eventAmounts[event.ordinal()]; } public boolean setEventAmount(CountableKarmaEvent event, int amount) { if (amount < event.getMaxCount() && eventAmounts[event.ordinal()] != amount) { eventAmounts[event.ordinal()] = (byte)amount; setDirty(); return true; } else { return false; } } public boolean increaseEventAmount(PlayerInformation.CountableKarmaEvent event) { return setEventAmount(event, eventAmounts[event.ordinal()] + 1); } public static enum CountableKarmaEvent { PIGMEN_ATTACK(1), CREATE_SNOWGOLEM(2), CREATE_IRONGOLEM(3); private final int maxCount; private CountableKarmaEvent(int maxCount) { this.maxCount = maxCount; } public int getMaxCount() { return maxCount; } } public int getCurrency() { return danris; } public int setCurrency(int danris) { if(this.danris != danris) { this.danris = danris; setDirty(); } if(this.danris > 999999) { this.danris = 999999; setDirty(); } return this.danris; } /** * marks that this needs to be resend to the client */ public void setDirty() { dirty = true; } } -Mew