Compare commits

...

6 commits

19 changed files with 247 additions and 18 deletions

View file

@ -1,2 +1,5 @@
// 1.20.4 2024-03-04T22:51:31.6164303 Registries // 1.20.4 2024-03-05T16:59:47.0535355 Registries
020d2b1f1c21d6c6663ef8126a52e2b9deb0e52e data/actuallyadditions/damage_type/atomicreconstructor.json 020d2b1f1c21d6c6663ef8126a52e2b9deb0e52e data/actuallyadditions/damage_type/atomicreconstructor.json
4ba41428fdcf03f52855029153722e22e8702823 data/actuallyadditions/neoforge/biome_modifier/add_black_quartz.json
3c9f4fbfed04f0e75ea7b370aa2f8acc531a63bb data/actuallyadditions/worldgen/configured_feature/ore_black_quartz.json
fce2111f746f4c6ddef5444d84a5c2b574efaaa0 data/actuallyadditions/worldgen/placed_feature/ore_black_quartz.json

View file

@ -0,0 +1,7 @@
{
"type": "actuallyadditions:bool_config_feature_modifier",
"biomes": "#minecraft:is_overworld",
"boolConfig": "generateQuartz",
"features": "actuallyadditions:ore_black_quartz",
"step": "underground_ores"
}

View file

@ -0,0 +1,18 @@
{
"type": "minecraft:ore",
"config": {
"discard_chance_on_air_exposure": 0.0,
"size": 6,
"targets": [
{
"state": {
"Name": "actuallyadditions:black_quartz_ore"
},
"target": {
"predicate_type": "minecraft:tag_match",
"tag": "minecraft:stone_ore_replaceables"
}
}
]
}
}

View file

@ -0,0 +1,27 @@
{
"feature": "actuallyadditions:ore_black_quartz",
"placement": [
{
"type": "minecraft:count",
"count": 8
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:trapezoid",
"max_inclusive": {
"absolute": 45
},
"min_inclusive": {
"absolute": 0
}
}
},
{
"type": "minecraft:biome"
}
]
}

View file

