Fixed most compiletime errors

This commit is contained in:
Frank 2023-04-29 11:48:56 +02:00
parent e232184b68
commit a974fab707
58 changed files with 449 additions and 679 deletions

View file

@ -4,7 +4,6 @@ import org.betterx.bclib.api.v2.ModIntegrationAPI;
import org.betterx.bclib.integration.ModIntegration;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.config.Configs;
import org.betterx.betterend.events.PlayerAdvancementsCallback;
import org.betterx.betterend.integration.byg.BYGIntegration;
import org.betterx.betterend.item.GuideBookItem;
@ -35,7 +34,6 @@ public class Integrations {
});
BCLRecipeBuilder.crafting(BetterEnd.makeID("guide_book"), GuideBookItem.GUIDE_BOOK)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("D", "B", "C")
.addMaterial('D', EndItems.ENDER_DUST)
.addMaterial('B', Items.BOOK)

View file

@ -26,11 +26,11 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.Material;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import org.joml.Vector3f;
import java.util.List;
import java.util.function.Function;
public class NightshadeRedwoodTreeFeature extends DefaultFeature {
private static final List<Vector3f> BRANCH;
@ -47,23 +47,17 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
BlockState leaves = Integrations.BYG.getDefaultState("nightshade_leaves");
BlockState leaves_flower = Integrations.BYG.getDefaultState("flowering_nightshade_leaves");
Function<BlockPos, BlockState> splinePlacer = (bpos) -> {
return log;
};
Function<BlockState, Boolean> replace = (state) -> {
return state.is(CommonBlockTags.END_STONES) || state.getMaterial()
.equals(Material.PLANT) || state.getMaterial()
.isReplaceable();
};
Function<BlockPos, BlockState> splinePlacer = (bpos) -> log;
Function<BlockState, Boolean> replace = (state) -> state.is(CommonBlockTags.END_STONES) || state.getMaterial()
.equals(Material.PLANT) || state.getMaterial()
.isReplaceable();
Function<PosInfo, BlockState> post = (info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
return wood;
}
return info.getState();
};
Function<BlockState, Boolean> ignore = (state) -> {
return state.equals(log) || state.equals(wood);
};
Function<BlockState, Boolean> ignore = (state) -> state.equals(log) || state.equals(wood);
int height = MHelper.randRange(40, 60, random);
List<Vector3f> trunk = SplineHelper.makeSpline(0, 0, 0, 0, height, 0, height / 4);
@ -102,12 +96,12 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos);
Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.35F);
for (int y = 0; y < 8; y++) {
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
BlockPos p = pos.offset((int) (last.x() + 0.5), (int) (last.y() + y), (int) (last.z() + 0.5));
BlocksHelper.setWithoutUpdate(world, p, y == 4 ? wood : log);
}
for (int y = 0; y < 16; y++) {
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
BlockPos p = pos.offset((int) (last.x() + 0.5), (int) (last.y() + y), (int) (last.z() + 0.5));
if (world.isEmptyBlock(p)) {
BlocksHelper.setWithoutUpdate(world, p, leaves);
}
@ -162,8 +156,8 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
if (distance > MHelper.randRange(2, 4, random)) {
return Blocks.AIR.defaultBlockState();
}
int airCount = 0;
for (Direction d : BlocksHelper.DIRECTIONS) {
int airCount = 0;
if (info.getState(d).isAir()) {
airCount++;
}
@ -179,12 +173,10 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
};
SDF canopy = new SDFCappedCone().setRadius1(12F).setRadius2(1f).setHeight(height * 0.3F).setBlock(leaves);
canopy = new SDFDisplacement().setFunction((vec) -> {
return MHelper.randRange(-3F, 3F, random);
}).setSource(canopy);
canopy = new SDFDisplacement().setFunction((vec) -> MHelper.randRange(-3F, 3F, random)).setSource(canopy);
canopy.addPostProcess(leavesPost1)
.addPostProcess(leavesPost2)
.fillRecursiveIgnore(world, pos.offset(0, height * 0.75, 0), ignore);
.fillRecursiveIgnore(world, pos.offset(0, (int) (height * 0.75), 0), ignore);
return true;
}

View file

