mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 19:39:37 +00:00
Fix PanelModelBaker
This commit is contained in:
1 parent
cce3b7b901
commit
4825f402fc
2 files changed
+16
-33
No files matched your search
@@ -36,29 +36,24 @@ public class ModelMutlipass<B extends Block & IMultipassBlock<K>, K> extends Mod
|
||||
protected K getWorldKey(IBlockState state) {
|
||||
return ((B) state.getBlock()).getWorldKey(state);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected IBakedModel bakeModel(IBlockState state, K key) {
|
||||
|
||||
@Override
|
||||
protected IBakedModel bakeModel(IBlockState state, K key, B block) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IModelBaker baker = new PanelModelBaker();
|
||||
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
B bBlock = blockClass.cast(block);
|
||||
|
||||
IModelBaker baker;
|
||||
if (state instanceof IExtendedBlockState) {
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
// baker.setRenderBounds(state.getBoundingBox(world, pos));
|
||||
baker = new PanelModelBaker(state.getBoundingBox(world, pos));
|
||||
}else{
|
||||
baker = new PanelModelBaker(block.getItemBoundingBox());
|
||||
}
|
||||
|
||||
bakeBlock(bBlock, key, baker, false);
|
||||
bakeBlock(block, key, baker, false);
|
||||
|
||||
blockModel = baker.bakeModel(false);
|
||||
onCreateModel(blockModel);
|
||||
@@ -86,14 +81,14 @@ public class ModelMutlipass<B extends Block & IMultipassBlock<K>, K> extends Mod
|
||||
return null;
|
||||
}
|
||||
|
||||
IModelBaker baker = new PanelModelBaker();
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
B bBlock = blockClass.cast(block);
|
||||
|
||||
// baker.setRenderBounds(bBlock.getItemBoundingBox());
|
||||
|
||||
IModelBaker baker = new PanelModelBaker(bBlock.getItemBoundingBox());
|
||||
bakeBlock(bBlock, key, baker, true);
|
||||
|
||||
return itemModel = baker.bakeModel(true);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PanelModelBaker implements IModelBaker {
|
||||
private final float[] quadsUV;
|
||||
private final List<ModelBakerFace> faces = new ArrayList<>();
|
||||
private final List<Pair<IBlockState, IBakedModel>> bakedModels = new ArrayList<>();
|
||||
protected AxisAlignedBB renderBounds = Block.FULL_BLOCK_AABB;
|
||||
protected AxisAlignedBB renderBounds;
|
||||
|
||||
protected ModelBakerModel currentModel = new ModelBakerModel(ModelManager.getInstance().getDefaultBlockState());
|
||||
|
||||
@@ -44,24 +44,15 @@ public class PanelModelBaker implements IModelBaker {
|
||||
protected final float[] defUVs;
|
||||
|
||||
public PanelModelBaker() {
|
||||
this(Block.FULL_BLOCK_AABB);
|
||||
}
|
||||
|
||||
public PanelModelBaker(AxisAlignedBB renderBounds) {
|
||||
quadsUV = new float[]{0, 0, 1, 1, 0, 0, 1, 1};
|
||||
defUVs = new float[]{0, 0, 1, 1};
|
||||
this.renderBounds = renderBounds;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void setRenderBounds(AxisAlignedBB renderBounds) {
|
||||
// if (renderBounds == null) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// this.renderBounds = renderBounds;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) {
|
||||
// renderBounds = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
// }
|
||||
|
||||
protected int colorIndex = -1;
|
||||
|
||||
@Override
|
||||
@@ -187,9 +178,6 @@ public class PanelModelBaker implements IModelBaker {
|
||||
return;
|
||||
}
|
||||
|
||||
// Vector3f to = new Vector3f((float) renderBounds.minX * 16.0f, (float) renderBounds.minY * 16.0f, (float) renderBounds.minZ * 16.0f);
|
||||
// Vector3f from = new Vector3f((float) renderBounds.maxX * 16.0f, (float) renderBounds.maxY * 16.0f, (float) renderBounds.maxZ * 16.0f);
|
||||
|
||||
faces.add(new ModelBakerFace(facing, colorIndex, sprite));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user