Rubber tree fixes and fixes to the solid fuel generator
This commit is contained in:
parent
5bbb48b3e2
commit
c60a279876
12 changed files with 461 additions and 387 deletions
|
@ -28,9 +28,11 @@ import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.entity.FurnaceBlockEntity;
|
import net.minecraft.block.entity.FurnaceBlockEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.BucketItem;
|
import net.minecraft.item.BucketItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import reborncore.api.IToolDrop;
|
import reborncore.api.IToolDrop;
|
||||||
import reborncore.api.blockentity.InventoryProvider;
|
import reborncore.api.blockentity.InventoryProvider;
|
||||||
import reborncore.client.containerBuilder.IContainerProvider;
|
import reborncore.client.containerBuilder.IContainerProvider;
|
||||||
|
@ -45,6 +47,8 @@ import techreborn.TechReborn;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
import techreborn.init.TRBlockEntities;
|
import techreborn.init.TRBlockEntities;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@RebornRegister(TechReborn.MOD_ID)
|
@RebornRegister(TechReborn.MOD_ID)
|
||||||
public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider, IContainerProvider {
|
public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider, IContainerProvider {
|
||||||
|
|
||||||
|
@ -69,8 +73,12 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl
|
||||||
super(TRBlockEntities.SOLID_FUEL_GENEREATOR);
|
super(TRBlockEntities.SOLID_FUEL_GENEREATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getItemBurnTime(ItemStack stack) {
|
public static int getItemBurnTime(@NonNull ItemStack stack) {
|
||||||
return FurnaceBlockEntity.createFuelTimeMap().get(stack) / 4;
|
Map<Item, Integer> burnMap = FurnaceBlockEntity.createFuelTimeMap();
|
||||||
|
if(burnMap.containsKey(stack.getItem())){
|
||||||
|
return burnMap.get(stack.getItem()) / 4;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
|
|
||||||
package techreborn.world;
|
package techreborn.world;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.Biome.Category;
|
import net.minecraft.world.biome.Biome.Category;
|
||||||
|
@ -38,6 +40,9 @@ import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||||
import net.minecraft.world.gen.feature.OreFeatureConfig.Target;
|
import net.minecraft.world.gen.feature.OreFeatureConfig.Target;
|
||||||
import techreborn.init.TRContent;
|
import techreborn.init.TRContent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author drcrazy
|
* @author drcrazy
|
||||||
*
|
*
|
||||||
|
@ -48,18 +53,34 @@ public class WorldGenerator {
|
||||||
// return state != null && (state.getBlock() == Blocks.END_STONE);
|
// return state != null && (state.getBlock() == Blocks.END_STONE);
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
private static List<Biome> checkedBiomes = new ArrayList<>();
|
||||||
|
|
||||||
public static void initBiomeFeatures() {
|
public static void initBiomeFeatures() {
|
||||||
for (Biome biome : Registry.BIOME) {
|
for (Biome biome : Registry.BIOME) {
|
||||||
|
addToBiome(biome);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Handles modded biomes
|
||||||
|
RegistryEntryAddedCallback.event(Registry.BIOME).register((i, identifier, biome) -> addToBiome(biome));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addToBiome(Biome biome){
|
||||||
|
if(checkedBiomes.contains(biome)){
|
||||||
|
//Just to be sure we dont add the stuff twice to the same biome
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
checkedBiomes.add(biome);
|
||||||
|
|
||||||
if (biome.getCategory() == Category.NETHER) {
|
if (biome.getCategory() == Category.NETHER) {
|
||||||
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.CINNABAR);
|
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.CINNABAR);
|
||||||
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.PYRITE);
|
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.PYRITE);
|
||||||
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.SPHALERITE);
|
addOre(biome, OreFeatureConfig.Target.NETHERRACK, TRContent.Ores.SPHALERITE);
|
||||||
|
|
||||||
} else if (biome.getCategory() == Category.THEEND) {
|
} else if (biome.getCategory() == Category.THEEND) {
|
||||||
// addOre(biome, IS_ENDSTONE, TRContent.Ores.PERIDOT);
|
// addOre(biome, IS_ENDSTONE, TRContent.Ores.PERIDOT);
|
||||||
// addOre(biome, IS_ENDSTONE, TRContent.Ores.SHELDONITE);
|
// addOre(biome, IS_ENDSTONE, TRContent.Ores.SHELDONITE);
|
||||||
// addOre(biome, IS_ENDSTONE, TRContent.Ores.SODALITE);
|
// addOre(biome, IS_ENDSTONE, TRContent.Ores.SODALITE);
|
||||||
// addOre(biome, IS_ENDSTONE, TRContent.Ores.TUNGSTEN);
|
// addOre(biome, IS_ENDSTONE, TRContent.Ores.TUNGSTEN);
|
||||||
} else {
|
} else {
|
||||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.BAUXITE);
|
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.BAUXITE);
|
||||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.COPPER);
|
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.COPPER);
|
||||||
|
@ -70,12 +91,12 @@ public class WorldGenerator {
|
||||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.SAPPHIRE);
|
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.SAPPHIRE);
|
||||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.SILVER);
|
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.SILVER);
|
||||||
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.TIN);
|
addOre(biome, OreFeatureConfig.Target.NATURAL_STONE, TRContent.Ores.TIN);
|
||||||
|
|
||||||
if (biome.getCategory() == Category.FOREST || biome.getCategory() == Category.TAIGA) {
|
if (biome.getCategory() == Category.FOREST || biome.getCategory() == Category.TAIGA) {
|
||||||
biome.addFeature(GenerationStep.Feature.VEGETAL_DECORATION,
|
biome.addFeature(GenerationStep.Feature.VEGETAL_DECORATION,
|
||||||
Biome.configureFeature(new RubberTreeFeature(DefaultFeatureConfig::deserialize, false),
|
Biome.configureFeature(new RubberTreeFeature(DefaultFeatureConfig::deserialize, false),
|
||||||
FeatureConfig.DEFAULT, Decorator.COUNT_EXTRA_HEIGHTMAP,
|
FeatureConfig.DEFAULT, Decorator.COUNT_EXTRA_HEIGHTMAP,
|
||||||
new CountExtraChanceDecoratorConfig(10, 0.1F, 1)));
|
new CountExtraChanceDecoratorConfig(1, 0.1F, 1)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,59 @@
|
||||||
{
|
{
|
||||||
"rolls": 1,
|
"rolls": 1,
|
||||||
"entries": [
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:alternatives",
|
||||||
|
"children": [
|
||||||
{
|
{
|
||||||
"type": "minecraft:item",
|
"type": "minecraft:item",
|
||||||
"name": "techreborn:rubber_leaves"
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:alternative",
|
||||||
|
"terms": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:match_tool",
|
||||||
|
"predicate": {
|
||||||
|
"item": "minecraft:shears"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:match_tool",
|
||||||
|
"predicate": {
|
||||||
|
"enchantments": [
|
||||||
|
{
|
||||||
|
"enchantment": "minecraft:silk_touch",
|
||||||
|
"levels": {
|
||||||
|
"min": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"name": "minecraft:rubber_leaves"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
"conditions": [
|
"conditions": [
|
||||||
{
|
{
|
||||||
"condition": "minecraft:survives_explosion"
|
"condition": "minecraft:survives_explosion"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"condition": "minecraft:table_bonus",
|
||||||
|
"enchantment": "minecraft:fortune",
|
||||||
|
"chances": [
|
||||||
|
0.05,
|
||||||
|
0.0625,
|
||||||
|
0.083333336,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "minecraft:rubber_sapling"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue