Removed color provider

This commit is contained in:
paulevsGitch 2021-07-10 16:25:34 +03:00
parent 2c8862a37b
commit 4040597a6d
475 changed files with 5411 additions and 7521 deletions

View file

@ -15,12 +15,12 @@ public class FlamboyantRefabricatedIntegration extends ModIntegration {
public FlamboyantRefabricatedIntegration() {
super("flamboyant");
}
@Override
public void init() {
Map<Integer, String> colors = Maps.newHashMap();
Map<Integer, ItemLike> dyes = Maps.newHashMap();
addColor("fead1d", "amber", colors, dyes);
addColor("bd9a5f", "beige", colors, dyes);
addColor("edeada", "cream", colors, dyes);
@ -37,15 +37,15 @@ public class FlamboyantRefabricatedIntegration extends ModIntegration {
addColor("6bb1cf", "sky_blue", colors, dyes);
addColor("6e8c9c", "slate_gray", colors, dyes);
addColor("b02454", "violet", colors, dyes);
new ColoredMaterial(HydraluxPetalColoredBlock::new, EndBlocks.HYDRALUX_PETAL_BLOCK, colors, dyes, true);
}
private void addColor(String hex, String name, Map<Integer, String> colors, Map<Integer, ItemLike> dyes) {
int color = ColorUtil.color(hex);
colors.put(color, name);
dyes.put(color, getItem(name + "_dye"));
System.out.println(name + " " + color + " " + new Color(color));
}
}

View file

@ -18,35 +18,29 @@ public class Integrations {
public static final ModIntegration BYG = ModIntegrationAPI.register(new BYGIntegration());
public static final ModIntegration NOURISH = ModIntegrationAPI.register(new NourishIntegration());
public static final ModIntegration FLAMBOYANT_REFABRICATED = ModIntegrationAPI.register(new FlamboyantRefabricatedIntegration());
private static boolean hasHydrogen;
public static void init() {
if (hasGuideBook()) {
GuideBookItem.register();
PlayerAdvancementsCallback.PLAYER_ADVANCEMENT_COMPLETE.register((player, advancement, criterionName) -> {
ResourceLocation advId = new ResourceLocation("minecraft:end/enter_end_gateway");
if (advId.equals(advancement.getId())) {
player.addItem(new ItemStack(GuideBookItem.GUIDE_BOOK));
}
});
GridRecipe.make(BetterEnd.MOD_ID, "guide_book", GuideBookItem.GUIDE_BOOK)
.checkConfig(Configs.RECIPE_CONFIG)
.setShape("D", "B", "C")
.addMaterial('D', EndItems.ENDER_DUST)
.addMaterial('B', Items.BOOK)
.addMaterial('C', EndItems.CRYSTAL_SHARDS)
.build();
GridRecipe.make(BetterEnd.MOD_ID, "guide_book", GuideBookItem.GUIDE_BOOK).checkConfig(Configs.RECIPE_CONFIG).setShape("D", "B", "C").addMaterial('D', EndItems.ENDER_DUST).addMaterial('B', Items.BOOK).addMaterial('C', EndItems.CRYSTAL_SHARDS).build();
}
hasHydrogen = FabricLoader.getInstance().isModLoaded("hydrogen");
}
public static boolean hasGuideBook() {
return FabricLoader.getInstance().isModLoaded("patchouli");
}
public static boolean hasHydrogen() {
return hasHydrogen;
}

View file

@ -10,46 +10,17 @@ public class NourishIntegration extends ModIntegration {
public NourishIntegration() {
super("nourish");
}
@Override
public void init() {
Tag.Named<Item> fats = getItemTag("fats");
Tag.Named<Item> fruit = getItemTag("fruit");
Tag.Named<Item> protein = getItemTag("protein");
Tag.Named<Item> sweets = getItemTag("sweets");
TagHelper.addTag(
fats,
EndItems.END_FISH_RAW,
EndItems.END_FISH_COOKED
);
TagHelper.addTag(
fruit,
EndItems.SHADOW_BERRY_RAW,
EndItems.SHADOW_BERRY_COOKED,
EndItems.BLOSSOM_BERRY,
EndItems.SHADOW_BERRY_JELLY,
EndItems.SWEET_BERRY_JELLY,
EndItems.BLOSSOM_BERRY_JELLY,
EndItems.AMBER_ROOT_RAW,
EndItems.CHORUS_MUSHROOM_RAW,
EndItems.CHORUS_MUSHROOM_COOKED,
EndItems.BOLUX_MUSHROOM_COOKED
);
TagHelper.addTag(
protein,
EndItems.END_FISH_RAW,
EndItems.END_FISH_COOKED,
EndItems.CHORUS_MUSHROOM_COOKED,
EndItems.BOLUX_MUSHROOM_COOKED,
EndItems.CAVE_PUMPKIN_PIE
);
TagHelper.addTag(
sweets,
EndItems.SHADOW_BERRY_JELLY,
EndItems.SWEET_BERRY_JELLY,
EndItems.BLOSSOM_BERRY_JELLY,
EndItems.CAVE_PUMPKIN_PIE
);
TagHelper.addTag(fats, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED);
TagHelper.addTag(fruit, EndItems.SHADOW_BERRY_RAW, EndItems.SHADOW_BERRY_COOKED, EndItems.BLOSSOM_BERRY, EndItems.SHADOW_BERRY_JELLY, EndItems.SWEET_BERRY_JELLY, EndItems.BLOSSOM_BERRY_JELLY, EndItems.AMBER_ROOT_RAW, EndItems.CHORUS_MUSHROOM_RAW, EndItems.CHORUS_MUSHROOM_COOKED, EndItems.BOLUX_MUSHROOM_COOKED);
TagHelper.addTag(protein, EndItems.END_FISH_RAW, EndItems.END_FISH_COOKED, EndItems.CHORUS_MUSHROOM_COOKED, EndItems.BOLUX_MUSHROOM_COOKED, EndItems.CAVE_PUMPKIN_PIE);
TagHelper.addTag(sweets, EndItems.SHADOW_BERRY_JELLY, EndItems.SWEET_BERRY_JELLY, EndItems.BLOSSOM_BERRY_JELLY, EndItems.CAVE_PUMPKIN_PIE);
}
}

View file

@ -8,9 +8,9 @@ import ru.betterend.registry.EndBlocks;
public class BYGBlocks {
public static final Block IVIS_MOSS = EndBlocks.registerBlock("ivis_moss", new EndWallPlantBlock());
public static final Block NIGHTSHADE_MOSS = EndBlocks.registerBlock("nightshade_moss", new EndWallPlantBlock());
public static final Block IVIS_VINE = EndBlocks.registerBlock("ivis_vine", new BaseVineBlock());
public static void register() {
}
}

View file

@ -23,7 +23,7 @@ public class BYGIntegration extends ModIntegration implements EndBiomeIntegratio
public BYGIntegration() {
super("byg");
}
@Override
public void init() {
Block block = Integrations.BYG.getBlock("ivis_phylium");
@ -34,14 +34,14 @@ public class BYGIntegration extends ModIntegration implements EndBiomeIntegratio
BYGFeatures.register();
BYGBiomes.register();
}
@Override
public void addBiomes() {
BYGBiomes.addBiomes();
Class<?> biomeClass = this.getClass("corgiaoc.byg.common.world.biome.BYGEndBiome");
List<Object> biomes = this.getStaticFieldValue(biomeClass, "BYG_END_BIOMES");
if (biomes != null && biomeClass != null) {
biomes.forEach((obj) -> {
Biome biome = this.getAndExecuteRuntime(biomeClass, obj, "getBiome");

View file

@ -9,11 +9,11 @@ public class BYGBiomes {
public static final EndBiome OLD_BULBIS_GARDENS = EndBiomes.registerSubBiomeIntegration(new OldBulbisGardens());
public static final EndBiome NIGHTSHADE_REDWOODS = EndBiomes.registerSubBiomeIntegration(new NightshadeRedwoods());
//public static final EndBiome ETHERIAL_GROVE = EndBiomes.registerSubBiomeIntegration(new EterialGrove());
public static void register() {
System.out.println("Registered " + OLD_BULBIS_GARDENS);
}
public static void addBiomes() {
EndBiomes.addSubBiomeIntegration(OLD_BULBIS_GARDENS, Integrations.BYG.getID("bulbis_gardens"));
EndBiomes.addSubBiomeIntegration(NIGHTSHADE_REDWOODS, Integrations.BYG.getID("nightshade_forest"));

View file

@ -21,25 +21,13 @@ public class NightshadeRedwoods extends EndBiome {
public NightshadeRedwoods() {
super(makeDef());
}
private static BCLBiomeDef makeDef() {
Biome biome = Integrations.BYG.getBiome("nightshade_forest");
BiomeSpecialEffects effects = biome.getSpecialEffects();
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("nightshade_redwoods"))
.setFogColor(140, 108, 47)
.setFogDensity(1.5F)
.setWaterAndFogColor(55, 70, 186)
.setFoliageColor(122, 17, 155)
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
.setSurface(biome.getGenerationSettings().getSurfaceBuilder().get())
.setGrassColor(48, 13, 89)
.setPlantsColor(200, 125, 9)
.addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE)
.addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD)
.addFeature(BYGFeatures.NIGHTSHADE_MOSS);
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("nightshade_redwoods")).setFogColor(140, 108, 47).setFogDensity(1.5F).setWaterAndFogColor(55, 70, 186).setFoliageColor(122, 17, 155).setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(biome.getGenerationSettings().getSurfaceBuilder().get()).setGrassColor(48, 13, 89).setPlantsColor(200, 125, 9).addFeature(EndFeatures.END_LAKE_RARE).addFeature(BYGFeatures.NIGHTSHADE_REDWOOD_TREE).addFeature(BYGFeatures.NIGHTSHADE_MOSS_WOOD).addFeature(BYGFeatures.NIGHTSHADE_MOSS);
if (BCLib.isClient()) {
SoundEvent loop = effects.getAmbientLoopSoundEvent().get();
SoundEvent music = effects.getBackgroundMusic().get().getEvent();
@ -52,14 +40,14 @@ public class NightshadeRedwoods extends EndBiome {
def.addFeature(Decoration.VEGETAL_DECORATION, feature.get());
});
});
for (MobCategory group : MobCategory.values()) {
List<SpawnerData> list = biome.getMobSettings().getMobs(group).unwrap();
list.forEach((entry) -> {
def.addMobSpawn(entry);
});
}
return def;
}
}

View file

@ -27,7 +27,7 @@ import java.util.function.Supplier;
class FeaturesAccesor extends Features {
static ConfiguredDecorator<?> shadowHEIGHTMAP_SQUARE;
static {
shadowHEIGHTMAP_SQUARE = Decorators.HEIGHTMAP_SQUARE;
}
@ -37,23 +37,15 @@ public class OldBulbisGardens extends EndBiome {
public OldBulbisGardens() {
super(makeDef());
}
private static BCLBiomeDef makeDef() {
Biome biome = Integrations.BYG.getBiome("bulbis_gardens");
BiomeSpecialEffects effects = biome.getSpecialEffects();
Block ivis = Integrations.BYG.getBlock("ivis_phylium");
Block origin = biome.getGenerationSettings().getSurfaceBuilderConfig().getTopMaterial().getBlock();
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("old_bulbis_gardens"))
.setFogColor(215, 132, 207)
.setFogDensity(1.8F)
.setWaterAndFogColor(40, 0, 56)
.setFoliageColor(122, 17, 155)
.setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F)
.setSurface(ivis, origin)
.addFeature(EndFeatures.END_LAKE_RARE)
.addFeature(BYGFeatures.OLD_BULBIS_TREE);
BCLBiomeDef def = new BCLBiomeDef(BetterEnd.makeID("old_bulbis_gardens")).setFogColor(215, 132, 207).setFogDensity(1.8F).setWaterAndFogColor(40, 0, 56).setFoliageColor(122, 17, 155).setParticles(ParticleTypes.REVERSE_PORTAL, 0.002F).setSurface(ivis, origin).addFeature(EndFeatures.END_LAKE_RARE).addFeature(BYGFeatures.OLD_BULBIS_TREE);
if (BCLib.isClient()) {
SoundEvent loop = effects.getAmbientLoopSoundEvent().get();
SoundEvent music = effects.getBackgroundMusic().get().getEvent();
@ -61,14 +53,14 @@ public class OldBulbisGardens extends EndBiome {
SoundEvent mood = effects.getAmbientMoodSettings().get().getSoundEvent();
def.setLoop(loop).setMusic(music).setAdditions(additions).setMood(mood);
}
for (MobCategory group : MobCategory.values()) {
List<SpawnerData> list = biome.getMobSettings().getMobs(group).unwrap();
list.forEach((entry) -> {
def.addMobSpawn(entry);
});
}
List<List<Supplier<ConfiguredFeature<?, ?>>>> features = biome.getGenerationSettings().features();
List<Supplier<ConfiguredFeature<?, ?>>> vegetal = features.get(Decoration.VEGETAL_DECORATION.ordinal());
if (vegetal.size() > 2) {
@ -89,13 +81,9 @@ public class OldBulbisGardens extends EndBiome {
def.addFeature(Decoration.VEGETAL_DECORATION, feature);
}
}
def.addFeature(EndFeatures.PURPLE_POLYPORE)
.addFeature(BYGFeatures.IVIS_MOSS_WOOD)
.addFeature(BYGFeatures.IVIS_MOSS)
.addFeature(BYGFeatures.IVIS_VINE)
.addFeature(BYGFeatures.IVIS_SPROUT);
def.addFeature(EndFeatures.PURPLE_POLYPORE).addFeature(BYGFeatures.IVIS_MOSS_WOOD).addFeature(BYGFeatures.IVIS_MOSS).addFeature(BYGFeatures.IVIS_VINE).addFeature(BYGFeatures.IVIS_SPROUT);
return def;
}
}

View file

@ -19,13 +19,13 @@ public class BYGFeatures {
public static final BCLFeature IVIS_MOSS_WOOD = redisterVegetation("ivis_moss_wood", new WallPlantOnLogFeature(BYGBlocks.IVIS_MOSS, 6), 15);
public static final BCLFeature NIGHTSHADE_MOSS = redisterVegetation("nightshade_moss", new WallPlantFeature(BYGBlocks.NIGHTSHADE_MOSS, 5), 2);
public static final BCLFeature NIGHTSHADE_MOSS_WOOD = redisterVegetation("nightshade_moss_wood", new WallPlantOnLogFeature(BYGBlocks.NIGHTSHADE_MOSS, 5), 8);
public static final BCLFeature NIGHTSHADE_REDWOOD_TREE = redisterVegetation("nightshade_redwood_tree", new NightshadeRedwoodTreeFeature(), 1);
public static final BCLFeature BIG_ETHER_TREE = redisterVegetation("big_ether_tree", new BigEtherTreeFeature(), 1);
public static void register() {
}
private static BCLFeature redisterVegetation(String name, Feature<NoneFeatureConfiguration> feature, int density) {
return BCLFeature.makeVegetationFeature(BetterEnd.makeID(name), feature, density);
}

View file

@ -24,24 +24,22 @@ public class BigEtherTreeFeature extends DefaultFeature {
final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
return false;
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
BlockState log = Integrations.BYG.getDefaultState("ether_log");
BlockState wood = Integrations.BYG.getDefaultState("ether_wood");
Function<BlockPos, BlockState> splinePlacer = (bpos) -> {
return log;
};
Function<BlockState, Boolean> replace = (state) -> {
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().isReplaceable();
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
};
int height = MHelper.randRange(40, 60, random);
List<Vector3f> trunk = SplineHelper.makeSpline(0, 0, 0, 0, height, 0, height / 4);
SplineHelper.offsetParts(trunk, random, 2F, 0, 2F);
SDF sdf = SplineHelper.buildSDF(trunk, 2.3F, 0.8F, splinePlacer);
int count = height / 15;
for (int i = 1; i < count; i++) {
float splinePos = (float) i / (float) count;
@ -57,22 +55,21 @@ public class BigEtherTreeFeature extends DefaultFeature {
List<Vector3f> br = SplineHelper.copySpline(branch);
SplineHelper.offsetParts(br, random, 0, 1, 1);
SplineHelper.rotateSpline(br, angle);
SplineHelper.offset(br, start);
SplineHelper.fillSpline(br, world, wood, pos, replace);
}
}
sdf.setReplaceFunction((state) -> {
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().isReplaceable();
return state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT) || state.getMaterial().isReplaceable();
}).addPostProcess((info) -> {
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
return wood;
}
return info.getState();
}).fillRecursive(world, pos);
return true;
}
}

