本文整理了Java中net.minecraft.block.Block.updateTick()
方法的一些代码示例,展示了Block.updateTick()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.updateTick()
方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:updateTick
暂无
代码示例来源:origin: RS485/LogisticsPipes
@Override
@ModDependentMethod(modId = LPConstants.mcmpModID)
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
Block block = mcmpBlockAccess.getBlock();
if (block != null) {
block.updateTick(world, pos, state, rand);
} else {
super.updateTick(world, pos, state, rand);
}
}
代码示例来源:origin: squeek502/VeganOption
public static boolean tryGrowthTickAt(World world, BlockPos pos, Random random)
{
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if ((block instanceof IPlantable || block instanceof IGrowable) && block.getTickRandomly())
{
block.updateTick(world, pos, state, random);
return true;
}
return false;
}
代码示例来源:origin: squeek502/VeganOption
@Override
// passive and very subtle soil building
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
{
super.updateTick(world, pos, state, rand);
// skip ForgeDirection.DOWN
EnumFacing randomDirection = EnumFacing.DOWN;
while (randomDirection == EnumFacing.DOWN)
{
randomDirection = EnumFacing.random(rand);
}
attemptSoilBuilding(world, pos.offset(randomDirection), random, randomDirection == EnumFacing.UP);
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
super.updateTick(world, pos, state, rand);
this.checkForDrop(world, pos, state);
if (rand.nextInt(10) == 0) {
EntityItem item = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.8, pos.getZ() + 0.5, new ItemStack(this.getItem()));
item.motionX = (rand.nextFloat() - 0.5F) * 0.5F;
item.motionY = 0.2F;
item.motionZ = (rand.nextFloat() - 0.5F) * 0.5F;
world.spawnEntity(item);
}
}
代码示例来源:origin: sinkillerj/ProjectE
private void speedUpRandomTicks(World world, int bonusTicks, AxisAlignedBB bBox)
{
if (bBox == null || bonusTicks == 0) // Sanity check the box for chunk unload weirdness
{
return;
}
List<String> blacklist = Arrays.asList(ProjectEConfig.effects.timeWatchBlockBlacklist);
for (BlockPos pos : WorldHelper.getPositionsFromBox(bBox))
{
for (int i = 0; i < bonusTicks; i++)
{
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if (block.getTickRandomly()
&& !blacklist.contains(block.getRegistryName().toString())
&& !(block instanceof BlockLiquid) // Don't speed vanilla non-source blocks - dupe issues
&& !(block instanceof BlockFluidBase) // Don't speed Forge fluids - just in case of dupes as well
&& !(block instanceof IGrowable)
&& !(block instanceof IPlantable)) // All plants should be sped using Harvest Goddess
{
block.updateTick(world, pos, state, itemRand);
}
}
}
}
代码示例来源:origin: WayofTime/BloodMagic
@Override
public void onSigilUpdate(ItemStack stack, World worldIn, EntityPlayer player, int itemSlot, boolean isSelected) {
if (PlayerHelper.isFakePlayer(player))
return;
int range = 3;
int verticalRange = 2;
int posX = (int) Math.round(player.posX - 0.5f);
int posY = (int) player.posY;
int posZ = (int) Math.round(player.posZ - 0.5f);
for (int ix = posX - range; ix <= posX + range; ix++) {
for (int iz = posZ - range; iz <= posZ + range; iz++) {
for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++) {
BlockPos blockPos = new BlockPos(ix, iy, iz);
IBlockState state = worldIn.getBlockState(blockPos);
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state)) {
if (state.getBlock() instanceof IGrowable) {
if (worldIn.rand.nextInt(50) == 0) {
IBlockState preBlockState = worldIn.getBlockState(blockPos);
state.getBlock().updateTick(worldIn, blockPos, state, worldIn.rand);
IBlockState newState = worldIn.getBlockState(blockPos);
if (!newState.equals(preBlockState) && !worldIn.isRemote)
worldIn.playEvent(2005, blockPos, 0);
}
}
}
}
}
}
}
代码示例来源:origin: amadornes/MCMultiPart
public default void updateTick(IPartInfo part, Random rand) {
part.getState().getBlock().updateTick(part.getPartWorld(), part.getPartPos(), part.getState(), rand);
}
代码示例来源:origin: Glitchfiend/ToughAsNails
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
super.updateTick(worldIn, pos, state, rand);
int age = ((Integer)state.getValue(AGE)).intValue();
if (state.getValue(BURNING) == true)
{
if (worldIn.isRainingAt(pos))
{
worldIn.setBlockState(pos, state.withProperty(BURNING, false).withProperty(AGE, 7), 2);
worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int i = 0; i < 8; ++i)
{
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double)((float)pos.getX() + 0.75F - (rand.nextFloat() / 2.0F)), (double)((float)pos.getY() + 0.9F), (double)((float)pos.getZ() + 0.75F - (rand.nextFloat() / 2.0F)), 0.0D, 0.0D, 0.0D, new int[] {Block.getStateId(state)});
}
}
if (rand.nextInt(1) == 0)
{
worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(age + 1)), 2);
if (age + 1 == 7)
{
worldIn.setBlockState(pos, state.withProperty(BURNING, false), 2);
}
}
}
}
代码示例来源:origin: WayofTime/BloodMagic
block.updateTick(world, blockPos, world.getBlockState(blockPos), world.rand);
代码示例来源:origin: PrinceOfAmber/Cyclic
world.scheduleBlockUpdate(current, block, world.rand.nextInt(TICKS) + 20, 1);
if (!world.isRemote) {
block.updateTick(world, current, bState, world.rand);
代码示例来源:origin: Ellpeck/ActuallyAdditions
Block block = state.getBlock();
int metaBefore = block.getMetaFromState(state);
block.updateTick(world, pos, world.getBlockState(pos), world.rand);
代码示例来源:origin: Ellpeck/ActuallyAdditions
plantBlock.updateTick(this.world, plant, plantState, this.world.rand);
代码示例来源:origin: sinkillerj/ProjectE
crop.updateTick(world, currentPos, state, world.rand);
代码示例来源:origin: Electrical-Age/ElectricalAge
b.updateTick(c.world(), c.x, c.y, c.z, c.world().rand);
代码示例来源:origin: WayofTime/BloodMagic
if (flag) {
if (world.rand.nextDouble() < growthChance) {
state.getBlock().updateTick(world, newPos, state, new Random());
IBlockState newState = world.getBlockState(newPos);
if (!newState.equals(state)) {
内容来源于网络,如有侵权,请联系作者删除!