nearly finishing potion stuff
This commit is contained in:
parent
00fe6f554e
commit
8fbec0bd43
@ -67,7 +67,7 @@ public class PermissionRegistry {
|
||||
public static ClaimPermission DROP = register(new ClaimPermission("DROP", () -> new ItemStack(Items.BOWL), true, "Allow the drop of items"));
|
||||
public static ClaimPermission PICKUP = register(new ClaimPermission("PICKUP", () -> new ItemStack(Items.BRICK), true, "Allow the pickup of items"));
|
||||
public static ClaimPermission FLIGHT = register(new ClaimPermission("FLIGHT", () -> new ItemStack(Items.FEATHER), true, "Allow non creative flight"));
|
||||
public static ClaimPermission CANSTAY = register(new ClaimPermission("CANSTAY", () -> new ItemStack(Items.PAPER), true, "Allow player to enter your claim"));
|
||||
public static ClaimPermission CANSTAY = register(new ClaimPermission("CANSTAY", () -> new ItemStack(Items.PAPER), true, "Allow players to enter your claim"));
|
||||
public static ClaimPermission TELEPORT = register(new ClaimPermission("TELEPORT", () -> new ItemStack(Items.END_PORTAL_FRAME), false, "Allow player to teleport to your claim home position"));
|
||||
public static ClaimPermission NOHUNGER = register(new ClaimPermission("NOHUNGER", () -> new ItemStack(Items.COOKED_BEEF), false, "Disable hunger"));
|
||||
|
||||
|
@ -15,7 +15,6 @@ import io.github.flemmli97.flan.config.ConfigHandler;
|
||||
import io.github.flemmli97.flan.player.PlayerClaimData;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
@ -200,7 +199,7 @@ public class Claim implements IPermissionContainer {
|
||||
}
|
||||
|
||||
public boolean intersects(Box box) {
|
||||
return this.minX <= box.maxX && this.maxX >= box.minX && this.minZ <= box.maxZ && this.maxZ >= box.minZ && box.maxY > this.minY;
|
||||
return this.minX < box.maxX && this.maxX + 1 > box.minX && this.minZ < box.maxZ && this.maxZ + 1 > box.minZ && box.maxY >= this.minY;
|
||||
}
|
||||
|
||||
public boolean isCorner(BlockPos pos) {
|
||||
@ -487,9 +486,9 @@ public class Claim implements IPermissionContainer {
|
||||
return this.potions;
|
||||
}
|
||||
|
||||
public void applyEffects(PlayerEntity player) {
|
||||
public void applyEffects(ServerPlayerEntity player) {
|
||||
if (player.world.getTime() % 160 == 0)
|
||||
this.potions.forEach((effect, amp) -> {
|
||||
if (!player.hasStatusEffect(effect))
|
||||
player.applyStatusEffect(new StatusEffectInstance(effect, 200, amp - 1, true, false));
|
||||
});
|
||||
}
|
||||
|
@ -5,11 +5,14 @@ import io.github.flemmli97.flan.CrossPlatformStuff;
|
||||
import io.github.flemmli97.flan.claim.Claim;
|
||||
import io.github.flemmli97.flan.claim.PermHelper;
|
||||
import net.minecraft.entity.effect.StatusEffect;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.PotionUtil;
|
||||
import net.minecraft.potion.Potions;
|
||||
import net.minecraft.screen.NamedScreenHandlerFactory;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
@ -19,6 +22,8 @@ import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.util.Formatting;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -77,11 +82,13 @@ public class PotionEditScreenHandler extends ServerOnlyScreenHandler {
|
||||
int id = (i % 9) + row * 7 - 1;
|
||||
if (id < potions.size()) {
|
||||
StatusEffect effect = key.get(id);
|
||||
ItemStack group = new ItemStack(Items.POTION);
|
||||
ItemStack effectStack = new ItemStack(Items.POTION);
|
||||
TranslatableText txt = new TranslatableText(effect.getTranslationKey());
|
||||
group.getOrCreateTag().putString("FlanEffect", CrossPlatformStuff.stringFromEffect(effect));
|
||||
group.setCustomName(txt.setStyle(txt.getStyle().withItalic(false).withFormatting(Formatting.DARK_BLUE)).append(ServerScreenHelper.coloredGuiText("-" + potions.get(effect), Formatting.DARK_BLUE)));
|
||||
inv.setStack(i, group);
|
||||
Collection<StatusEffectInstance> inst = Collections.singleton(new StatusEffectInstance(effect, 0, potions.get(effect)));
|
||||
effectStack.getOrCreateTag().putString("FlanEffect", CrossPlatformStuff.stringFromEffect(effect));
|
||||
effectStack.getTag().putInt("CustomPotionColor", PotionUtil.getColor(inst));
|
||||
effectStack.setCustomName(txt.setStyle(txt.getStyle().withItalic(false).withFormatting(Formatting.DARK_BLUE)).append(ServerScreenHelper.coloredGuiText("-" + potions.get(effect), Formatting.DARK_BLUE)));
|
||||
inv.setStack(i, effectStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Pair;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.Heightmap;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
@ -16,7 +15,7 @@ import java.util.function.BiFunction;
|
||||
public class TeleportUtils {
|
||||
|
||||
public static BlockPos roundedBlockPos(Vec3d pos) {
|
||||
return new BlockPos(Math.round(pos.getX()), MathHelper.floor(pos.getY()), Math.round(pos.getZ()));
|
||||
return new BlockPos(pos);
|
||||
}
|
||||
|
||||
public static Vec3d getTeleportPos(ServerPlayerEntity player, Vec3d playerPos, ClaimStorage storage, int[] dim, BlockPos.Mutable bPos, BiFunction<Claim, BlockPos, Boolean> check) {
|
||||
|
Loading…
Reference in New Issue
Block a user