@ -78,15 +78,29 @@ public class OldBulbisTreeFeature extends DefaultFeature {
SplineHelper.offset(spline, new Vector3f(size * random.nextFloat() * 0.3F, 0, 0));
SplineHelper.rotateSpline(spline, angle);
SplineHelper.offsetParts(spline, random, 1F, 0, 1F);// 1.3F 0.8F
SDF branch = SplineHelper.buildSDF(spline, 2.3F * addRad, 1.3F * addRad, (bpos) -> {
return stem;
});
SDF branch = SplineHelper.buildSDF(spline, 2.3F * addRad, 1.3F * addRad, (bpos) -> stem);
Vector3f vec = spline.get(spline.size() - 1);
float radius = (size + MHelper.randRange(0, size * 0.5F, random)) * 0.35F;
bigSphere(world, pos.offset(vec.x(), vec.y(), vec.z()), radius, cap, glow, wood, replacement, random);
bigSphere(
world,
pos.offset((int) vec.x(), (int) vec.y(), (int) vec.z()),
radius,
cap,
glow,
wood,
replacement,
random
);
vec = SplineHelper.getPos(spline, 0.3F);
makeRoots(world, pos.offset(vec.x(), vec.y(), vec.z()), size * 0.4F + 5, random, wood, replacement);
makeRoots(
world,
pos.offset((int) vec.x(), (int) vec.y(), (int) vec.z()),
size * 0.4F + 5,
random,
wood,
replacement
);
sdf = (sdf == null) ? branch : new SDFUnion().setSourceA(sdf).setSourceB(branch);
}
@ -116,14 +130,18 @@ public class OldBulbisTreeFeature extends DefaultFeature {
SDF sphere = new SDFSphere().setRadius(radius).setBlock(cap);
SDF sphereInner = new SDFSphere().setRadius(radius * 0.53F).setBlock(Blocks.AIR);
sphereInner = new SDFDisplacement().setFunction((vec) -> {
return (float) noise.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1);
}).setSource(sphereInner);
sphereInner = new SDFDisplacement().setFunction((vec) -> (float) noise.eval(
vec.x() * 0.1,
vec.y() * 0.1,
vec.z() * 0.1
)).setSource(sphereInner);
SDF sphereGlow = new SDFSphere().setRadius(radius * 0.6F).setBlock(glow);
sphereGlow = new SDFDisplacement().setFunction((vec) -> {
return (float) noise.eval(vec.x() * 0.1, vec.y() * 0.1, vec.z() * 0.1) * 2F;
}).setSource(sphereGlow);
sphereGlow = new SDFDisplacement().setFunction((vec) -> (float) noise.eval(
vec.x() * 0.1,
vec.y() * 0.1,
vec.z() * 0.1
) * 2F).setSource(sphereGlow);
sphereGlow = new SDFSubtraction().setSourceA(sphereGlow).setSourceB(sphereInner);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sphereGlow);
@ -150,7 +168,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
List<Vector3f> side = SplineHelper.copySpline(SIDE);
SplineHelper.rotateSpline(side, angle);
SplineHelper.scale(side, scale * radius);
BlockPos p = pos.offset(point.x() + 0.5F, point.y() + 0.5F, point.z() + 0.5F);
BlockPos p = pos.offset((int) (point.x() + 0.5F), (int) (point.y() + 0.5F), (int) (point.z() + 0.5F));
SplineHelper.fillSplineForce(side, world, wood, p, replacement);
}
}
@ -175,7 +193,8 @@ public class OldBulbisTreeFeature extends DefaultFeature {
SplineHelper.rotateSpline(branch, angle);
SplineHelper.scale(branch, scale);
Vector3f last = branch.get(branch.size() - 1);
if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(CommonBlockTags.GEN_END_STONES)) {
if (world.getBlockState(pos.offset((int) last.x(), (int) last.y(), (int) last.z()))
.is(CommonBlockTags.GEN_END_STONES)) {
SplineHelper.fillSpline(branch, world, wood, pos, replacement);
}
}

View file

@ -46,7 +46,7 @@ public class EMIInfusionRecipe implements EmiRecipe {
public EMIInfusionRecipe(InfusionRecipe recipe) {
this.id = recipe.getId();
this.input = recipe.getIngredients().stream().map(i -> EmiIngredient.of(i)).toList();
this.output = List.of(EmiStack.of(recipe.getResultItem()));
this.output = List.of(EmiStack.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())));
}
static void addAllRecipes(EmiRegistry emiRegistry, RecipeManager manager) {

View file

@ -4,6 +4,7 @@ import org.betterx.bclib.recipes.AlloyingRecipe;
import org.betterx.betterend.blocks.entities.EndStoneSmelterBlockEntity;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
@ -38,7 +39,7 @@ public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDi
protected REIAlloyingDisplay(Recipe<?> recipe, float xp, double smeltTime) {
super(
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())))
);
this.recipe = recipe;
this.xp = xp;

View file

@ -2,6 +2,7 @@ package org.betterx.betterend.integration.rei;
import org.betterx.bclib.recipes.AnvilRecipe;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe;
@ -22,7 +23,7 @@ public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDispl
public REIAnvilDisplay(AnvilRecipe recipe) {
super(
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())))
);
this.recipe = recipe;

View file

@ -2,6 +2,7 @@ package org.betterx.betterend.integration.rei;
import org.betterx.betterend.recipe.builders.InfusionRecipe;
import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.Recipe;
@ -22,7 +23,7 @@ public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDi
public REIInfusionDisplay(InfusionRecipe recipe) {
super(
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
Collections.singletonList(EntryIngredients.of(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())))
);
this.recipe = recipe;
this.time = recipe.getInfusionTime();