Skip to content

Commit

Permalink
Update to FabricItemSettings and add emissive lighting (#58)
Browse files Browse the repository at this point in the history
I couldn't tested these in MCreator but they work in Intellij.

Co-authored-by: NOYB <NOYBss@noreply.github.com>
  • Loading branch information
NOYB and NOYB authored Aug 22, 2020
1 parent 4d68856 commit ebeb243
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/fabric-1.16.2/templates/block.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public class ${name}Block extends <#if data.hasGravity> FallingBlock <#else> Blo
<#elseif data.rotationMode == 2 || data.rotationMode == 4 || data.rotationMode == 5>
public static final DirectionProperty FACING = FacingBlock.FACING;
</#if>

<#if data.emissiveRendering>
private static boolean always(BlockState state, BlockView world, BlockPos pos) {
return true;
}
</#if>

public ${name}Block() {
super(FabricBlockSettings.of(Material.${data.material})
Expand All @@ -40,6 +46,9 @@ public class ${name}Block extends <#if data.hasGravity> FallingBlock <#else> Blo
</#if>
<#if data.hasTransparency || (data.blockBase?has_content && data.blockBase == "Leaves")>
.nonOpaque()
</#if>
<#if data.emissiveRendering>
.emissiveLighting(${name}Block::always)
</#if>
<#if data.tickRandomly>
.ticksRandomly()
Expand Down
4 changes: 2 additions & 2 deletions src/fabric-1.16.2/templates/item.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ package ${package}.item;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import com.google.common.collect.*;

public class ${name}Item extends Item {
public ${name}Item() {
super(new Item.Settings()
super(new FabricItemSettings()
.group(${data.creativeTab})
<#if data.damageCount != 0>
.maxDamage(${data.damageCount})
Expand Down

0 comments on commit ebeb243

Please sign in to comment.