View file

@ -32,26 +32,24 @@ import java.util.Random;
public class NightshadeRedwoodTreeFeature extends DefaultFeature {
private static final List<Vector3f> BRANCH;
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
return false;
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
BlockState wood = Integrations.BYG.getDefaultState("nightshade_wood");
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(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|| state.getMaterial().isReplaceable();
return state.is(TagAPI.END_GROUND) || 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))) {
@ -62,15 +60,15 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
Function<BlockState, Boolean> ignore = (state) -> {
return 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);
SplineHelper.offsetParts(trunk, random, 0.8F, 0, 0.8F);
if (!SplineHelper.canGenerate(trunk, pos, world, replace)) {
return false;
}
int count = height >> 2;
float start = trunk.size() / 3F;
float delta = trunk.size() * 0.6F;
@ -89,11 +87,10 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
SplineHelper.offset(branch, offset);
SplineHelper.fillSpline(branch, world, wood, pos, replace);
}
SDF sdf = SplineHelper.buildSDF(trunk, 2.3F, 0.8F, splinePlacer);
SDF roots = new SDFSphere().setRadius(2F).setBlock(log);
roots = new SDFFlatWave().setIntensity(2F).setRaysCount(MHelper.randRange(5, 7, random))
.setAngle(random.nextFloat() * MHelper.PI2).setSource(roots);
roots = new SDFFlatWave().setIntensity(2F).setRaysCount(MHelper.randRange(5, 7, random)).setAngle(random.nextFloat() * MHelper.PI2).setSource(roots);
sdf = new SDFSmoothUnion().setRadius(2F).setSourceA(sdf).setSourceB(roots);
sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos);
Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.35F);
@ -101,7 +98,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, 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);
if (world.isEmptyBlock(p)) {
@ -123,7 +120,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
}
}
}
MutableBlockPos mut = new MutableBlockPos();
Function<PosInfo, BlockState> leavesPost1 = (info) -> {
if (info.getState().equals(log) || info.getState().equals(wood)) {
@ -173,19 +170,17 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
}
return info.getState();
};
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.addPostProcess(leavesPost1).addPostProcess(leavesPost2).fillRecursiveIgnore(world,
pos.offset(0, height * 0.75, 0), ignore);
canopy.addPostProcess(leavesPost1).addPostProcess(leavesPost2).fillRecursiveIgnore(world, pos.offset(0, height * 0.75, 0), ignore);
return true;
}
static {
BRANCH = Lists.newArrayList(new Vector3f(0, 0, 0), new Vector3f(0.25F, 0.1F, 0), new Vector3f(0.40F, 0.2F, 0),
new Vector3f(0.50F, 0.4F, 0), new Vector3f(0.55F, 0.6F, 0));
BRANCH = Lists.newArrayList(new Vector3f(0, 0, 0), new Vector3f(0.25F, 0.1F, 0), new Vector3f(0.40F, 0.2F, 0), new Vector3f(0.50F, 0.4F, 0), new Vector3f(0.55F, 0.6F, 0));
}
}

View file

@ -33,31 +33,27 @@ public class OldBulbisTreeFeature extends DefaultFeature {
private static final List<Vector3f> ROOT;
private static final List<Vector3f> LEAF;
private static final List<Vector3f> SIDE;
@Override
public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig) {
final Random random = featureConfig.random();
final BlockPos pos = featureConfig.origin();
final WorldGenLevel world = featureConfig.level();
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND))
return false;
if (!world.getBlockState(pos.below(4)).is(TagAPI.GEN_TERRAIN))
return false;
if (!world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) return false;
if (!world.getBlockState(pos.below(4)).is(TagAPI.GEN_TERRAIN)) return false;
BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem");
BlockState wood = Integrations.BYG.getDefaultState("bulbis_wood");
BlockState cap = Integrations.BYG
.getDefaultState(random.nextBoolean() ? "bulbis_shell" : "purple_bulbis_shell");
BlockState cap = Integrations.BYG.getDefaultState(random.nextBoolean() ? "bulbis_shell" : "purple_bulbis_shell");
BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight");
Function<BlockState, Boolean> replacement = (state) -> {
if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.END_GROUND)
|| state.getMaterial().equals(Material.PLANT)) {
if (state.equals(stem) || state.equals(wood) || state.is(TagAPI.END_GROUND) || state.getMaterial().equals(Material.PLANT)) {
return true;
}
return state.getMaterial().isReplaceable();
};
float size = MHelper.randRange(10, 20, random);
float addSize = MHelper.randRange(1, 1.7F, random);
float addRad = addSize * 0.5F + 0.5F;
@ -80,50 +76,48 @@ public class OldBulbisTreeFeature extends DefaultFeature {
SDF branch = SplineHelper.buildSDF(spline, 2.3F * addRad, 1.3F * addRad, (bpos) -> {
return 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);
vec = SplineHelper.getPos(spline, 0.3F);
makeRoots(world, pos.offset(vec.x(), vec.y(), vec.z()), size * 0.4F + 5, random, wood, replacement);
sdf = (sdf == null) ? branch : new SDFUnion().setSourceA(sdf).setSourceB(branch);
}
sdf.setReplaceFunction(replacement).addPostProcess((info) -> {
if (info.getState().equals(stem)
&& (!info.getStateUp().equals(stem) || !info.getStateDown().equals(stem))) {
if (info.getState().equals(stem) && (!info.getStateUp().equals(stem) || !info.getStateDown().equals(stem))) {
return wood;
}
return info.getState();
}).fillArea(world, pos, limits);
return true;
}
private void bigSphere(WorldGenLevel world, BlockPos pos, float radius, BlockState cap, BlockState glow,
BlockState wood, Function<BlockState, Boolean> replacement, Random random) {
private void bigSphere(WorldGenLevel world, BlockPos pos, float radius, BlockState cap, BlockState glow, BlockState wood, Function<BlockState, Boolean> replacement, Random random) {
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
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);
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 SDFSubtraction().setSourceA(sphereGlow).setSourceB(sphereInner);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sphereGlow);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sphereInner);
float offsetY = radius * 1.7F;
sphere = new SDFUnion().setSourceA(sphere).setSourceB(sphereGlow);
sphere = new SDFTranslate().setTranslate(0, offsetY, 0).setSource(sphere);
int leafCount = (int) (radius * 0.5F) + 2;
for (int i = 0; i < 4; i++) {
float angle = (float) i / 4 * MHelper.PI2;
@ -131,13 +125,13 @@ public class OldBulbisTreeFeature extends DefaultFeature {
SplineHelper.rotateSpline(spline, angle);
SplineHelper.scale(spline, radius * 1.4F);
SplineHelper.fillSplineForce(spline, world, wood, pos, replacement);
for (int j = 0; j < leafCount; j++) {
float delta = ((float) j / (float) (leafCount - 1));
float scale = (float) Math.sin(delta * Math.PI) * 0.8F + 0.2F;
float index = Mth.lerp(delta, 1F, 3.9F);
Vector3f point = SplineHelper.getPos(spline, index);
List<Vector3f> side = SplineHelper.copySpline(SIDE);
SplineHelper.rotateSpline(side, angle);
SplineHelper.scale(side, scale * radius);
@ -145,17 +139,16 @@ public class OldBulbisTreeFeature extends DefaultFeature {
SplineHelper.fillSplineForce(side, world, wood, p, replacement);
}
}
sphere.fillArea(world, pos, new AABB(pos.above((int) offsetY)).inflate(radius * 1.3F));
}
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood,
Function<BlockState, Boolean> replacement) {
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood, Function<BlockState, Boolean> replacement) {
int count = (int) (radius * 1.5F);
for (int i = 0; i < count; i++) {
float angle = (float) i / (float) count * MHelper.PI2;
float scale = radius * MHelper.randRange(0.85F, 1.15F, random);
List<Vector3f> branch = SplineHelper.copySpline(ROOT);
SplineHelper.rotateSpline(branch, angle);
SplineHelper.scale(branch, scale);
@ -165,20 +158,15 @@ public class OldBulbisTreeFeature extends DefaultFeature {
}
}
}
static {
SPLINE = Lists.newArrayList(new Vector3f(0.00F, 0.00F, 0.00F), new Vector3f(0.10F, 0.35F, 0.00F),
new Vector3f(0.20F, 0.50F, 0.00F), new Vector3f(0.30F, 0.55F, 0.00F), new Vector3f(0.42F, 0.70F, 0.00F),
new Vector3f(0.50F, 1.00F, 0.00F));
ROOT = Lists.newArrayList(new Vector3f(0F, 1F, 0), new Vector3f(0.1F, 0.70F, 0), new Vector3f(0.3F, 0.30F, 0),
new Vector3f(0.7F, 0.05F, 0), new Vector3f(0.8F, -0.20F, 0));
SPLINE = Lists.newArrayList(new Vector3f(0.00F, 0.00F, 0.00F), new Vector3f(0.10F, 0.35F, 0.00F), new Vector3f(0.20F, 0.50F, 0.00F), new Vector3f(0.30F, 0.55F, 0.00F), new Vector3f(0.42F, 0.70F, 0.00F), new Vector3f(0.50F, 1.00F, 0.00F));
ROOT = Lists.newArrayList(new Vector3f(0F, 1F, 0), new Vector3f(0.1F, 0.70F, 0), new Vector3f(0.3F, 0.30F, 0), new Vector3f(0.7F, 0.05F, 0), new Vector3f(0.8F, -0.20F, 0));
SplineHelper.offset(ROOT, new Vector3f(0, -0.45F, 0));
LEAF = Lists.newArrayList(new Vector3f(0.00F, 0.0F, 0), new Vector3f(0.10F, 0.4F, 0),
new Vector3f(0.40F, 0.8F, 0), new Vector3f(0.75F, 0.9F, 0), new Vector3f(1.00F, 0.8F, 0));
SIDE = Lists.newArrayList(new Vector3f(0, -0.3F, -0.5F), new Vector3f(0, -0.1F, -0.3F),
new Vector3f(0, 0.0F, 0.0F), new Vector3f(0, -0.1F, 0.3F), new Vector3f(0, -0.3F, 0.5F));
LEAF = Lists.newArrayList(new Vector3f(0.00F, 0.0F, 0), new Vector3f(0.10F, 0.4F, 0), new Vector3f(0.40F, 0.8F, 0), new Vector3f(0.75F, 0.9F, 0), new Vector3f(1.00F, 0.8F, 0));
SIDE = Lists.newArrayList(new Vector3f(0, -0.3F, -0.5F), new Vector3f(0, -0.1F, -0.3F), new Vector3f(0, 0.0F, 0.0F), new Vector3f(0, -0.1F, 0.3F), new Vector3f(0, -0.3F, 0.5F));
}
}

View file

@ -22,26 +22,26 @@ import java.util.List;
public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingDisplay> {
private final EntryStack ICON;
REIAlloyingCategory(EntryStack icon) {
ICON = icon;
}
@Override
public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.ALLOYING;
}
@Override
public @NotNull Component getTitle() {
return new TranslatableComponent(EndBlocks.END_STONE_SMELTER.getDescriptionId());
}
@Override
public @NotNull EntryStack getIcon() {
return ICON;
}
@Override
public @NotNull List<Widget> setupDisplay(REIAlloyingDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
@ -51,8 +51,7 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createResultSlotBackground(new Point(startPoint.x + 61, startPoint.y + 9)));
widgets.add(Widgets.createBurningFire(new Point(startPoint.x - 9, startPoint.y + 20)).animationDurationMS(10000));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5),
new TranslatableComponent("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 5, bounds.y + 5), new TranslatableComponent("category.rei.cooking.time&xp", df.format(display.getXp()), df.format(smeltTime / 20D))).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
List<EntryIngredient> inputEntries = display.getInputEntries();
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1)).entries(inputEntries.get(0)).markInput());
@ -65,10 +64,9 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput());
return widgets;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display,
IntList redSlots) {
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAlloyingDisplay display, IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose();
matrices.translate(0, 0, 400);
@ -78,7 +76,7 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
}
matrices.popPose();
}
@Override
public int getDisplayHeight() {
return 49;

View file

@ -21,79 +21,73 @@ import java.util.Optional;
import java.util.stream.Collectors;
public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
private static List<EntryStack> fuel;
private Recipe<?> recipe;
private float xp;
private double smeltTime;
public REIAlloyingDisplay(AlloyingRecipe recipe) {
this(recipe, recipe.getExperience(), recipe.getSmeltTime());
}
protected REIAlloyingDisplay(Recipe<?> recipe, float xp, double smeltTime) {
super(
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
);
super(EntryIngredients.ofIngredients(recipe.getIngredients()), Collections.singletonList(EntryIngredients.of(recipe.getResultItem())));
this.recipe = recipe;
this.xp = xp;
this.smeltTime = smeltTime;
}
public static List<EntryStack> getFuel() {
return fuel;
}
@Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId);
}
@Override
public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.ALLOYING;
}
// @Override
// public @NotNull List<List<EntryStack>> getRequiredEntries() {
// return this.input;
// }
public float getXp() {
return this.xp;
}
public double getSmeltTime() {
return this.smeltTime;
}
public Optional<Recipe<?>> getOptionalRecipe() {
return Optional.ofNullable(recipe);
}
@Override
public int getWidth() {
return 2;
}
@Override
public int getHeight() {
return 1;
}
// @Override
// public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) {
// return this.input;
// }
static {
fuel = EndStoneSmelterBlockEntity.availableFuels().keySet().stream()
.map(Item::getDefaultInstance).map(EntryStacks::of)
.map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableComponent("category.rei.smelting.fuel")
.withStyle(ChatFormatting.YELLOW)))).collect(Collectors.toList());
fuel = EndStoneSmelterBlockEntity.availableFuels().keySet().stream().map(Item::getDefaultInstance).map(EntryStacks::of).map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(new TranslatableComponent("category.rei.smelting.fuel").withStyle(ChatFormatting.YELLOW)))).collect(Collectors.toList());
}
}

