Skip to content

Commit

Permalink
fix: bugfixes for TeamGalacticraft#392, three NullPointerErrors and o…
Browse files Browse the repository at this point in the history
…ther inconsistencies (TeamGalacticraft#394)

* fix: prevented NullPointerError when clicking the Sun in the celestial screen and corrected parent/grandparent labels when zooming in on the Sun

* fix: resolves TeamGalacticraft#392

* fix: prevented NullPointerError when pressing create satellite button and renamed structures folder to structure (1.21)

* fix: prevented NullPointerError when clicking the Sun in the celestial screen and corrected parent/grandparent labels when zooming in on the Sun

* fix: addressed implicit narrowing conversion in compound assignment

* fix: changed stack size of armor to 1

* fix: corrected mistakes in recipes

* fix: rerun runDatagen command to update recipes

* fix: prevent crash from NullPointerError if player dies in oil or sulfuric acid

* refactor: removed flipped recipes as the other recipe can already be mirrored by default

* fix: shifted fallen meteor down a pixel to prevent it from floating

* fix: swap orientation of north/south unlit torches in Moon dungeon corridors
  • Loading branch information
Roelymole authored Feb 3, 2025
1 parent f8f2a65 commit 2ff5374
Show file tree
Hide file tree
Showing 109 changed files with 58 additions and 288 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/generated/data/galacticraft/recipe/desh_axe_flipped.json

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/generated/data/galacticraft/recipe/desh_hoe_flipped.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"pattern": [
"D",
"S",
"D",
"S"
],
"result": {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"B": {
"item": "galacticraft:compressed_bronze"
"A": {
"item": "galacticraft:compressed_aluminum"
},
"S": {
"item": "galacticraft:compressed_steel"
}
},
"pattern": [
" S",
" B ",
"B "
" A ",
"A "
],
"result": {
"count": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ public Int2ObjectMap<Ingredient> ingredients() {

@Override
public boolean test(@NotNull Container inventory) {
IntList slotModifiers = new IntArrayList(inventory.getContainerSize());
int invSize = inventory.getContainerSize();
if (invSize == 0) return false;

IntArrayList slotModifiers = new IntArrayList();
slotModifiers.size(invSize);

for (Int2ObjectMap.Entry<Ingredient> ingredient : this.ingredients.int2ObjectEntrySet()) {
int amount = ingredient.getIntKey();
for (int i = 0; i < inventory.getContainerSize(); i++) {
for (int i = 0; i < invSize; i++) {
ItemStack stack = inventory.getItem(i);
if (ingredient.getValue().test(stack)) {
amount -= (stack.getCount() - slotModifiers.getInt(i));
slotModifiers.set(i, slotModifiers.getInt(i) + (stack.getCount() - slotModifiers.getInt(i)) - Math.min(amount, 0));
slotModifiers.set(i, stack.getCount() - Math.min(amount, 0));
if (amount <= 0) break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,10 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) {

CelestialBody<?, ?> selectedParent = this.selectedParent;

if (this.selectedBody != null) {
selectedParent = this.selectedBody.parent().value();
}
if (this.selectedBody == null) {
if (this.selectedBody == null || this.selectedBody.parent() == null) {
selectedParent = celestialBodies.get(Constant.id("sol"));
} else {
selectedParent = this.selectedBody.parent().value();
}

if (this.selectedParent != selectedParent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ public void onClose() {

protected String getGrandparentName() {
CelestialBody<?, ?> body = this.selectedBody;
if (body == null) return I18n.get(Translations.Galaxy.MILKY_WAY); //fixme
if (body == null || body == celestialBodies.get(Constant.id("sol"))) {
return I18n.get(Translations.Galaxy.MILKY_WAY); //fixme
}
if (body.parent() != null) {
if (body.parent().value().parent() != null) {
return I18n.get(((TranslatableContents)body.parent().value().parent().value().name().getContents()).getKey());
Expand All @@ -210,6 +212,7 @@ protected String getGrandparentName() {

protected String parentName() {
if (this.selectedBody == null) return I18n.get(Translations.CelestialBody.SOL); //fixme
if (this.selectedBody == celestialBodies.get(Constant.id("sol"))) return I18n.get(Translations.CelestialBody.SOL);
if (this.selectedBody.parent() != null) return I18n.get(((TranslatableContents)this.selectedBody.parent().value().name().getContents()).getKey());
return I18n.get(((TranslatableContents) this.selectedBody.galaxy().value().name().getContents()).getKey());
}
Expand Down Expand Up @@ -359,7 +362,7 @@ public boolean mouseClicked(double x, double y, int button) {
{
assert this.minecraft != null;
assert this.minecraft.player != null;
if (recipe.test(this.minecraft.player.getInventory()) || this.minecraft.player.getAbilities().instabuild)
if (recipe.test(this.minecraft.player.getInventory()) || this.minecraft.player.isCreative())
{
// GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_BIND_SPACE_STATION_ID, GCCoreUtil.getWorld(this.minecraft.level), new Object[]{this.selectedBody.getWorld()}));
ClientPlayNetworking.send(new SatelliteCreationPayload(celestialBodies.getHolderOrThrow(celestialBodies.getResourceKey(this.selectedBody).get())));
Expand Down Expand Up @@ -665,7 +668,11 @@ public void drawButtons(GuiGraphics gui, int mouseX, int mouseY) {

// Grandparent frame:
texture.blit(LHS + 2 - 95 + scale, LHS + 14, 93, 17, GRANDPARENT_LABEL_U, GRANDPARENT_LABEL_V, GRANDPARENT_LABEL_WIDTH, GRANDPARENT_LABEL_HEIGHT, YELLOW);
str = planetZoomedNotMoon ? this.parentName() : this.getGrandparentName();
if (this.isZoomed() && this.selectedBody == celestialBodies.get(Constant.id("sol"))) {
str = this.getGrandparentName();
} else {
str = planetZoomedNotMoon ? this.parentName() : this.getGrandparentName();
}
texture.drawText(str, LHS + 7 - 95 + scale, LHS + 16, GREY3, false);

List<CelestialBody<?, ?>> children = this.getChildren(/*planetZoomedNotMoon*/this.isZoomed() ? this.selectedBody : celestialBodies.get(Constant.id("sol")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void tick() {
this.zd *= 1.1D;
}

this.quadSize *= 0.9599999785423279D;
this.quadSize *= 0.95999998F;

this.xd *= 0.9599999785423279D;
this.yd *= 0.9599999785423279D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public static void renderFootprints(WorldRenderContext context) {
}

if (footprintsToDraw.isEmpty()) {
context.profiler().pop();
return;
}

Expand Down Expand Up @@ -127,6 +128,7 @@ public static void renderFootprints(WorldRenderContext context) {
// OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightMapSaveX, lightMapSaveY);
// }

RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
poseStack.popPose();
context.profiler().pop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

public class FallenMeteorBlock extends FallingBlock implements SimpleWaterloggedBlock {
public static final MapCodec<FallenMeteorBlock> CODEC = simpleCodec(FallenMeteorBlock::new);
private static final VoxelShape SHAPE = box(3, 1, 3, 13, 11, 13);
private static final VoxelShape SHAPE = box(3, 0, 3, 13, 10, 13);
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
public static final IntegerProperty HEAT = IntegerProperty.create("heat", 0, 5);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void tick() {
super.tick();
if (this.level().isClientSide) {
Vec3 delta = getDeltaMovement();
this.wheelRotationX += Math.sqrt(delta.x * delta.x + delta.z * delta.z) * 150.0F * (this.speed < 0 ? 1 : -1);
this.wheelRotationX += (float)Math.sqrt(delta.x * delta.x + delta.z * delta.z) * 150.0F * (this.speed < 0 ? 1 : -1);
this.wheelRotationX %= 360;
this.wheelRotationZ = Math.max(-30.0F, Math.min(30.0F, this.wheelRotationZ * 0.9F));
}
Expand Down
Loading

0 comments on commit 2ff5374

Please sign in to comment.