[factions-banking] IMPLEMENT FIRST COMMISSIONED ART INTO GAMEgit br
Some checks are pending
build / build (21) (push) Waiting to run
Some checks are pending
build / build (21) (push) Waiting to run
This commit is contained in:
parent
6d14d47e0b
commit
74722b465a
@ -14,7 +14,7 @@ import net.minecraft.util.Identifier;
|
|||||||
|
|
||||||
public class FactionBlockScreen extends HandledScreen<FactionBlockScreenHandler> {
|
public class FactionBlockScreen extends HandledScreen<FactionBlockScreenHandler> {
|
||||||
// This is a placeholder image until an actual one is drawn
|
// This is a placeholder image until an actual one is drawn
|
||||||
private static final Identifier TEXTURE = new Identifier(Keeblarcraft.MOD_ID, "textures/gui/faction_base_block.png");
|
private static final Identifier TEXTURE = new Identifier(Keeblarcraft.MOD_ID, "textures/gui/faction_block_menu.png");
|
||||||
|
|
||||||
public FactionBlockScreen(FactionBlockScreenHandler handler, PlayerInventory inventory, Text title) {
|
public FactionBlockScreen(FactionBlockScreenHandler handler, PlayerInventory inventory, Text title) {
|
||||||
super(handler, inventory, title);
|
super(handler, inventory, title);
|
||||||
@ -32,6 +32,10 @@ public class FactionBlockScreen extends HandledScreen<FactionBlockScreenHandler>
|
|||||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
|
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
|
||||||
RenderSystem.setShaderTexture(0, TEXTURE);
|
RenderSystem.setShaderTexture(0, TEXTURE);
|
||||||
|
|
||||||
|
this.backgroundHeight = 256;
|
||||||
|
this.backgroundWidth = 256;
|
||||||
|
|
||||||
int x = (width - backgroundWidth) / 2;
|
int x = (width - backgroundWidth) / 2;
|
||||||
int y = (height - backgroundHeight) / 2;
|
int y = (height - backgroundHeight) / 2;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import jesse.keeblarcraft.AttributeMgr.AttributeNodes.AbstractNode;
|
|||||||
import jesse.keeblarcraft.FactionMgr.Callbacks.PlayerCommandFlightCallback;
|
import jesse.keeblarcraft.FactionMgr.Callbacks.PlayerCommandFlightCallback;
|
||||||
import jesse.keeblarcraft.FactionMgr.Callbacks.PlayerEnteredBaseCallback;
|
import jesse.keeblarcraft.FactionMgr.Callbacks.PlayerEnteredBaseCallback;
|
||||||
import jesse.keeblarcraft.FactionMgr.Callbacks.PlayerExitedBaseCallback;
|
import jesse.keeblarcraft.FactionMgr.Callbacks.PlayerExitedBaseCallback;
|
||||||
|
import jesse.keeblarcraft.FactionMgr.Callbacks.PlayerInBaseCallback;
|
||||||
import net.minecraft.entity.player.PlayerAbilities;
|
import net.minecraft.entity.player.PlayerAbilities;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
@ -20,6 +21,7 @@ public class FactionFlight extends AbstractNode {
|
|||||||
private ServerPlayerEntity player;
|
private ServerPlayerEntity player;
|
||||||
private float SPEED_SCALAR = 40.0f; // The value to scale this correctly to CREATIVE flight is '20.0f' however faction flight is slower than creative intentionally
|
private float SPEED_SCALAR = 40.0f; // The value to scale this correctly to CREATIVE flight is '20.0f' however faction flight is slower than creative intentionally
|
||||||
private Boolean canFly = false;
|
private Boolean canFly = false;
|
||||||
|
private Boolean loginInBaseToggle = false; // Covers the unique case if player logs in inside the faction block border; in which case they need flight enabled!
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String GetNodeTitle() {
|
public String GetNodeTitle() {
|
||||||
@ -87,6 +89,19 @@ public class FactionFlight extends AbstractNode {
|
|||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
PlayerInBaseCallback.EVENT.register((player, world) -> {
|
||||||
|
// Make sure player can fly while inside the border. We don't ever want to run this more than once!
|
||||||
|
System.out.println("INSIDE BORDER CHECK: canFly && !loginBase: " + canFly + " " + !loginInBaseToggle);
|
||||||
|
if (!canFly && !loginInBaseToggle) {
|
||||||
|
player.sendMessage(Text.of("Faction flight enabled"));
|
||||||
|
loginInBaseToggle = true;
|
||||||
|
canFly = true;
|
||||||
|
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;
|
||||||
|
ToggleFlight(serverPlayer);
|
||||||
|
}
|
||||||
|
return ActionResult.SUCCESS;
|
||||||
|
});
|
||||||
|
|
||||||
PlayerCommandFlightCallback.EVENT.register((player, world) -> {
|
PlayerCommandFlightCallback.EVENT.register((player, world) -> {
|
||||||
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;
|
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;
|
||||||
Boolean isFlying = ToggleFlight(serverPlayer);
|
Boolean isFlying = ToggleFlight(serverPlayer);
|
||||||
|
@ -113,7 +113,6 @@ public class FactionBlockEntity extends BlockEntity implements ExtendedScreenHan
|
|||||||
Boolean yBounds = player.getY() <= pos.getY() + 50 && player.getY() >= pos.getY() - 50;
|
Boolean yBounds = player.getY() <= pos.getY() + 50 && player.getY() >= pos.getY() - 50;
|
||||||
Boolean zBounds = player.getZ() <= pos.getZ() + 50 && player.getZ() >= pos.getZ() - 50;
|
Boolean zBounds = player.getZ() <= pos.getZ() + 50 && player.getZ() >= pos.getZ() - 50;
|
||||||
if (xBounds && yBounds && zBounds) {
|
if (xBounds && yBounds && zBounds) {
|
||||||
System.out.println("PLAYER IN BOUNDS");
|
|
||||||
isNearBlock = true;
|
isNearBlock = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
Loading…
Reference in New Issue
Block a user