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

Add config options #139

Open
wants to merge 2 commits into
base: 1.16
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -2,6 +2,9 @@

public class CampanionConfig {

public boolean renderTentContents = true;
public boolean renderTentPlacement = true;

public CampanionConfig() {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.terraformersmc.campanion.client.renderer.item.BuiltTentItemRenderer;
import com.terraformersmc.campanion.client.renderer.item.SpearItemRenderer;
import com.terraformersmc.campanion.config.CampanionConfigManager;
import com.terraformersmc.campanion.item.CampanionItems;
import com.terraformersmc.campanion.item.SpearItem;
import net.minecraft.block.Blocks;
Expand Down Expand Up @@ -29,16 +30,16 @@ public void renderItem(LivingEntity entity, ItemStack stack, ModelTransformation
if(stack.getItem() instanceof SpearItem && SpearItemRenderer.INSTANCE.render(entity, stack, renderMode, leftHanded, matrices, vertexConsumers, light, overlay, model)) {
info.cancel();
}
if(stack.getItem() == CampanionItems.TENT_BAG && renderMode != ModelTransformation.Mode.GUI) {
matrices.push();
matrices.scale(1/4F, 1/4F, 1/4F);
MinecraftClient.getInstance().getBlockRenderManager().getModel(Blocks.STONE.getDefaultState()).getTransformation().getTransformation(renderMode).apply(leftHanded, matrices);
boolean ret = BuiltTentItemRenderer.INSTANCE.render(stack, matrices, BlockPos.ORIGIN.up(500), vertexConsumers, light);
matrices.pop();
if(ret) {
info.cancel();
}
}
if(CampanionConfigManager.getConfig().renderTentContents && stack.getItem() == CampanionItems.TENT_BAG && renderMode != ModelTransformation.Mode.GUI) {
matrices.push();
matrices.scale(1/4F, 1/4F, 1/4F);
MinecraftClient.getInstance().getBlockRenderManager().getModel(Blocks.STONE.getDefaultState()).getTransformation().getTransformation(renderMode).apply(leftHanded, matrices);
boolean ret = BuiltTentItemRenderer.INSTANCE.render(stack, matrices, BlockPos.ORIGIN.up(500), vertexConsumers, light);
matrices.pop();
if(ret) {
info.cancel();
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import com.terraformersmc.campanion.client.renderer.item.BuiltTentItemRenderer;
import com.terraformersmc.campanion.client.util.TentPreviewImmediate;
import com.terraformersmc.campanion.config.CampanionConfigManager;
import com.terraformersmc.campanion.item.PlaceableTentItem;
import com.terraformersmc.campanion.item.TentBagItem;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
Expand Down Expand Up @@ -58,7 +58,9 @@ public void render(MatrixStack matrices, float tickDelta, long limitTime, boolea

List<BlockPos> list = tent.getErrorPosition(this.client.world, placePos, stack);
TentPreviewImmediate.STORAGE.setApplyModifiers(!list.isEmpty());
BuiltTentItemRenderer.INSTANCE.render(stack, matrices, placePos, immediate, -1);
if (CampanionConfigManager.getConfig().renderTentPlacement) {
BuiltTentItemRenderer.INSTANCE.render(stack, matrices, placePos, immediate, -1);
}

for (BlockPos pos : list) {
matrices.push();
Expand Down