Exemple #1
0
        public override void Initialize(ICoreAPI api, JsonObject properties)
        {
            base.Initialize(api, properties);

            bepu = Blockentity as BEPulverizer;


            Matrixf mat = bepu.mat;

            leftOffset  = mat.TransformVector(new Vec4f(4.5f / 16f - 0.5f, 4 / 16f, -4.5f / 16f, 0f));
            rightOffset = mat.TransformVector(new Vec4f(11.5f / 16f - 0.5f, 4 / 16f, -4.5f / 16f, 0f));


            slideDustParticles = new SimpleParticleProperties(1, 3, ColorUtil.ToRgba(40, 220, 220, 220), new Vec3d(), new Vec3d(), new Vec3f(-0.25f, -0.25f, -0.25f), new Vec3f(0.25f, 0.25f, 0.25f), 1, 1, 0.1f, 0.2f, EnumParticleModel.Quad);
            slideDustParticles.AddPos.Set(2 / 32f, 1 / 32f, 2 / 32f);
            slideDustParticles.WithTerrainCollision = false;
            slideDustParticles.ParticleModel        = EnumParticleModel.Quad;
            slideDustParticles.LifeLength           = 0.75f;
            slideDustParticles.SelfPropelled        = true;
            slideDustParticles.GravityEffect        = 0f;
            slideDustParticles.SizeEvolve           = EvolvingNatFloat.create(EnumTransformFunction.QUADRATIC, 0.4f);
            slideDustParticles.OpacityEvolve        = EvolvingNatFloat.create(EnumTransformFunction.QUADRATIC, -16f);
            slideDustParticles.MinQuantity          = 1;
            slideDustParticles.AddQuantity          = 3;

            Vec4f vec = mat.TransformVector(new Vec4f(-0.1f, -0.1f, 0.2f, 0f));

            slideDustParticles.MinVelocity.Set(vec.X, vec.Y, vec.Z);

            vec = mat.TransformVector(new Vec4f(0.2f, -0.05f, 0.2f, 0f));
            slideDustParticles.AddVelocity.Set(vec.X, vec.Y, vec.Z);

            leftSlidePos  = mat.TransformVector(new Vec4f(4.5f / 16f - 0.5f, 4 / 16f, -2.5f / 16f, 0f)).XYZ.ToVec3d().Add(Position).Add(0.5, 0, 0.5);
            rightSlidePos = mat.TransformVector(new Vec4f(11.5f / 16f - 0.5f, 4 / 16f, -2.5f / 16f, 0f)).XYZ.ToVec3d().Add(Position).Add(0.5, 0, 0.5);
        }
        public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            BEPulverizer bep = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BEPulverizer;

            if (bep != null)
            {
                return(bep.OnInteract(byPlayer, blockSel));
            }
            return(base.OnBlockInteractStart(world, byPlayer, blockSel));
        }
        public override ItemStack[] GetDrops(IWorldAccessor world, BlockPos pos, IPlayer byPlayer, float dropQuantityMultiplier = 1f)
        {
            ItemStack    pulvFrame = new ItemStack(world.BlockAccessor.GetBlock(CodeWithParts("north")));
            BEPulverizer bep       = world.BlockAccessor.GetBlockEntity(pos) as BEPulverizer;

            if (bep != null)
            {
                return(bep.getDrops(world, pulvFrame));
            }
            return(new ItemStack[] { pulvFrame });
        }
Exemple #4
0
 public override float GetResistance()
 {
     bepu = Blockentity as BEPulverizer;
     return(bepu.hasAxle ? 0.085f : 0.005f);
 }