Skip to content

Commit

Permalink
Merge branch '1.21.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Oct 24, 2024
2 parents 0d2564c + 4f405d1 commit ccbfd13
Show file tree
Hide file tree
Showing 86 changed files with 156 additions and 303 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ org.gradle.parallel=true
# Fabric Properties
# check these at https://fabricmc.net/develop/ and
# https://modrinth.com/mod/fabric-api/versions
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.7

# Fabric API
fabric_version=0.105.0+1.21.1
fabric_version=0.106.1+1.21.3

# Mod Properties
mod_version = 1.10-MC1.21.1
mod_version = 1.10-MC1.21.3
maven_group = net.wurstclient.glass
archives_base_name = Mo-Glass

# CurseForge
cf_game_version=1.21.1
cf_game_version=1.21.3

# Dependencies
3 changes: 1 addition & 2 deletions src/main/java/net/wurstclient/glass/GlassSlabBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ public float getAmbientOcclusionLightLevel(BlockState state,
}

@Override
public boolean isTransparent(BlockState state, BlockView world,
BlockPos pos)
public boolean isTransparent(BlockState state)
{
return true;
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/net/wurstclient/glass/GlassStairsBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ public float getAmbientOcclusionLightLevel(BlockState state,
}

@Override
public boolean isTransparent(BlockState state, BlockView world,
BlockPos pos)
public boolean isTransparent(BlockState state)
{
return true;
}
Expand Down
16 changes: 10 additions & 6 deletions src/main/java/net/wurstclient/glass/MoGlassBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ public enum MoGlassBlocks
.allowsSpawning(Blocks::never).solidBlock(Blocks::never)
.suffocates(Blocks::never).blockVision(Blocks::never));

