Search in sources :

Example 1 with BlockMap

use of org.blockartistry.DynSurround.client.footsteps.implem.BlockMap in project DynamicSurroundings by OreCruncher.

the class FootstepsRegistry method init.

@Override
public void init() {
    this.acousticsManager = new AcousticsManager();
    this.primitiveMap = new PrimitiveMap(this.acousticsManager);
    this.blockMap = new BlockMap(this.acousticsManager);
    this.FOOTPRINT_MATERIAL = new IdentityHashSet<>();
    this.FOOTPRINT_STATES = new IdentityHashSet<>();
    this.ARMOR_SOUND = new EnumMap<>(ArmorClass.class);
    this.ARMOR_SOUND_FOOT = new EnumMap<>(ArmorClass.class);
    this.variators = new HashMap<>();
    // Initialize the known materials that leave footprints
    this.FOOTPRINT_MATERIAL.add(Material.CLAY);
    this.FOOTPRINT_MATERIAL.add(Material.GRASS);
    this.FOOTPRINT_MATERIAL.add(Material.GROUND);
    this.FOOTPRINT_MATERIAL.add(Material.ICE);
    this.FOOTPRINT_MATERIAL.add(Material.PACKED_ICE);
    this.FOOTPRINT_MATERIAL.add(Material.SAND);
    this.FOOTPRINT_MATERIAL.add(Material.CRAFTED_SNOW);
    this.FOOTPRINT_MATERIAL.add(Material.SNOW);
    // It's a hack - needs refactor
    AcousticsManager.SWIM = null;
    AcousticsManager.JUMP = null;
    AcousticsManager.SPLASH = null;
    final List<Pack> repo = ResourcePacks.findResourcePacks();
    reloadAcoustics(repo);
    reloadPrimitiveMap(repo);
    seedMap();
}
Also used : AcousticsManager(org.blockartistry.DynSurround.client.footsteps.implem.AcousticsManager) BlockMap(org.blockartistry.DynSurround.client.footsteps.implem.BlockMap) PrimitiveMap(org.blockartistry.DynSurround.client.footsteps.implem.PrimitiveMap) Pack(org.blockartistry.DynSurround.packs.ResourcePacks.Pack)

Example 2 with BlockMap

use of org.blockartistry.DynSurround.client.footsteps.implem.BlockMap in project DynamicSurroundings by OreCruncher.

the class InspectionHUD method gatherBlockText.

private List<String> gatherBlockText(final ItemStack stack, final List<String> text, final IBlockState state, final BlockPos pos) {
    if (ItemStackUtil.isValidItemStack(stack)) {
        text.add(TextFormatting.RED + stack.getDisplayName());
        final String itemName = getItemName(stack);
        if (itemName != null) {
            text.add("ITEM: " + itemName);
            text.add(TextFormatting.DARK_AQUA + stack.getItem().getClass().getName());
        }
    }
    if (state != null) {
        this.block.set(state);
        text.add("BLOCK: " + this.block.toString());
        text.add(TextFormatting.DARK_AQUA + this.block.getBlock().getClass().getName());
        text.add("Material: " + MCHelper.getMaterialName(state.getMaterial()));
        final SoundType st = state.getBlock().getSoundType(state, EnvironState.getWorld(), pos, EnvironState.getPlayer());
        if (st != null) {
            text.add("Step Sound: " + st.getStepSound().getSoundName().toString());
        }
        if (ClientRegistry.FOOTSTEPS.hasFootprint(state))
            text.add("Footprints Generated");
        final BlockMap bm = ClientRegistry.FOOTSTEPS.getBlockMap();
        if (bm != null) {
            final List<String> data = new ArrayList<>();
            bm.collectData(EnvironState.getWorld(), state, pos, data);
            if (data.size() > 0) {
                text.add(TEXT_FOOTSTEP_ACOUSTICS);
                for (final String s : data) text.add(TextFormatting.GOLD + s);
            }
        }
        BlockEffect[] effects = ClientRegistry.BLOCK.getEffects(state);
        if (effects.length > 0) {
            text.add(TEXT_BLOCK_EFFECTS);
            for (final BlockEffect e : effects) {
                text.add(TextFormatting.GOLD + e.getEffectType().getName());
            }
        }
        effects = ClientRegistry.BLOCK.getAlwaysOnEffects(state);
        if (effects.length > 0) {
            text.add(TEXT_ALWAYS_ON_EFFECTS);
            for (final BlockEffect e : effects) {
                text.add(TextFormatting.GOLD + e.getEffectType().getName());
            }
        }
        SoundEffect[] sounds = ClientRegistry.BLOCK.getAllStepSounds(state);
        if (sounds.length > 0) {
            text.add(TEXT_STEP_SOUNDS);
            text.add(TextFormatting.DARK_GREEN + "Chance: 1 in " + ClientRegistry.BLOCK.getStepSoundChance(state));
            for (final SoundEffect s : sounds) text.add(TextFormatting.GOLD + s.toString());
        }
        sounds = ClientRegistry.BLOCK.getAllSounds(state);
        if (sounds.length > 0) {
            text.add(TEXT_BLOCK_SOUNDS);
            text.add(TextFormatting.DARK_GREEN + "Chance: 1 in " + ClientRegistry.BLOCK.getSoundChance(state));
            for (final SoundEffect s : sounds) text.add(TextFormatting.GOLD + s.toString());
        }
    }
    final List<String> oreNames = gatherOreNames(stack);
    if (oreNames.size() > 0) {
        text.add(TEXT_DICTIONARY_NAMES);
        for (final String ore : oreNames) text.add(TextFormatting.GOLD + ore);
    }
    return text;
}
Also used : SoundType(net.minecraft.block.SoundType) SoundEffect(org.blockartistry.DynSurround.client.sound.SoundEffect) BlockMap(org.blockartistry.DynSurround.client.footsteps.implem.BlockMap) BlockEffect(org.blockartistry.DynSurround.client.fx.BlockEffect) ArrayList(java.util.ArrayList)

Aggregations

BlockMap (org.blockartistry.DynSurround.client.footsteps.implem.BlockMap)2 ArrayList (java.util.ArrayList)1 SoundType (net.minecraft.block.SoundType)1 AcousticsManager (org.blockartistry.DynSurround.client.footsteps.implem.AcousticsManager)1 PrimitiveMap (org.blockartistry.DynSurround.client.footsteps.implem.PrimitiveMap)1 BlockEffect (org.blockartistry.DynSurround.client.fx.BlockEffect)1 SoundEffect (org.blockartistry.DynSurround.client.sound.SoundEffect)1 Pack (org.blockartistry.DynSurround.packs.ResourcePacks.Pack)1