mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +01:00
Anyone can read the spellbook now
This commit is contained in:
parent
e994b5e837
commit
a664a52bbe
4 changed files with 5 additions and 7 deletions
|
@ -30,8 +30,8 @@ public class SpellbookProfilePageContent extends DrawableHelper implements Spell
|
||||||
public void init(SpellbookScreen screen, Identifier pageId) {
|
public void init(SpellbookScreen screen, Identifier pageId) {
|
||||||
Bounds bounds = screen.getFrameBounds();
|
Bounds bounds = screen.getFrameBounds();
|
||||||
int size = 32;
|
int size = 32;
|
||||||
int x = screen.getX() + bounds.left + bounds.width / 4 - size + 10;
|
int x = screen.getX() + bounds.left + bounds.width / 4 - size + 5;
|
||||||
int y = screen.getY() + bounds.top + bounds.height / 2;
|
int y = screen.getY() + bounds.top + bounds.height / 2 + 3;
|
||||||
|
|
||||||
|
|
||||||
screen.addDrawable(new SpellbookScreen.ImageButton(x, y, size, size))
|
screen.addDrawable(new SpellbookScreen.ImageButton(x, y, size, size))
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.function.Predicate;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe;
|
import com.minelittlepony.unicopia.ability.magic.spell.crafting.SpellbookRecipe;
|
||||||
import com.minelittlepony.unicopia.container.inventory.*;
|
import com.minelittlepony.unicopia.container.inventory.*;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
|
@ -153,7 +152,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canUse(PlayerEntity player) {
|
public boolean canUse(PlayerEntity player) {
|
||||||
return EquinePredicates.IS_CASTER.test(player);
|
return player.isAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class SpellbookEntity extends MobEntity {
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOpen() && EquinePredicates.PLAYER_UNICORN.test(player)) {
|
if (isOpen()) {
|
||||||
setBored(false);
|
setBored(false);
|
||||||
player.openHandledScreen(new ExtendedScreenHandlerFactory() {
|
player.openHandledScreen(new ExtendedScreenHandlerFactory() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.minelittlepony.unicopia.item;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.EquinePredicates;
|
|
||||||
import com.minelittlepony.unicopia.entity.SpellbookEntity;
|
import com.minelittlepony.unicopia.entity.SpellbookEntity;
|
||||||
import com.minelittlepony.unicopia.entity.UEntities;
|
import com.minelittlepony.unicopia.entity.UEntities;
|
||||||
import com.minelittlepony.unicopia.util.Dispensable;
|
import com.minelittlepony.unicopia.util.Dispensable;
|
||||||
|
@ -44,7 +43,7 @@ public class SpellbookItem extends BookItem implements Dispensable {
|
||||||
@Nullable
|
@Nullable
|
||||||
PlayerEntity player = context.getPlayer();
|
PlayerEntity player = context.getPlayer();
|
||||||
|
|
||||||
if (!context.getWorld().isClient && EquinePredicates.PLAYER_UNICORN.test(player)) {
|
if (!context.getWorld().isClient) {
|
||||||
BlockPos pos = context.getBlockPos().offset(context.getSide());
|
BlockPos pos = context.getBlockPos().offset(context.getSide());
|
||||||
|
|
||||||
placeBook(context.getStack(), context.getWorld(), pos.getX(), pos.getY(), pos.getZ(), context.getPlayerYaw() + 180);
|
placeBook(context.getStack(), context.getWorld(), pos.getX(), pos.getY(), pos.getZ(), context.getPlayerYaw() + 180);
|
||||||
|
|
Loading…
Reference in a new issue