Update to BCLib 0.3.0

This commit is contained in:
paulevsGitch 2021-07-20 00:39:58 +03:00
parent 1a52251af0
commit b2431153dc
294 changed files with 7484 additions and 1440 deletions

View file

@ -32,7 +32,13 @@ public class Integrations {
}
});
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");
}

View file

@ -19,8 +19,33 @@ public class NourishIntegration extends ModIntegration {
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(
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

@ -62,7 +62,11 @@ public class BYGIntegration extends ModIntegration implements EndBiomeIntegratio
EndBiomes.LAND_BIOMES.removeMutableBiome(biomeID);
EndBiomes.VOID_BIOMES.addBiomeMutable(endBiome);
}
ShufflingList<ResourceLocation> subBiomes = this.getAndExecuteRuntime(biomeClass, obj, "getHills");
ShufflingList<ResourceLocation> subBiomes = this.getAndExecuteRuntime(
biomeClass,
obj,
"getHills"
);
if (subBiomes != null) {
subBiomes.stream().collect(Collectors.toList()).forEach((id) -> {
BCLBiome subBiome = BiomeAPI.getBiome(id);

View file

@ -26,7 +26,23 @@ public class NightshadeRedwoods extends EndBiome {
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();

View file

@ -44,7 +44,17 @@ public class OldBulbisGardens extends EndBiome {
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();
@ -71,7 +81,11 @@ public class OldBulbisGardens extends EndBiome {
getter = vegetal.get(i);
ConfiguredFeature<?, ?> feature = getter.get();
ResourceLocation id = BetterEnd.makeID("obg_feature_" + i);
feature = Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id, feature.decorated(FeaturesAccesor.shadowHEIGHTMAP_SQUARE).countRandom(1));
feature = Registry.register(
BuiltinRegistries.CONFIGURED_FEATURE,
id,
feature.decorated(FeaturesAccesor.shadowHEIGHTMAP_SQUARE).countRandom(1)
);
def.addFeature(Decoration.VEGETAL_DECORATION, feature);
}
// Grasses and other features
@ -82,7 +96,11 @@ public class OldBulbisGardens extends EndBiome {
}
}
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

@ -12,15 +12,47 @@ import ru.betterend.world.features.WallPlantFeature;
import ru.betterend.world.features.WallPlantOnLogFeature;
public class BYGFeatures {
public static final BCLFeature OLD_BULBIS_TREE = redisterVegetation("old_bulbis_tree", new OldBulbisTreeFeature(), 1);
public static final BCLFeature IVIS_SPROUT = redisterVegetation("ivis_sprout", new SinglePlantFeature(Integrations.BYG.getBlock("ivis_sprout"), 6, 2), 6);
public static final BCLFeature IVIS_VINE = redisterVegetation("ivis_vine", new VineFeature(BYGBlocks.IVIS_VINE, 24), 5);
public static final BCLFeature IVIS_MOSS = redisterVegetation("ivis_moss", new WallPlantFeature(BYGBlocks.IVIS_MOSS, 6), 1);
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 OLD_BULBIS_TREE = redisterVegetation(
"old_bulbis_tree",
new OldBulbisTreeFeature(),
1
);
public static final BCLFeature IVIS_SPROUT = redisterVegetation(
"ivis_sprout",
new SinglePlantFeature(Integrations.BYG.getBlock("ivis_sprout"), 6, 2),
6
);
public static final BCLFeature IVIS_VINE = redisterVegetation(
"ivis_vine",
new VineFeature(BYGBlocks.IVIS_VINE, 24),
5
);
public static final BCLFeature IVIS_MOSS = redisterVegetation(
"ivis_moss",
new WallPlantFeature(BYGBlocks.IVIS_MOSS, 6),
1
);
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 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() {

View file

@ -32,7 +32,8 @@ public class BigEtherTreeFeature extends DefaultFeature {
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);
@ -62,7 +63,8 @@ public class BigEtherTreeFeature extends DefaultFeature {
}
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;

View file

@ -49,7 +49,8 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
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))) {
@ -90,7 +91,10 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
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);
@ -175,12 +179,20 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
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

@ -48,7 +48,8 @@ public class OldBulbisTreeFeature extends DefaultFeature {
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();
@ -87,7 +88,8 @@ public class OldBulbisTreeFeature extends DefaultFeature {
}
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();
@ -160,13 +162,38 @@ 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));
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));
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));
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));
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

