Skip to content

Commit

Permalink
🐛 Fixed closed blinds causing visible cullfacing. Closes #447
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCrayfish committed Jun 10, 2021
1 parent 74283d7 commit 2a603c3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import groovy.json.JsonSlurper
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = 'https://repo.spongepowered.org/maven' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

version = project.property('mod.version') + "-" + project.property('minecraft.version')
Expand All @@ -19,6 +22,10 @@ archivesBaseName = "furniture"

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'

mixin {
add sourceSets.main, "cfm.refmap.json"
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

Expand All @@ -30,6 +37,7 @@ minecraft {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
arg '-mixin.config=cfm.mixins.json'
mods {
cfm {
source sourceSets.main
Expand All @@ -41,6 +49,7 @@ minecraft {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
arg '-mixin.config=cfm.mixins.json'
mods {
cfm {
source sourceSets.main
Expand Down Expand Up @@ -92,7 +101,8 @@ jar {
"Implementation-Title" : project.name,
"Implementation-Version" : "${version}",
"Implementation-Vendor" : project.property('mod.author'),
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "cfm.mixins.json"
])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.mrcrayfish.furniture.mixin.client;

import com.mrcrayfish.furniture.block.BlindsBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

/**
* Author: MrCrayfish
*/
@Mixin(Block.class)
public class BlockMixin
{
@Inject(method = "shouldSideBeRendered", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/math/shapes/VoxelShapes;compare(Lnet/minecraft/util/math/shapes/VoxelShape;Lnet/minecraft/util/math/shapes/VoxelShape;Lnet/minecraft/util/math/shapes/IBooleanFunction;)Z"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
private static void shouldRenderSideWithBlinds(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction dir, CallbackInfoReturnable<Boolean> cir, BlockPos offsetPos, BlockState offsetState)
{
if(offsetState.getBlock() instanceof BlindsBlock)
{
cir.setReturnValue(true);
}
}
}
13 changes: 13 additions & 0 deletions src/main/resources/cfm.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"required": true,
"package": "com.mrcrayfish.furniture.mixin",
"compatibilityLevel": "JAVA_8",
"minVersion": "0.8",
"refmap": "cfm.refmap.json",
"client": [
"client.BlockMixin"
],
"injectors": {
"defaultRequire": 1
}
}

0 comments on commit 2a603c3

Please sign in to comment.