Skip to content

Commit

Permalink
Fixed missing cave population & tags
Browse files Browse the repository at this point in the history
  • Loading branch information
paulevsGitch committed Jun 21, 2021
1 parent bed07d2 commit 684f307
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 42 deletions.
1 change: 0 additions & 1 deletion src/main/java/ru/betterend/registry/EndBiomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ public static void mutateRegistry(Registry<Biome> biomeRegistry) {
hasCaves = JsonFactory.getBoolean(element.getAsJsonObject(), "has_caves", true);
}
EndBiome endBiome = new EndBiome(id, biome, fog, chance, hasCaves);
System.out.println("Added biome: " + endBiome);

if (isVoid) {
VOID_BIOMES.addBiomeMutable(endBiome);
Expand Down
47 changes: 6 additions & 41 deletions src/main/java/ru/betterend/registry/EndTags.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package ru.betterend.registry;

import java.util.List;
import java.util.function.Supplier;

import com.google.common.collect.Lists;

import net.fabricmc.fabric.api.tag.TagRegistry;
import net.fabricmc.fabric.impl.tool.attribute.ToolManagerImpl;
import net.fabricmc.fabric.impl.tool.attribute.handlers.ModdedToolsVanillaBlocksToolHandler;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.tags.Tag.Named;
import net.minecraft.tags.TagCollection;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.biome.Biome;
Expand All @@ -39,43 +33,12 @@ public class EndTags {
// https://fabricmc.net/wiki/tutorial:tags

// Block Tags
public static final Tag.Named<Block> PEDESTALS = makeBlockTag("pedestal");
public static final Tag.Named<Block> END_STONES = makeCommonBlockTag("end_stones");
public static final Tag.Named<Block> DRAGON_IMMUNE = getMCBlockTag("dragon_immune");
public static final Tag.Named<Block> PEDESTALS = TagAPI.makeBlockTag(BetterEnd.MOD_ID, "pedestal");
public static final Tag.Named<Block> END_STONES = TagAPI.makeCommonBlockTag("end_stones");
public static final Tag.Named<Block> DRAGON_IMMUNE = TagAPI.getMCBlockTag("dragon_immune");

// Item Tags
public final static Tag.Named<Item> HAMMERS = makeFabricItemTag("hammers");

public static <T> Tag.Named<T> makeTag(Supplier<TagCollection<T>> containerSupplier, ResourceLocation id) {
Tag<T> tag = containerSupplier.get().getTag(id);
return tag == null ? TagRegistry.create(id, containerSupplier) : (Named<T>) tag;
}

public static Tag.Named<Block> makeBlockTag(String name) {
return makeTag(BlockTags::getAllTags, BetterEnd.makeID(name));
}

public static Tag.Named<Item> makeItemTag(String name) {
return makeTag(ItemTags::getAllTags, BetterEnd.makeID(name));
}

public static Tag.Named<Block> makeCommonBlockTag(String name) {
return makeTag(BlockTags::getAllTags, new ResourceLocation("c", name));
}

public static Tag.Named<Item> makeCommonItemTag(String name) {
return makeTag(ItemTags::getAllTags, new ResourceLocation("c", name));
}

public static Tag.Named<Item> makeFabricItemTag(String name) {
return makeTag(ItemTags::getAllTags, new ResourceLocation("fabric", name));
}

public static Tag.Named<Block> getMCBlockTag(String name) {
ResourceLocation id = new ResourceLocation(name);
Tag<Block> tag = BlockTags.getAllTags().getTag(id);
return tag == null ? (Named<Block>) TagRegistry.block(id) : (Named<Block>) tag;
}
public final static Tag.Named<Item> HAMMERS = TagAPI.makeItemTag("fabric", "hammers");

public static void register() {
TagAPI.addEndGround(EndBlocks.THALLASIUM.ore);
Expand Down Expand Up @@ -104,6 +67,8 @@ else if (block instanceof PedestalBlock) {
ComposterBlockAccessor.callAdd(0.1F, block);
}
});
TagAPI.addEndGround(EndBlocks.CAVE_MOSS);
TagHelper.addTag(BlockTags.NYLIUM, EndBlocks.CAVE_MOSS);
BonemealAPI.addSpreadableBlock(EndBlocks.CAVE_MOSS);

List<Item> hammers = Lists.newArrayList();
Expand Down

0 comments on commit 684f307

Please sign in to comment.