Skip to content

Commit

Permalink
Added fireresistantce to ruby/cincinnasite armor and ruby blocks (#/i…
Browse files Browse the repository at this point in the history
  • Loading branch information
quiqueck committed Apr 28, 2022
1 parent b399d75 commit 076ce9b
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 50 deletions.
13 changes: 12 additions & 1 deletion src/main/java/paulevs/betternether/blocks/BlockNetherRuby.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
package paulevs.betternether.blocks;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.Blocks;

public class BlockNetherRuby extends BlockBase {
import ru.bclib.interfaces.CustomItemProvider;

public class BlockNetherRuby extends BlockBase implements CustomItemProvider {
public BlockNetherRuby() {
super(FabricBlockSettings.copyOf(Blocks.DIAMOND_BLOCK));
}

@Override
public BlockItem getCustomItem(ResourceLocation blockID, FabricItemSettings settings) {
return new BlockItem(this, settings.fireproof());
}
}
21 changes: 18 additions & 3 deletions src/main/java/paulevs/betternether/blocks/BlockOre.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
package paulevs.betternether.blocks;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;

import paulevs.betternether.registry.NetherBlocks;
import ru.bclib.api.tag.NamedCommonBlockTags;
import ru.bclib.api.tag.TagAPI;
import ru.bclib.blocks.BaseOreBlock;
import ru.bclib.interfaces.CustomItemProvider;
import ru.bclib.interfaces.TagProvider;

import java.util.List;

public class BlockOre extends BaseOreBlock implements TagProvider {

public BlockOre(Item drop, int minCount, int maxCount, int experience, int miningLevel) {
public class BlockOre extends BaseOreBlock implements TagProvider, CustomItemProvider
{
public final boolean fireproof;
public BlockOre(Item drop, int minCount, int maxCount, int experience, int miningLevel, boolean fireproof) {
super(
FabricBlockSettings.of(Material.STONE, MaterialColor.COLOR_RED)
.hardness(3F)
Expand All @@ -28,10 +36,17 @@ public BlockOre(Item drop, int minCount, int maxCount, int experience, int minin
experience,
miningLevel
);
this.fireproof = fireproof;
}

@Override
public void addTags(List<TagAPI.TagLocation<Block>> blockTags, List<TagAPI.TagLocation<Item>> itemTags) {
blockTags.add(NamedCommonBlockTags.NETHERRACK);
}

@Override
public BlockItem getCustomItem(ResourceLocation blockID, FabricItemSettings settings) {
if (fireproof) settings = settings.fireproof();
return new BlockItem(this, settings);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ protected void _initBase(FabricBlockSettings blockSettings, FabricItemSettings i
}).setBlockTags(NamedBlockTags.PLANKS).setItemTags(NamedItemTags.PLANKS));

addBlockEntry(new BlockEntry(BLOCK_STAIRS, (complexMaterial, settings) -> {
return new BaseStairsBlock(getBlock(BLOCK_PLANKS));
return new BaseStairsBlock(getBlock(BLOCK_PLANKS), false);
}).setBlockTags(NamedBlockTags.WOODEN_STAIRS, NamedBlockTags.STAIRS).setItemTags(NamedItemTags.WOODEN_STAIRS, NamedItemTags.STAIRS));
addBlockEntry(new BlockEntry(BLOCK_SLAB, (complexMaterial, settings) -> {
return new BaseSlabBlock(getBlock(BLOCK_PLANKS));
return new BaseSlabBlock(getBlock(BLOCK_PLANKS), false);
}).setBlockTags(NamedBlockTags.WOODEN_SLABS, NamedBlockTags.SLABS).setItemTags(NamedItemTags.WOODEN_SLABS, NamedItemTags.SLABS));
addBlockEntry(new BlockEntry(BLOCK_FENCE, (complexMaterial, settings) -> {
return new BaseFenceBlock(getBlock(BLOCK_PLANKS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ protected void _initBase(FabricBlockSettings blockSettings, FabricItemSettings i
}).setBlockTags(NamedBlockTags.PLANKS).setItemTags(NamedItemTags.PLANKS));

addBlockEntry(new BlockEntry(BLOCK_STAIRS, (complexMaterial, settings) -> {
return new BaseStairsBlock(getBlock(BLOCK_PLANKS));
return new BaseStairsBlock(getBlock(BLOCK_PLANKS), false);
}).setBlockTags(NamedBlockTags.WOODEN_STAIRS, NamedBlockTags.STAIRS).setItemTags(NamedItemTags.WOODEN_STAIRS, NamedItemTags.STAIRS));
addBlockEntry(new BlockEntry(BLOCK_SLAB, (complexMaterial, settings) -> {
return new BaseSlabBlock(getBlock(BLOCK_PLANKS));
return new BaseSlabBlock(getBlock(BLOCK_PLANKS), false);
}).setBlockTags(NamedBlockTags.WOODEN_SLABS, NamedBlockTags.SLABS).setItemTags(NamedItemTags.WOODEN_SLABS, NamedItemTags.SLABS));
addBlockEntry(new BlockEntry(BLOCK_FENCE, (complexMaterial, settings) -> {
return new BaseFenceBlock(getBlock(BLOCK_PLANKS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public NetherWoodenMaterial init() {
@Override
protected FabricBlockSettings getBlockSettings() {
return FabricBlockSettings.copyOf(Blocks.WARPED_PLANKS)
.materialColor(planksColor);
.mapColor(planksColor);
}

protected void _initBase(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ protected void initDefault(FabricBlockSettings blockSettings, FabricItemSettings
return new BaseBlock(FabricBlockSettings.copyOf(getBlock(BLOCK_PLANKS)));
}));
addBlockEntry(new BlockEntry(BLOCK_ROOF_STAIRS, (complexMaterial, settings) -> {
return new BaseStairsBlock(getBlock(BLOCK_ROOF));
return new BaseStairsBlock(getBlock(BLOCK_ROOF), false);
}));
addBlockEntry(new BlockEntry(BLOCK_ROOF_SLAB, (complexMaterial, settings) -> {
return new BaseSlabBlock(getBlock(BLOCK_ROOF));
return new BaseSlabBlock(getBlock(BLOCK_ROOF), false);
}));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/paulevs/betternether/items/NetherArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class NetherArmor extends BaseArmorItem implements InitialStackStateProvider {
public NetherArmor(ArmorMaterial material, EquipmentSlot slot) {
super(material, slot, NetherItems.defaultSettings());
super(material, slot, NetherItems.defaultSettings().fireResistant());
}

static final Map<Enchantment, Integer> DEFAULT_RUBY_ENCHANTS;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/paulevs/betternether/items/NetherAxe.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package paulevs.betternether.items;

import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.Tier;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.level.block.state.BlockState;
Expand Down
Loading

0 comments on commit 076ce9b

Please sign in to comment.