View file

@ -25,60 +25,58 @@ import java.util.List;
public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelDisplay> {
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
@Override
public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.ALLOYING_FUEL;
}
@Override
public @NotNull Component getTitle() {
return new TranslatableComponent("category.rei.fuel");
}
@Override
public int getDisplayHeight() {
return 49;
}
@Override
public @NotNull EntryStack getIcon() {
return EntryStacks.of(Items.COAL);
}
@Override
public List<Widget> setupDisplay(REIAlloyingFuelDisplay recipeDisplay, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 17);
String burnTime = DECIMAL_FORMAT.format(recipeDisplay.getFuelTime());
List<Widget> widgets = Lists.newArrayList();
widgets.add(Widgets.createRecipeBase(bounds));
widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 15), new TranslatableComponent("category.rei.fuel.time", burnTime))
.color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
widgets.add(Widgets.createLabel(new Point(bounds.x + 26, bounds.getMaxY() - 15), new TranslatableComponent("category.rei.fuel.time", burnTime)).color(0xFF404040, 0xFFBBBBBB).noShadow().leftAligned());
widgets.add(Widgets.createBurningFire(new Point(bounds.x + 6, startPoint.y + 1)).animationDurationTicks(recipeDisplay.getFuelTime()));
widgets.add(Widgets.createSlot(new Point(bounds.x + 6, startPoint.y + 18)).entries(recipeDisplay.getInputEntries().get(0)).markInput());
return widgets;
}
@Override
public DisplayRenderer getDisplayRenderer(REIAlloyingFuelDisplay recipe) {
Slot slot = Widgets.createSlot(new Point(0, 0)).entries(recipe.getInputEntries().get(0)).disableBackground().disableHighlight();
String burnItems = DECIMAL_FORMAT.format(recipe.getFuelTime() / 200d);
return new DisplayRenderer() {
private TranslatableComponent text = new TranslatableComponent("category.rei.fuel.time_short.items", burnItems);
@Override
public int getHeight() {
return 22;
}
@Nullable
@Override
public Tooltip getTooltip(Point point) {
if (slot.containsMouse(point))
return slot.getCurrentTooltip(point);
if (slot.containsMouse(point)) return slot.getCurrentTooltip(point);
return null;
}
@Override
public void render(PoseStack matrices, Rectangle bounds, int mouseX, int mouseY, float delta) {
slot.setZ(getZ() + 50);

View file

@ -10,11 +10,11 @@ import java.util.List;
public class REIAlloyingFuelDisplay extends BasicDisplay {
private final int fuelTime;
public REIAlloyingFuelDisplay(List<EntryIngredient> fuel, CompoundTag tag) {
this(fuel, tag.getInt("fuelTime"));
}
public REIAlloyingFuelDisplay(List<EntryIngredient> fuel, int fuelTime) {
super(fuel, Collections.emptyList());
this.fuelTime = fuelTime;
@ -23,14 +23,14 @@ public class REIAlloyingFuelDisplay extends BasicDisplay {
this.fuel = fuel;
this.fuelTime = fuelTime;
}*/
@Override
public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.ALLOYING_FUEL;
}
public int getFuelTime() {
return fuelTime;
}
}

View file

@ -27,27 +27,27 @@ import java.util.stream.Collectors;
public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay> {
private final EntryStack[] ANVILS;
REIAnvilCategory(EntryStack[] anvils) {
ANVILS = anvils;
}
@Override
public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.SMITHING;
}
@Override
public @NotNull Component getTitle() {
return new TranslatableComponent(Blocks.ANVIL.getDescriptionId());
}
@Override
public @NotNull EntryStack getIcon() {
return ANVILS[0];
}
@Override
public @NotNull List<Widget> setupDisplay(REIAnvilDisplay display, Rectangle bounds) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.y + 10);
@ -72,19 +72,17 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
}).collect(Collectors.toList());
//materials.forEach(entryStack -> entryStack.setAmount(display.getInputCount()));
widgets.add(Widgets.createArrow(new Point(x + 24, y + 4)));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15),
new TranslatableComponent("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createLabel(new Point(bounds.x + bounds.width - 7, bounds.y + bounds.height - 15), new TranslatableComponent("category.rei.damage.amount&dmg", display.getDamage())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
widgets.add(Widgets.createSlot(new Point(x - 20, y + 4)).entries(materials).markInput());
widgets.add(Widgets.createSlot(new Point(x + 1, y + 4)).entries(inputEntries.get(0)).markInput());
widgets.add(Widgets.createSlot(new Point(x + 61, y + 5)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput());
widgets.add(Widgets.createSlot(new Point(x - 9, y + 25)).entries(anvils));
return widgets;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display,
IntList redSlots) {
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIAnvilDisplay display, IntList redSlots) {
Point startPoint = new Point(bounds.getCenterX() - 41, bounds.getCenterY() - 27);
matrices.pushPose();
matrices.translate(0, 0, 400);
@ -94,10 +92,10 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
}
matrices.popPose();
}
@Override
public int getDisplayHeight() {
return 60;
}
}

View file

@ -13,54 +13,51 @@ import java.util.Collections;
import java.util.Optional;
public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
private final AnvilRecipe recipe;
public REIAnvilDisplay(AnvilRecipe recipe) {
super(
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
);
super(EntryIngredients.ofIngredients(recipe.getIngredients()), Collections.singletonList(EntryIngredients.of(recipe.getResultItem())));
this.recipe = recipe;
}
public int getDamage() {
return recipe.getDamage();
}
public int getInputCount() {
return recipe.getInputCount();
}
public int getAnvilLevel() {
return recipe.getAnvilLevel();
}
@Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId);
}
@Override
public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.SMITHING;
}
// @Override
// public @NotNull List<List<EntryStack>> getRequiredEntries() {
// return input;
// }
@Override
public int getWidth() {
return 2;
}
@Override
public int getHeight() {
return 1;
}
// @Override
// public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo,
// AbstractContainerMenu container) {

View file

@ -1,7 +1,7 @@
package ru.betterend.integration.rei;
public class REIContainer implements Runnable {
@Override
public void run() {
//ContainerInfoHandler.registerContainerInfo(AlloyingRecipe.ID, CraftingContainerInfoWrapper.create(EndStoneSmelterScreenHandler.class));

View file

@ -22,29 +22,29 @@ import java.util.ArrayList;
import java.util.List;
public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionDisplay> {
private final static ResourceLocation BACKGROUND = BetterEnd.makeID("textures/gui/rei_infusion.png");
private final EntryStack ICON;
REIInfusionCategory(EntryStack icon) {
ICON = icon;
}
@Override
public @NotNull CategoryIdentifier getCategoryIdentifier() {
return REIPlugin.INFUSION;
}
@Override
public @NotNull Component getTitle() {
return new TranslatableComponent(EndBlocks.INFUSION_PEDESTAL.getDescriptionId());
}
@Override
public @NotNull EntryStack getIcon() {
return ICON;
}
@Override
public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) {
Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2);
@ -71,23 +71,15 @@ public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionD
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0)).disableBackground().markOutput());
widgets.add(
Widgets.createLabel(
new Point(bounds.getMaxX() - 5, bounds.y + 6),
new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime())
)
.noShadow()
.rightAligned()
.color(0xFF404040, 0xFFBBBBBB)
);
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 6), new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime())).noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB));
return widgets;
}
@Override
public int getDisplayHeight() {
return 104;
}
@Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIInfusionDisplay display, IntList redSlots) {}
}

