Search in sources :

Example 1 with EntityBoat

use of net.minecraft.entity.item.EntityBoat in project Minestuck by mraof.

the class ClientProxy method preInit.

@Override
public void preInit() {
    RenderingRegistry.registerEntityRenderingHandler(EntityNakagator.class, RenderEntityMinestuck.getFactory(new ModelNakagator(), 0.5F));
    RenderingRegistry.registerEntityRenderingHandler(EntitySalamander.class, RenderEntityMinestuck.getFactory(new ModelSalamander(), 0.5F));
    RenderingRegistry.registerEntityRenderingHandler(EntityIguana.class, RenderEntityMinestuck.getFactory(new ModelIguana(), 0.5F));
    RenderingRegistry.registerEntityRenderingHandler(EntityTurtle.class, RenderEntityMinestuck.getFactory(new ModelTurtle(), 0.5F));
    RenderingRegistry.registerEntityRenderingHandler(EntityImp.class, RenderEntityMinestuck.getFactory(new ModelImp(), 0.5F));
    RenderingRegistry.registerEntityRenderingHandler(EntityOgre.class, RenderEntityMinestuck.getFactory(new ModelOgre(), 2.8F));
    RenderingRegistry.registerEntityRenderingHandler(EntityBasilisk.class, RenderEntityMinestuck.getFactory(new ModelBasilisk(), 2.8F));
    RenderingRegistry.registerEntityRenderingHandler(EntityLich.class, RenderEntityMinestuck.getFactory(new ModelLich(), 0.5F));
    RenderingRegistry.registerEntityRenderingHandler(EntityGiclops.class, RenderEntityMinestuck.getFactory(new ModelGiclops(), 7.6F));
    RenderingRegistry.registerEntityRenderingHandler(EntityBishop.class, RenderEntityMinestuck.getFactory(new ModelBishop(), 1.8F));
    RenderingRegistry.registerEntityRenderingHandler(EntityRook.class, RenderEntityMinestuck.getFactory(new ModelRook(), 2.5F));
    RenderingRegistry.registerEntityRenderingHandler(EntityUnderlingPart.class, new IRenderFactory<EntityUnderlingPart>() {

        @Override
        public Render<EntityUnderlingPart> createRenderFor(RenderManager manager) {
            return new RenderShadow(manager, 2.8F);
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityBigPart.class, new IRenderFactory<EntityBigPart>() {

        @Override
        public Render<EntityBigPart> createRenderFor(RenderManager manager) {
            return new RenderShadow(manager, 0F);
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityPawn.class, new IRenderFactory<EntityPawn>() {

        @Override
        public Render<EntityPawn> createRenderFor(RenderManager manager) {
            return new RenderPawn(manager, new ModelBiped(), 0.5F);
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityGrist.class, new IRenderFactory<EntityGrist>() {

        @Override
        public Render<EntityGrist> createRenderFor(RenderManager manager) {
            return new RenderGrist(manager);
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityVitalityGel.class, new IRenderFactory<EntityVitalityGel>() {

        @Override
        public Render<EntityVitalityGel> createRenderFor(RenderManager manager) {
            return new RenderVitalityGel(manager);
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityDecoy.class, new IRenderFactory<EntityDecoy>() {

        @Override
        public Render<EntityDecoy> createRenderFor(RenderManager manager) {
            return new RenderDecoy(manager);
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityMetalBoat.class, new IRenderFactory<EntityBoat>() {

        @Override
        public Render<EntityBoat> createRenderFor(RenderManager manager) {
            return new RenderMetalBoat(manager);
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityCrewPoster.class, new IRenderFactory<EntityCrewPoster>() {

        @Override
        public Render<EntityCrewPoster> createRenderFor(RenderManager manager) {
            return new RenderHangingArt<>(manager, "midnight_poster");
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntitySbahjPoster.class, new IRenderFactory<EntitySbahjPoster>() {

        @Override
        public Render<EntitySbahjPoster> createRenderFor(RenderManager manager) {
            return new RenderHangingArt<>(manager, "sbahj_poster");
        }
    });
    MinecraftForge.EVENT_BUS.register(new MinestuckKeyHandler());
    MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
    MinecraftForge.EVENT_BUS.register(MinestuckModelManager.class);
}
Also used : EntityPawn(com.mraof.minestuck.entity.carapacian.EntityPawn) MinestuckKeyHandler(com.mraof.minestuck.client.settings.MinestuckKeyHandler) Render(net.minecraft.client.renderer.entity.Render) EntityBoat(net.minecraft.entity.item.EntityBoat) RenderManager(net.minecraft.client.renderer.entity.RenderManager) EntityBigPart(com.mraof.minestuck.entity.EntityBigPart) EntityDecoy(com.mraof.minestuck.entity.EntityDecoy) ModelBiped(net.minecraft.client.model.ModelBiped) ClientEventHandler(com.mraof.minestuck.event.ClientEventHandler)

Example 2 with EntityBoat

use of net.minecraft.entity.item.EntityBoat in project takumicraft by TNTModders.

the class EntitySkeletonCreeper method onLivingUpdate.

/**
 * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
 * use this to react to sunlight and start to burn.
 */
@Override
public void onLivingUpdate() {
    if (this.world.isDaytime() && !this.world.isRemote) {
        float f = this.getBrightness();
        BlockPos blockpos = this.getRidingEntity() instanceof EntityBoat ? new BlockPos(this.posX, (double) Math.round(this.posY), this.posZ).up() : new BlockPos(this.posX, (double) Math.round(this.posY), this.posZ);
        if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.canSeeSky(blockpos)) {
            boolean flag = true;
            ItemStack itemstack = this.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (!itemstack.isEmpty()) {
                if (itemstack.isItemStackDamageable()) {
                    itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2));
                    if (itemstack.getItemDamage() >= itemstack.getMaxDamage()) {
                        this.renderBrokenItemStack(itemstack);
                        this.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY);
                    }
                }
                flag = false;
            }
            if (flag) {
                this.setFire(8);
            }
        }
    }
    super.onLivingUpdate();
}
Also used : EntityBoat(net.minecraft.entity.item.EntityBoat) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack)

Example 3 with EntityBoat

use of net.minecraft.entity.item.EntityBoat in project DynamicSurroundings by OreCruncher.

the class EntitySwingEffect method update.

@Override
public void update(@Nonnull final Entity subject) {
    final EntityLivingBase entity = (EntityLivingBase) subject;
    // Boats are strange - ignore them for now
    if (entity.getRidingEntity() instanceof EntityBoat)
        return;
    // Is the swing in motion
    if (entity.swingingHand != null && entity.swingProgressInt > this.swingProgress) {
        if (!this.isSwinging) {
            final ItemStack currentItem = entity.getHeldItem(entity.swingingHand);
            final SoundEffect soundEffect = ClientRegistry.ITEMS.getSwingSound(currentItem);
            if (soundEffect != null) {
                final RayTraceResult whatImHitting = RayTrace.trace(entity);
                if (whatImHitting == null || whatImHitting.typeOfHit != Type.BLOCK) {
                    final ITrackedSound snd = getState().createSound(soundEffect, entity);
                    getState().playSound(snd);
                }
            }
        }
        this.isSwinging = true;
        this.swingProgress = entity.swingProgressInt;
    } else {
        this.isSwinging = false;
        this.swingProgress = entity.swingProgressInt;
    }
}
Also used : SoundEffect(org.blockartistry.DynSurround.client.sound.SoundEffect) EntityBoat(net.minecraft.entity.item.EntityBoat) EntityLivingBase(net.minecraft.entity.EntityLivingBase) RayTraceResult(net.minecraft.util.math.RayTraceResult) ITrackedSound(org.blockartistry.lib.sound.ITrackedSound) ItemStack(net.minecraft.item.ItemStack)

Example 4 with EntityBoat

use of net.minecraft.entity.item.EntityBoat in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class EventsCommon method onEntityJoinWorldEvent.

@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onEntityJoinWorldEvent(EntityJoinWorldEvent event) {
    Entity entity = event.getEntity();
    World world = entity.world;
    BlockPos posAt = new BlockPos(entity);
    Optional<PhysicsObject> physicsObject = ValkyrienUtils.getPhysoManagingBlock(world, posAt);
    if (!event.getWorld().isRemote && physicsObject.isPresent() && !(entity instanceof EntityFallingBlock)) {
        if (entity instanceof EntityArmorStand || entity instanceof EntityPig || entity instanceof EntityBoat) {
            EntityMountable entityMountable = new EntityMountable(world, entity.getPositionVector(), CoordinateSpaceType.SUBSPACE_COORDINATES, posAt);
            world.spawnEntity(entityMountable);
            entity.startRiding(entityMountable);
        }
        physicsObject.get().getShipTransformationManager().getCurrentTickTransform().transform(entity, TransformType.SUBSPACE_TO_GLOBAL, false);
    // TODO: This should work but it doesn't because of sponge. Instead we have to rely on MixinChunk.preAddEntity() to fix this
    // event.setCanceled(true);
    // event.getWorld().spawnEntity(entity);
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityPig(net.minecraft.entity.passive.EntityPig) EntityBoat(net.minecraft.entity.item.EntityBoat) EntityMountable(org.valkyrienskies.mod.common.entity.EntityMountable) BlockPos(net.minecraft.util.math.BlockPos) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) World(net.minecraft.world.World) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with EntityBoat

use of net.minecraft.entity.item.EntityBoat in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class VSWorldEventListener method onEntityAdded.

// TODO: Fix conflicts with EventsCommon.onEntityJoinWorldEvent()
@Override
public void onEntityAdded(Entity entity) {
    // This is really only here because Sponge doesn't call the entity join event for some reason :/
    // So I basically just copied the event code here as well.
    World world = worldObj;
    BlockPos posAt = new BlockPos(entity);
    Optional<PhysicsObject> physicsObject = ValkyrienUtils.getPhysoManagingBlock(world, posAt);
    if (!worldObj.isRemote && physicsObject.isPresent() && !(entity instanceof EntityFallingBlock)) {
        if (entity instanceof EntityArmorStand || entity instanceof EntityPig || entity instanceof EntityBoat) {
            EntityMountable entityMountable = new EntityMountable(world, entity.getPositionVector(), CoordinateSpaceType.SUBSPACE_COORDINATES, posAt);
            world.spawnEntity(entityMountable);
            entity.startRiding(entityMountable);
        }
        world.getChunk(entity.getPosition().getX() >> 4, entity.getPosition().getZ() >> 4).removeEntity(entity);
        physicsObject.get().getShipTransformationManager().getCurrentTickTransform().transform(entity, TransformType.SUBSPACE_TO_GLOBAL, false);
        world.getChunk(entity.getPosition().getX() >> 4, entity.getPosition().getZ() >> 4).addEntity(entity);
    }
}
Also used : EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) EntityPig(net.minecraft.entity.passive.EntityPig) EntityBoat(net.minecraft.entity.item.EntityBoat) EntityMountable(org.valkyrienskies.mod.common.entity.EntityMountable) BlockPos(net.minecraft.util.math.BlockPos) EntityArmorStand(net.minecraft.entity.item.EntityArmorStand) World(net.minecraft.world.World)

Aggregations

EntityBoat (net.minecraft.entity.item.EntityBoat)10 BlockPos (net.minecraft.util.math.BlockPos)5 ItemStack (net.minecraft.item.ItemStack)4 EntityArmorStand (net.minecraft.entity.item.EntityArmorStand)3 EntityFallingBlock (net.minecraft.entity.item.EntityFallingBlock)3 EntityPig (net.minecraft.entity.passive.EntityPig)3 World (net.minecraft.world.World)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 EntityMountable (org.valkyrienskies.mod.common.entity.EntityMountable)2 Vector (ValkyrienWarfareBase.API.Vector)1 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)1 EntityMountingWeaponBase (ValkyrienWarfareCombat.Entity.EntityMountingWeaponBase)1 MinestuckKeyHandler (com.mraof.minestuck.client.settings.MinestuckKeyHandler)1 EntityBigPart (com.mraof.minestuck.entity.EntityBigPart)1 EntityDecoy (com.mraof.minestuck.entity.EntityDecoy)1 EntityPawn (com.mraof.minestuck.entity.carapacian.EntityPawn)1 ClientEventHandler (com.mraof.minestuck.event.ClientEventHandler)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 ModelBiped (net.minecraft.client.model.ModelBiped)1 Render (net.minecraft.client.renderer.entity.Render)1