Search in sources :

Example 16 with EntityType

use of net.minecraft.entity.EntityType in project trofers by ochotonida.

the class TrophyBuilder method getLootTables.

protected Map<EntityType<?>, ResourceLocation> getLootTables() {
    Map<EntityType<?>, ResourceLocation> result = new HashMap<>();
    getPotionEffects().forEach((type, compoundTag) -> {
        if (compoundTag.isEmpty()) {
            String modid = Trofers.MODID.equals(getModId()) ? "" : getModId() + "/";
            // noinspection ConstantConditions
            result.put(type, new ResourceLocation(Trofers.MODID, String.format("trophies/%s", modid + type.getRegistryName().getPath())));
        }
    });
    return result;
}
Also used : EntityType(net.minecraft.entity.EntityType) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 17 with EntityType

use of net.minecraft.entity.EntityType in project trofers by ochotonida.

the class VanillaTrophies method getEntityData.

@Override
public Map<EntityType<?>, CompoundNBT> getEntityData() {
    Map<EntityType<?>, CompoundNBT> result = super.getEntityData();
    result.get(EntityType.CAT).putInt("CatType", 0);
    result.get(EntityType.CAT).putBoolean("Sitting", true);
    result.get(EntityType.COW).putUUID("UUID", Util.NIL_UUID);
    result.get(EntityType.ENDERMAN).put("carriedBlockState", new CompoundNBT());
    result.get(EntityType.ENDERMAN).getCompound("carriedBlockState").putString("Name", "minecraft:tnt");
    result.get(EntityType.FOX).putString("Type", "red");
    result.get(EntityType.FOX).putBoolean("Sleeping", true);
    result.get(EntityType.HOGLIN).putBoolean("IsImmuneToZombification", true);
    result.get(EntityType.HORSE).putInt("Variant", 1 | 1 << 8);
    result.get(EntityType.IRON_GOLEM).putUUID("UUID", Util.NIL_UUID);
    result.get(EntityType.LLAMA).putInt("Variant", 3);
    result.get(EntityType.MAGMA_CUBE).putInt("Size", 1);
    result.get(EntityType.PANDA).putString("MainGene", "playful");
    result.get(EntityType.PARROT).putInt("Variant", 0);
    result.get(EntityType.PIGLIN).putBoolean("IsImmuneToZombification", true);
    result.get(EntityType.PUFFERFISH).putInt("PuffState", 2);
    result.get(EntityType.RABBIT).putInt("RabbitType", 0);
    result.get(EntityType.SHULKER).putByte("Color", (byte) 16);
    result.get(EntityType.SLIME).putInt("Size", 1);
    result.get(EntityType.TRADER_LLAMA).putInt("Variant", 2);
    result.get(EntityType.TROPICAL_FISH).putInt("Variant", 1 | 1 << 8 | 14 << 16 | 14 << 24);
    result.get(EntityType.VILLAGER).put("VillagerData", new CompoundNBT());
    result.get(EntityType.VILLAGER).getCompound("VillagerData").putInt("level", 1);
    result.get(EntityType.VILLAGER).getCompound("VillagerData").putString("profession", "minecraft:weaponsmith");
    result.get(EntityType.VILLAGER).getCompound("VillagerData").putString("type", "minecraft:plains");
    result.get(EntityType.WOLF).putBoolean("Sitting", true);
    result.get(EntityType.WOLF).putUUID("Owner", Util.NIL_UUID);
    result.get(EntityType.ZOMBIE_VILLAGER).put("VillagerData", new CompoundNBT());
    result.get(EntityType.ZOMBIE_VILLAGER).getCompound("VillagerData").putInt("level", 1);
    result.get(EntityType.ZOMBIE_VILLAGER).getCompound("VillagerData").putString("profession", "minecraft:weaponsmith");
    result.get(EntityType.ZOMBIE_VILLAGER).getCompound("VillagerData").putString("type", "minecraft:plains");
    putHandItem(result.get(EntityType.PIGLIN_BRUTE), Items.GOLDEN_AXE);
    putHandItem(result.get(EntityType.PILLAGER), Items.CROSSBOW);
    putHandItem(result.get(EntityType.SKELETON), Items.BOW);
    putHandItem(result.get(EntityType.STRAY), Items.BOW);
    putHandItem(result.get(EntityType.WITHER_SKELETON), Items.STONE_SWORD);
    putHandItem(result.get(EntityType.ZOMBIFIED_PIGLIN), Items.GOLDEN_SWORD);
    return result;
}
Also used : EntityType(net.minecraft.entity.EntityType) CompoundNBT(net.minecraft.nbt.CompoundNBT)

