mirror of
https://github.com/Oth3r/Sit.git
synced 2025-09-19 16:03:22 +02:00
Merge branch 'master' into dev
This commit is contained in:
commit
07b3077438
23 changed files with 130 additions and 34 deletions
|
@ -24,9 +24,9 @@ public class ServerConfig implements CustomFile<ServerConfig> {
|
|||
private Double version = 2.2;
|
||||
|
||||
@SerializedName("lang")
|
||||
private String lang = "en_us";
|
||||
private String lang = "en_US";
|
||||
@SerializedName("lang-options")
|
||||
private final String langOptions = "en_us, it_it, pt_br, tr_tr, zh_tw, zh_ch, de_de";
|
||||
private final String langOptions = "en_US, it_IT, pt_BR, tr_TR, zh_TW, zh_CH, de_DE";
|
||||
|
||||
@SerializedName("keep-active")
|
||||
private Boolean keepActive = true;
|
||||
|
|
|
@ -6,8 +6,8 @@ import net.minecraft.server.command.ReloadCommand;
|
|||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Formatting;
|
||||
import one.oth3r.sit.file.FileData;
|
||||
import one.oth3r.sit.utl.Data;
|
||||
import one.oth3r.sit.utl.Logic;
|
||||
import one.oth3r.sit.utl.Utl;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -18,7 +18,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
public class ReloadCommandMixin {
|
||||
@Inject(at = @At("TAIL"), method = "register")
|
||||
private static void register(CommandDispatcher<ServerCommandSource> dispatcher, CallbackInfo ci) {
|
||||
FileData.loadFiles();
|
||||
Logic.reload();
|
||||
|
||||
// make sure the server isn't null
|
||||
MinecraftServer server = Data.getServer();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package one.oth3r.sit.screen;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.tooltip.Tooltip;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
|
@ -21,8 +20,6 @@ public class ClickableImageWidget extends ButtonWidget {
|
|||
|
||||
@Override
|
||||
protected void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.enableDepthTest();
|
||||
context.drawTexture(RenderLayer::getGuiTextured, image,
|
||||
this.getX(), this.getY(), 0.0f, 0.0f, this.getWidth(), this.getHeight(), this.getWidth(), this.getHeight());
|
||||
}
|
||||
|
|
|
@ -71,11 +71,7 @@ public class ConfigScreen extends Screen {
|
|||
}
|
||||
|
||||
private void renderBanner(DrawContext context, int x, int y, float alpha) {
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
context.drawTexture(RenderLayer::getGuiTextured,Identifier.of(Data.MOD_ID, "textures/gui/banner.png"),
|
||||
x, y, 0.0f, 0.0f, 128, 72, 128, 72, ColorHelper.getWhite(alpha));
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,7 @@ import net.minecraft.util.Formatting;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import one.oth3r.sit.file.FileData;
|
||||
import one.oth3r.sit.file.ServerConfig;
|
||||
import one.oth3r.sit.file.SittingConfig;
|
||||
import one.oth3r.sit.file.HandSetting;
|
||||
import one.oth3r.sit.file.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Logic {
|
||||
|
@ -184,7 +181,7 @@ public class Logic {
|
|||
// get the poses to check above the block
|
||||
BlockPos pos1 = new BlockPos(pos).add(0,1,0), pos2 = new BlockPos(pos).add(0,2,0), posBelow = new BlockPos(pos);
|
||||
// doesn't check 2 blocks above if not sitting above .80 of the block
|
||||
if (pos.getY() > entity.getY() - .80) {
|
||||
if (pos.getY() > (entity.getY()-Utl.Entity.Y_ADJUSTMENT) - .80) {
|
||||
pos2 = pos2.add(0,-1,0);
|
||||
posBelow = posBelow.add(0,-1,0);
|
||||
}
|
||||
|
@ -201,6 +198,7 @@ public class Logic {
|
|||
public static void reload() {
|
||||
FileData.loadFiles();
|
||||
FileData.saveFiles();
|
||||
LangReader.loadLanguageFile();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -209,7 +209,7 @@ public class Utl {
|
|||
/**
|
||||
* the customizable y height of the entity, as some versions have different sitting heights on the entity
|
||||
*/
|
||||
private static final double Y_ADJUSTMENT = 0;
|
||||
public static final double Y_ADJUSTMENT = 0;
|
||||
|
||||
/**
|
||||
* checks if the entity's block is still there, & is valid
|
||||
|
@ -228,9 +228,9 @@ public class Utl {
|
|||
public static BlockPos getBlockPos(DisplayEntity.TextDisplayEntity entity) {
|
||||
// the entity Y level, adjusted
|
||||
// the adjustment - is the opposite of the offset applied in Entity.create()
|
||||
double entityY = entity.getBlockY() + (Y_ADJUSTMENT*-1);
|
||||
int entityBlockY = (int) (Math.floor(entity.getY() + (Y_ADJUSTMENT*-1)));
|
||||
// get the block pos
|
||||
BlockPos pos = new BlockPos(entity.getBlockX(),(int)entityY,entity.getBlockZ());
|
||||
BlockPos pos = new BlockPos(entity.getBlockX(),entityBlockY,entity.getBlockZ());
|
||||
// if above the block, subtract 1
|
||||
if (isAboveBlockHeight(entity)) {
|
||||
pos = pos.add(0,-1,0);
|
||||
|
@ -370,7 +370,8 @@ public class Utl {
|
|||
* sends the settings packets to the server, if client & in game
|
||||
*/
|
||||
public static void sendSettingsPackets() {
|
||||
if (Data.isClient() && Data.isInGame()) {
|
||||
if (Data.isClient() && Data.isInGame() &&
|
||||
ClientPlayNetworking.canSend(SitPayloads.SettingsPayload.ID)) {
|
||||
ClientPlayNetworking.send(new SitPayloads.SettingsPayload(Utl.getGson().toJson(FileData.getSittingConfig())));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue