mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-16 18:44:44 +00:00
use forgeregistries instead of iregistry where possible
This commit is contained in:
1 parent
ff975fbded
commit
80170942e5
7 files changed
+19
-14
No files matched your search
@@ -22,6 +22,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.mana.IManaPool;
|
||||
@@ -136,7 +137,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
return false;
|
||||
|
||||
knownMana = mana;
|
||||
SoundEvent evt = IRegistry.SOUND_EVENT.get(DING_SOUND_EVENT);
|
||||
SoundEvent evt = ForgeRegistries.SOUND_EVENTS.getValue(DING_SOUND_EVENT);
|
||||
if(evt != null)
|
||||
player.playSound(evt, 0.1F, 1F);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.IManaNetwork;
|
||||
import vazkii.botania.api.mana.IManaCollector;
|
||||
@@ -226,7 +227,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
sync();
|
||||
|
||||
knownMana = mana;
|
||||
SoundEvent evt = IRegistry.SOUND_EVENT.get(DING_SOUND_EVENT);
|
||||
SoundEvent evt = ForgeRegistries.SOUND_EVENTS.getValue(DING_SOUND_EVENT);
|
||||
if(evt != null)
|
||||
player.playSound(evt, 0.1F, 1F);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.lwjgl.opengl.ARBFragmentShader;
|
||||
import org.lwjgl.opengl.ARBVertexShader;
|
||||
import org.lwjgl.opengl.GL;
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
@@ -365,7 +366,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl
|
||||
cmp.put(TAG_ITEM, itemCmp);
|
||||
|
||||
String enchStr = enchants.stream()
|
||||
.map(e -> IRegistry.ENCHANTMENT.getKey(e.enchantment) + "=" + e.enchantmentLevel)
|
||||
.map(e -> ForgeRegistries.ENCHANTMENTS.getKey(e.enchantment) + "=" + e.enchantmentLevel)
|
||||
.collect(Collectors.joining(","));
|
||||
cmp.putString(TAG_ENCHANTS, enchStr);
|
||||
}
|
||||
@@ -388,7 +389,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl
|
||||
for(String token : enchTokens) {
|
||||
try {
|
||||
String[] entryTokens = token.split("=");
|
||||
Enchantment ench = IRegistry.ENCHANTMENT.get(new ResourceLocation(entryTokens[0]));
|
||||
Enchantment ench = ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(entryTokens[0]));
|
||||
int lvl = Integer.parseInt(entryTokens[1]);
|
||||
enchants.add(new EnchantmentData(ench, lvl));
|
||||
} catch (ResourceLocationException ignored) {}
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.common.brew.ModBrews;
|
||||
@@ -75,9 +76,9 @@ public class ModBrewRecipes {
|
||||
}
|
||||
|
||||
public static void initTC() {
|
||||
Item salisMundus = IRegistry.ITEM.get(new ResourceLocation("thaumcraft", "salis_mundus"));
|
||||
Item bathSalts = IRegistry.ITEM.get(new ResourceLocation("thaumcraft", "bath_salts"));
|
||||
Item amber = IRegistry.ITEM.get(new ResourceLocation("thaumcraft", "amber"));
|
||||
Item salisMundus = ForgeRegistries.ITEMS.getValue(new ResourceLocation("thaumcraft", "salis_mundus"));
|
||||
Item bathSalts = ForgeRegistries.ITEMS.getValue(new ResourceLocation("thaumcraft", "bath_salts"));
|
||||
Item amber = ForgeRegistries.ITEMS.getValue(new ResourceLocation("thaumcraft", "amber"));
|
||||
|
||||
warpWardBrew = BotaniaAPI.registerBrewRecipe(ModBrews.warpWard, Ingredient.fromItems(Items.NETHER_WART), Ingredient.fromItems(salisMundus), Ingredient.fromItems(bathSalts), Ingredient.fromItems(amber));
|
||||
}
|
||||
|
||||
@@ -110,8 +110,7 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
|
||||
} else {
|
||||
if(player == null || player.abilities.isCreativeMode || getBlockCount(stack) > 0) {
|
||||
ItemStack toUse = new ItemStack(bBlock);
|
||||
// todo 1.13 need the protected constructor probably
|
||||
ItemUseContext newCtx = new ItemUseContext(ctx.getPlayer(), stack, pos, side, ctx.getHitX(), ctx.getHitY(), ctx.getHitZ());
|
||||
ItemUseContext newCtx = new ItemUseContext(world, ctx.getPlayer(), stack, pos, side, ctx.getHitX(), ctx.getHitY(), ctx.getHitZ());
|
||||
EnumActionResult result = toUse.getItem().onItemUse(newCtx);
|
||||
|
||||
if (result == EnumActionResult.SUCCESS) {
|
||||
@@ -261,11 +260,11 @@ public class ItemBlackHoleTalisman extends ItemMod implements IBlockProvider {
|
||||
|
||||
@Nullable
|
||||
public static Block getBlock(ItemStack stack) {
|
||||
try {
|
||||
return IRegistry.BLOCK.get(new ResourceLocation(getBlockName(stack)));
|
||||
} catch (ResourceLocationException ex) {
|
||||
return null;
|
||||
ResourceLocation id = ResourceLocation.tryCreate(getBlockName(stack));
|
||||
if(id != null) {
|
||||
return ForgeRegistries.BLOCKS.getValue(id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getBlockCount(ItemStack stack) {
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileCacophonium;
|
||||
@@ -166,7 +167,7 @@ public class ItemCacophonium extends ItemMod {
|
||||
return ModSounds.doit;
|
||||
else {
|
||||
try {
|
||||
return IRegistry.SOUND_EVENT.get(new ResourceLocation(ItemNBTHelper.getString(stack, TAG_SOUND, "")));
|
||||
return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ItemNBTHelper.getString(stack, TAG_SOUND, "")));
|
||||
} catch (ResourceLocationException ex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user