mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-27 05:38:33 +01:00
Compare commits
No commits in common. "f831d48bbafaf17e36042375a71e7f7faee034d8" and "5f9897ca1c51cc94bb5a0ac8480b69ae87476a3d" have entirely different histories.
f831d48bba
...
5f9897ca1c
11 changed files with 17 additions and 25 deletions
|
@ -7,7 +7,6 @@ steps:
|
|||
maven-publish:
|
||||
image: eclipse-temurin:17-jdk
|
||||
when:
|
||||
event: [push, manual]
|
||||
branch: main
|
||||
commands:
|
||||
- chmod +x ./gradlew
|
||||
|
|
|
@ -309,14 +309,13 @@ public final class Helper {
|
|||
}
|
||||
}
|
||||
|
||||
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player, boolean hotbarOnly) {
|
||||
public static ItemStack getEquippedItem(Predicate<ItemStack> predicate, Player player) {
|
||||
if (Compat.hasCompat("curios")) {
|
||||
var stack = CuriosApi.getCuriosHelper().findFirstCurio(player, predicate).map(SlotResult::stack);
|
||||
if (stack.isPresent())
|
||||
return stack.get();
|
||||
}
|
||||
var invSize = hotbarOnly ? 9 : player.getInventory().getContainerSize();
|
||||
for (var i = 0; i < invSize; i++) {
|
||||
for (var i = 0; i < player.getInventory().getContainerSize(); i++) {
|
||||
var slot = player.getInventory().getItem(i);
|
||||
if (!slot.isEmpty() && predicate.test(slot))
|
||||
return slot;
|
||||
|
|
|
@ -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, false);
|
||||
var stack = Helper.getEquippedItem(s -> s.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER).isPresent(), player);
|
||||
if (!stack.isEmpty()) {
|
||||
var container = stack.getCapability(NaturesAuraAPI.CAP_AURA_CONTAINER).orElse(null);
|
||||
if (extract) {
|
||||
|
@ -181,5 +181,4 @@ public class InternalHooks implements NaturesAuraAPI.IInternalHooks {
|
|||
highest = defaultSpot;
|
||||
return highest;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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).noOcclusion().sound(SoundType.STONE));
|
||||
super("field_creator", BlockEntityFieldCreator.class, Properties.of().strength(2F).noCollission().sound(SoundType.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,6 +87,8 @@ 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;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BlockSpring extends BlockContainerImpl implements ICustomBlockState
|
|||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockColor getBlockColor() {
|
||||
return (state, level, pos, i) -> level == null || pos == null ? -1 : BiomeColors.getAverageWaterColor(level, pos);
|
||||
return (state, level, pos, i) -> BiomeColors.getAverageWaterColor(level, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -153,9 +153,9 @@ public class ClientEvents {
|
|||
inst.setParticleSpawnRange(32);
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
if (!ClientEvents.heldOcular.isEmpty() && mc.level.getGameTime() % 20 == 0) {
|
||||
ClientEvents.SHOWING_EFFECTS.clear();
|
||||
|
|
|
@ -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, false);
|
||||
var equipped = Helper.getEquippedItem(s -> s.getItem() == ModItems.DEATH_RING, (Player) entity);
|
||||
if (!equipped.isEmpty()) {
|
||||
entity.setHealth(entity.getMaxHealth() / 2);
|
||||
entity.removeAllEffects();
|
||||
|
@ -39,7 +39,5 @@ public class ItemDeathRing extends ItemImpl {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ 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;
|
||||
|
@ -33,7 +32,6 @@ 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;
|
||||
|
||||
|
@ -92,25 +90,22 @@ 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);
|
||||
if (!step.hasModifier(ItemArmor.SKY_STEP_MODIFIER))
|
||||
step.addPermanentModifier(ItemArmor.SKY_STEP_MODIFIER);
|
||||
// TODO use new forge attribute for step height
|
||||
player.setMaxUpStep(1.1F);
|
||||
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);
|
||||
step.removeModifier(ItemArmor.SKY_STEP_MODIFIER);
|
||||
player.setMaxUpStep(0.6F);
|
||||
speed.removeModifier(ItemArmor.SKY_MOVEMENT_MODIFIER);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
},
|
||||
{
|
||||
"type": "text",
|
||||
"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."
|
||||
"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."
|
||||
},
|
||||
{
|
||||
"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, as well as its current mode, 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 can be seen.",
|
||||
"recipe": "naturesaura:grated_chute"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
{
|
||||
"type": "text",
|
||||
"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."
|
||||
"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."
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
|
|
Loading…
Reference in a new issue