View file

@ -13,48 +13,45 @@ import java.util.Collections;
import java.util.Optional;
public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDisplay {
private final InfusionRecipe recipe;
private final int time;
public REIInfusionDisplay(InfusionRecipe recipe) {
super(
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
);
super(EntryIngredients.ofIngredients(recipe.getIngredients()), Collections.singletonList(EntryIngredients.of(recipe.getResultItem())));
this.recipe = recipe;
this.time = recipe.getInfusionTime();
}
public int getInfusionTime() {
return this.time;
}
@Override
public @NotNull Optional<ResourceLocation> getDisplayLocation() {
return Optional.ofNullable(recipe).map(Recipe::getId);
}
@Override
public CategoryIdentifier<?> getCategoryIdentifier() {
return REIPlugin.INFUSION;
}
// @Override
// public @NotNull List<List<EntryStack>> getRequiredEntries() {
// return this.input;
// }
@Override
public int getWidth() {
return 0;
}
@Override
public int getHeight() {
return 0;
}
// @Override
// public List<List<EntryStack>> getOrganisedInputEntries(ContainerInfo<AbstractContainerMenu> containerInfo, AbstractContainerMenu container) {
// return this.input;

View file

@ -34,39 +34,36 @@ public class REIPlugin implements REIClientPlugin {
public final static CategoryIdentifier ALLOYING = CategoryIdentifier.of(BetterEnd.MOD_ID, AlloyingRecipe.GROUP);
public final static CategoryIdentifier SMITHING = CategoryIdentifier.of(BetterEnd.MOD_ID, AnvilRecipe.ID.getPath());
public final static CategoryIdentifier INFUSION = CategoryIdentifier.of(BetterEnd.MOD_ID, InfusionRecipe.GROUP);
private EntryStack END_STONE_SMELTER;
private EntryStack INFUSION_RITUAL;
private EntryStack[] ANVILS;
private EntryStack[] FURNACES;
void init() {
//we need to initialize those variables after the static initialization
//otherwise the registry does not know the BlockItems
if (END_STONE_SMELTER != null) {
return;
}
END_STONE_SMELTER = EntryStacks.of(EndBlocks.END_STONE_SMELTER);
INFUSION_RITUAL = EntryStacks.of(EndBlocks.INFUSION_PEDESTAL);
List<EntryStack> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream()
.filter(EndAnvilBlock.class::isInstance).collect(Collectors.toList())));
List<EntryStack> anvils = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(EndAnvilBlock.class::isInstance).collect(Collectors.toList())));
anvils.add(0, EntryStacks.of(Blocks.ANVIL));
ANVILS = anvils.toArray(new EntryStack[0]);
FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream()
.filter(BaseFurnaceBlock.class::isInstance).collect(Collectors.toList())))
.toArray(new EntryStack[0]);
FURNACES = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(BaseFurnaceBlock.class::isInstance).collect(Collectors.toList()))).toArray(new EntryStack[0]);
}
@Override
public void registerDisplays(DisplayRegistry registry) {
registry.registerRecipeFiller(AlloyingRecipe.class, AlloyingRecipe.TYPE, REIAlloyingDisplay::new);
registry.registerRecipeFiller(BlastingRecipe.class, RecipeType.BLASTING, REIBlastingDisplay::new);
registry.registerRecipeFiller(AnvilRecipe.class, AnvilRecipe.TYPE, REIAnvilDisplay::new);
registry.registerRecipeFiller(InfusionRecipe.class, InfusionRecipe.TYPE, REIInfusionDisplay::new);
FuelRegistryImpl.INSTANCE.getFuelTimes().forEach((item, time) -> {
if (time >= 2000) {
final List<EntryIngredient> list = Arrays.asList(EntryIngredients.of(item));
@ -74,25 +71,20 @@ public class REIPlugin implements REIClientPlugin {
}
});
}
@Override
public void registerCategories(CategoryRegistry registry) {
init();
registry.add(
new REIAlloyingFuelCategory(),
new REIAlloyingCategory(END_STONE_SMELTER),
new REIInfusionCategory(INFUSION_RITUAL),
new REIAnvilCategory(ANVILS)
);
registry.add(new REIAlloyingFuelCategory(), new REIAlloyingCategory(END_STONE_SMELTER), new REIInfusionCategory(INFUSION_RITUAL), new REIAnvilCategory(ANVILS));
registry.addWorkstations(ALLOYING_FUEL, END_STONE_SMELTER);
registry.addWorkstations(ALLOYING, END_STONE_SMELTER);
registry.addWorkstations(INFUSION, INFUSION_RITUAL);
registry.addWorkstations(SMITHING, ANVILS);
registry.removePlusButton(ALLOYING_FUEL);
registry.removePlusButton(SMITHING);
registry.addWorkstations(DefaultPlugin.SMELTING, FURNACES);
registry.addWorkstations(DefaultPlugin.FUEL, FURNACES);
}