Example 18 with EntityType

use of net.minecraft.entity.EntityType in project trofers by ochotonida.

the class VanillaTrophies method getLootTables.

@Override
public Map<EntityType<?>, ResourceLocation> getLootTables() {
    Map<EntityType<?>, ResourceLocation> result = super.getLootTables();
    result.put(EntityType.CAT, new ResourceLocation("gameplay/cat_morning_gift"));
    result.put(EntityType.PIGLIN, new ResourceLocation("gameplay/piglin_bartering"));
    return result;
}
Also used : EntityType(net.minecraft.entity.EntityType) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 19 with EntityType

use of net.minecraft.entity.EntityType in project BudschieMorphMod by Budschie.

the class FilteredSimpleMorphGui method showGui.

@Override
public void showGui() {
    @SuppressWarnings("resource") LazyOptional<IMorphCapability> cap = Minecraft.getInstance().player.getCapability(MorphCapabilityAttacher.MORPH_CAP);
    if (cap.isPresent()) {
        IMorphCapability resolved = cap.resolve().get();
        // Create a list of indices of morphs
        List<Integer> morphList = new ArrayList<>();
        // This is dumb
        for (int i = 0; i < resolved.getMorphList().getMorphArrayList().size(); i++) {
            if (filter.test(resolved, i))
                morphList.add(i);
        }
        morphWidgets.add(new MorphWidget(null, false, -1));
        HashMap<EntityType<?>, Pair<MorphWidget, Integer>> currentWidgetHeads = new HashMap<>();
        for (int i = 0; i < morphList.size(); i++) {
            int indexOfMorph = morphList.get(i);
            MorphItem item = resolved.getMorphList().getMorphArrayList().get(indexOfMorph);
            MorphWidget widget = new MorphWidget(item, resolved.getFavouriteList().containsMorphItem(item), indexOfMorph);
            Pair<MorphWidget, Integer> currentWidgetHead = currentWidgetHeads.get(widget.morphItem.getEntityType());
            // Check if there is a head.
            if (currentWidgetHead != null) {
                // There is a head, add to head
                MorphWidget head = currentWidgetHead.getA();
                head.child = widget;
            } else {
                // No head, add to widget list
                morphWidgets.add(widget);
            }
            // Set as new entity head
            currentWidgetHeads.put(widget.morphItem.getEntityType(), new Pair<>(widget, currentWidgetHead == null ? 0 : currentWidgetHead.getB() + 1));
        }
        for (int i = 1; i < morphWidgets.size(); i++) {
            MorphWidget widget = morphWidgets.get(i);
            Pair<MorphWidget, Integer> currentWidgetHead = currentWidgetHeads.get(widget.morphItem.getEntityType());
            widget.depth = currentWidgetHead.getB();
        }
    }
}
Also used : IMorphCapability(de.budschie.bmorph.capabilities.IMorphCapability) MorphItem(de.budschie.bmorph.morph.MorphItem) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) EntityType(net.minecraft.entity.EntityType) Pair(de.budschie.bmorph.util.Pair)

Example 20 with EntityType

use of net.minecraft.entity.EntityType in project minecolonies by ldtteam.

the class AbstractShipRaidEvent method onUpdate.

