Everything posted by DonKresenko
-
[SOLVED][1.7.10] On block placed method is executed twice?
In other word, what should i do in order to my item to dorp whenever the block is placed?
-
[SOLVED][1.7.10] On block placed method is executed twice?
I call this method in my block class, nowhere else
-
[SOLVED][1.7.10] On block placed method is executed twice?
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
-
[SOLVED][1.7.10] On block placed method is executed twice?
Any ideas?
-
[SOLVED][1.7.10] On block placed method is executed twice?
Thank you for replaying, but removing the clientside only doesn't fix this. The item is spawned twice again
-
[SOLVED][1.7.10] On block placed method is executed twice?
No luck. Even when i put this... if(world.getBlock(i, j, k) == Test.testBlock){...} ...it isn't working
-
[1.7.10] List Every Item In A Creative Tab In An Array?
I know what he wants, I was thinking that this may help
-
[1.7.10] List Every Item In A Creative Tab In An Array?
@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. }
-
[SOLVED][1.7.10] On block placed method is executed twice?
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"); }
-
[1.7.10] Generating bush on surface
- I don't have world gen, this is the method in my main class - I don't know what that is
-
[1.7.10] Generating bush on surface
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..
-
[1.7.10] 'API' that registers your block and item
Can someone point me on how to do this properly?
-
[1.7.10] 'API' that registers your block and item
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); } }
-
[1.7.10] 'API' that registers your block and item
- [1.7.10] 'API' that registers your block and item
It's pointing me to the line in the main class- [1.7.10] 'API' that registers your block and item
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?- (SOLVED)[1.7.2] Creating potion that makes you fly
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); } }- (SOLVED)[1.7.2] Creating potion that makes you fly
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; } }- (SOLVED)[1.7.2] Creating potion that makes you fly
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; } }- (SOLVED)[1.7.2] Creating potion that makes you fly
but all 31 id's are used by vanilla potions- (SOLVED)[1.7.2] Creating potion that makes you fly
Oh yeah, sorry i forgot to do that http://pastebin.com/YCTfpKAv- (SOLVED)[1.7.2] Creating potion that makes you fly
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- (SOLVED)[1.7.2] Creating potion that makes you fly
I didn't quite understand. Can you tell me where and what i need to override? And thank you- (SOLVED)[1.7.2] Creating potion that makes you fly
anyone?- Detect all nearby entities to player and then shoot lightning at them
Can you post the full source? - [1.7.10] 'API' that registers your block and item
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.