This commit is contained in:
paulevsGitch 2020-09-24 18:49:23 +03:00
parent 34e7c442e4
commit 36ea4b8726
8 changed files with 32 additions and 57 deletions

View file

@ -1,12 +1,8 @@
package ru.betterend;
import net.fabricmc.api.ModInitializer;
import net.minecraft.block.Blocks;
import net.minecraft.item.Items;
import net.minecraft.tag.ItemTags;
import ru.betterend.config.MainConfig;
import ru.betterend.recipe.CraftingRecipes;
import ru.betterend.recipe.RecipeBuilder;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.FeatureRegistry;
@ -27,25 +23,5 @@ public class BetterEnd implements ModInitializer {
BiomeRegistry.register();
BetterEndBiomeSource.register();
CraftingRecipes.register();
// TEST //
RecipeBuilder.make("test_block", Blocks.ANVIL)
.setShape(new String[] {"I#", "#I"})
.addMaterial('I', Items.STRING)
.addMaterial('#', Items.APPLE)
.build();
RecipeBuilder.make("test_block_shaped", Blocks.STONE)
.setShape(new String[] {"I#", "#I"})
.addMaterial('I', Items.STRING)
.addMaterial('#', ItemTags.LOGS)
.build();
RecipeBuilder.make("test_item_shapeless", Items.SUGAR)
.setList("I#Y")
.addMaterial('I', Items.STRING)
.addMaterial('#', ItemTags.LOGS)
.addMaterial('Y', ItemTags.ARROWS)
.build();
}
}

View file

@ -38,8 +38,7 @@ public class BlockOre extends OreBlock {
@Override
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.get(LootContextParameters.TOOL);
if (tool.isEffectiveOn(state))
{
if (tool != null && tool.isEffectiveOn(state)) {
int fortune = EnchantmentHelper.getLevel(Enchantments.FORTUNE, tool);
int min = MathHelper.clamp(minCount + fortune, 0, maxCount);
if (min == maxCount)

View file

@ -6,7 +6,6 @@ import net.minecraft.block.MaterialColor;
import net.minecraft.sound.BlockSoundGroup;
public class TerminiteBlock extends BlockBase {
public TerminiteBlock() {
super(FabricBlockSettings.of(Material.METAL, MaterialColor.field_25708)
.hardness(7F)

View file

@ -28,10 +28,10 @@ public class BackgroundRendererMixin {
private static float fogEnd;
private static float lerp;
private static final float SKY_RED = 21F / 255F;
private static final float SKY_GREEN = 16F / 255F;
private static final float SKY_BLUE = 20F / 255F;
//private static final float NORMAL = 0.12757292F;
//private static final float SKY_RED = 21F / 255F;
//private static final float SKY_GREEN = 16F / 255F;
//private static final float SKY_BLUE = 20F / 255F;
private static final float NORMAL = 1.5F/ 0.12757292F; // 0.12757292F is max value for red channel after all transformations
@Shadow
private static float red;
@ -47,10 +47,10 @@ public class BackgroundRendererMixin {
FluidState fluidState = camera.getSubmergedFluidState();
if (fluidState.isEmpty() && world.getDimension().hasEnderDragonFight()) {
RenderSystem.clearColor(SKY_RED, SKY_GREEN, SKY_BLUE, 0);
//red /= NORMAL;
//green /= NORMAL;
//blue /= NORMAL;
//RenderSystem.clearColor(SKY_RED, SKY_GREEN, SKY_BLUE, 0);
red *= NORMAL;
green *= NORMAL;
blue *= NORMAL;
}
}

View file

@ -17,8 +17,7 @@ import ru.betterend.world.generator.BetterEndBiomeSource;
public class DimensionTypeMixin
{
@Inject(method = "createEndGenerator", at = @At("HEAD"), cancellable = true)
private static void replaceGenerator(Registry<Biome> biomeRegistry, Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry, long seed, CallbackInfoReturnable<ChunkGenerator> info)
{
private static void replaceGenerator(Registry<Biome> biomeRegistry, Registry<ChunkGeneratorSettings> chunkGeneratorSettingsRegistry, long seed, CallbackInfoReturnable<ChunkGenerator> info) {
info.setReturnValue(new NoiseChunkGenerator(new BetterEndBiomeSource(biomeRegistry, seed), seed, () -> {
return (ChunkGeneratorSettings) chunkGeneratorSettingsRegistry.getOrThrow(ChunkGeneratorSettings.END);
}));

View file

@ -27,23 +27,22 @@ import net.minecraft.world.World;
import ru.betterend.recipe.EndRecipeManager;
@Mixin(RecipeManager.class)
public class RecipeManagerMixin
{
public class RecipeManagerMixin {
@Shadow
private Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes;
@Inject(method = "apply", at = @At(value = "RETURN"))
private void setRecipes(Map<Identifier, JsonElement> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info)
{
private void setRecipes(Map<Identifier, JsonElement> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) {
recipes = EndRecipeManager.getMap(recipes);
}
@Shadow
private <C extends Inventory, T extends Recipe<C>> Map<Identifier, Recipe<C>> getAllOfType(RecipeType<T> type) { return null; }
private <C extends Inventory, T extends Recipe<C>> Map<Identifier, Recipe<C>> getAllOfType(RecipeType<T> type) {
return null;
}
@Overwrite
public <C extends Inventory, T extends Recipe<C>> Optional<T> getFirstMatch(RecipeType<T> type, C inventory, World world)
{
public <C extends Inventory, T extends Recipe<C>> Optional<T> getFirstMatch(RecipeType<T> type, C inventory, World world) {
Collection<Recipe<C>> values = getAllOfType(type).values();
List<Recipe<C>> list = new ArrayList<Recipe<C>>(values);
list.sort((v1, v2) -> {
@ -53,7 +52,7 @@ public class RecipeManagerMixin
});
return list.stream().flatMap((recipe) -> {
return Util.stream(type.get(recipe, world, inventory));
}).findFirst();
}
return Util.stream(type.get(recipe, world, inventory));
}).findFirst();
}
}

View file

@ -21,13 +21,11 @@ public class CraftingRecipes {
}
}
protected static boolean itemExists(Item item)
{
protected static boolean itemExists(Item item) {
return Registry.ITEM.getId(item) != Registry.ITEM.getDefaultId();
}
protected static boolean blockExists(Block block)
{
protected static boolean blockExists(Block block) {
return Registry.BLOCK.getId(block) != Registry.BLOCK.getDefaultId();
}
}

View file

@ -15,9 +15,14 @@ import ru.betterend.blocks.TerminiteBlock;
import ru.betterend.tab.CreativeTab;
public class BlockRegistry {
// Terrain //
public static final Block ENDSTONE_DUST = registerBlock("endstone_dust", new BlockEndstoneDust());
public static final Block WET_MYCELIUM = registerBlock("wet_mycelium", new BlockWetMycelium());
// Ores //
public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(ItemRegistry.ENDER_DUST, 1, 3));
// Materials //
public static final Block TERMINITE_BLOCK = registerBlock("terminite_block", new TerminiteBlock());
public static final Block AETERNIUM_BLOCK = registerBlock("aeternium_block", new AeterniumBlock());
public static final Block ENDER_BLOCK = registerBlock("ender_block", new EnderBlock());