net.minecraft.world.poi.PointOfInterestType Java Examples

The following examples show how to use net.minecraft.world.poi.PointOfInterestType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VillagerProfession_wartFarmMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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));
    }
}
 
Example #2
Source File: MixinPointOfInterestType.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IForgeRegistryEntry<PointOfInterestType> setRegistryName(Identifier name) {
	this.registryName = name;

	return this;
}
 
Example #3
Source File: MixinPointOfInterestType.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Identifier getRegistryName() {
	PointOfInterestType pointOfInterestType = (PointOfInterestType) (Object) this;

	return Identifiers.getOrFallback(Registry.POINT_OF_INTEREST_TYPE, pointOfInterestType, registryName);
}
 
Example #4
Source File: MixinPointOfInterestType.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Class<PointOfInterestType> getRegistryType() {
	return PointOfInterestType.class;
}
 
Example #5
Source File: VillagerEntity_aiMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
@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();
    }
}
 
Example #6
Source File: VillagerEntity_aiMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
private boolean canReachHome(VillagerEntity villager, BlockPos pos) {
    Path path = villager.getNavigation().findPathTo(pos, PointOfInterestType.HOME.getSearchDistance());
    return path != null && path.reachesTarget();
}
 
Example #7
Source File: VillagerProfession_wartFarmMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 votes vote down vote up
@Shadow static VillagerProfession register(String string, PointOfInterestType pointOfInterestType, ImmutableSet<Item> immutableSet, ImmutableSet<Block> immutableSet2, /*@Nullable*/ SoundEvent soundEvent) {return null;}