类net.minecraft.world.poi.PointOfInterestType源码实例Demo

下面列出了怎么用net.minecraft.world.poi.PointOfInterestType的API类实例代码及写法,或者点击链接到github查看源代码。

@Inject(method = "register(Ljava/lang/String;Lnet/minecraft/world/poi/PointOfInterestType;Lnet/minecraft/sound/SoundEvent;)Lnet/minecraft/village/VillagerProfession;", cancellable = true, at = @At("HEAD"))
private static void registerCleric(String key, PointOfInterestType pointOfInterestType, SoundEvent soundEvent, CallbackInfoReturnable<VillagerProfession> cir)
{
    if (key.equals("cleric"))
    {
        cir.setReturnValue(register(key, pointOfInterestType, ImmutableSet.of(Items.NETHER_WART), ImmutableSet.of(Blocks.SOUL_SAND), soundEvent));
    }
}
 
源代码2 项目: patchwork-api   文件: MixinPointOfInterestType.java
@Override
public IForgeRegistryEntry<PointOfInterestType> setRegistryName(Identifier name) {
	this.registryName = name;

	return this;
}
 
源代码3 项目: patchwork-api   文件: MixinPointOfInterestType.java
public Identifier getRegistryName() {
	PointOfInterestType pointOfInterestType = (PointOfInterestType) (Object) this;

	return Identifiers.getOrFallback(Registry.POINT_OF_INTEREST_TYPE, pointOfInterestType, registryName);
}
 
源代码4 项目: patchwork-api   文件: MixinPointOfInterestType.java
public Class<PointOfInterestType> getRegistryType() {
	return PointOfInterestType.class;
}
 
源代码5 项目: fabric-carpet   文件: VillagerEntity_aiMixin.java
@Inject(method = "interactMob", at = @At("HEAD"), cancellable = true)
private void onInteract(PlayerEntity playerEntity_1, Hand hand_1, CallbackInfoReturnable<Boolean> cir)
{
    if (MobAI.isTracking(this, MobAI.TrackingType.VILLAGER_BREEDING))
    {
        ItemStack itemStack_1 = playerEntity_1.getStackInHand(hand_1);
        if (itemStack_1.getItem() == Items.EMERALD)
        {
            GlobalPos bedPos = this.brain.getOptionalMemory(MemoryModuleType.HOME).orElse(null);
            if (bedPos == null || bedPos.getDimension() != dimension)
            {
                sayNo();
                ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER, getX(), getY() + getStandingEyeHeight() + 1, getZ(), 1, 0.1, 0.1, 0.1, 0.0);
            }
            else
            {

                ParticleDisplay.drawParticleLine((ServerPlayerEntity) playerEntity_1, getPos(), new Vec3d(bedPos.getPos()).add(0.5, 0.5, 0.5), "dust 0 0 0 1", "happy_villager", 100, 0.2);
            }
        }
        else if (itemStack_1.getItem() == Items.ROTTEN_FLESH)
        {
            while(getAvailableFood() >= 12) eatForBreeding();

        }
        else if (itemStack_1.getItem() instanceof BedItem)
        {
            List<PointOfInterest> list_1 = ((ServerWorld) getEntityWorld()).getPointOfInterestStorage().get(
                    type -> type == PointOfInterestType.HOME,
                    getBlockPos(),
                    48, PointOfInterestStorage.OccupationStatus.ANY).collect(Collectors.toList());
            for (PointOfInterest poi : list_1)
            {
                Vec3d pv = new Vec3d(poi.getPos()).add(0.5, 0.5, 0.5);
                if (!poi.hasSpace())
                {
                    ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.HAPPY_VILLAGER,
                            pv.x, pv.y+1.5, pv.z,
                            50, 0.1, 0.3, 0.1, 0.0);
                }
                else if (canReachHome((VillagerEntity)(Object)this, poi.getPos()))
                    ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.END_ROD,
                            pv.x, pv.y+1, pv.z,
                            50, 0.1, 0.3, 0.1, 0.0);
                else
                    ((ServerWorld) getEntityWorld()).spawnParticles(ParticleTypes.BARRIER,
                            pv.x, pv.y+1, pv.z,
                            1, 0.1, 0.1, 0.1, 0.0);
            }
        }
        cir.setReturnValue(false);
        cir.cancel();
    }
}
 
源代码6 项目: fabric-carpet   文件: VillagerEntity_aiMixin.java
private boolean canReachHome(VillagerEntity villager, BlockPos pos) {
    Path path = villager.getNavigation().findPathTo(pos, PointOfInterestType.HOME.getSearchDistance());
    return path != null && path.reachesTarget();
}
 
@Shadow static VillagerProfession register(String string, PointOfInterestType pointOfInterestType, ImmutableSet<Item> immutableSet, ImmutableSet<Block> immutableSet2, /*@Nullable*/ SoundEvent soundEvent) {return null;} 
 类所在包
 类方法
 同包方法