12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package me.km.utils;
- import net.minecraft.block.Block;
- import net.minecraft.enchantment.Enchantment;
- import net.minecraft.item.Item;
- import net.minecraft.particles.IParticleData;
- import net.minecraft.potion.Effect;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.SoundEvent;
- import net.minecraft.world.GameRules;
- import net.minecraftforge.registries.ForgeRegistries;
- public class Mapper
- {
- public static SoundEvent getSound(String name)
- {
- return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(name));
- }
-
- 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 IParticleData getParticle(String name)
- {
- return (IParticleData) 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 GameRules.RuleKey getGameRule(String name)
- {
- switch(name)
- {
- case "doFireTick": return GameRules.DO_FIRE_TICK;
- case "mobGriefing": return GameRules.MOB_GRIEFING;
- case "keepInventory": return GameRules.KEEP_INVENTORY;
- case "doMobSpawning": return GameRules.DO_MOB_SPAWNING;
- case "doMobLoot": return GameRules.DO_MOB_LOOT;
- case "doTileDrops": return GameRules.DO_TILE_DROPS;
- case "doEntityDrops": return GameRules.DO_ENTITY_DROPS;
- case "commandBlockOutput": return GameRules.COMMAND_BLOCK_OUTPUT;
- case "naturalRegeneration": return GameRules.NATURAL_REGENERATION;
- case "doDaylightCycle": return GameRules.DO_DAYLIGHT_CYCLE;
- case "logAdminCommands": return GameRules.LOG_ADMIN_COMMANDS;
- case "showDeathMessages": return GameRules.SHOW_DEATH_MESSAGES;
- case "randomTickSpeed": return GameRules.RANDOM_TICK_SPEED;
- case "sendCommandFeedback": return GameRules.SEND_COMMAND_FEEDBACK;
- case "reducedDebugInfo": return GameRules.REDUCED_DEBUG_INFO;
- case "spectatorsGenerateChunks": return GameRules.SPECTATORS_GENERATE_CHUNKS;
- case "spawnRadius": return GameRules.SPAWN_RADIUS;
- case "disableElytraMovementCheck": return GameRules.DISABLE_ELYTRA_MOVEMENT_CHECK;
- case "maxEntityCramming": return GameRules.MAX_ENTITY_CRAMMING;
- case "doWeatherCycle": return GameRules.DO_WEATHER_CYCLE;
- case "doLimitedCrafting": return GameRules.DO_LIMITED_CRAFTING;
- case "maxCommandChainLength": return GameRules.MAX_COMMAND_CHAIN_LENGTH;
- case "announceAdvancements": return GameRules.ANNOUNCE_ADVANCEMENTS;
- case "disableRaids": return GameRules.DISABLE_RAIDS;
- }
- return null;
- }
- }
|