Compare commits

...

7 commits

Author SHA1 Message Date
Ell f831d48bba fixed environmental eye working in the whole inventory
closes #311
2023-09-19 22:54:09 +02:00
Ell 01813ed372 toubled
closes #316
2023-09-19 22:48:41 +02:00
Ell da7a7bab64 use forge's step-up attribute
closes #319
2023-09-19 22:46:13 +02:00
Ell 5a1f689b51 improved adept hopper interaction to not require sneaking
closes #326
2023-09-19 22:34:48 +02:00
Ell 433bd56957 fixed aura field creator not accepting item frames
closes #324
2023-09-19 22:27:46 +02:00
Ell 19cd7dcbce only publish on main repo 2023-09-19 21:59:53 +02:00
Martijn van den Brand 2a0f63e9f9
Add null check in BlockSpring#getBlockColor (#321) 2023-09-19 21:50:01 +02:00
11 changed files with 25 additions and 17 deletions

View file

@ -7,6 +7,7 @@ steps:
maven-publish:
image: eclipse-temurin:17-jdk
when:
event: [push, manual]
branch: main
commands:
- chmod +x ./gradlew

View file

@ -309,13 +309,14 @@ public final class Helper {
}
}
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) {
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player, boolean hotbarOnly) {
if (Compat.hasCompat("curios")) {
var stack = CuriosApi.getCuriosHelper().findFirstCurio(player, predicate).map(SlotResult::stack);
if (stack.isPresent())
return stack.get();
}
for (var i = 0; i < player.getInventory().getContainerSize(); i++) {
var invSize = hotbarOnly ? 9 : player.getInventory().getContainerSize();
for (var i = 0; i < invSize; i++) {
var slot = player.getInventory().getItem(i);
if (!slot.isEmpty() && predicate.test(slot))
return slot;

View file

@ -37,7 +37,7 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
private boolean auraPlayerInteraction(Player player, int amount, boolean extract, boolean simulate) {
if (extract && player.isCreative())
return true;
var stack = Helper.getEquippedItem(s -> s.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER).isPresent(), player);
var stack = Helper.getEquippedItem(s -> s.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER).isPresent(), player, false);
if (!stack.isEmpty()) {
var container = stack.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER).orElse(null);
if (extract) {
@ -181,4 +181,5 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
highest = defaultSpot;
return highest;
}
}

View file

@ -21,7 +21,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class BlockFieldCreator extends BlockContainerImpl implements ICustomBlockState {
public BlockFieldCreator() {
super("field_creator", BlockEntityFieldCreator.class, Properties.of().strength(2F).noCollission().sound(SoundType.STONE));
super("field_creator", BlockEntityFieldCreator.class, Properties.of().strength(2F).noOcclusion().sound(SoundType.STONE));
}
@Override

View file

@ -87,8 +87,6 @@ public class BlockGratedChute extends BlockContainerImpl implements ICustomBlock
@Override
@SuppressWarnings("deprecation")
public InteractionResult use(BlockState state, Level levelIn, BlockPos pos, Player player, InteractionHand handIn, BlockHitResult hit) {
if (!player.isShiftKeyDown())
return InteractionResult.FAIL;
var tile = levelIn.getBlockEntity(pos);
if (!(tile instanceof BlockEntityGratedChute chute))
return InteractionResult.FAIL;

View file

@ -33,7 +33,7 @@ public class BlockSpring extends BlockContainerImpl implements ICustomBlockState
@Override
@OnlyIn(Dist.CLIENT)
public BlockColor getBlockColor() {
return (state, level, pos, i) -> BiomeColors.getAverageWaterColor(level, pos);
return (state, level, pos, i) -> level == null || pos == null ? -1 : BiomeColors.getAverageWaterColor(level, pos);
}
@Override

View file

@ -153,9 +153,9 @@ public class ClientEvents {
inst.setParticleSpawnRange(32);
}
ClientEvents.heldCache = Helper.getEquippedItem(s -> s.getItem() instanceof ItemAuraCache, mc.player);
ClientEvents.heldEye = Helper.getEquippedItem(s -> s.getItem() == ModItems.EYE, mc.player);
ClientEvents.heldOcular = Helper.getEquippedItem(s -> s.getItem() == ModItems.EYE_IMPROVED, mc.player);
ClientEvents.heldCache = Helper.getEquippedItem(s -> s.getItem() instanceof ItemAuraCache, mc.player, false);
ClientEvents.heldEye = Helper.getEquippedItem(s -> s.getItem() == ModItems.EYE, mc.player, true);
ClientEvents.heldOcular = Helper.getEquippedItem(s -> s.getItem() == ModItems.EYE_IMPROVED, mc.player, false);
if (!ClientEvents.heldOcular.isEmpty() && mc.level.getGameTime() % 20 == 0) {
ClientEvents.SHOWING_EFFECTS.clear();

View file

@ -24,7 +24,7 @@ public class ItemDeathRing extends ItemImpl {
public void onDeath(LivingDeathEvent event) {
var entity = event.getEntity();
if (!entity.level().isClientSide && entity instanceof Player) {
var equipped = Helper.getEquippedItem(s -> s.getItem() == ModItems.DEATH_RING, (Player) entity);
var equipped = Helper.getEquippedItem(s -> s.getItem() == ModItems.DEATH_RING, (Player) entity, false);
if (!equipped.isEmpty()) {
entity.setHealth(entity.getMaxHealth() / 2);
entity.removeAllEffects();
@ -39,5 +39,7 @@ public class ItemDeathRing extends ItemImpl {
}
}
}
}
}

View file

@ -16,6 +16,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.*;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
@ -32,6 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class ItemArmor extends ArmorItem implements IModItem {
private static final AttributeModifier SKY_MOVEMENT_MODIFIER = new AttributeModifier(UUID.fromString("c1f96acc-e117-4dc1-a351-e196a4de6071"), NaturesAura.MOD_ID + ":sky_movement_speed", 0.15F, AttributeModifier.Operation.MULTIPLY_TOTAL);
private static final AttributeModifier SKY_STEP_MODIFIER = new AttributeModifier(UUID.fromString("ac3ce414-7243-418c-97f8-ac84c2c102f6"), NaturesAura.MOD_ID + ":sky_step_modifier", 0.5F, AttributeModifier.Operation.ADDITION);
private static final Map<ArmorMaterial, Item[]> SETS = new ConcurrentHashMap<>();
private final String baseName;
@ -90,22 +92,25 @@ public class ItemArmor extends ArmorItem implements IModItem {
public static void update(TickEvent.PlayerTickEvent event) {
var player = event.player;
var speed = player.getAttribute(Attributes.MOVEMENT_SPEED);
var step = player.getAttribute(ForgeMod.STEP_HEIGHT_ADDITION.get());
var key = NaturesAura.MOD_ID + ":sky_equipped";
var nbt = player.getPersistentData();
var equipped = ItemArmor.isFullSetEquipped(player, ModArmorMaterial.SKY);
if (equipped && !nbt.getBoolean(key)) {
// we just equipped it
nbt.putBoolean(key, true);
// TODO use new forge attribute for step height
player.setMaxUpStep(1.1F);
if (!step.hasModifier(ItemArmor.SKY_STEP_MODIFIER))
step.addPermanentModifier(ItemArmor.SKY_STEP_MODIFIER);
if (!speed.hasModifier(ItemArmor.SKY_MOVEMENT_MODIFIER))
speed.addPermanentModifier(ItemArmor.SKY_MOVEMENT_MODIFIER);
} else if (!equipped && nbt.getBoolean(key)) {
// we just unequipped it
nbt.putBoolean(key, false);
player.setMaxUpStep(0.6F);
step.removeModifier(ItemArmor.SKY_STEP_MODIFIER);
speed.removeModifier(ItemArmor.SKY_MOVEMENT_MODIFIER);
}
}
}
}

View file

@ -14,11 +14,11 @@
},
{
"type": "text",
"text": "Additionally, the $(item)Adept Hopper$()'s functionality can be $(thing)inverted$() simply by interacting with it while sneaking: This will cause not items $(italic)in$() the frames to be accepted, but all items that are $(italic)not$() in the frames. This, additionally, allows for throughput of any item, simply by not placing down any frames at all."
"text": "Additionally, the $(item)Adept Hopper$()'s functionality can be $(thing)inverted$() simply by interacting with it: This will cause not items $(italic)in$() the frames to be accepted, but all items that are $(italic)not$() in the frames. This, additionally, allows for throughput of any item, simply by not placing down any frames at all."
},
{
"type": "crafting",
"text": "Creating the $(item)Adept Hopper$()$(p)It should be noted that, when equipping an $(l:items/eye)Environmental Eye$(), the amount of items currently stored in the hopper can be seen.",
"text": "Creating the $(item)Adept Hopper$()$(p)It should be noted that, when equipping an $(l:items/eye)Environmental Eye$(), the amount of items currently stored in the hopper, as well as its current mode, can be seen.",
"recipe": "naturesaura:grated_chute"
}
]

View file

@ -13,7 +13,7 @@
},
{
"type": "text",
"text": "When it comes to the inner workings of $(aura), scientists are toubled to admit that they have not quite figured out how exactly it works yet.$(br)The only thing they know is that excess or missing amounts of $(aura) affect an area of varying size (based on the apparatus used) around the place the modification happened from.$(br)If an area is drained and a new generating instrument is added, it will renew the drained area first before creating its own luscious area."
"text": "When it comes to the inner workings of $(aura), scientists are troubled to admit that they have not quite figured out how exactly it works yet.$(br)The only thing they know is that excess or missing amounts of $(aura) affect an area of varying size (based on the apparatus used) around the place the modification happened from.$(br)If an area is drained and a new generating instrument is added, it will renew the drained area first before creating its own luscious area."
},
{
"type": "text",