Compare commits

...

5 commits

6 changed files with 36 additions and 34 deletions

View file

@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
version = '37.2'
version = '37.3'
group = 'de.ellpeck.naturesaura' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'NaturesAura'

View file

@ -7,6 +7,7 @@ import de.ellpeck.naturesaura.api.misc.WeatherType;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
@ -52,7 +53,7 @@ public class BlockEntityWeatherChanger extends BlockEntityImpl implements ITicka
if (this.processTime > 0) {
if (this.processTime % 20 == 0) {
var spot = IAuraChunk.getHighestSpot(this.level, this.worldPosition, 35, this.worldPosition);
IAuraChunk.getAuraChunk(this.level, spot).drainAura(spot, 30000 * this.itemAmount);
IAuraChunk.getAuraChunk(this.level, spot).drainAura(spot, 30000 * Mth.ceil(this.itemAmount * 0.75F));
}
this.processTime--;

View file

@ -62,8 +62,8 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
@Override
public void onRemovedFromWorld() {
super.onRemovedFromWorld();
this.setInhibitedEffect(null);
this.updatePowderListStatus();
// we pass a null effect because we want to remove our effect from the world
this.updatePowderListStatus(null);
}
@Override
@ -92,7 +92,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
super.tick();
if (this.powderListDirty)
this.updatePowderListStatus();
this.updatePowderListStatus(this.getInhibitedEffect());
if (this.level.isClientSide) {
if (this.level.getGameTime() % 5 == 0) {
@ -199,18 +199,17 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable {
return this.getColor();
}
private void updatePowderListStatus() {
private void updatePowderListStatus(ResourceLocation inhibitedEffect) {
var powders = ((LevelData) ILevelData.getLevelData(this.level)).effectPowders;
if (this.lastEffect != null) {
var oldList = powders.get(this.lastEffect);
oldList.removeIf(t -> this.getEyePosition().equals(t.getA()));
}
var effect = this.getInhibitedEffect();
if (effect != null) {
var newList = powders.get(effect);
if (inhibitedEffect != null) {
var newList = powders.get(inhibitedEffect);
newList.add(new Tuple<>(this.getEyePosition(), this.getAmount()));
}
this.powderListDirty = false;
this.lastEffect = effect;
this.lastEffect = inhibitedEffect;
}
}

View file

@ -336,23 +336,20 @@ public class ClientEvents {
stack.popPose();
if (!ClientEvents.heldOcular.isEmpty()) {
var scale = 0.75F;
stack.pushPose();
stack.scale(scale, scale, scale);
//stack.scale(scale, scale, scale);
var stackX = conf % 2 == 0 ? 10 : res.getGuiScaledWidth() - 22;
var stackY = conf < 2 ? 15 : res.getGuiScaledHeight() - 55;
var stackY = conf < 2 ? 10 : res.getGuiScaledHeight() - 60;
for (var effect : ClientEvents.SHOWING_EFFECTS.values()) {
var theX = (int) (stackX / scale);
var theY = (int) (stackY / scale);
var itemStack = effect.getA();
Helper.renderItemInGui(itemStack, theX, theY, 1F);
Helper.renderItemInGui(itemStack, stackX, stackY, 1F);
if (effect.getB()) {
RenderSystem.disableDepthTest();
RenderSystem.setShaderTexture(0, ClientEvents.OVERLAYS);
Screen.blit(stack, theX, theY, 240, 0, 16, 16, 256, 256);
Screen.blit(stack, stackX, stackY, 240, 0, 16, 16, 256, 256);
RenderSystem.enableDepthTest();
}
stackY += 8;
stackY += 12;
}
stack.popPose();
}

View file

@ -2,8 +2,9 @@ package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.entities.EntityStructureFinder;
import de.ellpeck.naturesaura.entities.ModEntities;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@ -15,11 +16,11 @@ import net.minecraft.world.level.levelgen.structure.Structure;
public class ItemStructureFinder extends ItemImpl {
private final Holder<Structure> structure;
private final ResourceKey<Structure> structure;
private final int color;
private final int radius;
public ItemStructureFinder(String baseName, Holder<Structure> structure, int color, int radius) {
public ItemStructureFinder(String baseName, ResourceKey<Structure> structure, int color, int radius) {
super(baseName);
this.structure = structure;
this.color = color;
@ -30,7 +31,9 @@ public class ItemStructureFinder extends ItemImpl {
public InteractionResultHolder<ItemStack> use(Level levelIn, Player playerIn, InteractionHand handIn) {
var stack = playerIn.getItemInHand(handIn);
if (!levelIn.isClientSide && ((ServerLevel) levelIn).structureManager().shouldGenerateStructures()) {
var holderSet = HolderSet.direct(this.structure);
var registry = levelIn.registryAccess().registryOrThrow(Registry.STRUCTURE_REGISTRY);
var holderSet = registry.getHolder(this.structure).map(HolderSet::direct).orElse(null);
if (holderSet != null) {
var pos = ((ServerLevel) levelIn).getChunkSource().getGenerator().findNearestMapStructure((ServerLevel) levelIn, holderSet, playerIn.blockPosition(), this.radius, false);
if (pos != null) {
var entity = new EntityStructureFinder(ModEntities.STRUCTURE_FINDER, levelIn);
@ -43,6 +46,7 @@ public class ItemStructureFinder extends ItemImpl {
stack.shrink(1);
}
}
}
return new InteractionResultHolder<>(InteractionResult.SUCCESS, stack);
}
}

View file

@ -38,6 +38,7 @@ import net.minecraft.world.level.block.FlowerPotBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.extensions.IForgeMenuType;
@ -201,9 +202,9 @@ public final class ModRegistry {
new ItemArmor("sky_chest", ModArmorMaterial.SKY, EquipmentSlot.CHEST),
new ItemArmor("sky_pants", ModArmorMaterial.SKY, EquipmentSlot.LEGS),
new ItemArmor("sky_shoes", ModArmorMaterial.SKY, EquipmentSlot.FEET),
new ItemStructureFinder("fortress_finder", Structures.FORTRESS, 0xba2800, 1024),
new ItemStructureFinder("end_city_finder", Structures.END_CITY, 0xca5cd6, 1024),
new ItemStructureFinder("outpost_finder", Structures.PILLAGER_OUTPOST, 0xab9f98, 2048),
new ItemStructureFinder("fortress_finder", BuiltinStructures.FORTRESS, 0xba2800, 1024),
new ItemStructureFinder("end_city_finder", BuiltinStructures.END_CITY, 0xca5cd6, 1024),
new ItemStructureFinder("outpost_finder", BuiltinStructures.PILLAGER_OUTPOST, 0xab9f98, 2048),
new ItemBreakPrevention(),
new ItemPetReviver(),
new ItemNetheriteFinder()