@Override
public void onUpdate() {
    status = EventStatus.PROGRESSING;
    colony.getRaiderManager().setNightsSinceLastRaid(0);
    if (spawners.size() <= 0 && raiders.size() == 0 && respawns.isEmpty()) {
        status = EventStatus.WAITING;
        return;
    }
    updateRaidBar();
    if (!respawns.isEmpty()) {
        for (final Tuple<EntityType<?>, BlockPos> entry : respawns) {
            final BlockPos spawnPos = ShipBasedRaiderUtils.getLoadedPositionTowardsCenter(entry.getB(), colony, MAX_LANDING_DISTANCE, spawnPoint, MIN_CENTER_DISTANCE, 10);
            if (spawnPos != null) {
                RaiderMobUtils.spawn(entry.getA(), 1, spawnPos, colony.getWorld(), colony, id);
            }
        }
        respawns.clear();
        return;
    }
    spawners.removeIf(spawner -> colony.getWorld() != null && WorldUtil.isBlockLoaded(colony.getWorld(), spawner) && colony.getWorld().getBlockState(spawner).getBlock() != Blocks.SPAWNER);
    // Spawns landing troops.
    if (raiders.size() < spawners.size() * 2) {
        BlockPos spawnPos = ShipBasedRaiderUtils.getLoadedPositionTowardsCenter(spawnPoint, colony, MAX_LANDING_DISTANCE, spawnPoint, MIN_CENTER_DISTANCE, 10);
        if (spawnPos != null) {
            // Find nice position on the ship
            if (spawnPos.distSqr(spawnPoint) < 25) {
                spawnPos = ShipBasedRaiderUtils.findSpawnPosOnShip(spawnPos, colony.getWorld(), 3);
            }
            RaiderMobUtils.spawn(getNormalRaiderType(), shipSize.normal, spawnPos, colony.getWorld(), colony, id);
            RaiderMobUtils.spawn(getArcherRaiderType(), shipSize.archer, spawnPos, colony.getWorld(), colony, id);
            RaiderMobUtils.spawn(getBossRaiderType(), shipSize.boss, spawnPos, colony.getWorld(), colony, id);
        }
    }
    // Mark entities when spies exist
    if (colony.getRaiderManager().areSpiesEnabled()) {
        for (final Entity entity : getEntities()) {
            if (entity instanceof LivingEntity) {
                ((LivingEntity) entity).addEffect(new EffectInstance(Effects.GLOWING, 550));
            }
        }
    }
}
Also used : EntityType(net.minecraft.entity.EntityType) LivingEntity(net.minecraft.entity.LivingEntity) MobSpawnerTileEntity(net.minecraft.tileentity.MobSpawnerTileEntity) Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) LivingEntity(net.minecraft.entity.LivingEntity) TileEntity(net.minecraft.tileentity.TileEntity) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) BlockPos(net.minecraft.util.math.BlockPos) EffectInstance(net.minecraft.potion.EffectInstance)

Aggregations

EntityType (net.minecraft.entity.EntityType)48 Entity (net.minecraft.entity.Entity)16 ResourceLocation (net.minecraft.util.ResourceLocation)13 LivingEntity (net.minecraft.entity.LivingEntity)11 CompoundNBT (net.minecraft.nbt.CompoundNBT)11 BlockPos (net.minecraft.util.math.BlockPos)11 PlayerEntity (net.minecraft.entity.player.PlayerEntity)9 ItemStack (net.minecraft.item.ItemStack)9 HashMap (java.util.HashMap)6 World (net.minecraft.world.World)5 ArrayList (java.util.ArrayList)4 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)4 EffectInstance (net.minecraft.potion.EffectInstance)4 List (java.util.List)3 Nonnull (javax.annotation.Nonnull)3 MobEntity (net.minecraft.entity.MobEntity)3 TileEntity (net.minecraft.tileentity.TileEntity)3 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)3 IPlacementHandler (com.ldtteam.structurize.placement.handlers.placement.IPlacementHandler)2 Random (java.util.Random)2