• Recently Browsing

    No registered users viewing this page.

  • Posts

    • package drachenbauer32.yellowredstonemod.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.RedstoneOreBlock; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.particles.RedstoneParticleData; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.ITickList; import net.minecraft.world.World; public class YellowRedstoneOreBlock extends RedstoneOreBlock { public YellowRedstoneOreBlock(Properties properties) { super(properties); } public void onBlockClicked(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) { activate(state, worldIn, pos); } @Override public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { activate(worldIn.getBlockState(pos), worldIn, pos); } @Override public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { activate(state, world, pos); if (world.isRemote) { return ActionResultType.SUCCESS; } else { return ActionResultType.PASS; } } private static void activate(BlockState state, World world, BlockPos pos) { spawnParticles(world, pos); ITickList<Block> tickList = world.getPendingBlockTicks(); tickList.scheduleTick(pos, state.getBlock(), 80); if (!state.get(LIT)) { world.setBlockState(pos, state.with(LIT, Boolean.valueOf(true)), 3); } } @Override public void animateTick(BlockState state, World world, BlockPos pos, Random rand) { if(state.get(LIT)) { spawnParticles(world, pos); } } private static void spawnParticles(World world, BlockPos pos) { Random random = world.rand; for(Direction direction : Direction.values()) { BlockPos blockpos = pos.offset(direction); if (!world.getBlockState(blockpos).isOpaqueCube(world, blockpos)) { Direction.Axis direction$axis = direction.getAxis(); double d1 = direction$axis == Direction.Axis.X ? 0.5D + 0.5625D * (double)direction.getXOffset() : (double)random.nextFloat(); double d2 = direction$axis == Direction.Axis.Y ? 0.5D + 0.5625D * (double)direction.getYOffset() : (double)random.nextFloat(); double d3 = direction$axis == Direction.Axis.Z ? 0.5D + 0.5625D * (double)direction.getZOffset() : (double)random.nextFloat(); world.addParticle(new RedstoneParticleData(1.0F, 0.875F, 0.0F, 1.0F), (double)pos.getX() + d1, (double)pos.getY() + d2, (double)pos.getZ() + d3, 0.0D, 0.0D, 0.0D); } } } }  
    • Now i have a platform of theese blocks and as i walked multiple times diagonally over them. At one try two blocks stayed activated. Why this could happen?
    • Depends on what exactly you want to do. Each Model is made of a collection of ModelRenderers each are a rectangular prism and have their own rotations. So yes you can rotate each "limb". But those limbs are strictly speaking limited. IE for a player a leg is one limb you can't bend it in the middle.   Honestly just write the Model class yourself. But if you really need to use a program(visual way) there are plenty out there.   Also you should use the RenderPlayerEvent. Events are documented here. What you want to do is cancel the event and render your own model under the circumstances that it should be rendered IE. if (playerIsSitting()) {   // Cancel Event   // Render Sitting Player }
    • Because they only tick when you tell them to tick. And you only ever tell them to tick when they become activated.
  • Topics

  • Who's Online (See full list)