Wooden crucibles/barrels are now furnace fuels
This commit is contained in:
parent
a86082b028
commit
d5a671ca20
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Ex Deorum
|
||||
* Copyright (c) 2024 thedarkcolour
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package thedarkcolour.exdeorum.item;
|
||||
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
// BlockItem except it is furnace fuel
|
||||
public class WoodenBlockItem extends BlockItem {
|
||||
public WoodenBlockItem(Block block, Properties properties) {
|
||||
super(block, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) {
|
||||
return 300;
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import thedarkcolour.exdeorum.registry.EItems;
|
||||
|
||||
public abstract class AbstractMaterial implements ItemLike {
|
||||
// The sound this block makes (a string corresponding to a field in SoundType or a JSON object with the five sound events used to create a sound type)
|
||||
|
|
@ -51,6 +52,10 @@ public abstract class AbstractMaterial implements ItemLike {
|
|||
|
||||
protected abstract Block createBlock();
|
||||
|
||||
protected BlockItem createBlockItem(Block block) {
|
||||
return new BlockItem(block, EItems.props());
|
||||
}
|
||||
|
||||
protected BlockBehaviour.Properties props() {
|
||||
var properties = BlockBehaviour.Properties.of().strength(this.strength).sound(this.soundType);
|
||||
if (this.needsCorrectTool) properties.requiresCorrectToolForDrops();
|
||||
|
|
|
|||
|
|
@ -18,10 +18,13 @@
|
|||
|
||||
package thedarkcolour.exdeorum.material;
|
||||
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import thedarkcolour.exdeorum.block.BarrelBlock;
|
||||
import thedarkcolour.exdeorum.item.WoodenBlockItem;
|
||||
import thedarkcolour.exdeorum.registry.EItems;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -48,6 +51,15 @@ public class BarrelMaterial extends AbstractMaterial {
|
|||
return new BarrelBlock(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockItem createBlockItem(Block block) {
|
||||
if (!this.fireproof) {
|
||||
return new WoodenBlockItem(block, EItems.props());
|
||||
} else {
|
||||
return super.createBlockItem(block);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static BarrelMaterial readFromJson(MaterialParser parser) {
|
||||
SoundType soundType = parser.getSoundType();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.google.common.base.Preconditions;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
|
@ -98,7 +99,7 @@ public class MaterialRegistry<M extends AbstractMaterial> implements Iterable<M>
|
|||
}
|
||||
|
||||
material.block = EBlocks.BLOCKS.register(id, material::createBlock);
|
||||
material.item = EItems.registerItemBlock(material.block);
|
||||
material.item = EItems.ITEMS.register(id, () -> material.createBlockItem(material.block.get()));
|
||||
this.values.add(material);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,12 @@
|
|||
|
||||
package thedarkcolour.exdeorum.material;
|
||||
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import thedarkcolour.exdeorum.block.WaterCrucibleBlock;
|
||||
import thedarkcolour.exdeorum.item.WoodenBlockItem;
|
||||
import thedarkcolour.exdeorum.registry.EItems;
|
||||
|
||||
public class WaterCrucibleMaterial extends AbstractCrucibleMaterial {
|
||||
protected WaterCrucibleMaterial(SoundType soundType, float strength, boolean needsCorrectTool, int mapColor, String requiredModId, boolean transparent) {
|
||||
|
|
@ -31,4 +34,9 @@ public class WaterCrucibleMaterial extends AbstractCrucibleMaterial {
|
|||
protected Block createBlock() {
|
||||
return new WaterCrucibleBlock(props().noOcclusion());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockItem createBlockItem(Block block) {
|
||||
return new WoodenBlockItem(block, EItems.props());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user