Jump to content

Recommended Posts

Posted

What is your problem? BlockPos is just a wrapper class that wraps x, y and z in one Object.

 

I'm having trouble with updating my generateSurface method, here's the code: private void generateSurface(World world, Random random, int blockX, int blockZ) {

for(int i = 0; i < 10; i++){

int Xcoord = blockX + random.nextInt(16);

int Ycoord = random.nextInt(28);

int Zcoord = blockZ + random.nextInt(16);

 

new WorldGenMinable(DanArmourMain.invisore, 4).generate(world, random, Xcoord, Ycoord, Zcoord);

}

 

}

 

hope this helps

Posted

generate

now takes a BlockPos argument instead of 3 ints.

 

Sorry, I have lots of errors with this, I have no idea what's changed or what to change, here is my full class:

 

public class InvisOreWorldGeneration implements IWorldGenerator{

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world,

IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.getDimensionId()){

case -1 : generateNether(world, random, chunkX * 16, chunkZ * 16);

case 0 : generateSurface(world, random, chunkX * 16, chunkZ * 16);

}

 

}

 

private void generateSurface(World world, Random random, int blockX, int blockZ) {

for(int i = 0; i < 10; i++){

int Xcoord = blockX + random.nextInt(16);

int Ycoord = random.nextInt(28);

int Zcoord = blockZ + random.nextInt(16);

 

new WorldGenMinable(DanArmourMain.invisore, 4).generate(world, random, pos);

}

 

}

 

private void generateNether(World world, Random random, int i, int j) {

}

}

 

I've got an error on new WroldGenMineable because it needs invisore (my block) to be a block state. Also, inserting a BlockPos into the generate method means I have to put it into the generateSurface parameters, which in turn needs one in main generate method, which then causes an error with the @Override meaning that it no longer implements the needed method for IWorldGenerator.

Posted

To get the default block state (IBlockState) for your Block use the

getDefaultState

method.

For your BlockPos: all you need to do is wrap the 3 variables (Xcoord, Ycoord, Zcoord) into a BlockPos. Seriously.

 

Sorry, first time updating w/o tutorials but I've got it now, thanks a bunch

  • 1 month later...
  • 3 weeks later...
Posted

To get the default block state (IBlockState) for your Block use the

getDefaultState

method.

For your BlockPos: all you need to do is wrap the 3 variables (Xcoord, Ycoord, Zcoord) into a BlockPos. Seriously.

 

Wow...such a simple change, an annoying one, but simple once it's been explained. Thank You. 8)

a.k.a. Sirius

width=400 height=82http://i.imgur.com/QRtYi6e.png[/img]

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • You can check mod compatibility remove new mods and test them one by one.
    • @Tsuk1 Also, new note, you can use blockbench to make the custom item model for when it is not on the head.   EDIT: Funny story, I am making a mod similar to yours! Mine is called NorseMC.
    • @Nood_dev Could you send a screenshot of your weapon code? Here is the one I made (for a dagger): The specific UUID does not matter, just that it is the same every time, which is why UUID#randomUUID does not work public class DaggerItem extends TieredItem implements Vanishable { protected static final double REACH_MODIFIER = -1.5D; protected final Multimap<Attribute, AttributeModifier> defaultModifiers; protected final UUID BASE_ATTACK_REACH_UUID = UUID.fromString("6fe75b5c-9d1b-4e83-9eea-a1d5a94e8dd5") public DaggerItem(Tier pTier, int pAttackDamageModifier, float pAttackSpeedModifier, Properties pProperties) { super(pTier, pAttackDamageModifier, pAttackSpeedModifier, pProperties); this.attackDamage = (float) pAttackDamageModifier + pTier.getAttackDamageBonus(); ImmutableMultimap.Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder(); builder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", this.attackDamage, AttributeModifier.Operation.ADDITION)); builder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", pAttackSpeedModifier, AttributeModifier.Operation.ADDITION)); // THE ONE YOU WANT: builder.put(ForgeMod.ENTITY_REACH.get(), new AttributeModifier(BASE_ATTACK_REACH_UUID, "Weapon modifier", REACH_MODIFIER, AttributeModifier.Operation.ADDITION)); this.defaultModifiers = builder.build(); } @Override public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot pEquipmentSlot) { return pEquipmentSlot == EquipmentSlot.MAINHAND ? this.defaultModifiers : super.getDefaultAttributeModifiers(pEquipmentSlot); } }
    • https://images.app.goo.gl/1PxFKdxByTgkxvSu6
    • That's what we'll try out. I could never figure out how to recreate the crash, so I'll just have to wait and see.
  • Topics

×
×
  • Create New...

Important Information

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