Jump to content

[1.16.4] net.minecraft.world.World.isMaterialInBB()


Recommended Posts

Posted

What did you change from net.minecraft.world.World.isMaterialInBB() to? Or please tell me how you can use it instead.

※ I couldn't speak English very well, so I used a translator. Please let me know by correcting the wrong part of the sentence.

Posted

Hello

 

How I find the new name when it has changed version (eg from 1.12  to 1.16):

1) Find the code in 1.12 which calls .isMaterialInBB(); for example

EntityLlamaSpit:onUpdate....->

if (!this.world.isMaterialInBB(this.getEntityBoundingBox(), Material.AIR))
{
    this.setDead();
}
else if (this.isInWater())
{
    this.setDead();
}

 

2) Look at EntityLlamaSpit in 1.16.4: (LlamaSpitEntity::tick )

      if (this.world.func_234853_a_(this.getBoundingBox()).noneMatch(AbstractBlock.AbstractBlockState::isAir)) {
         this.remove();
      } else if (this.isInWaterOrBubbleColumn()) {
         this.remove();
      } else {

 

-TGG

  • Thanks 1
  • 5 months later...
Posted (edited)

I have the same problem but "this.world.func_234853_a_(this.getBoundingBox()).noneMatch(AbstractBlock.AbstractBlockState::isAir)" dosnt really help me.

package com.rwtema.monkmod.abilities;

import net.minecraft.block.material.Material;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.MobEffects;

import net.minecraft.potion.PotionEffect;

import net.minecraft.util.DamageSource;

import javax.annotation.Nonnull;

public class MonkAbilitiyProtectionLava extends MonkAbilityProtection {

public MonkAbilitiyProtectionLava() {

super("lava_protection");

}

@Override

public float getAbsorbtion(DamageSource source, @Nonnull EntityPlayer player) {

if (!player.isBurning()) {

if (player.world.isMaterialInBB(player.getEntityBoundingBox(), Material.LAVA)) {

player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 20 * 4, 2));

player.extinguish();

return 0;

}

}

return 1;

}

@Override

public boolean canHandle(EntityPlayer player, @Nonnull DamageSource source) {

return source.isFireDamage();

}

}

this is the class that i want to update.

 

and this is what i have done so far. but the Material.LAVA is there wrong. it needs Predicate <net.minecraft.entity.Entity> and i provide a Material.

package com.rwtema.monkmod.abilities;

import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.util.DamageSource;

import javax.annotation.Nonnull;

public class MonkAbilitiyProtectionLava extends MonkAbilityProtection {
	public MonkAbilitiyProtectionLava() {
		super("lava_protection");
	}

	@Override
	public float getAbsorbtion(DamageSource source, @Nonnull PlayerEntity player) {
		if (!player.isOnFire()) {
			if (player.level.getCollisions(player, player.getBoundingBox(), Material.LAVA)) {
				player.addEffect(new EffectInstance(Effects.FIRE_RESISTANCE, 20 * 4, 2));
				player.extinguish();
				return 0;
			}
		}
		return 1;
	}

	@Override
	public boolean canHandle(PlayerEntity player, @Nonnull DamageSource source) {
		return source.isFire();
	}
}

 

Edited by Trackhe

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



×
×
  • Create New...

Important Information

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