Fix crashes

This commit is contained in:
Vincent Lee committed 2020-01-15 21:33:09 -06:00
1 parent 76bdd37efe
commit fa325cefdf
6 files changed
+111 -71

No files matched your search

@@ -31,6 +31,7 @@ import vazkii.botania.client.render.entity.RenderBabylonWeapon;
import vazkii.botania.client.render.entity.RenderCorporeaSpark;
import vazkii.botania.client.render.entity.RenderDoppleganger;
import vazkii.botania.client.render.entity.RenderManaStorm;
import vazkii.botania.client.render.entity.RenderNoop;
import vazkii.botania.client.render.entity.RenderPinkWither;
import vazkii.botania.client.render.entity.RenderPixie;
import vazkii.botania.client.render.entity.RenderPoolMinecart;
@@ -74,6 +75,7 @@ import vazkii.botania.common.entity.EntityBabylonWeapon;
import vazkii.botania.common.entity.EntityCorporeaSpark;
import vazkii.botania.common.entity.EntityDoppleganger;
import vazkii.botania.common.entity.EntityEnderAirBottle;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.entity.EntityManaStorm;
import vazkii.botania.common.entity.EntityPinkWither;
import vazkii.botania.common.entity.EntityPixie;
@@ -106,7 +108,7 @@ public final class ModelHandler {
ClientRegistry.bindTileEntityRenderer(TileAlfPortal.TYPE, RenderTileAlfPortal::new);
ClientRegistry.bindTileEntityRenderer(TileFloatingFlower.TYPE, RenderTileFloatingFlower::new);
// TODO 1.14 this seems highly questionable.
ModSubtiles.TYPES.stream()
ModSubtiles.getTypes().stream()
.map(Pair::getSecond)
.map(rl -> Registry.BLOCK_ENTITY_TYPE.getValue(rl).get())
.forEach(typ -> ClientRegistry.bindTileEntityRenderer(typ, RenderTileFloatingFlower::new));
@@ -135,6 +137,8 @@ public final class ModelHandler {
ClientRegistry.bindTileEntityRenderer(TileAvatar.TYPE, RenderTileAvatar::new);
ClientRegistry.bindTileEntityRenderer(TileAnimatedTorch.TYPE, RenderTileAnimatedTorch::new);
RenderingRegistry.registerEntityRenderingHandler(EntityManaBurst.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(TileLightRelay.EntityPlayerMover.TYPE, RenderNoop::new);
RenderingRegistry.registerEntityRenderingHandler(EntityPixie.TYPE, RenderPixie::new);
RenderingRegistry.registerEntityRenderingHandler(EntityDoppleganger.TYPE, RenderDoppleganger::new);
RenderingRegistry.registerEntityRenderingHandler(EntitySpark.TYPE, RenderSpark::new);
@@ -0,0 +1,27 @@
package vazkii.botania.client.render.entity;
import net.minecraft.client.renderer.culling.ClippingHelperImpl;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
public class RenderNoop<T extends Entity> extends EntityRenderer<T> {
public RenderNoop(EntityRendererManager manager) {
super(manager);
}
@Override
public boolean shouldRender(T entity, @Nonnull ClippingHelperImpl clipping, double x, double y, double z) {
return false;
}
@Nonnull
@Override
public ResourceLocation getEntityTexture(@Nonnull T entity) {
return AtlasTexture.LOCATION_BLOCKS_TEXTURE;
}
}
@@ -20,6 +20,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.EndPortalTileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -37,7 +38,7 @@ import java.util.Random;
// [VanillaCopy] end portal TESR, relevant edits are commented
public class RenderTileStarfield extends TileEntityRenderer<TileStarfield> {
private static final Random RANDOM = new Random(31100L);
private static List<RenderType> field_228881_e_ = ObfuscationReflectionHelper.getPrivateValue(TileStarfield.class, null, "field_228881_e_");
private static List<RenderType> field_228881_e_ = ObfuscationReflectionHelper.getPrivateValue(EndPortalTileEntityRenderer.class, null, "field_228881_e_");
public RenderTileStarfield(TileEntityRendererDispatcher manager) {
super(manager);
@@ -2,27 +2,33 @@ package vazkii.botania.client.render.tile;
import com.google.common.base.Preconditions;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.LazyValue;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.Registry;
public class TEISR extends ItemStackTileEntityRenderer {
private final IItemProvider item;
private final TileEntity dummy;
private final Block block;
private final LazyValue<TileEntity> dummy;
public TEISR(IItemProvider item, TileEntityType<?> type) {
this.item = Preconditions.checkNotNull(item);
this.dummy = type.create();
public TEISR(Block block) {
this.block = Preconditions.checkNotNull(block);
this.dummy = new LazyValue<>(() -> {
TileEntityType<?> type = Registry.BLOCK_ENTITY_TYPE.getValue(block.getRegistryName()).get();
return type.create();
});
}
@Override
public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffers, int light, int overlay) {
if(stack.getItem() == item.asItem()) {
TileEntityRendererDispatcher.instance.getRenderer(dummy)
if(stack.getItem() == block.asItem()) {
TileEntityRendererDispatcher.instance.getRenderer(dummy.getValue())
.render(null, 0, ms, buffers, light, overlay);
}
}
@@ -833,13 +833,13 @@ public final class ModBlocks {
register(r, new ItemBlockMod(naturaPylon, pylonProps), naturaPylon.getRegistryName());
register(r, new ItemBlockMod(gaiaPylon, pylonProps), gaiaPylon.getRegistryName());
register(r, new ItemBlockMod(teruTeruBozu, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(ModBlocks.teruTeruBozu, TileTeruTeruBozu.TYPE))), teruTeruBozu.getRegistryName());
register(r, new ItemBlockMod(avatar, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(ModBlocks.avatar, TileAvatar.TYPE))), avatar.getRegistryName());
register(r, new ItemBlockMod(bellows, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(ModBlocks.bellows, TileBellows.TYPE))), bellows.getRegistryName());
register(r, new ItemBlockMod(brewery, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(ModBlocks.brewery, TileBrewery.TYPE))), brewery.getRegistryName());
register(r, new ItemBlockMod(corporeaIndex, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(ModBlocks.corporeaIndex, TileCorporeaIndex.TYPE))), corporeaIndex.getRegistryName());
register(r, new ItemBlockMod(hourglass, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(ModBlocks.hourglass, TileHourglass.TYPE))), hourglass.getRegistryName());
Item head = new ItemGaiaHead(gaiaHead, gaiaHeadWall, ModItems.defaultBuilder().rarity(Rarity.UNCOMMON).setTEISR(() -> () -> new TEISR(ModBlocks.gaiaHead, TileGaiaHead.TYPE)));
register(r, new ItemBlockMod(teruTeruBozu, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(teruTeruBozu))), teruTeruBozu.getRegistryName());
register(r, new ItemBlockMod(avatar, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(avatar))), avatar.getRegistryName());
register(r, new ItemBlockMod(bellows, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(bellows))), bellows.getRegistryName());
register(r, new ItemBlockMod(brewery, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(brewery))), brewery.getRegistryName());
register(r, new ItemBlockMod(corporeaIndex, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(corporeaIndex))), corporeaIndex.getRegistryName());
register(r, new ItemBlockMod(hourglass, ModItems.defaultBuilder().setTEISR(() -> () -> new TEISR(hourglass))), hourglass.getRegistryName());
Item head = new ItemGaiaHead(gaiaHead, gaiaHeadWall, ModItems.defaultBuilder().rarity(Rarity.UNCOMMON).setTEISR(() -> () -> new TEISR(gaiaHead)));
register(r, head, gaiaHead.getRegistryName());
return null;
}
@@ -153,57 +153,59 @@ public class ModSubtiles {
return new ResourceLocation(orig.getNamespace(), orig.getPath() + "_chibi");
}
public static final List<Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation>> TYPES = ImmutableList.<Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation>>of(
Pair.of(SubTilePureDaisy::new, LibBlockNames.SUBTILE_PUREDAISY),
Pair.of(SubTileManastar::new, LibBlockNames.SUBTILE_MANASTAR),
Pair.of(SubTileEndoflame::new, LibBlockNames.SUBTILE_ENDOFLAME),
Pair.of(SubTileHydroangeas::new, LibBlockNames.SUBTILE_HYDROANGEAS),
Pair.of(SubTileThermalily::new, LibBlockNames.SUBTILE_THERMALILY),
Pair.of(SubTileArcaneRose::new, LibBlockNames.SUBTILE_ARCANE_ROSE),
Pair.of(SubTileMunchdew::new, LibBlockNames.SUBTILE_MUNCHDEW),
Pair.of(SubTileEntropinnyum::new, LibBlockNames.SUBTILE_ENTROPINNYUM),
Pair.of(SubTileKekimurus::new, LibBlockNames.SUBTILE_KEKIMURUS),
Pair.of(SubTileGourmaryllis::new, LibBlockNames.SUBTILE_GOURMARYLLIS),
Pair.of(SubTileNarslimmus::new, LibBlockNames.SUBTILE_NARSLIMMUS),
Pair.of(SubTileSpectrolus::new, LibBlockNames.SUBTILE_SPECTROLUS),
Pair.of(SubTileDandelifeon::new, LibBlockNames.SUBTILE_DANDELIFEON),
Pair.of(SubTileRafflowsia::new, LibBlockNames.SUBTILE_RAFFLOWSIA),
Pair.of(SubTileShulkMeNot::new, LibBlockNames.SUBTILE_SHULK_ME_NOT),
Pair.of(SubTileBellethorn::new, LibBlockNames.SUBTILE_BELLETHORN),
Pair.of(SubTileBellethorn.Mini::new, chibi(LibBlockNames.SUBTILE_BELLETHORN)),
Pair.of(SubTileBergamute::new, LibBlockNames.SUBTILE_BERGAMUTE),
Pair.of(SubTileDreadthorn::new, LibBlockNames.SUBTILE_DREADTHORN),
Pair.of(SubTileHeiseiDream::new, LibBlockNames.SUBTILE_HEISEI_DREAM),
Pair.of(SubTileTigerseye::new, LibBlockNames.SUBTILE_TIGERSEYE),
Pair.of(SubTileJadedAmaranthus::new, LibBlockNames.SUBTILE_JADED_AMARANTHUS),
Pair.of(SubTileOrechid::new, LibBlockNames.SUBTILE_ORECHID),
Pair.of(SubTileFallenKanade::new, LibBlockNames.SUBTILE_FALLEN_KANADE),
Pair.of(SubTileExoflame::new, LibBlockNames.SUBTILE_EXOFLAME),
Pair.of(SubTileAgricarnation::new, LibBlockNames.SUBTILE_AGRICARNATION),
Pair.of(SubTileAgricarnation.Mini::new, chibi(LibBlockNames.SUBTILE_AGRICARNATION)),
Pair.of(SubTileHopperhock::new, LibBlockNames.SUBTILE_HOPPERHOCK),
Pair.of(SubTileHopperhock.Mini::new, chibi(LibBlockNames.SUBTILE_HOPPERHOCK)),
Pair.of(SubTileTangleberrie::new, LibBlockNames.SUBTILE_TANGLEBERRIE),
Pair.of(SubTileJiyuulia::new, LibBlockNames.SUBTILE_JIYUULIA),
Pair.of(SubTileRannuncarpus::new, LibBlockNames.SUBTILE_RANNUNCARPUS),
Pair.of(SubTileRannuncarpus.Mini::new, chibi(LibBlockNames.SUBTILE_RANNUNCARPUS)),
Pair.of(SubTileHyacidus::new, LibBlockNames.SUBTILE_HYACIDUS),
Pair.of(SubTilePollidisiac::new, LibBlockNames.SUBTILE_POLLIDISIAC),
Pair.of(SubTileClayconia::new, LibBlockNames.SUBTILE_CLAYCONIA),
Pair.of(SubTileClayconia.Mini::new, chibi(LibBlockNames.SUBTILE_CLAYCONIA)),
Pair.of(SubTileLoonuim::new, LibBlockNames.SUBTILE_LOONIUM),
Pair.of(SubTileDaffomill::new, LibBlockNames.SUBTILE_DAFFOMILL),
Pair.of(SubTileVinculotus::new, LibBlockNames.SUBTILE_VINCULOTUS),
Pair.of(SubTileSpectranthemum::new, LibBlockNames.SUBTILE_SPECTRANTHEMUM),
Pair.of(SubTileMedumone::new, LibBlockNames.SUBTILE_MEDUMONE),
Pair.of(SubTileMarimorphosis::new, LibBlockNames.SUBTILE_MARIMORPHOSIS),
Pair.of(SubTileMarimorphosis.Mini::new, chibi(LibBlockNames.SUBTILE_MARIMORPHOSIS)),
Pair.of(SubTileBubbell::new, LibBlockNames.SUBTILE_BUBBELL),
Pair.of(SubTileBubbell.Mini::new, chibi(LibBlockNames.SUBTILE_BUBBELL)),
Pair.of(SubTileSolegnolia::new, LibBlockNames.SUBTILE_SOLEGNOLIA),
Pair.of(SubTileSolegnolia.Mini::new, chibi(LibBlockNames.SUBTILE_SOLEGNOLIA)),
Pair.of(SubTileOrechidIgnem::new, LibBlockNames.SUBTILE_ORECHID_IGNEM)
);
public static List<Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation>> getTypes() {
return ImmutableList.of(
Pair.of(SubTilePureDaisy::new, LibBlockNames.SUBTILE_PUREDAISY),
Pair.of(SubTileManastar::new, LibBlockNames.SUBTILE_MANASTAR),
Pair.of(SubTileEndoflame::new, LibBlockNames.SUBTILE_ENDOFLAME),
Pair.of(SubTileHydroangeas::new, LibBlockNames.SUBTILE_HYDROANGEAS),
Pair.of(SubTileThermalily::new, LibBlockNames.SUBTILE_THERMALILY),
Pair.of(SubTileArcaneRose::new, LibBlockNames.SUBTILE_ARCANE_ROSE),
Pair.of(SubTileMunchdew::new, LibBlockNames.SUBTILE_MUNCHDEW),
Pair.of(SubTileEntropinnyum::new, LibBlockNames.SUBTILE_ENTROPINNYUM),
Pair.of(SubTileKekimurus::new, LibBlockNames.SUBTILE_KEKIMURUS),
Pair.of(SubTileGourmaryllis::new, LibBlockNames.SUBTILE_GOURMARYLLIS),
Pair.of(SubTileNarslimmus::new, LibBlockNames.SUBTILE_NARSLIMMUS),
Pair.of(SubTileSpectrolus::new, LibBlockNames.SUBTILE_SPECTROLUS),
Pair.of(SubTileDandelifeon::new, LibBlockNames.SUBTILE_DANDELIFEON),
Pair.of(SubTileRafflowsia::new, LibBlockNames.SUBTILE_RAFFLOWSIA),
Pair.of(SubTileShulkMeNot::new, LibBlockNames.SUBTILE_SHULK_ME_NOT),
Pair.of(SubTileBellethorn::new, LibBlockNames.SUBTILE_BELLETHORN),
Pair.of(SubTileBellethorn.Mini::new, chibi(LibBlockNames.SUBTILE_BELLETHORN)),
Pair.of(SubTileBergamute::new, LibBlockNames.SUBTILE_BERGAMUTE),
Pair.of(SubTileDreadthorn::new, LibBlockNames.SUBTILE_DREADTHORN),
Pair.of(SubTileHeiseiDream::new, LibBlockNames.SUBTILE_HEISEI_DREAM),
Pair.of(SubTileTigerseye::new, LibBlockNames.SUBTILE_TIGERSEYE),
Pair.of(SubTileJadedAmaranthus::new, LibBlockNames.SUBTILE_JADED_AMARANTHUS),
Pair.of(SubTileOrechid::new, LibBlockNames.SUBTILE_ORECHID),
Pair.of(SubTileFallenKanade::new, LibBlockNames.SUBTILE_FALLEN_KANADE),
Pair.of(SubTileExoflame::new, LibBlockNames.SUBTILE_EXOFLAME),
Pair.of(SubTileAgricarnation::new, LibBlockNames.SUBTILE_AGRICARNATION),
Pair.of(SubTileAgricarnation.Mini::new, chibi(LibBlockNames.SUBTILE_AGRICARNATION)),
Pair.of(SubTileHopperhock::new, LibBlockNames.SUBTILE_HOPPERHOCK),
Pair.of(SubTileHopperhock.Mini::new, chibi(LibBlockNames.SUBTILE_HOPPERHOCK)),
Pair.of(SubTileTangleberrie::new, LibBlockNames.SUBTILE_TANGLEBERRIE),
Pair.of(SubTileJiyuulia::new, LibBlockNames.SUBTILE_JIYUULIA),
Pair.of(SubTileRannuncarpus::new, LibBlockNames.SUBTILE_RANNUNCARPUS),
Pair.of(SubTileRannuncarpus.Mini::new, chibi(LibBlockNames.SUBTILE_RANNUNCARPUS)),
Pair.of(SubTileHyacidus::new, LibBlockNames.SUBTILE_HYACIDUS),
Pair.of(SubTilePollidisiac::new, LibBlockNames.SUBTILE_POLLIDISIAC),
Pair.of(SubTileClayconia::new, LibBlockNames.SUBTILE_CLAYCONIA),
Pair.of(SubTileClayconia.Mini::new, chibi(LibBlockNames.SUBTILE_CLAYCONIA)),
Pair.of(SubTileLoonuim::new, LibBlockNames.SUBTILE_LOONIUM),
Pair.of(SubTileDaffomill::new, LibBlockNames.SUBTILE_DAFFOMILL),
Pair.of(SubTileVinculotus::new, LibBlockNames.SUBTILE_VINCULOTUS),
Pair.of(SubTileSpectranthemum::new, LibBlockNames.SUBTILE_SPECTRANTHEMUM),
Pair.of(SubTileMedumone::new, LibBlockNames.SUBTILE_MEDUMONE),
Pair.of(SubTileMarimorphosis::new, LibBlockNames.SUBTILE_MARIMORPHOSIS),
Pair.of(SubTileMarimorphosis.Mini::new, chibi(LibBlockNames.SUBTILE_MARIMORPHOSIS)),
Pair.of(SubTileBubbell::new, LibBlockNames.SUBTILE_BUBBELL),
Pair.of(SubTileBubbell.Mini::new, chibi(LibBlockNames.SUBTILE_BUBBELL)),
Pair.of(SubTileSolegnolia::new, LibBlockNames.SUBTILE_SOLEGNOLIA),
Pair.of(SubTileSolegnolia.Mini::new, chibi(LibBlockNames.SUBTILE_SOLEGNOLIA)),
Pair.of(SubTileOrechidIgnem::new, LibBlockNames.SUBTILE_ORECHID_IGNEM)
);
}
@SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> evt) {
@@ -211,7 +213,7 @@ public class ModSubtiles {
Block.Properties props = Block.Properties.from(Blocks.POPPY);
Block.Properties floatProps = Block.Properties.create(Material.EARTH).hardnessAndResistance(0.5F).sound(SoundType.GROUND).lightValue(15);
for (Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation> type : TYPES) {
for (Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation> type : getTypes()) {
register(r, new BlockSpecialFlower(props, type.getFirst()), type.getSecond());
register(r, new BlockFloatingSpecialFlower(floatProps, type.getFirst()), floating(type.getSecond()));
}
@@ -223,7 +225,7 @@ public class ModSubtiles {
IForgeRegistry<Item> r = evt.getRegistry();
Item.Properties props = ModItems.defaultBuilder();
for (Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation> type : TYPES) {
for (Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation> type : getTypes()) {
Block block = b.getValue(type.getSecond());
Block floating = b.getValue(floating(type.getSecond()));
@@ -237,7 +239,7 @@ public class ModSubtiles {
IForgeRegistry<Block> b = ForgeRegistries.BLOCKS;
IForgeRegistry<TileEntityType<?>> r = evt.getRegistry();
for (Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation> type : TYPES) {
for (Pair<Supplier<? extends TileEntitySpecialFlower>, ResourceLocation> type : getTypes()) {
Block block = b.getValue(type.getSecond());
Block floating = b.getValue(floating(type.getSecond()));
register(r, TileEntityType.Builder.create(type.getFirst(), block, floating).build(null), type.getSecond());