From 7df46a4b765b2e29879c2dce53165f9f92e6f6a1 Mon Sep 17 00:00:00 2001 From: Adrien1106 Date: Fri, 14 Jun 2024 17:16:53 +0200 Subject: [PATCH] fix: more checks on ThemedEntity Class --- gradle.properties | 2 +- .../adrien1106/reframed/util/mixin/ThemedBlockEntity.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 91ac973..12b6a5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ loader_version=0.15.11 # Mod Properties modrinth_id = jCpoCBpn -mod_version = 1.6.2 +mod_version = 1.6.3 maven_group = fr.adrien1106 archives_base_name = ReFramed mod_id = reframed diff --git a/src/main/java/fr/adrien1106/reframed/util/mixin/ThemedBlockEntity.java b/src/main/java/fr/adrien1106/reframed/util/mixin/ThemedBlockEntity.java index 257921a..9f5e6a2 100644 --- a/src/main/java/fr/adrien1106/reframed/util/mixin/ThemedBlockEntity.java +++ b/src/main/java/fr/adrien1106/reframed/util/mixin/ThemedBlockEntity.java @@ -2,6 +2,7 @@ package fr.adrien1106.reframed.util.mixin; import fr.adrien1106.reframed.util.blocks.ThemeableBlockEntity; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtHelper; @@ -29,12 +30,17 @@ public class ThemedBlockEntity extends BlockEntity implements ThemeableBlockEnti @Override public BlockState getTheme(int i) { + if (i > themes.size()) + return Blocks.AIR.getDefaultState(); return themes.get(Math.max(0, i-1)); } @Override public void setTheme(BlockState state, int i) { - themes.set(Math.max(0, i-1), state); + if (i > themes.size()) + themes.add(state); + else + themes.set(Math.max(0, i-1), state); } @Override