@ -50,18 +50,35 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
List<Widget> widgets = Lists.newArrayList();
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.createArrow(new Point(startPoint.x + 24, startPoint.y + 8)).animationDurationTicks(smeltTime));
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.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());
widgets.add(Widgets.createSlot(new Point(startPoint.x - 20, startPoint.y + 1))
.entries(inputEntries.get(0))
.markInput());
if (inputEntries.size() > 1) {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(inputEntries.get(1)).markInput());
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1))
.entries(inputEntries.get(1))
.markInput());
}
else {
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entries(Lists.newArrayList()).markInput());
widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1))
.entries(Lists.newArrayList())
.markInput());
}
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9)).entries(display.getOutputEntries().get(0)).disableBackground().markOutput());
widgets.add(Widgets.createSlot(new Point(startPoint.x + 61, startPoint.y + 9))
.entries(display.getOutputEntries().get(0))
.disableBackground()
.markOutput());
return widgets;
}
@ -71,8 +88,22 @@ public class REIAlloyingCategory implements TransferDisplayCategory<REIAlloyingD
matrices.pushPose();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
GuiComponent.fill(matrices, startPoint.x - 20, startPoint.y + 1, startPoint.x - 20 + 16, startPoint.y + 1 + 16, 1090453504);
GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 1, startPoint.x + 1 + 16, startPoint.y + 1 + 16, 1090453504);
GuiComponent.fill(
matrices,
startPoint.x - 20,
startPoint.y + 1,
startPoint.x - 20 + 16,
startPoint.y + 1 + 16,
1090453504
);
GuiComponent.fill(
matrices,
startPoint.x + 1,
startPoint.y + 1,
startPoint.x + 1 + 16,
startPoint.y + 1 + 16,
1090453504
);
}
matrices.popPose();
}

View file

@ -34,7 +34,10 @@ 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())));
super(
EntryIngredients.ofIngredients(recipe.getIngredients()),
Collections.singletonList(EntryIngredients.of(recipe.getResultItem()))
);
this.recipe = recipe;
this.xp = xp;
this.smeltTime = smeltTime;
@ -88,6 +91,16 @@ public class REIAlloyingDisplay extends BasicDisplay implements SimpleGridMenuDi
// }
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

@ -52,18 +52,30 @@ public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelD
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.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());
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();
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);
private TranslatableComponent text = new TranslatableComponent(
"category.rei.fuel.time_short.items",
burnItems
);
@Override
public int getHeight() {
@ -82,7 +94,13 @@ public class REIAlloyingFuelCategory implements DisplayCategory<REIAlloyingFuelD
slot.setZ(getZ() + 50);
slot.getBounds().setLocation(bounds.x + 4, bounds.y + 2);
slot.render(matrices, mouseX, mouseY, delta);
Minecraft.getInstance().font.drawShadow(matrices, text.getVisualOrderText(), bounds.x + 25, bounds.y + 8, -1);
Minecraft.getInstance().font.drawShadow(
matrices,
text.getVisualOrderText(),
bounds.x + 25,
bounds.y + 8,
-1
);
}
};
}

View file

@ -71,10 +71,16 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
return anvilLevel == 1;
}).collect(Collectors.toList());
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 + 61, y + 5))
.entries(display.getOutputEntries().get(0))
.disableBackground()
.markOutput());
widgets.add(Widgets.createSlot(new Point(x - 9, y + 25)).entries(anvils));
return widgets;
@ -86,8 +92,22 @@ public class REIAnvilCategory implements TransferDisplayCategory<REIAnvilDisplay
matrices.pushPose();
matrices.translate(0, 0, 400);
if (redSlots.contains(0)) {
GuiComponent.fill(matrices, startPoint.x - 20, startPoint.y + 3, startPoint.x - 20 + 16, startPoint.y + 3 + 16, 1090453504);
GuiComponent.fill(matrices, startPoint.x + 1, startPoint.y + 3, startPoint.x + 1 + 16, startPoint.y + 3 + 16, 1090453504);
GuiComponent.fill(
matrices,
startPoint.x - 20,
startPoint.y + 3,
startPoint.x - 20 + 16,
startPoint.y + 3 + 16,
1090453504
);
GuiComponent.fill(
matrices,
startPoint.x + 1,
startPoint.y + 3,
startPoint.x + 1 + 16,
startPoint.y + 3 + 16,
1090453504
);
}
matrices.popPose();
}

View file

@ -18,9 +18,12 @@ public class REIAnvilDisplay extends BasicDisplay implements SimpleGridMenuDispl
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;
inputs.get(1).forEach(entryStack -> {
if (entryStack.getValue() instanceof ItemStack itemStack) {
itemStack.setCount(recipe.getInputCount());

View file

@ -62,16 +62,46 @@ public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionD
}
widgets.add(Widgets.createTexturedWidget(BACKGROUND, bounds.x, bounds.y, 0, 0, 150, 104, 150, 104));
widgets.add(Widgets.createSlot(centerPoint).entries(inputEntries.get(0)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y)).entries(inputEntries.get(3)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28)).entries(inputEntries.get(5)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y)).entries(inputEntries.get(7)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24)).entries(inputEntries.get(2)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24)).entries(inputEntries.get(4)).disableBackground().markInput());
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.createSlot(new Point(centerPoint.x, centerPoint.y - 28))
.entries(inputEntries.get(1))
.disableBackground()
.markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 28, centerPoint.y))
.entries(inputEntries.get(3))
.disableBackground()
.markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y + 28))
.entries(inputEntries.get(5))
.disableBackground()
.markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 28, centerPoint.y))
.entries(inputEntries.get(7))
.disableBackground()
.markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y - 24))
.entries(inputEntries.get(2))
.disableBackground()
.markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 24, centerPoint.y + 24))
.entries(inputEntries.get(4))
.disableBackground()
.markInput());
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));
return widgets;
}

View file

@ -18,7 +18,10 @@ public class REIInfusionDisplay extends BasicDisplay implements SimpleGridMenuDi
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();
}

View file

@ -5,7 +5,6 @@ import me.shedaniel.rei.api.client.plugins.REIClientPlugin;
import me.shedaniel.rei.api.client.registry.category.CategoryRegistry;
import me.shedaniel.rei.api.client.registry.display.DisplayRegistry;
import me.shedaniel.rei.api.common.category.CategoryIdentifier;
import me.shedaniel.rei.api.common.display.Display;
import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.entry.EntryStack;
import me.shedaniel.rei.api.common.util.EntryIngredients;
@ -25,7 +24,6 @@ import ru.betterend.recipe.builders.AnvilRecipe;
import ru.betterend.recipe.builders.InfusionRecipe;
import ru.betterend.registry.EndBlocks;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@ -33,10 +31,22 @@ import java.util.stream.Collectors;
//https://github.com/shedaniel/RoughlyEnoughItems/blob/6.x-1.17/default-plugin/src/main/java/me/shedaniel/rei/plugin/client/DefaultClientPlugin.java
public class REIPlugin implements REIClientPlugin {
public final static ResourceLocation PLUGIN_ID = BetterEnd.makeID("rei_plugin");
public final static CategoryIdentifier<REIAlloyingFuelDisplay> ALLOYING_FUEL = CategoryIdentifier.of(BetterEnd.MOD_ID, "alloying_fuel");
public final static CategoryIdentifier<REIAlloyingDisplay> ALLOYING = CategoryIdentifier.of(BetterEnd.MOD_ID, AlloyingRecipe.GROUP);
public final static CategoryIdentifier<REIAnvilDisplay> SMITHING = CategoryIdentifier.of(BetterEnd.MOD_ID, AnvilRecipe.ID.getPath());
public final static CategoryIdentifier<REIInfusionDisplay> INFUSION = CategoryIdentifier.of(BetterEnd.MOD_ID, InfusionRecipe.GROUP);
public final static CategoryIdentifier<REIAlloyingFuelDisplay> ALLOYING_FUEL = CategoryIdentifier.of(
BetterEnd.MOD_ID,
"alloying_fuel"
);
public final static CategoryIdentifier<REIAlloyingDisplay> ALLOYING = CategoryIdentifier.of(
BetterEnd.MOD_ID,
AlloyingRecipe.GROUP
);
public final static CategoryIdentifier<REIAnvilDisplay> SMITHING = CategoryIdentifier.of(
BetterEnd.MOD_ID,
AnvilRecipe.ID.getPath()
);
public final static CategoryIdentifier<REIInfusionDisplay> INFUSION = CategoryIdentifier.of(
BetterEnd.MOD_ID,
InfusionRecipe.GROUP
);
@Override
public void registerDisplays(DisplayRegistry registry) {
@ -57,13 +67,24 @@ public class REIPlugin implements REIClientPlugin {
public void registerCategories(CategoryRegistry registry) {
EntryStack<ItemStack> endStoneSmelter = EntryStacks.of(EndBlocks.END_STONE_SMELTER);
EntryStack<ItemStack> infusionRitual = 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));
List<EntryStack<?>> furnaces = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks().stream().filter(BaseFurnaceBlock.class::isInstance).collect(Collectors.toList())));
List<EntryStack<?>> furnaces = Lists.newArrayList(EntryIngredients.ofItems(EndBlocks.getModBlocks()
.stream()
.filter(BaseFurnaceBlock.class::isInstance)
.collect(Collectors.toList())));
EntryStack<?>[] anvilsArray = anvils.toArray(new EntryStack[0]);
EntryStack<?>[] furnacesArray = furnaces.toArray(new EntryStack[0]);
registry.add(new REIAlloyingFuelCategory(), new REIAlloyingCategory(endStoneSmelter), new REIInfusionCategory(infusionRitual), new REIAnvilCategory(anvilsArray));
registry.add(
new REIAlloyingFuelCategory(),
new REIAlloyingCategory(endStoneSmelter),
new REIInfusionCategory(infusionRitual),
new REIAnvilCategory(anvilsArray)
);
registry.addWorkstations(ALLOYING_FUEL, endStoneSmelter);
registry.addWorkstations(ALLOYING, endStoneSmelter);