@ -1,6 +1,9 @@
package de.ellpeck.actuallyadditions.data; package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyBiomeModifiers;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyConfiguredFeatures;
import de.ellpeck.actuallyadditions.mod.gen.ActuallyPlacedFeatures;
import de.ellpeck.actuallyadditions.mod.misc.ActuallyDamageTypes; import de.ellpeck.actuallyadditions.mod.misc.ActuallyDamageTypes;
import net.minecraft.core.Cloner; import net.minecraft.core.Cloner;
import net.minecraft.core.HolderLookup; import net.minecraft.core.HolderLookup;
@ -17,6 +20,7 @@ import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper; import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.data.event.GatherDataEvent; import net.neoforged.neoforge.data.event.GatherDataEvent;
import net.neoforged.neoforge.registries.NeoForgeRegistries;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -65,6 +69,9 @@ public class ActuallyAdditionsData {
registryBuilder.add(Registries.DAMAGE_TYPE, (context) -> { registryBuilder.add(Registries.DAMAGE_TYPE, (context) -> {
context.register(ActuallyDamageTypes.ATOMIC_RECONSTRUCTOR, new DamageType("actuallyadditions.atomic_reconstructor", 0.0F)); context.register(ActuallyDamageTypes.ATOMIC_RECONSTRUCTOR, new DamageType("actuallyadditions.atomic_reconstructor", 0.0F));
}); });
registryBuilder.add(Registries.CONFIGURED_FEATURE, ActuallyConfiguredFeatures::bootstrap);
registryBuilder.add(Registries.PLACED_FEATURE, ActuallyPlacedFeatures::bootstrap);
registryBuilder.add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ActuallyBiomeModifiers::bootstrap);
// We need the BIOME registry to be present, so we can use a biome tag, doesn't matter that it's empty // We need the BIOME registry to be present, so we can use a biome tag, doesn't matter that it's empty
registryBuilder.add(Registries.BIOME, $ -> { registryBuilder.add(Registries.BIOME, $ -> {
}); });

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod; package de.ellpeck.actuallyadditions.mod;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.ActuallyTags; import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior; import de.ellpeck.actuallyadditions.api.farmer.IFarmerBehavior;
@ -25,12 +26,12 @@ import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
import de.ellpeck.actuallyadditions.mod.entity.InitEntities; import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
import de.ellpeck.actuallyadditions.mod.event.CommonEvents; import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.gen.modifier.BoolConfigFeatureBiomeModifier;
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers; import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.Worm; import de.ellpeck.actuallyadditions.mod.items.Worm;
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper; import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler; import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
@ -43,6 +44,9 @@ import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.neoforged.bus.api.IEventBus; import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod; import net.neoforged.fml.common.Mod;
@ -54,6 +58,7 @@ import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent; import net.neoforged.neoforge.client.event.RegisterParticleProvidersEvent;
import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.common.conditions.ICondition; import net.neoforged.neoforge.common.conditions.ICondition;
import net.neoforged.neoforge.common.world.BiomeModifier;
import net.neoforged.neoforge.event.AddReloadListenerEvent; import net.neoforged.neoforge.event.AddReloadListenerEvent;
import net.neoforged.neoforge.event.server.ServerStartedEvent; import net.neoforged.neoforge.event.server.ServerStartedEvent;
import net.neoforged.neoforge.event.server.ServerStoppedEvent; import net.neoforged.neoforge.event.server.ServerStoppedEvent;
@ -86,6 +91,15 @@ public class ActuallyAdditions {
private static final DeferredRegister<Codec<? extends ICondition>> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, MODID); private static final DeferredRegister<Codec<? extends ICondition>> CONDITION_CODECS = DeferredRegister.create(NeoForgeRegistries.Keys.CONDITION_CODECS, MODID);
public static final DeferredHolder<Codec<? extends ICondition>, Codec<BoolConfigCondition>> BOOL_CONFIG_CONDITION = CONDITION_CODECS.register("bool_config_condition", () -> BoolConfigCondition.CODEC); public static final DeferredHolder<Codec<? extends ICondition>, Codec<BoolConfigCondition>> BOOL_CONFIG_CONDITION = CONDITION_CODECS.register("bool_config_condition", () -> BoolConfigCondition.CODEC);
public static final DeferredRegister<Codec<? extends BiomeModifier>> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, MODID);
public static final Supplier<Codec<BoolConfigFeatureBiomeModifier>> BOOL_CONFIG_MODIFIER = BIOME_MODIFIER_SERIALIZERS.register("bool_config_feature_modifier", () ->
RecordCodecBuilder.create(builder -> builder.group(
Biome.LIST_CODEC.fieldOf("biomes").forGetter(BoolConfigFeatureBiomeModifier::biomes),
PlacedFeature.LIST_CODEC.fieldOf("features").forGetter(BoolConfigFeatureBiomeModifier::features),
GenerationStep.Decoration.CODEC.fieldOf("step").forGetter(BoolConfigFeatureBiomeModifier::step),
Codec.STRING.fieldOf("boolConfig").forGetter(BoolConfigFeatureBiomeModifier::boolConfig)
).apply(builder, BoolConfigFeatureBiomeModifier::new))
);
public static boolean commonCapsLoaded; public static boolean commonCapsLoaded;
@ -101,6 +115,7 @@ public class ActuallyAdditions {
ActuallyContainers.CONTAINERS.register(eventBus); ActuallyContainers.CONTAINERS.register(eventBus);
ENTITIES.register(eventBus); ENTITIES.register(eventBus);
CONDITION_CODECS.register(eventBus); CONDITION_CODECS.register(eventBus);
BIOME_MODIFIER_SERIALIZERS.register(eventBus);
eventBus.addListener(this::onConfigReload); eventBus.addListener(this::onConfigReload);
ActuallyParticles.init(eventBus); ActuallyParticles.init(eventBus);
ActuallyTags.init(); ActuallyTags.init();

View file

@ -14,6 +14,7 @@ public class CommonConfig {
static { static {
Other.build(); Other.build();
Machines.build(); Machines.build();
Worldgen.build();
ItemSettings.build(); ItemSettings.build();
COMMON_CONFIG = BUILDER.build(); COMMON_CONFIG = BUILDER.build();
} }
@ -54,6 +55,18 @@ public class CommonConfig {
} }
} }
public static class Worldgen {
public static ModConfigSpec.BooleanValue GENERATE_QUARTZ;
public static void build() {
BUILDER.comment("Worldgen Settings").push("worldgenSettings");
GENERATE_QUARTZ = BUILDER.comment("Should Black Quartz generate in the world?").define("laserRelayLoss", true);
BUILDER.pop();
}
}
public static class Other { public static class Other {
public static ModConfigSpec.BooleanValue SOLID_XP_ALWAYS_ORBS; public static ModConfigSpec.BooleanValue SOLID_XP_ALWAYS_ORBS;
public static ModConfigSpec.BooleanValue DO_UPDATE_CHECK; public static ModConfigSpec.BooleanValue DO_UPDATE_CHECK;

View file

@ -0,0 +1,34 @@
package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.gen.modifier.BoolConfigFeatureBiomeModifier;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BiomeTags;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.neoforged.neoforge.common.world.BiomeModifier;
import net.neoforged.neoforge.registries.NeoForgeRegistries;
public class ActuallyBiomeModifiers {
protected static final ResourceKey<BiomeModifier> ADD_BLACK_QUARTZ_ORE_MODIFIER = ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS,
new ResourceLocation(ActuallyAdditions.MODID, "add_black_quartz"));
public static void bootstrap(BootstapContext<BiomeModifier> context) {
HolderGetter<Biome> biomeGetter = context.lookup(Registries.BIOME);
HolderGetter<PlacedFeature> placedGetter = context.lookup(Registries.PLACED_FEATURE);
HolderSet.Named<Biome> overworldHolder = biomeGetter.getOrThrow(BiomeTags.IS_OVERWORLD);
context.register(ADD_BLACK_QUARTZ_ORE_MODIFIER, new BoolConfigFeatureBiomeModifier(
overworldHolder,
HolderSet.direct(placedGetter.getOrThrow(ActuallyPlacedFeatures.PLACED_ORE_BLACK_QUARTZ)),
GenerationStep.Decoration.UNDERGROUND_ORES, "generateQuartz"
));
}
}

View file

@ -0,0 +1,28 @@
package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest;
import java.util.List;
public class ActuallyConfiguredFeatures {
public static final ResourceKey<ConfiguredFeature<?, ?>> ORE_BLACK_QUARTZ = FeatureUtils.createKey("actuallyadditions:ore_black_quartz");
// public static final ResourceKey<ConfiguredFeature<?, ?>> ORE_BLACK_QUARTZ_BURIED = FeatureUtils.createKey("actuallyadditions:ore_black_quartz_buried");
public static void bootstrap(BootstapContext<ConfiguredFeature<?, ?>> context) {
RuleTest stoneRuleTest = new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES);
List<OreConfiguration.TargetBlockState> list = List.of(
OreConfiguration.target(stoneRuleTest, ActuallyBlocks.BLACK_QUARTZ_ORE.get().defaultBlockState())
);
FeatureUtils.register(context, ORE_BLACK_QUARTZ, Feature.ORE, new OreConfiguration(list, 6));
}
}

View file

@ -0,0 +1,37 @@
package de.ellpeck.actuallyadditions.mod.gen;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
import net.minecraft.world.level.levelgen.placement.CountPlacement;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
import java.util.List;
public class ActuallyPlacedFeatures {
public static final ResourceKey<PlacedFeature> PLACED_ORE_BLACK_QUARTZ = PlacementUtils.createKey("actuallyadditions:ore_black_quartz");
// public static final ResourceKey<PlacedFeature> PLACED_ORE_BLACK_QUARTZ_BURIED = PlacementUtils.createKey("actuallyadditions:ore_black_quartz_buried");
public static void bootstrap(BootstapContext<PlacedFeature> context) {
HolderGetter<ConfiguredFeature<?, ?>> holdergetter = context.lookup(Registries.CONFIGURED_FEATURE);
PlacementUtils.register(context, PLACED_ORE_BLACK_QUARTZ, holdergetter.getOrThrow(ActuallyConfiguredFeatures.ORE_BLACK_QUARTZ),
commonOrePlacement(8, HeightRangePlacement.triangle(VerticalAnchor.absolute(0), VerticalAnchor.absolute(45))));
}
private static List<PlacementModifier> orePlacement(PlacementModifier modifier, PlacementModifier modifier1) {
return List.of(modifier, InSquarePlacement.spread(), modifier1, BiomeFilter.biome());
}
private static List<PlacementModifier> commonOrePlacement(int count, PlacementModifier modifier) {
return orePlacement(CountPlacement.of(count), modifier);
}
}