public static final Block TINTED_GLASS_SLAB = new TintedGlassSlabBlock(
AbstractBlock.Settings.copy(Blocks.GLASS).mapColor(MapColor.GRAY)
.nonOpaque().allowsSpawning(Blocks::never).solidBlock(Blocks::never)
public static final Block TINTED_GLASS_SLAB =
new TintedGlassSlabBlock(AbstractBlock.Settings.create()
.instrument(NoteBlockInstrument.HAT).strength(0.3F)
.sounds(BlockSoundGroup.GLASS).mapColor(MapColor.GRAY)
.allowsSpawning(Blocks::never).solidBlock(Blocks::never)
.suffocates(Blocks::never).blockVision(Blocks::never));

public static final Block TINTED_GLASS_STAIRS = new TintedGlassStairsBlock(
AbstractBlock.Settings.copy(Blocks.GLASS).mapColor(MapColor.GRAY)
.nonOpaque().allowsSpawning(Blocks::never).solidBlock(Blocks::never)
public static final Block TINTED_GLASS_STAIRS =
new TintedGlassStairsBlock(AbstractBlock.Settings.create()
.instrument(NoteBlockInstrument.HAT).strength(0.3F)
.sounds(BlockSoundGroup.GLASS).mapColor(MapColor.GRAY)
.allowsSpawning(Blocks::never).solidBlock(Blocks::never)
.suffocates(Blocks::never).blockVision(Blocks::never));

public static final StainedGlassSlabBlock WHITE_STAINED_GLASS_SLAB =
Expand Down
31 changes: 8 additions & 23 deletions src/main/java/net/wurstclient/glass/MoGlassTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,23 @@
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.wurstclient.glass.mixin.ChunkLightProviderMixin;
import net.wurstclient.glass.mixin.BlockMixin;

public enum MoGlassTags
{
;

/**
* <p>
* Blocks in this tag aren't opaque, but need to be considered opaque for
* lighting calculations. This is necessary for tinted glass slabs and
* stairs to properly block light.
*
* <p>
* Minecraft's lighting engine automatically calculates how smaller blocks
* like stairs and slabs will sometimes block light depending on how they
* are placed, but it only does this for blocks that are marked as opaque.
* Blocks made of glass, however, can't be opaque.
*
* <p>
* This is fine for vanilla tinted glass blocks, since full blocks can skip
* this calculation altogether and simply block all light in all directions.
* But for smaller tinted glass blocks like slabs and stairs, this needs to
* be fixed.
* Blocks in this tag need to be considered opaque for lighting
* calculations, but non-opaque for culling. This is necessary for tinted
* glass slabs and stairs to properly block light without letting you see
* through the world.
*
* <p>
* See {@link ChunkLightProviderMixin} for how I modified the default
* lighting engine to make this work. If your mod replaces the default
* lighting engine (hi jellysquid), you will likely need to make a similar
* change to make it compatible with Mo Glass's tinted glass blocks.
* See {@link BlockMixin} for how I modified culling to make this work.
*/
public static final TagKey<Block> OPAQUE_FOR_LIGHTING =
createTag("opaque_for_lighting");
public static final TagKey<Block> NON_OPAQUE_FOR_CULLING =
createTag("non_opaque_for_culling");

private static TagKey<Block> createTag(String idPath)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ public float getAmbientOcclusionLightLevel(BlockState state,
}

@Override
public boolean isTransparent(BlockState state, BlockView world,
BlockPos pos)
public boolean isTransparent(BlockState state)
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ public float getAmbientOcclusionLightLevel(BlockState state,
}

@Override
public boolean isTransparent(BlockState state, BlockView world,
BlockPos pos)
public boolean isTransparent(BlockState state)
{
return true;
}
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/net/wurstclient/glass/TintedGlassSlabBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,14 @@ public float getAmbientOcclusionLightLevel(BlockState state,
}

@Override
public boolean isTransparent(BlockState state, BlockView world,
BlockPos pos)
public boolean isTransparent(BlockState state)
{
return false;
}

@Override
public int getOpacity(BlockState state, BlockView world, BlockPos pos)
public int getOpacity(BlockState state)
{
return state.get(TYPE) == SlabType.DOUBLE ? world.getMaxLightLevel()
: 0;
return state.get(TYPE) == SlabType.DOUBLE ? 15 : 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ public float getAmbientOcclusionLightLevel(BlockState state,
}

@Override
public boolean isTransparent(BlockState state, BlockView world,
BlockPos pos)
public boolean isTransparent(BlockState state)
{
return false;
}
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/net/wurstclient/glass/mixin/BlockMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2019-2024 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.glass.mixin;

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 net.fabricmc.fabric.api.block.v1.FabricBlock;
import net.fabricmc.fabric.api.tag.convention.v2.ConventionalBlockTags;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemConvertible;
import net.minecraft.util.math.Direction;
import net.wurstclient.glass.MoGlass;
import net.wurstclient.glass.MoGlassTags;

@Mixin(Block.class)
public abstract class BlockMixin extends AbstractBlock
implements ItemConvertible, FabricBlock
{
private BlockMixin(MoGlass moGlass, Settings settings)
{
super(settings);
}

/**
* See {@link MoGlassTags#NON_OPAQUE_FOR_CULLING} for why this exists.
*/
@Inject(at = @At("HEAD"),
method = "shouldDrawSide(Lnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Direction;)Z",
cancellable = true)
private static void onShouldDrawSide(BlockState state,
BlockState otherState, Direction direction,
CallbackInfoReturnable<Boolean> cir)
{
if(!state.isIn(ConventionalBlockTags.GLASS_BLOCKS_TINTED)
&& !state.isIn(MoGlassTags.NON_OPAQUE_FOR_CULLING)
&& otherState.isIn(MoGlassTags.NON_OPAQUE_FOR_CULLING))
cir.setReturnValue(true);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"category": "building",
"group": "stained_glass_slab",
"key": {
"#": {
"item": "minecraft:black_stained_glass"
}
"#": "minecraft:black_stained_glass"
},
"pattern": [
"###"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "minecraft:black_stained_glass"
},
"ingredient": "minecraft:black_stained_glass",
"result": {
"count": 2,
"id": "mo_glass:black_stained_glass_slab"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"category": "building",
"group": "stained_glass_stairs",
"key": {
"#": {
"item": "minecraft:black_stained_glass"
}
"#": "minecraft:black_stained_glass"
},
"pattern": [
"# ",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "minecraft:black_stained_glass"
},
"ingredient": "minecraft:black_stained_glass",
"result": {
"count": 1,
"id": "mo_glass:black_stained_glass_stairs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"category": "building",
"group": "stained_glass_slab",
"key": {
"#": {
"item": "minecraft:blue_stained_glass"
}
"#": "minecraft:blue_stained_glass"
},
"pattern": [
"###"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "minecraft:blue_stained_glass"
},
"ingredient": "minecraft:blue_stained_glass",
"result": {
"count": 2,
"id": "mo_glass:blue_stained_glass_slab"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"category": "building",
"group": "stained_glass_stairs",
"key": {
"#": {
"item": "minecraft:blue_stained_glass"
}
"#": "minecraft:blue_stained_glass"
},
"pattern": [
"# ",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "minecraft:blue_stained_glass"
},
"ingredient": "minecraft:blue_stained_glass",
"result": {
"count": 1,
"id": "mo_glass:blue_stained_glass_stairs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"category": "building",
"group": "stained_glass_slab",
"key": {
"#": {
"item": "minecraft:brown_stained_glass"
}
"#": "minecraft:brown_stained_glass"
},
"pattern": [
"###"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "minecraft:brown_stained_glass"
},
"ingredient": "minecraft:brown_stained_glass",
"result": {
"count": 2,
"id": "mo_glass:brown_stained_glass_slab"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"category": "building",
"group": "stained_glass_stairs",
"key": {
"#": {
"item": "minecraft:brown_stained_glass"
}
"#": "minecraft:brown_stained_glass"
},
"pattern": [
"# ",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "minecraft:brown_stained_glass"
},
"ingredient": "minecraft:brown_stained_glass",
"result": {
"count": 1,
"id": "mo_glass:brown_stained_glass_stairs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"category": "building",
"group": "stained_glass_slab",
"key": {
"#": {
"item": "minecraft:cyan_stained_glass"
}
"#": "minecraft:cyan_stained_glass"
},
"pattern": [
"###"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"type": "minecraft:stonecutting",
"ingredient": {
"item": "minecraft:cyan_stained_glass"
},
"ingredient": "minecraft:cyan_stained_glass",
"result": {
"count": 2,
"id": "mo_glass:cyan_stained_glass_slab"
Expand Down
Loading

0 comments on commit ccbfd13

Please sign in to comment.