java minecraftmodexample.example000_009.e004_damage_block.BlockDamageBlock.java
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java minecraftmodexample.example000_009.e004_damage_block.BlockDamageBlock.java相关的知识,希望对你有一定的参考价值。
package net.nyagosu.minecraftmodexample.example000_009.e004_damage_block;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.nyagosu.minecraftmodexample.MinecraftModExample;
public class BlockDamageBlock extends Block {
public BlockDamageBlock()
{
super(Material.GROUND);
this.setCreativeTab(MinecraftModExample.base_tab);
}
//エンティティが触れると呼ばれるイベント
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
//エンティティにダメージを与える。
entityIn.attackEntityFrom(DamageSource.GENERIC, 1.0F);
}
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
{
//1.0x1.0x1.0より少し小さいサイズを指定しないとダメ。
return new AxisAlignedBB(0.0125D, 0.0D, 0.0125D, 0.9875D, 0.9875D, 0.9875D);
}
}
以上是关于java minecraftmodexample.example000_009.e004_damage_block.BlockDamageBlock.java的主要内容,如果未能解决你的问题,请参考以下文章
java minecraftmodexample.example000_009.e004_damage_block.BlockDamageBlock.java
java minecraftmodexample.example000_009.e000_basic_block.InitClient.java
java minecraftmodexample.example000_009.e000_basic_block.InitCommon.java
java minecraftmodexample.example000_009.e000_basic_block.BlockBasicBlock.java
java net.nyagosu.minecraftmodexample.example000-009.e003_fragile_block.BlockFragileBlock.java
java net.nyagosu.minecraftmodexample.example000-009.e001_hardest_block.BlockGlowBlock.java