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.

DonKresenko

Members
  • Joined

  • Last visited

Everything posted by DonKresenko

  1. In other word, what should i do in order to my item to dorp whenever the block is placed?
  2. I call this method in my block class, nowhere else
  3. This is what i have currently in my block class //@SideOnly(Side.CLIENT) public void onBlockAdded(World world, int i, int j, int k) { super.onBlockAdded(world, i, j, k); if (!world.isRemote && world.getBlock(i,j,k) == Test.testBlock) { float f = 0.7F; double d = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.2D + 0.6D; double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem(world, i + d, j + d1, k + d2, new ItemStack(Items.blaze_powder, 1)); entityitem.delayBeforeCanPickup = 5; world.spawnEntityInWorld(entityitem); } } And, as I said, the items is spawned twice
  4. Thank you for replaying, but removing the clientside only doesn't fix this. The item is spawned twice again
  5. No luck. Even when i put this... if(world.getBlock(i, j, k) == Test.testBlock){...} ...it isn't working
  6. I know what he wants, I was thinking that this may help
  7. @SideOnly(Side.CLIENT) public void displayAllReleventItems(List itemList) { itemList.add(new ItemStack(Items.apple)); itemList.add(new ItemStack(Items.beef)); itemList.add(new ItemStack(Blocks.dirt)); //etc. }
  8. I'm trying to make whenever I place my block, the item pops out. The problem is, that the method is somehow executed twice. Here's my code @SideOnly(Side.CLIENT) public void onBlockAdded(World world, int i, int j, int k) { super.onBlockAdded(world, i, j, k); if(!world.isRemote) { float f = 0.7F; double d = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; double d1 = world.rand.nextFloat() * f + (1.0F - f) * 0.2D + 0.6D; double d2 = world.rand.nextFloat() * f + (1.0F - f) * 0.5D; EntityItem pan = new EntityItem(world, i + d, j + d1, k + d2, new ItemStack(Items.blaze_rod, 1)); pan.delayBeforeCanPickup = 5; world.spawnEntityInWorld(pan); } System.out.println("executed"); }
  9. - I don't have world gen, this is the method in my main class - I don't know what that is
  10. I'm trying to generate my bush block (like flower) on surface of the forest biome. It must generate on grass block only. I can't get it to work. Any ideas? I tried this: But no luck..
  11. Can someone point me on how to do this properly?
  12. package com.nuclearbanana.piecraft; @Mod(modid = PieCraft.modid, name = "PieCraft", version = "5.3") public class PieCraft { public static final String modid = "piecraft"; @Instance(modid) public static PieCraft instance; @SidedProxy(clientSide = "com.nuclearbanana.piecraft.ClientBanana", serverSide = "com.nuclearbanana.piecraft.ServerBanana") public static ServerBanana proxy; public static CreativeTabs pieTab = new CreativeTabs("pieTab"){ public Item getTabIconItem() { return ItemApplePie; } }; public static Block PairBlock; public static Item PairItem; public static Item PairSubItem; @EventHandler public static void preLoad(FMLPreInitializationEvent PreEvent){ proxy.renderInformation(); } @EventHandler public void init(FMLInitializationEvent e) { } @EventHandler public void loadServer(FMLServerStartingEvent event) { } public PieCraft() { //registerBlock(PairBlock, "Pair Block"); //registerItem(PairItem, "Pair Item"); PieAPI.createPair(PairBlock, PairItem, PairSubItem, "pair"); } public static void registerBlock(Block block, String name) { GameRegistry.registerBlock(block, block.getUnlocalizedName()); LanguageRegistry.addName(block, name); } public static void registerItem(Item item, String name) { GameRegistry.registerItem(item, item.getUnlocalizedName()); LanguageRegistry.addName(item, name); } }
  13. It's pointing me to the line in the main class
  14. I'm making a mod. I wanted to make the code look nicer and make it easier. I tried to make like and API that will register my block and item and the crafting recipe. Here's an example: Methods in the API class: And this is in my main class: PairAPI.createPair(PairBlockTest, PairItemTest, ItemSubTest, "pair"); But Minecraft just keep crashing. Where am I making a mistake?
  15. After debugging, i saw that it only prints the number 1, always. So when i set if it is 0, that code never executes @Override public void performEffect(EntityLivingBase lb, int ticksLeft) { if(this.id == InfusionCraft.flyingEffect.id && lb instanceof EntityPlayer) { if(ticksLeft == 1) { ((EntityPlayer)lb).capabilities.allowFlying = true; System.out.println("If: "+ticksLeft); } else { ((EntityPlayer)lb).capabilities.allowFlying = false; ((EntityPlayer)lb).capabilities.isFlying = false; System.out.println("Else: "+ticksLeft); } System.out.println("N: "+ticksLeft); } }
  16. Well, I can't get it to work. I tried everything. Setting if statements, changing 0 to 1, nothing. Here's what i did so far @Override public void performEffect(EntityLivingBase lb, int ticksLeft) { if(this.id == InfusionCraft.flyingEffect.id && lb instanceof EntityPlayer) { if(ticksLeft == 0) { ((EntityPlayer)lb).capabilities.allowFlying = false; ((EntityPlayer)lb).capabilities.isFlying = false; } else ((EntityPlayer)lb).capabilities.allowFlying = true; } } Also, I tried to add an icon for the potion effect. The image is loaded and it's there, just it doesn't show the whole image. Here's what i mean http://i.imgur.com/XApGbPg.png It's like the image is too big (Don't think so, i copied the vanilla template 17x17 for potion icon) Here's my class package com.nuclearbanana.ic; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; public class FlyingPotionEffect extends Potion { private static final ResourceLocation icon = new ResourceLocation(InfusionCraft.modid,"/textures/potion/fly.png"); protected FlyingPotionEffect(int par1, boolean par2, int par3) { super(par1, par2, par3); this.setIconIndex(0, 0); } @Override public void performEffect(EntityLivingBase lb, int ticksLeft) { if(this.id == InfusionCraft.flyingEffect.id && lb instanceof EntityPlayer) { if(ticksLeft == 0) { ((EntityPlayer)lb).capabilities.allowFlying = false; ((EntityPlayer)lb).capabilities.isFlying = false; } else ((EntityPlayer)lb).capabilities.allowFlying = true; } } @Override public boolean isReady(int par1, int par2) { return this.id == InfusionCraft.flyingEffect.id; } @Override @SideOnly(Side.CLIENT) public boolean hasStatusIcon() { Minecraft.getMinecraft().renderEngine.bindTexture(icon); return true; } }
  17. Wow, i set the id to 31 and it worked When i right click with item i get my potion of flying and i can fly. That cool! But 1 thing...when the potion effect ends i can still fly. Is there a way that i can check if the player has potion effect? And where should i put it? Here's the PotionEffect class public class FlyingPotionEffect extends Potion { protected FlyingPotionEffect(int par1, boolean par2, int par3) { super(par1, par2, par3); } @Override public void performEffect(EntityLivingBase lb, int par2) { if (this.id == InfusionCraft.flyingEffect.id && lb instanceof EntityPlayer) { ((EntityPlayer)lb).capabilities.allowFlying = true; } } @Override public boolean isReady(int par1, int par2) { return this.id == InfusionCraft.flyingEffect.id; } }
  18. but all 31 id's are used by vanilla potions
  19. Oh yeah, sorry i forgot to do that http://pastebin.com/YCTfpKAv
  20. done it like this @Override public boolean isReady(int par1, int par2) { return this.id == InfusionCraft.flyingEffect.id; } i got crash when i try to run minecraft
  21. I didn't quite understand. Can you tell me where and what i need to override? And thank you

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.