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.

Featured Replies

Posted

Hi,

Im trying to make some kind of ritual which will spawn wither ...

this is my item class

 

 

package fewmorethings.items;

 

import net.minecraft.block.Block;

import net.minecraft.entity.boss.EntityWither;

import net.minecraft.entity.effect.EntityLightningBolt;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.init.Items;

import net.minecraft.item.ItemStack;

import net.minecraft.util.IIcon;

import net.minecraft.world.World;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import fewmorethings.help.LogHelper;

import fewmorethings.items.bases.ItemBase;

 

public class TestItem extends ItemBase {

 

public TestItem () {

this.setUnlocalizedName("TestItem");

}

 

 

@Override

public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par1, float par2, float par3, float par4) {

Block blockoneye = world.getBlock(x, y, z);

if(!world.isRemote) {

if(blockoneye == Blocks.iron_block && this.checkRitualBlocks(x, y, z, world)) {

LogHelper.info("DEBUG");

EntityWither wither = new EntityWither(world);

world.spawnEntityInWorld(wither);

}

}

return true;

}

 

@SideOnly(Side.CLIENT)

    public IIcon getIcon(ItemStack i, int j) {

        return Items.stick.getIcon(i, j);

    }

 

private boolean checkRitualBlocks(int x, int y,int z, World world) {

if(world.getBlock(x, y, z - 1) == Blocks.obsidian &&

  world.getBlock(x, y, z + 1) == Blocks.obsidian &&

  world.getBlock(x + 1, y, z) == Blocks.obsidian &&

  world.getBlock(x - 1, y, z) == Blocks.obsidian &&

 

  world.getBlock(x - 1, y, z - 1) == Blocks.glowstone &&

  world.getBlock(x + 1, y, z - 1) == Blocks.glowstone &&

  world.getBlock(x + 1, y, z - 1) == Blocks.glowstone &&

  world.getBlock(x + 1, y, z + 1) == Blocks.glowstone &&

 

  world.getBlock(x - 4, y + 1, z - 1) == Blocks.quartz_block &&

  world.getBlock(x - 4, y + 2, z - 1) == Blocks.quartz_block &&

  world.getBlock(x - 4, y + 3, z - 1) == Blocks.diamond_block &&

 

  world.getBlock(x - 4, y + 1, z + 2) == Blocks.quartz_block &&

  world.getBlock(x - 4, y + 2, z + 2) == Blocks.quartz_block &&

  world.getBlock(x - 4, y + 3, z + 2) == Blocks.diamond_block &&

 

  world.getBlock(x + 4, y + 1, z + 1) == Blocks.quartz_block &&

  world.getBlock(x + 4, y + 2, z + 1) == Blocks.quartz_block &&

  world.getBlock(x + 4, y + 3, z + 1) == Blocks.diamond_block &&

 

  world.getBlock(x + 1, y + 1, z + 4) == Blocks.quartz_block &&

  world.getBlock(x + 1, y + 2, z + 4) == Blocks.quartz_block &&

  world.getBlock(x + 1, y + 3, z + 4) == Blocks.beacon &&

 

  world.getBlock(x - 1, y + 1, z - 4) == Blocks.quartz_block &&

  world.getBlock(x - 1, y + 2, z - 4) == Blocks.quartz_block &&

  world.getBlock(x - 1, y + 3, z - 4) == Blocks.beacon) {

return true;

}

return false;

}

}

 

 

 

 

 

The word DEBUG will be actually printed out but the wither will not spawn

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

  • Author

what ??

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

  • Author

how to set cords ?

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

You use the alternative constructor.

 

Edit: I just found out there's no alternative constructor, so you'd have to set the position manually using

entity.posX/Y/Z = ?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

  • Author

no idea why but this is not working

wither.setPosition(x, y, z);

this one either

wither.posX = x;
wither.posY = y;
wither.posZ = z;

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

  • Author

what yaw and pitch means ? How to get them ?

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

  • Author

this isnt working

 

@Override

public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par1, float par2, float par3, float par4) {

Block blockoneye = world.getBlock(x, y, z);

if(!world.isRemote) {

if(blockoneye == Blocks.iron_block && this.checkRitualBlocks(x, y, z, world)) {

LogHelper.info("DEBUG");

EntityPlayer p = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, 100);

                float yaw = p.rotationYaw;

                float pitch = p.rotationPitch;

EntityWither wither = new EntityWither(world);

world.spawnEntityInWorld(wither);

wither.setLocationAndAngles(x, y, z, yaw, pitch);

}

}

return true;

}

 

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

  • Author

oh i didnt recognize i did that ok thank you for help :)

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.