From 4ec0a07e7dc7e19747f180e15e32164dabae52b2 Mon Sep 17 00:00:00 2001 From: Meredith Espinosa Date: Thu, 11 Jul 2019 16:13:00 -0700 Subject: [PATCH] fix another crash --- build.gradle | 2 +- .../github/cottonmc/templates/block/TemplateBlock.java | 2 +- .../io/github/cottonmc/templates/util/SpriteSet.java | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 5053b20..659a6c7 100755 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ if(rootProject.file('private.gradle').exists()) { //Publishing details archivesBaseName = "templates" group = "io.github.cottonmc" -version = "1.0.4+1.14.3" +version = "1.0.5+1.14.3" minecraft { refmapName = 'mixins.templates.refmap.json' diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java index c207f26..cfa5d20 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java @@ -42,7 +42,7 @@ public abstract class TemplateBlock extends Block implements BlockEntityProvider } ItemPlacementContext ctx = new ItemPlacementContext(new ItemUsageContext(player, hand, hit)); BlockState placementState = block.getPlacementState(ctx); - if (state.isSimpleFullBlock(world, pos) && !(block instanceof BlockEntityProvider)) { + if (Block.isShapeFullCube(state.getCollisionShape(world, pos)) && !(block instanceof BlockEntityProvider)) { if (be.getRenderedState().getBlock() == Blocks.AIR) { be.setRenderedState(placementState); if (!player.abilities.creativeMode) stack.decrement(1); diff --git a/src/main/java/io/github/cottonmc/templates/util/SpriteSet.java b/src/main/java/io/github/cottonmc/templates/util/SpriteSet.java index eb492aa..6d12508 100644 --- a/src/main/java/io/github/cottonmc/templates/util/SpriteSet.java +++ b/src/main/java/io/github/cottonmc/templates/util/SpriteSet.java @@ -3,6 +3,7 @@ package io.github.cottonmc.templates.util; import java.util.List; import java.util.Random; +import net.minecraft.client.texture.MissingSprite; import org.apache.commons.lang3.ObjectUtils; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -17,7 +18,8 @@ import net.minecraft.util.math.Direction; public class SpriteSet { private Object2ObjectOpenHashMap quads = new Object2ObjectOpenHashMap<>(); private boolean isDefault = true; - public static final Sprite FALLBACK = MinecraftClient.getInstance().getSpriteAtlas().getSprite(new Identifier("minecraft:block/scaffolding_top")); + public static final Sprite DEFAULT = MinecraftClient.getInstance().getSpriteAtlas().getSprite(new Identifier("minecraft:block/scaffolding_top")); + public static final Sprite FALLBACK = MissingSprite.getMissingSprite(); public SpriteSet() { clear(); @@ -43,7 +45,10 @@ public class SpriteSet { } public Sprite getSprite(Direction dir) { - return isDefault ? FALLBACK : ObjectUtils.defaultIfNull(quads.get(dir).getSprite(), FALLBACK); + if (isDefault) return DEFAULT; + BakedQuad quad = quads.get(dir); + if (quad == null) return FALLBACK; + return quad.getSprite(); } public boolean hasColor(Direction dir) {