Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Forge model methods on ForwardingBakedModel #71

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
import java.util.function.Supplier;

import net.minecraft.block.BlockState;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.client.render.model.json.ModelOverrideList;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
Expand All @@ -33,6 +36,11 @@

import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;

import net.minecraftforge.client.ChunkRenderTypeSet;
import net.minecraftforge.client.model.data.ModelData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Base class for specialized model implementations that need to wrap other baked models.
* Avoids boilerplate code for pass-through methods.
Expand Down Expand Up @@ -100,4 +108,50 @@ public ModelOverrideList getOverrides() {
public BakedModel getWrappedModel() {
return wrapped;
}

@Override
@NotNull
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull ModelData data, @Nullable RenderLayer renderType) {
return wrapped.getQuads(state, side, rand, data, renderType);
}

@Override
public boolean useAmbientOcclusion(BlockState state) {
return wrapped.useAmbientOcclusion(state);
}

@Override
public boolean useAmbientOcclusion(BlockState state, RenderLayer renderType) {
return wrapped.useAmbientOcclusion(state, renderType);
}

@Override
public BakedModel applyTransform(ModelTransformationMode transformType, MatrixStack poseStack, boolean applyLeftHandTransform) {
return wrapped.applyTransform(transformType, poseStack, applyLeftHandTransform);
}

@Override
public @NotNull ModelData getModelData(@NotNull BlockRenderView level, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull ModelData modelData) {
return wrapped.getModelData(level, pos, state, modelData);
}

@Override
public Sprite getParticleIcon(@NotNull ModelData data) {
return wrapped.getParticleIcon(data);
}

@Override
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull Random rand, @NotNull ModelData data) {
return wrapped.getRenderTypes(state, rand, data);
}

@Override
public List<RenderLayer> getRenderTypes(ItemStack itemStack, boolean fabulous) {
return wrapped.getRenderTypes(itemStack, fabulous);
}

@Override
public List<BakedModel> getRenderPasses(ItemStack itemStack, boolean fabulous) {
return wrapped.getRenderPasses(itemStack, fabulous);
}
}
Loading