Skip to content

Commit

Permalink
Update other elements to use FabricItemSettings (#59)
Browse files Browse the repository at this point in the history
* Update food and music disc to use FabricItemSettings also fix foods

* Also update tools

Co-authored-by: NOYB <NOYBss@noreply.github.com>
  • Loading branch information
NOYB and NOYB authored Aug 22, 2020
1 parent ebeb243 commit 6b1e648
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/fabric-1.16.2/templates/food.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ package ${package}.item;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

public class ${name}Item {
public class ${name}Item extends Item {
public ${name}Item() {
super(new Item.Settings().group(${data.creativeTab})
super(new FabricItemSettings()
.group(${data.creativeTab})
.maxCount(${data.stackSize})
.food((new FoodComponent.Builder()).hunger(${data.nutritionalValue}).saturationModifier(${data.saturation}f)
<#if data.isAlwaysEdible>.alwaysEdible()</#if>
Expand Down
2 changes: 1 addition & 1 deletion src/fabric-1.16.2/templates/musicdisc.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import net.fabricmc.api.Environment;
public class ${name}MusicDisc extends MusicDiscItem {
public ${name}MusicDisc() {
super(0, (net.minecraft.sound.SoundEvent) Registry.SOUND_EVENT.get(new Identifier("${data.music}")),
new Item.Settings().group(${data.creativeTab}).maxCount(1).rarity(Rarity.RARE));
new FabricItemSettings().group(${data.creativeTab}).maxCount(1).rarity(Rarity.RARE));
}

<#if data.hasGlow>
Expand Down
8 changes: 4 additions & 4 deletions src/fabric-1.16.2/templates/tool.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class ${name}Tool {
<#if data.toolType=="Special">
public static class CustomToolItem extends Item {
public CustomToolItem() {
super(new Item.Settings().group(${data.creativeTab}).maxDamage(${data.usageCount}));
super(new FabricItemSettings().group(${data.creativeTab}).maxDamage(${data.usageCount}));
}

@Override
Expand Down Expand Up @@ -96,7 +96,7 @@ public class ${name}Tool {
<#elseif data.toolType=="MultiTool">
public static class CustomToolItem extends Item {
public CustomToolItem() {
super(new Item.Settings().group(${data.creativeTab}).maxDamage(${data.usageCount}));
super(new FabricItemSettings().group(${data.creativeTab}).maxDamage(${data.usageCount}));
}

@Override
Expand Down Expand Up @@ -139,8 +139,8 @@ public class ${name}Tool {
</#if>

public static final Item INSTANCE = new
<#if data.toolType == "Pickaxe" || data.toolType == "Axe" || data.toolType == "Sword" || data.toolType == "Spade" || data.toolType == "Hoe">${data.toolType.toString().replace("Spade", "Shovel")}Item(${name?upper_case}_TOOL_MATERIAL, ${data.attackSpeed - 4}, ${data.attackSpeed - 4}, (new Item.Settings().group(${data.creativeTab})))
<#elseif data.toolType == "Shears">ShearsItem((new Item.Settings().group(${data.creativeTab})))
<#if data.toolType == "Pickaxe" || data.toolType == "Axe" || data.toolType == "Sword" || data.toolType == "Spade" || data.toolType == "Hoe">${data.toolType.toString().replace("Spade", "Shovel")}Item(${name?upper_case}_TOOL_MATERIAL, ${data.attackSpeed - 4}, ${data.attackSpeed - 4}, (new FabricItemSettings().group(${data.creativeTab})))
<#elseif data.toolType == "Shears">ShearsItem((new FabricItemSettings().group(${data.creativeTab})))
<#else>CustomToolItem()</#if>{

<#if data.toolType == "Shears">
Expand Down

0 comments on commit 6b1e648

Please sign in to comment.