123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- package me.km.utils;
- import net.minecraft.block.Block;
- import net.minecraft.enchantment.Enchantment;
- import net.minecraft.item.Item;
- import net.minecraft.particles.ParticleType;
- import net.minecraft.potion.Effect;
- import net.minecraft.state.Property;
- import net.minecraft.state.properties.BlockStateProperties;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.SoundCategory;
- import net.minecraft.util.SoundEvent;
- import net.minecraftforge.registries.ForgeRegistries;
- public class Mapper {
- public static SoundEvent getSound(String name) {
- return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(name));
- }
- public static SoundCategory getSoundCategory(String name) {
- for(SoundCategory sc : SoundCategory.values()) {
- if(sc.getName().equals(name)) {
- return sc;
- }
- }
- return SoundCategory.MASTER;
- }
- public static Enchantment getEnchantment(String name) {
- return ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(name));
- }
- public static Effect getPotion(String name) {
- return ForgeRegistries.POTIONS.getValue(new ResourceLocation(name));
- }
- public static ParticleType<?> getParticle(String name) {
- return ForgeRegistries.PARTICLE_TYPES.getValue(new ResourceLocation(name));
- }
- public static Item getItem(String name) {
- return ForgeRegistries.ITEMS.getValue(new ResourceLocation(name));
- }
- public static Block getBlock(String name) {
- return ForgeRegistries.BLOCKS.getValue(new ResourceLocation(name));
- }
- public static Property<?> getProperty(String name) {
- switch(name) {
- case "attached":
- return BlockStateProperties.ATTACHED;
- case "bottom":
- return BlockStateProperties.BOTTOM;
- case "conditional":
- return BlockStateProperties.CONDITIONAL;
- case "disarmed":
- return BlockStateProperties.DISARMED;
- case "drag":
- return BlockStateProperties.DRAG;
- case "enabled":
- return BlockStateProperties.ENABLED;
- case "extended":
- return BlockStateProperties.EXTENDED;
- case "eye":
- return BlockStateProperties.EYE;
- case "falling":
- return BlockStateProperties.FALLING;
- case "hanging":
- return BlockStateProperties.HANGING;
- case "has_bottle_0":
- return BlockStateProperties.HAS_BOTTLE_0;
- case "has_bottle_1":
- return BlockStateProperties.HAS_BOTTLE_1;
- case "has_bottle_2":
- return BlockStateProperties.HAS_BOTTLE_2;
- case "has_record":
- return BlockStateProperties.HAS_RECORD;
- case "has_book":
- return BlockStateProperties.HAS_BOOK;
- case "inverted":
- return BlockStateProperties.INVERTED;
- case "in_wall":
- return BlockStateProperties.IN_WALL;
- case "lit":
- return BlockStateProperties.LIT;
- case "locked":
- return BlockStateProperties.LOCKED;
- case "occupied":
- return BlockStateProperties.OCCUPIED;
- case "open":
- return BlockStateProperties.OPEN;
- case "persistent":
- return BlockStateProperties.PERSISTENT;
- case "powered":
- return BlockStateProperties.POWERED;
- case "short":
- return BlockStateProperties.SHORT;
- case "signal_fire":
- return BlockStateProperties.SIGNAL_FIRE;
- case "snowy":
- return BlockStateProperties.SNOWY;
- case "triggered":
- return BlockStateProperties.TRIGGERED;
- case "unstable":
- return BlockStateProperties.UNSTABLE;
- case "waterlogged":
- return BlockStateProperties.WATERLOGGED;
- case "horizontal_axis":
- return BlockStateProperties.HORIZONTAL_AXIS;
- case "axis":
- return BlockStateProperties.AXIS;
- case "up":
- return BlockStateProperties.UP;
- case "down":
- return BlockStateProperties.DOWN;
- case "north":
- return BlockStateProperties.NORTH;
- case "east":
- return BlockStateProperties.EAST;
- case "south":
- return BlockStateProperties.SOUTH;
- case "west":
- return BlockStateProperties.WEST;
- case "facing":
- return BlockStateProperties.FACING;
- case "facing_hopper":
- return BlockStateProperties.FACING_HOPPER;
- case "horizontal_facing":
- return BlockStateProperties.HORIZONTAL_FACING;
- case "attach_face":
- return BlockStateProperties.ATTACH_FACE;
- case "attachment":
- return BlockStateProperties.BELL_ATTACHMENT;
- case "redstone_east":
- return BlockStateProperties.EAST_REDSTONE;
- case "redstone_north":
- return BlockStateProperties.NORTH_REDSTONE;
- case "redstone_south":
- return BlockStateProperties.SOUTH_REDSTONE;
- case "redstone_west":
- return BlockStateProperties.WEST_REDSTONE;
- case "double_block_half":
- return BlockStateProperties.DOUBLE_BLOCK_HALF;
- case "half":
- return BlockStateProperties.HALF;
- case "rail_shape":
- return BlockStateProperties.RAIL_SHAPE;
- case "rail_shape_straight":
- return BlockStateProperties.RAIL_SHAPE_STRAIGHT;
- case "age_1":
- return BlockStateProperties.AGE_1;
- case "age_2":
- return BlockStateProperties.AGE_2;
- case "age_3":
- return BlockStateProperties.AGE_3;
- case "age_5":
- return BlockStateProperties.AGE_5;
- case "age_7":
- return BlockStateProperties.AGE_7;
- case "age_15":
- return BlockStateProperties.AGE_15;
- case "age_25":
- return BlockStateProperties.AGE_25;
- case "bites":
- return BlockStateProperties.BITES;
- case "delay":
- return BlockStateProperties.DELAY;
- case "distance":
- return BlockStateProperties.DISTANCE;
- case "eggs":
- return BlockStateProperties.EGGS;
- case "hatch":
- return BlockStateProperties.HATCH;
- case "layers":
- return BlockStateProperties.LAYERS;
- case "level":
- return BlockStateProperties.LEVEL;
- case "level_cauldron":
- return BlockStateProperties.LEVEL_CAULDRON;
- case "level_composter":
- return BlockStateProperties.LEVEL_COMPOSTER;
- case "level_flowing":
- return BlockStateProperties.LEVEL_FLOWING;
- case "level_honey":
- return BlockStateProperties.LEVEL_HONEY;
- case "moisture":
- return BlockStateProperties.MOISTURE;
- case "note":
- return BlockStateProperties.NOTE;
- case "pickles":
- return BlockStateProperties.PICKLES;
- case "power":
- return BlockStateProperties.POWER;
- case "stage":
- return BlockStateProperties.STAGE;
- case "stability_distance":
- return BlockStateProperties.STABILITY_DISTANCE;
- case "rotation_16":
- return BlockStateProperties.ROTATION_16;
- case "part":
- return BlockStateProperties.BED_PART;
- case "chest_type":
- return BlockStateProperties.CHEST_TYPE;
- case "mode":
- return BlockStateProperties.MODE_COMPARATOR;
- case "hinge":
- return BlockStateProperties.DOOR_HINGE;
- case "instrument":
- return BlockStateProperties.NOTEBLOCK_INSTRUMENT;
- case "piston_type":
- return BlockStateProperties.PISTON_TYPE;
- case "slab_type":
- return BlockStateProperties.SLAB_TYPE;
- case "stair_shape":
- return BlockStateProperties.STAIRS_SHAPE;
- case "structure_block_mode":
- return BlockStateProperties.STRUCTUREBLOCK_MODE;
- case "leaves":
- return BlockStateProperties.BAMBOO_LEAVES;
- }
- return null;
- }
- }
|