diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemBreakPrevention.java b/src/main/java/de/ellpeck/naturesaura/items/ItemBreakPrevention.java index b7b3ece9..5de5dd4d 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemBreakPrevention.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemBreakPrevention.java @@ -12,6 +12,8 @@ import net.minecraft.util.text.Style; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.AnvilUpdateEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; @@ -57,6 +59,7 @@ public class ItemBreakPrevention extends ItemImpl { } @SubscribeEvent + @OnlyIn(Dist.CLIENT) public void onTooltip(ItemTooltipEvent event) { ItemStack stack = event.getItemStack(); if (!stack.hasTag() || !stack.getTag().getBoolean(NaturesAura.MOD_ID + ":break_prevention")) diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java index 2275f358..a26855ae 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java @@ -32,6 +32,8 @@ import net.minecraft.block.FlowerPotBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.SpriteRenderer; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityClassification; @@ -54,6 +56,7 @@ import net.minecraft.world.gen.placement.Placement; import net.minecraftforge.common.extensions.IForgeContainerType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.registries.ForgeRegistries; @@ -263,6 +266,7 @@ public final class ModRegistry { Helper.populateObjectHolders(ModEnchantments.class, event.getRegistry()); } + @SuppressWarnings("Convert2Lambda") @SubscribeEvent public static void registerEntities(RegistryEvent.Register> event) { event.getRegistry().registerAll( @@ -288,7 +292,13 @@ public final class ModRegistry { NaturesAura.proxy.registerEntityRenderer(ModEntities.MOVER_CART, () -> RenderMoverMinecart::new); NaturesAura.proxy.registerEntityRenderer(ModEntities.EFFECT_INHIBITOR, () -> RenderEffectInhibitor::new); NaturesAura.proxy.registerEntityRenderer(ModEntities.LIGHT_PROJECTILE, () -> RenderStub::new); - NaturesAura.proxy.registerEntityRenderer(ModEntities.STRUCTURE_FINDER, () -> m -> new SpriteRenderer<>(m, Minecraft.getInstance().getItemRenderer())); + // for some reason, only this one causes classloading issues if shortened to a lambda, what + NaturesAura.proxy.registerEntityRenderer(ModEntities.STRUCTURE_FINDER, () -> new IRenderFactory() { + @Override + public EntityRenderer createRenderFor(EntityRendererManager m) { + return new SpriteRenderer<>(m, Minecraft.getInstance().getItemRenderer()); + } + }); } @SubscribeEvent