Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Alanzote

Forge Modder
  • Joined

  • Last visited

Everything posted by Alanzote

  1. Hi!, I am making a mod, and an Item requires a description, how can I do it? Something Like this:
  2. I know, but what I need it's how? How can I make it check for the item?
  3. Hi, I am making a TileEntity, I want to check if Item: "PowerGive", it is slot, then it adds power. How can I do that? Thank you for your attention, Alanzote.
  4. I use the "UpdateEntity" to it, sets it power to "power+=10", when It is full, I remove this command and the power it's still there but when I re-start the game, it is gone, I wanted to make it check If item is in Slot to add power, EX: I inserct Item "Cobblestone" on the slot and It adds 100power. Thank you for your attention, Alanzote.
  5. Same, it didn't worked. I don't know the problem, is there a working way that I could save my files?
  6. I think I forgot to register in other one... Same... when I re-start the game it has gone!
  7. I think I forgot to register in other one...
  8. Yep, It's Registred in a Client and Common Proxy that I load it on my Main Class: Client Proxy: package com.gpa.startrekmod.proxy; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.Item; import net.minecraftforge.client.MinecraftForgeClient; import com.gpa.startrekmod.blocks.STModBlocks; import com.gpa.startrekmod.blocks.STReplicator; import com.gpa.startrekmod.renderer.ItemRenderReplicator; import com.gpa.startrekmod.renderer.RenderReplicator; import com.gpa.startrekmod.tileentities.TileEntityReplicatorBlock; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.registry.GameRegistry; public class ClientProxy extends CommonProxy { public void registerRendering() { //Replicator TileEntitySpecialRenderer render = new RenderReplicator(); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityReplicatorBlock.class, render); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(STModBlocks.Replicator), new ItemRenderReplicator(render, new TileEntityReplicatorBlock())); } public void registerTileEntities() { GameRegistry.registerTileEntity(TileEntityReplicatorBlock.class, "TileEntityReplicatorBlock"); } } Common Proxy: package com.gpa.startrekmod.proxy; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import com.gpa.startrekmod.renderer.RenderReplicator; import com.gpa.startrekmod.tileentities.TileEntityReplicatorBlock; import cpw.mods.fml.client.registry.ClientRegistry; public class CommonProxy { public void registerRendering() { } public void registerTileEntities() { } } Mod Main Class package com.gpa.startrekmod; import net.minecraft.creativetab.CreativeTabs; import com.gpa.startrekmod.achviments.STAchiviments; import com.gpa.startrekmod.blocks.STModBlocks; import com.gpa.startrekmod.creativeTabs.StarTrekTab; import com.gpa.startrekmod.gui.StarTrekGUIHandler; import com.gpa.startrekmod.handler.STModRecipes; import com.gpa.startrekmod.items.STModItems; import com.gpa.startrekmod.proxy.CommonProxy; import com.gpa.startrekmod.worldgen.STWorldGenerationLoader; import cpw.gpa.startrekmod.help.STReferencies; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = STReferencies.MODID, version = STReferencies.VERSION, name = STReferencies.NAME, modLanguage = STReferencies.MODLANGUAGE) public class STModInfo { public static CreativeTabs tabStarTrekMod = new StarTrekTab("tabStarTrek"); @Instance public static STModInfo instance; public static final int guiIDReplicator = 0; @EventHandler public void preInit(FMLPreInitializationEvent event){ //Load All - Blocks - Items - Recipes - WorldGen STModBlocks.loadBlocks(); STWorldGenerationLoader.loadGenerator(); STModItems.loadItems(); STModRecipes.loadRecipes(); STAchiviments.loadAchviments(); instance = this; //Load Rendering gpaProxy.registerTileEntities(); gpaProxy.registerRendering(); //Load GUI NetworkRegistry.INSTANCE.registerGuiHandler(this, new StarTrekGUIHandler()); } @SidedProxy(clientSide = "com.gpa.startrekmod.proxy.ClientProxy", serverSide = "com.gpa.startrekmod.proxy.CommonProxy") public static CommonProxy gpaProxy; }
  9. a) Client Thread b) I've seen that it saves when I pause the game, but It does not load c) I change when I'm running, I re-start to see if this really is working
  10. I've found the problem, my minecraft is saving the TileEntity. But is not loading! My Console Gave me the "Writing..." string but not the "Loading..." string.(readFromNBT(NBTTagCompound nbt))
  11. Set it in actual code?
  12. Show the code. Wat. ?! 3 Quote: I use a float named "power" that I add 500 by code(this.power=500), using the debug mode I enter my world and I can see the 500 power working, but when I go back to the game MENU and delete the "this.power=500" and re-load the map, It has gone the NBT is not saving the power. 2 Quote: Saying my original mod idea. And it's error... Oh! I am using GUIs with it! The Power is a float FROM the Block that is being used on the GUI.
  13. All My TitleEntity Code: TitleEntity: package com.gpa.startrekmod.tileentities; import com.gpa.startrekmod.items.STModItems; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityReplicatorBlock extends TileEntity implements ISidedInventory { private ItemStack[] slots = new ItemStack[2]; private final String IventoryName = "Replicator"; public int maxPower = 10000; public float power = 0; public float test = 5F; public void updateEntity(){ if(power > maxPower) power = maxPower; } public int getPowerScaled(int scaled) { return (int) (this.power * scaled / this.maxPower); } @Override public void writeToNBT(NBTTagCompound nbt){ super.writeToNBT(nbt); nbt.setFloat("Power", this.power); System.out.println("Writing"); } @Override public void readFromNBT(NBTTagCompound nbt){ super.readFromNBT(nbt); this.power = nbt.getFloat("Power"); System.out.println("Loading"); } public int getSizeInventory() { return this.slots.length; } public ItemStack getStackInSlot(int i) { return this.slots[i]; } public ItemStack decrStackSize(int i, int j) { if(this.slots[i] != null) { ItemStack itemstack; if(this.slots[i].stackSize <= j) { itemstack = this.slots[i]; this.slots[i] = null; return itemstack; }else{ itemstack = this.slots[i].splitStack(j); if(this.slots[i].stackSize == 0) { this.slots[i] = null; } return itemstack; } } return null; } public ItemStack getStackInSlotOnClosing(int i) { if(this.slots[i] != null) { ItemStack itemstack = this.slots[i]; this.slots[i] = null; return itemstack; } return null; } public void setInventorySlotContents(int i, ItemStack itemstack) { this.slots[i] = itemstack; if(itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()){ itemstack.stackSize = this.getInventoryStackLimit(); } } public String getInventoryName() { return null; } public boolean hasCustomInventoryName() { return false; } public int getInventoryStackLimit() { return 64; } public void setInventoryName(String string){ } public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { return false; } public void openInventory() { } public void closeInventory() { } public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { return false; } public int[] getAccessibleSlotsFromSide(int p_94128_1_) { return null; } public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) { return false; } public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) { return false; } }
  14. Please answer that. We cannot help you otherwise. I use an Item into a Slot and it Adds 500 of power.(Original Mod Idea(WIP-Can't Identity Item in Slot). Using this.power=500 in debug mode and then deleting it)
  15. You have no clue about his code or whatever the hell he is doing. Don't just speculate... This might very well be the cause. But you don't know. INFO: I am making a regular Custom Modelled Block.
  16. It does not save! I enter like 500 power and when the minecraft re-start, it just dissipers! (From: 500 gets 0)!
  17. Hello, I've seen the Forge Wiki and I've read the NBT saving tutorial and is does not work! Here is The Code! @Override public void writeToNBT(NBTTagCompound nbt){ super.writeToNBT(nbt); nbt.setFloat("Power", this.power); System.out.println("Writing"); } @Override public void readFromNBT(NBTTagCompound nbt){ super.readFromNBT(nbt); this.power = nbt.getFloat("Power"); System.out.println("Loading"); } Thanks!

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.