-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Placeholder previews & start of placement handlers
Part of #38. - Wood placeholder previews - Start of wood placement handlers Todo: door bug, testing inventories, fix lectern, stone/soil support, handle dynamic wood variants in placement handler (further testing needed)
- Loading branch information
Showing
6 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/natrow/tfc_minecolonies/mixin/BlueprintRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.natrow.tfc_minecolonies.mixin; | ||
|
||
import java.util.Locale; | ||
import com.ldtteam.structurize.client.BlueprintRenderer; | ||
import com.ldtteam.structurize.helpers.Settings; | ||
import com.natrow.tfc_minecolonies.TFCMConstants; | ||
import com.natrow.tfc_minecolonies.structurize.ISettingsExtension; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(value = BlueprintRenderer.class, remap = false) | ||
public abstract class BlueprintRendererMixin implements AutoCloseable | ||
{ | ||
@ModifyVariable(method = "init", name = "state", at = @At("STORE")) | ||
BlockState initInjector(BlockState value) | ||
{ | ||
if (Settings.instance.renderLightPlaceholders() && TFCMConstants.PLACEHOLDER_TO_WOOD.get().containsKey(value.getBlock())) | ||
{ | ||
final String woodType = ((ISettingsExtension) (Object) Settings.instance).getWoodType().toLowerCase(Locale.ROOT); | ||
final Block targetBlock = TFCMConstants.PLACEHOLDER_TO_WOOD.get().get(value.getBlock()).get(woodType); | ||
return targetBlock.withPropertiesOf(value); | ||
} | ||
else | ||
{ | ||
return value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters