Created
June 30, 2020 18:55
-
-
Save Lanse505/f26a7c8b83affa6e190d2d0afc85cd86 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Nullable | |
public static BlockState damage(BlockState state) { | |
if (net.minecraftforge.common.ForgeHooks.onAnvilDamage(state)) return state; | |
if (state.isIn(Blocks.ANVIL)) { | |
return Blocks.CHIPPED_ANVIL.getDefaultState().with(FACING, state.get(FACING)); | |
} else { | |
return state.isIn(Blocks.CHIPPED_ANVIL) ? Blocks.DAMAGED_ANVIL.getDefaultState().with(FACING, state.get(FACING)) : null; | |
} | |
} | |
Added Line: | |
if (net.minecraftforge.common.ForgeHooks.onAnvilDamage(state)) return state; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean onLivingFall(float distance, float damageMultiplier) { | |
if (this.hurtEntities) { | |
int i = MathHelper.ceil(distance - 1.0F); | |
if (i > 0) { | |
List<Entity> list = Lists.newArrayList(this.world.getEntitiesWithinAABBExcludingEntity(this, this.getBoundingBox())); | |
boolean flag = this.fallTile.func_235714_a_(BlockTags.ANVIL); | |
DamageSource damagesource = flag ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK; | |
for(Entity entity : list) { | |
entity.attackEntityFrom(damagesource, (float)Math.min(MathHelper.floor((float)i * this.fallHurtAmount), this.fallHurtMax)); | |
} | |
if (flag && (double)this.rand.nextFloat() < (double)0.05F + (double)i * 0.05D && !net.minecraftforge.common.ForgeHooks.onAnvilDamageFalling(this.fallTile, this.onGround ? this.getEntityWorld().getBlockState(this.getPositionUnderneath()) : null)) { | |
BlockState blockstate = AnvilBlock.damage(this.fallTile); | |
if (blockstate == null) { | |
this.dontSetBlock = true; | |
} else { | |
this.fallTile = blockstate; | |
} | |
} | |
} | |
} | |
Changed Line: | |
if (flag && (double)this.rand.nextFloat() < (double)0.05F + (double)i * 0.05D && !net.minecraftforge.common.ForgeHooks.onAnvilDamageFalling(this.fallTile, this.onGround ? this.getEntityWorld().getBlockState(this.getPositionUnderneath()) : null)) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment