1.0.28
All checks were successful
RelicCraft/pipeline/head This commit looks good

Fix Server Crash
This commit is contained in:
TheBrokenRail 2020-08-05 14:44:53 -04:00
parent b58f4b0809
commit d1f6af50af
4 changed files with 31 additions and 11 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.0.28**
* Fix Server Crash
**1.0.27** **1.0.27**
* Use DataTracker * Use DataTracker

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.8.8+build.202 fabric_loader_version = 0.8.8+build.202
# Mod Properties # Mod Properties
mod_version = 1.0.27 mod_version = 1.0.28
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
archives_base_name = reliccraft archives_base_name = reliccraft

View File

@ -2,6 +2,7 @@ package com.thebrokenrail.reliccraft.client;
import com.thebrokenrail.reliccraft.RelicCraft; import com.thebrokenrail.reliccraft.RelicCraft;
import com.thebrokenrail.reliccraft.client.entity.RelicEntityRenderer; import com.thebrokenrail.reliccraft.client.entity.RelicEntityRenderer;
import com.thebrokenrail.reliccraft.item.DragonEggHolderBlockItem;
import com.thebrokenrail.reliccraft.item.RelicItem; import com.thebrokenrail.reliccraft.item.RelicItem;
import com.thebrokenrail.reliccraft.packet.UpdateTimeDilationS2CPacket; import com.thebrokenrail.reliccraft.packet.UpdateTimeDilationS2CPacket;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
@ -75,6 +76,8 @@ public class RelicCraftClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
DragonEggHolderBlockItem.initClient();
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex > 0 ? -1 : getStackColor(stack), RelicCraft.ORB_ITEM); ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex > 0 ? -1 : getStackColor(stack), RelicCraft.ORB_ITEM);
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex > 0 ? -1 : getStackColor(stack), RelicCraft.STAFF_ITEM); ColorProviderRegistry.ITEM.register((stack, tintIndex) -> tintIndex > 0 ? -1 : getStackColor(stack), RelicCraft.STAFF_ITEM);

View File

@ -2,6 +2,8 @@ package com.thebrokenrail.reliccraft.item;
import com.thebrokenrail.reliccraft.RelicCraft; import com.thebrokenrail.reliccraft.RelicCraft;
import com.thebrokenrail.reliccraft.mixin.ModelPredicateProviderRegistryHook; import com.thebrokenrail.reliccraft.mixin.ModelPredicateProviderRegistryHook;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.inventory.Inventories; import net.minecraft.inventory.Inventories;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
@ -11,10 +13,21 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity; import net.minecraft.util.Rarity;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import java.util.ArrayList;
import java.util.List;
public class DragonEggHolderBlockItem extends BlockItem { public class DragonEggHolderBlockItem extends BlockItem {
private static final List<DragonEggHolderBlockItem> list = new ArrayList<>();
public DragonEggHolderBlockItem(Block block) { public DragonEggHolderBlockItem(Block block) {
super(block, new Settings().rarity(Rarity.UNCOMMON).group(RelicCraft.ITEM_GROUP)); super(block, new Settings().rarity(Rarity.UNCOMMON).group(RelicCraft.ITEM_GROUP));
ModelPredicateProviderRegistryHook.callRegister(this, new Identifier(RelicCraft.NAMESPACE, "active"), (stack, world, entity) -> { list.add(this);
}
@Environment(EnvType.CLIENT)
public static void initClient() {
for (DragonEggHolderBlockItem item : list) {
ModelPredicateProviderRegistryHook.callRegister(item, new Identifier(RelicCraft.NAMESPACE, "active"), (stack, world, entity) -> {
CompoundTag tag = stack.getSubTag("BlockEntityTag"); CompoundTag tag = stack.getSubTag("BlockEntityTag");
if (tag != null) { if (tag != null) {
DefaultedList<ItemStack> list = DefaultedList.ofSize(1, ItemStack.EMPTY); DefaultedList<ItemStack> list = DefaultedList.ofSize(1, ItemStack.EMPTY);
@ -26,4 +39,5 @@ public class DragonEggHolderBlockItem extends BlockItem {
return 0; return 0;
}); });
} }
}
} }