View file

@ -0,0 +1,39 @@
package de.ellpeck.actuallyadditions.mod.gen.modifier;
import com.mojang.serialization.Codec;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.neoforged.neoforge.common.world.BiomeGenerationSettingsBuilder;
import net.neoforged.neoforge.common.world.BiomeModifier;
import net.neoforged.neoforge.common.world.ModifiableBiomeInfo;
public record BoolConfigFeatureBiomeModifier(HolderSet<Biome> biomes, HolderSet<PlacedFeature> features, GenerationStep.Decoration step,
String boolConfig) implements BiomeModifier {
@Override
public void modify(Holder<Biome> biome, Phase phase, ModifiableBiomeInfo.BiomeInfo.Builder builder) {
if (phase == Phase.ADD && checkConfig() && this.biomes.contains(biome)) {
BiomeGenerationSettingsBuilder generationSettings = builder.getGenerationSettings();
this.features.forEach(holder -> generationSettings.addFeature(this.step, holder));
}
}
private boolean checkConfig() {
switch (boolConfig) {
default:
return true;
case "generateQuartz":
return CommonConfig.Worldgen.GENERATE_QUARTZ.get();
}
}
@Override
public Codec<? extends BiomeModifier> codec() {
return ActuallyAdditions.BOOL_CONFIG_MODIFIER.get();
}
}

View file

@ -26,7 +26,6 @@ public abstract class AAScreen<T extends AbstractContainerMenu> extends Abstract
@Override @Override
public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(guiGraphics, mouseX, mouseY, partialTicks);
super.render(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks);
this.renderTooltip(guiGraphics, mouseX, mouseY); this.renderTooltip(guiGraphics, mouseX, mouseY);
} }

View file

