Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
IchHabeHunger54 committed Jan 18, 2025
2 parents e2dfd83 + ebc43f9 commit f7b81f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.github.minecraftschurlimods.bibliocraft.client.model;

import com.github.minecraftschurlimods.bibliocraft.content.table.TableBlock;
import com.github.minecraftschurlimods.bibliocraft.content.table.TableBlockEntity;
import com.github.minecraftschurlimods.bibliocraft.util.BCUtil;
import com.google.gson.JsonObject;
import com.mojang.blaze3d.vertex.PoseStack;
Expand Down Expand Up @@ -31,7 +30,6 @@
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -54,8 +52,11 @@ public TableModel(boolean useAmbientOcclusion, boolean isGui3d, boolean usesBloc

@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, RandomSource rand, ModelData extraData, @Nullable RenderType renderType) {
TableBlock.Type type = extraData.get(TableBlockEntity.TYPE_PROPERTY);
return new ArrayList<>(baseMap.get(type).getQuads(state, side, rand, extraData, renderType));
TableBlock.Type type = TableBlock.Type.NONE;
if (state != null && state.hasProperty(TableBlock.TYPE)) {
type = state.getValue(TableBlock.TYPE);
}
return baseMap.get(type).getQuads(state, side, rand, extraData, renderType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.neoforged.neoforge.client.model.data.ModelData;
import net.neoforged.neoforge.client.model.data.ModelProperty;

import java.util.Objects;

public class TableBlockEntity extends BCBlockEntity {
public static final ModelProperty<TableBlock.Type> TYPE_PROPERTY = new ModelProperty<>();

public TableBlockEntity(BlockPos pos, BlockState state) {
super(BCBlockEntities.TABLE.get(), 2, pos, state);
}
Expand All @@ -42,9 +38,4 @@ public void setItem(int slot, ItemStack stack) {
requestModelDataUpdate();
}
}

@Override
public ModelData getModelData() {
return ModelData.builder().with(TYPE_PROPERTY, getBlockState().getValue(TableBlock.TYPE)).build();
}
}

0 comments on commit f7b81f8

Please sign in to comment.