Skip to content

Commit

Permalink
fix rocket launching, disable sky rendering mixin temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Dec 1, 2023
1 parent 63141c8 commit d226be6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.lowdragmc.lowdraglib.gui.modular.IUIHolder;
import com.lowdragmc.lowdraglib.gui.modular.ModularUI;
import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup;
import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture;
import com.lowdragmc.lowdraglib.gui.texture.TextTexture;
import com.lowdragmc.lowdraglib.gui.widget.ButtonWidget;
import com.lowdragmc.lowdraglib.gui.widget.LabelWidget;
Expand Down Expand Up @@ -180,7 +181,7 @@ public InteractionResult interact(Player player, InteractionHand hand) {
public ModularUI createUI(Player entityPlayer) {
return new ModularUI(176, 166, this, entityPlayer)
.widget(new LabelWidget(7, 7, this.getDisplayName().getString()))
.widget(new TankWidget(this.fuelTank, 16, 20, 20, 58, true, true).setBackground(GuiTextures.FLUID_TANK_BACKGROUND))
.widget(new TankWidget(this.fuelTank, 16, 20, 20, 58, true, true).setBackground(GuiTextures.FLUID_TANK_BACKGROUND).setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP))
.widget(new SlotWidget(configSlot, 0, 40, 20))
.widget(new SlotWidget(satelliteSlot, 0, 60, 20))
.widget(new ButtonWidget(40, 60, 36, 18, new GuiTextureGroup(GuiTextures.BUTTON.copy().setColor(0xFFAA0000), new TextTexture("menu.gcyr.launch")), (clickData) -> this.startRocket()))
Expand Down Expand Up @@ -307,7 +308,7 @@ public long computeRequiredFuelAmountForDestination(@Nullable Planet destination
Planet current = PlanetData.getPlanetFromLevelOrOrbit(this.level().dimension()).orElse(null);
if (current == null || destination == null) {
return (long) (this.getFuelCapacity() * 0.85);
} else if (destination.parentWorld() == current.level() || current.parentWorld() == destination.level()) {
} else if (destination.parentWorld() == current.level() || current.parentWorld() == destination.level() || current == destination) {
return GCyRConfig.INSTANCE.rocket.moonFuelAmount;
} else if (current.solarSystem().equals(destination.solarSystem())) {
return GCyRConfig.INSTANCE.rocket.solarSystemFuelAmount;
Expand All @@ -334,7 +335,10 @@ public void startRocket() {
} else if (GCyRItems.KEYCARD.isIn(config)) {
this.destination = KeyCardBehaviour.getSavedPlanet(config);
}
if (this.fuelTank.getFluidAmount() < computeRequiredFuelAmountForDestination(this.destination)) return;
if (this.fuelTank.getFluidAmount() < computeRequiredFuelAmountForDestination(this.destination)) {
sendVehicleHasNoFuelMessage(player);
return;
}

if (PlanetIdChipBehaviour.getSpaceStationId(config) != null || KeyCardBehaviour.getSavedStation(config) != null) {
this.destinationIsSpaceStation = true;
Expand Down Expand Up @@ -570,6 +574,8 @@ public void unBuild() {

if (!configSlot.getStackInSlot(0).isEmpty())
this.spawnAtLocation(configSlot.getStackInSlot(0));
if (!satelliteSlot.getStackInSlot(0).isEmpty())
this.spawnAtLocation(satelliteSlot.getStackInSlot(0));

BlockPos origin = this.blockPosition();
for (PosWithState state : this.getBlocks()) {
Expand Down Expand Up @@ -601,10 +607,10 @@ private void buildSpaceStation(ItemStack stack, BlockPos origin) {
BlockPos pos = state.pos();
if (start) origin = pos;
start = false;
if (origin.compareTo(pos) < 0) origin = new BlockPos(
Math.min(pos.getX(), origin.getX()),
Math.min(pos.getY(), origin.getY()),
Math.min(pos.getZ(), origin.getZ()));
if (origin.compareTo(pos.offset(original)) < 0) origin = new BlockPos(
Math.min(pos.getX() + original.getX(), origin.getX()),
Math.min(pos.getY() + original.getY(), origin.getY()),
Math.min(pos.getZ() + original.getZ(), origin.getZ()));
}
origin = new BlockPos(original.getX() - origin.getX() / 2, original.getY(), original.getZ() - origin.getZ() / 2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@Mixin(LevelRenderer.class)
public abstract class LevelRendererMixin {

/* TODO find out how to make sodium happy with this. :sadge:
@WrapWithCondition(method = "renderSky",
slice = @Slice(
from = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderTexture(ILnet/minecraft/resources/ResourceLocation;)V")
Expand All @@ -26,4 +27,5 @@ public abstract class LevelRendererMixin {
}
return true;
}
*/
}

0 comments on commit d226be6

Please sign in to comment.