@ -35,13 +35,11 @@ public class Buttons {
public void renderWidget(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float f) { public void renderWidget(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float f) {
if (this.visible) { if (this.visible) {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, this.resLoc);
this.isHovered = mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.width && mouseY < this.getY() + this.height;
int k = !this.active ? 0 : (this.isHoveredOrFocused() ? 2 : 1); int k = !this.active ? 0 : (this.isHoveredOrFocused() ? 2 : 1);
GlStateManager._enableBlend(); GlStateManager._enableBlend();
GlStateManager.glBlendFuncSeparate(770, 771, 1, 0); GlStateManager.glBlendFuncSeparate(770, 771, 1, 0);
GlStateManager._blendFunc(770, 771); GlStateManager._blendFunc(770, 771);
guiGraphics.blit(this.resLoc, mouseX, mouseY, this.smaller guiGraphics.blit(this.resLoc, this.getX(), this.getY(), this.smaller
? 200 ? 200
: 176, k * this.height, this.width, this.height); : 176, k * this.height, this.width, this.height);
//this.mouseDragged(mc, x, y); // The heck was this doing here? //this.mouseDragged(mc, x, y); // The heck was this doing here?
@ -74,8 +72,6 @@ public class Buttons {
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float f) { public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float f) {
if (this.visible) { if (this.visible) {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, this.resLoc);
this.isHovered = mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.width && mouseY < this.getY() + this.height;
int k = !this.active ? 0 : (this.isHoveredOrFocused() ? 2 : 1); int k = !this.active ? 0 : (this.isHoveredOrFocused() ? 2 : 1);
GlStateManager._enableBlend(); GlStateManager._enableBlend();
GlStateManager.glBlendFuncSeparate(770, 771, 1, 0); GlStateManager.glBlendFuncSeparate(770, 771, 1, 0);

View file

@ -53,7 +53,7 @@ public class GuiCoalGenerator extends AAScreen<ContainerCoalGenerator> {
@Override @Override
public void renderBg(GuiGraphics guiGraphics, float f, int x, int y) { public void renderBg(GuiGraphics guiGraphics, float f, int x, int y) {
RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION); RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86); guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86);

View file

@ -56,7 +56,6 @@ public class GuiFeeder extends AAScreen<ContainerFeeder> {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 70, 0, 0, 176, 86); guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 70, 0, 0, 176, 86);
RenderSystem.setShaderTexture(0, RES_LOC);
guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 70); guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 70);
if (this.tileFeeder.currentTimer > 0) { if (this.tileFeeder.currentTimer > 0) {

View file

@ -59,7 +59,6 @@ public class GuiFermentingBarrel extends AAScreen<ContainerFermentingBarrel> {
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86); guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86);
RenderSystem.setShaderTexture(0, RES_LOC);
guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93); guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93);
if (this.press.currentProcessTime > 0) { if (this.press.currentProcessTime > 0) {

View file

@ -53,7 +53,6 @@ public class GuiMiner extends AAScreen<ContainerMiner> {
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86); guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 93, 0, 0, 176, 86);
RenderSystem.setShaderTexture(0, RES_LOC);
guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93); guiGraphics.blit(RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 93);
String mining = this.miner.onlyMineOres String mining = this.miner.onlyMineOres

View file

@ -96,7 +96,6 @@ public class SackGui extends AAScreen<SackContainer> {
protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int x, int y) { protected void renderBg(GuiGraphics guiGraphics, float partialTicks, int x, int y) {
RenderSystem.setShaderColor(1F, 1F, 1F, 1F); RenderSystem.setShaderColor(1F, 1F, 1F, 1F);
RenderSystem.setShaderTexture(0, AssetUtil.GUI_INVENTORY_LOCATION);
guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 90, 0, 0, 176, 86); guiGraphics.blit(AssetUtil.GUI_INVENTORY_LOCATION, this.leftPos, this.topPos + 90, 0, 0, 176, 86);
guiGraphics.blit(this.isVoid ? RES_LOC_VOID : RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 90); guiGraphics.blit(this.isVoid ? RES_LOC_VOID : RES_LOC, this.leftPos, this.topPos, 0, 0, 176, 90);

View file

@ -13,12 +13,16 @@ package de.ellpeck.actuallyadditions.mod.items.base;
import de.ellpeck.actuallyadditions.mod.attachments.ActuallyAttachments; import de.ellpeck.actuallyadditions.mod.attachments.ActuallyAttachments;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems; import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage; import de.ellpeck.actuallyadditions.mod.tile.CustomEnergyStorage;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.capabilities.Capabilities;
import net.neoforged.neoforge.energy.IEnergyStorage; import net.neoforged.neoforge.energy.IEnergyStorage;
@ -79,17 +83,23 @@ public abstract class ItemEnergy extends ItemBase {
@Override @Override
public int getBarWidth(ItemStack stack) { public int getBarWidth(ItemStack stack) {
if (stack.hasTag() && stack.getTag().contains("Energy")) { if (stack.hasData(ActuallyAttachments.ENERGY_STORAGE)) {
return (int)(1 - (stack.getTag().getDouble("Energy") / this.maxPower)); CustomEnergyStorage storage = stack.getData(ActuallyAttachments.ENERGY_STORAGE);
return Math.round(13.0F - (float)storage.getEnergyStored() * 13.0F / storage.getMaxEnergyStored());
} }
return 1; return 1;
} }
@Override @Override
public int getBarColor(ItemStack stack) { public int getBarColor(ItemStack stack) {
//float[] color = AssetUtil.getWheelColor(player.level().getGameTime() % 256); int defaultColor = super.getBarColor(stack);
//return MathHelper.color(color[0] / 255F, color[1] / 255F, color[2] / 255F); if (FMLEnvironment.dist.isClient()) {
return super.getBarColor(stack); Minecraft mc = Minecraft.getInstance();
if (mc.player == null) return defaultColor;
float[] color = AssetUtil.getWheelColor(mc.player.level().getGameTime() % 256);
return Mth.color(color[0] / 255F, color[1] / 255F, color[2] / 255F);
}
return defaultColor;
} }
public void setEnergy(ItemStack stack, int energy) { public void setEnergy(ItemStack stack, int energy) {