Code style changes, entities fixes
This commit is contained in:
parent
9d604b2d25
commit
44962e18b6
377 changed files with 5038 additions and 4914 deletions
|
@ -1,10 +1,6 @@
|
|||
package ru.betterend.util;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -20,6 +16,9 @@ import ru.betterend.blocks.BlueVineBlock;
|
|||
import ru.betterend.blocks.basis.FurBlock;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class BlockFixer {
|
||||
private static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
private static final BlockState WATER = Blocks.WATER.defaultBlockState();
|
||||
|
|
|
@ -10,46 +10,46 @@ public class BonemealPlants {
|
|||
BonemealAPI.addLandGrass(EndBlocks.UMBRELLA_MOSS, EndBlocks.END_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBlocks.CREEPING_MOSS, EndBlocks.END_MYCELIUM);
|
||||
BonemealAPI.addLandGrass(EndBlocks.UMBRELLA_MOSS, EndBlocks.END_MYCELIUM);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBlocks.CAVE_GRASS, EndBlocks.CAVE_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBlocks.CHORUS_GRASS, EndBlocks.CHORUS_NYLIUM);
|
||||
BonemealAPI.addLandGrass(EndBlocks.CRYSTAL_GRASS, EndBlocks.CRYSTAL_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBlocks.SHADOW_PLANT, EndBlocks.SHADOW_GRASS);
|
||||
BonemealAPI.addLandGrass(EndBlocks.BUSHY_GRASS, EndBlocks.PINK_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBlocks.AMBER_GRASS, EndBlocks.AMBER_MOSS);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBlocks.JUNGLE_GRASS, EndBlocks.JUNGLE_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBlocks.TWISTED_UMBRELLA_MOSS, EndBlocks.JUNGLE_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBlocks.JUNGLE_MOSS, EndBlocks.SMALL_JELLYSHROOM, 0.1F);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.BLOOMING_COOKSONIA, EndBlocks.END_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.VAIOLUSH_FERN, EndBlocks.END_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.FRACTURN, EndBlocks.END_MOSS);
|
||||
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.SALTEAGO, EndBlocks.END_MOSS);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.END_MOSS, EndBlocks.CREEPING_MOSS, 0.1F);
|
||||
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.END_MOSS, EndBlocks.UMBRELLA_MOSS, 0.1F);
|
||||
BonemealAPI.addLandGrass(EndBiomes.GLOWING_GRASSLANDS.getID(), EndBlocks.END_MOSS, EndBlocks.TWISTED_UMBRELLA_MOSS, 0.1F);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBlocks.ORANGO, EndBlocks.RUTISCUS);
|
||||
BonemealAPI.addLandGrass(EndBlocks.RUTISCUS, EndBlocks.AERIDIUM, 0.2F);
|
||||
BonemealAPI.addLandGrass(EndBlocks.RUTISCUS, EndBlocks.LUTEBUS, 0.2F);
|
||||
BonemealAPI.addLandGrass(EndBlocks.RUTISCUS, EndBlocks.LAMELLARIUM);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.RUTISCUS, EndBlocks.AERIDIUM, 0.2F);
|
||||
BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.LAMELLARIUM, EndBlocks.RUTISCUS);
|
||||
BonemealAPI.addLandGrass(EndBiomes.LANTERN_WOODS.getID(), EndBlocks.RUTISCUS, EndBlocks.BOLUX_MUSHROOM, 0.05F);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBlocks.GLOBULAGUS, EndBlocks.SANGNUM, EndBlocks.MOSSY_OBSIDIAN, EndBlocks.MOSSY_DRAGON_BONE);
|
||||
BonemealAPI.addLandGrass(EndBlocks.CLAWFERN, EndBlocks.SANGNUM, EndBlocks.MOSSY_OBSIDIAN, EndBlocks.MOSSY_DRAGON_BONE);
|
||||
BonemealAPI.addLandGrass(EndBlocks.SANGNUM, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
|
||||
BonemealAPI.addLandGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
|
||||
BonemealAPI.addLandGrass(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBlocks.GLOBULAGUS, EndBlocks.MOSSY_DRAGON_BONE);
|
||||
BonemealAPI.addLandGrass(EndBlocks.CLAWFERN, EndBlocks.MOSSY_DRAGON_BONE);
|
||||
BonemealAPI.addLandGrass(EndBlocks.MOSSY_DRAGON_BONE, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
|
||||
|
||||
|
||||
BonemealAPI.addLandGrass(EndBlocks.GLOBULAGUS, EndBlocks.MOSSY_OBSIDIAN);
|
||||
BonemealAPI.addLandGrass(EndBlocks.CLAWFERN, EndBlocks.MOSSY_OBSIDIAN);
|
||||
BonemealAPI.addLandGrass(EndBlocks.MOSSY_OBSIDIAN, EndBlocks.SMALL_AMARANITA_MUSHROOM, 0.1F);
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
package ru.betterend.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
|
@ -16,6 +10,11 @@ import ru.betterend.mixin.common.BiomeGenerationSettingsAccessor;
|
|||
import ru.betterend.registry.EndFeatures;
|
||||
import ru.betterend.registry.EndStructures;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FeaturesHelper {
|
||||
private static final Set<Biome> INJECTED = Sets.newHashSet();
|
||||
|
||||
|
@ -37,6 +36,6 @@ public class FeaturesHelper {
|
|||
accessor.be_setStructures(structures);
|
||||
INJECTED.add(biome);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,19 +1,17 @@
|
|||
package ru.betterend.util;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
||||
public class ItemUtil {
|
||||
|
||||
|
||||
public static String toStackString(@NotNull ItemStack stack) {
|
||||
try {
|
||||
if (stack == null) {
|
||||
|
@ -21,12 +19,13 @@ public class ItemUtil {
|
|||
}
|
||||
Item item = stack.getItem();
|
||||
return Registry.ITEM.getKey(item) + ":" + stack.getCount();
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BetterEnd.LOGGER.error("ItemStack serialization error!", ex);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static ItemStack fromStackString(String stackString) {
|
||||
if (stackString == null || stackString.equals("")) {
|
||||
|
@ -47,12 +46,13 @@ public class ItemUtil {
|
|||
return new IllegalStateException("Output item " + itemId + " does not exists!");
|
||||
});
|
||||
return new ItemStack(item, Integer.valueOf(parts[2]));
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BetterEnd.LOGGER.error("ItemStack deserialization error!", ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static ItemStack fromJsonRecipe(JsonObject recipe) {
|
||||
try {
|
||||
|
@ -65,7 +65,8 @@ public class ItemUtil {
|
|||
});
|
||||
int count = GsonHelper.getAsInt(recipe, "count", 1);
|
||||
return new ItemStack(item, count);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
catch (Exception ex) {
|
||||
BetterEnd.LOGGER.error("ItemStack deserialization error!", ex);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -5,33 +5,33 @@ import net.minecraft.network.chat.TranslatableComponent;
|
|||
|
||||
public class LangUtil {
|
||||
public final static String CONFIG_ELEMENT = "configuration";
|
||||
|
||||
|
||||
private String element;
|
||||
|
||||
|
||||
public LangUtil(String element) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
|
||||
public void setElement(String key) {
|
||||
this.element = key;
|
||||
}
|
||||
|
||||
|
||||
public String getString(String key) {
|
||||
return getString(element, key);
|
||||
}
|
||||
|
||||
|
||||
public TranslatableComponent getText(String key) {
|
||||
return getText(element, key);
|
||||
}
|
||||
|
||||
|
||||
public static String translate(String key) {
|
||||
return I18n.get(key);
|
||||
}
|
||||
|
||||
|
||||
public static String getString(String element, String key) {
|
||||
return translate(String.format("%s.%s", element, key));
|
||||
}
|
||||
|
||||
|
||||
public static TranslatableComponent getText(String element, String key) {
|
||||
return new TranslatableComponent(getString(element, key));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class LootTableUtil {
|
|||
builder.withCondition(LootItemRandomChanceCondition.randomChance(0.5f).build());
|
||||
builder.withEntry(LootItem.lootTableItem(Items.GHAST_TEAR).build());
|
||||
supplier.withPool(builder);
|
||||
|
||||
|
||||
builder = FabricLootPoolBuilder.builder();
|
||||
builder.setRolls(UniformGenerator.between(0, 5));
|
||||
builder.withCondition(LootItemRandomChanceCondition.randomChance(0.1f).build());
|
||||
|
|
|
@ -8,11 +8,12 @@ public class RecipeHelper {
|
|||
public static boolean exists(ItemLike item) {
|
||||
if (item instanceof Block) {
|
||||
return Registry.BLOCK.getKey((Block) item) != Registry.BLOCK.getDefaultKey();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return Registry.ITEM.getKey(item.asItem()) != Registry.ITEM.getDefaultKey();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean exists(ItemLike... items) {
|
||||
for (ItemLike item : items) {
|
||||
if (!exists(item)) {
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package ru.betterend.util;
|
||||
|
||||
import net.minecraft.world.entity.ai.behavior.ShufflingList;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public interface ShuffelingListExtended<U> {
|
||||
public boolean isEmpty();
|
||||
public U getOne();
|
||||
public boolean isEmpty();
|
||||
|
||||
public U getOne();
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@ public class SpawnHelper {
|
|||
public static <T extends Mob> void restrictionAir(EntityType<T> entity, SpawnPredicate<T> predicate) {
|
||||
SpawnRestrictionAccessor.callRegister(entity, Type.NO_RESTRICTIONS, Types.MOTION_BLOCKING, predicate);
|
||||
}
|
||||
|
||||
|
||||
public static <T extends Mob> void restrictionLand(EntityType<T> entity, SpawnPredicate<T> predicate) {
|
||||
SpawnRestrictionAccessor.callRegister(entity, Type.ON_GROUND, Types.MOTION_BLOCKING, predicate);
|
||||
}
|
||||
|
||||
|
||||
public static <T extends Mob> void restrictionWater(EntityType<T> entity, SpawnPredicate<T> predicate) {
|
||||
SpawnRestrictionAccessor.callRegister(entity, Type.IN_WATER, Types.MOTION_BLOCKING, predicate);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue