Skip to content

Commit 0c3ddaa

Browse files
authored
Merge pull request #313 from Mixinors/development-1.16.3
Development 1.16.3
2 parents f0139fb + 27155b5 commit 0c3ddaa

File tree

238 files changed

+3503
-1002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+3503
-1002
lines changed

astromine-core/src/main/java/com/github/chainmailstudios/astromine/client/rei/AstromineRoughlyEnoughItemsPlugin.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
package com.github.chainmailstudios.astromine.client.rei;
2626

27+
import com.github.chainmailstudios.astromine.common.utilities.NumberUtilities;
2728
import net.fabricmc.api.EnvType;
2829
import net.fabricmc.api.Environment;
2930

@@ -32,23 +33,21 @@
3233
import net.minecraft.client.render.OverlayTexture;
3334
import net.minecraft.client.render.RenderLayer;
3435
import net.minecraft.client.render.VertexConsumerProvider;
35-
import net.minecraft.client.texture.SpriteAtlasTexture;
3636
import net.minecraft.client.util.math.MatrixStack;
3737
import net.minecraft.screen.PlayerScreenHandler;
3838
import net.minecraft.text.LiteralText;
3939
import net.minecraft.text.TranslatableText;
40+
import net.minecraft.util.Formatting;
4041
import net.minecraft.util.Identifier;
4142
import net.minecraft.util.math.MathHelper;
4243

4344
import com.github.chainmailstudios.astromine.AstromineCommon;
4445
import com.github.chainmailstudios.astromine.client.render.sprite.SpriteRenderer;
4546
import com.github.chainmailstudios.astromine.common.volume.fraction.Fraction;
46-
import com.github.chainmailstudios.astromine.common.utilities.EnergyUtilities;
4747
import com.github.chainmailstudios.astromine.common.utilities.FluidUtilities;
4848
import com.github.chainmailstudios.astromine.common.volume.fluid.FluidVolume;
4949
import me.shedaniel.math.Point;
5050
import me.shedaniel.math.Rectangle;
51-
import me.shedaniel.rei.api.ClientHelper;
5251
import me.shedaniel.rei.api.EntryStack;
5352
import me.shedaniel.rei.api.plugins.REIPluginV0;
5453
import me.shedaniel.rei.api.widgets.Tooltip;
@@ -80,11 +79,7 @@ public void render(MatrixStack matrices, Rectangle bounds, int mouseX, int mouse
8079

8180
@Override
8281
public @Nullable Tooltip getTooltip(Point mouse) {
83-
if (generating)
84-
return Tooltip.create(mouse, new TranslatableText("text.astromine.energy"), ClientHelper.getInstance().getFormattedModFromIdentifier(AstromineCommon.identifier("a")), new LiteralText(""), new TranslatableText("category.astromine.generating.energy",
85-
EnergyUtilities.simpleDisplay(energy)));
86-
else return Tooltip.create(mouse, new TranslatableText("text.astromine.energy"), ClientHelper.getInstance().getFormattedModFromIdentifier(AstromineCommon.identifier("a")), new LiteralText(""), new TranslatableText("category.astromine.consuming.energy",
87-
EnergyUtilities.simpleDisplay(energy)));
82+
return Tooltip.create(mouse, new TranslatableText("text.astromine.energy"), new LiteralText(NumberUtilities.shorten(energy, "")).formatted(Formatting.GRAY), new LiteralText("Astromine").formatted(Formatting.BLUE, Formatting.ITALIC));
8883
}
8984
}).notFavoritesInteractable());
9085
}
@@ -158,7 +153,8 @@ protected void drawCurrentEntry(MatrixStack matrices, int mouseX, int mouseY, fl
158153
else height = MathHelper.ceil((System.currentTimeMillis() / (speed / bounds.height) % bounds.height) / 1f);
159154
VertexConsumerProvider.Immediate consumers = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
160155
SpriteRenderer.beginPass().setup(consumers, RenderLayer.getSolid()).sprite(FluidUtilities.texture(entry.getFluid())[0]).color(FluidUtilities.color(MinecraftClient.getInstance().player, entry.getFluid())).light(0x00f000f0).overlay(OverlayTexture.DEFAULT_UV).alpha(
161-
0xff).normal(matrices.peek().getNormal(), 0, 0, 0).position(matrices.peek().getModel(), bounds.x + 1, bounds.y + bounds.height - height + 1, bounds.x + bounds.width - 1, bounds.y + bounds.height - 1, getZOffset() + 1).next(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
156+
0xff).normal(matrices.peek().getNormal(), 0, 0, 0).position(matrices.peek().getModel(), bounds.x + 1, bounds.y + bounds.height - height + 1, bounds.x + bounds.width - 1, bounds.y + bounds.height - 1, getZOffset() + 1).next(
157+
PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
162158
consumers.draw();
163159
}
164160
}

astromine-core/src/main/java/com/github/chainmailstudios/astromine/client/render/sprite/SpriteRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public void next(Identifier texture) {
235235
}
236236

237237
if (isOverY) {
238-
dY = (uEnd - uStart) * (1 - (nSY / sY));
238+
dY = (vEnd - vStart) * (1 - (nSY / sY));
239239
}
240240

241241
this.consumer = consumers.getBuffer(RenderLayer.getSolid());

astromine-core/src/main/java/com/github/chainmailstudios/astromine/client/screen/base/BladeHandledScreen.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2020 Chainmail Studios
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
125
package com.github.chainmailstudios.astromine.client.screen.base;
226

327
import com.github.vini2003.blade.client.handler.BaseHandledScreen;

astromine-core/src/main/java/com/github/chainmailstudios/astromine/client/screen/base/entity/ComponentEntityFluidInventoryHandledScreen.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
package com.github.chainmailstudios.astromine.client.screen.base.entity;
2626

2727
import com.github.chainmailstudios.astromine.common.screenhandler.base.entity.ComponentEntityFluidInventoryScreenHandler;
28-
import com.github.chainmailstudios.astromine.common.screenhandler.base.entity.ComponentEntityFluidScreenHandler;
2928
import com.github.vini2003.blade.common.handler.BaseScreenHandler;
3029
import net.minecraft.entity.player.PlayerInventory;
3130
import net.minecraft.text.Text;

astromine-core/src/main/java/com/github/chainmailstudios/astromine/common/block/base/WrenchableHorizontalFacingBlockWithEntity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
package com.github.chainmailstudios.astromine.common.block.base;
2626

2727
import com.github.chainmailstudios.astromine.common.utilities.capability.block.FacingBlockWrenchable;
28-
import com.github.chainmailstudios.astromine.common.utilities.tier.MachineTier;
2928

3029
public abstract class WrenchableHorizontalFacingBlockWithEntity extends HorizontalFacingBlockWithEntity implements FacingBlockWrenchable {
3130
public WrenchableHorizontalFacingBlockWithEntity(Settings settings) {

astromine-core/src/main/java/com/github/chainmailstudios/astromine/common/block/base/WrenchableHorizontalFacingTieredBlockWithEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
7979
return ActionResult.CONSUME;
8080
}
8181

82-
if(!player.isCreative()) {
82+
if (!player.isCreative()) {
8383
ItemStack copy = stack.copy();
8484
copy.decrement(1);
8585
player.setStackInHand(hand, copy);

astromine-core/src/main/java/com/github/chainmailstudios/astromine/common/callback/ServerChunkTickCallback.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2020 Chainmail Studios
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
125
package com.github.chainmailstudios.astromine.common.callback;
226

327
import net.fabricmc.fabric.api.event.Event;

astromine-core/src/main/java/com/github/chainmailstudios/astromine/common/component/entity/EntityOxygenComponent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public EntityOxygenComponent(int oxygen, Entity entity) {
4343
this.oxygen = oxygen;
4444
this.entity = entity;
4545
}
46-
46+
4747
public static EntityOxygenComponent defaulted(Entity entity) {
4848
return new EntityOxygenComponent(0, entity);
4949
}

astromine-core/src/main/java/com/github/chainmailstudios/astromine/common/component/inventory/EnergyInventoryComponent.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,24 @@ default TypedActionResult<EnergyVolume> extract(Direction direction) {
134134
@Nullable
135135
default EnergyVolume getFirstExtractableVolume(Direction direction) {
136136
EnergyVolume volume = getVolume();
137-
if (canExtract(direction) && !volume.isEmpty()) return volume;
137+
if (canExtract(direction) && !volume.isEmpty())
138+
return volume;
138139
return null;
139140
}
140141

141142
@Nullable
142143
default EnergyVolume getFirstInsertableVolume(double amount, Direction direction) {
143144
EnergyVolume volume = getVolume();
144-
if (canInsert(direction) && volume.hasAvailable(amount)) return volume;
145+
if (canInsert(direction) && volume.hasAvailable(amount))
146+
return volume;
145147
return null;
146148
}
147149

148150
@Nullable
149151
default EnergyVolume getFirstInsertableVolume(Direction direction) {
150152
EnergyVolume volume = getVolume();
151-
if (canInsert(direction) && !volume.isFull()) return volume;
153+
if (canInsert(direction) && !volume.isFull())
154+
return volume;
152155
return null;
153156
}
154157

@@ -215,7 +218,7 @@ default boolean isEmpty() {
215218
default void setAmount(double amount) {
216219
getVolume().setAmount(amount);
217220
}
218-
221+
219222
default double getAmount() {
220223
return getVolume().getAmount();
221224
}

astromine-core/src/main/java/com/github/chainmailstudios/astromine/common/component/inventory/FluidInventoryComponent.java

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
package com.github.chainmailstudios.astromine.common.component.inventory;
2626

27-
import net.minecraft.fluid.Fluid;
2827
import net.minecraft.item.Item;
2928
import net.minecraft.nbt.CompoundTag;
3029
import net.minecraft.nbt.Tag;
@@ -97,20 +96,12 @@ default boolean canExtract(@Nullable Direction direction, FluidVolume volume, in
9796
}
9897

9998
default TypedActionResult<FluidVolume> insert(Direction direction, FluidVolume volume) {
100-
if (this.canInsert()) {
101-
return this.insert(direction, volume.getFluid(), volume.getAmount());
102-
} else {
103-
return new TypedActionResult<>(ActionResult.FAIL, volume);
104-
}
105-
}
106-
107-
default TypedActionResult<FluidVolume> insert(Direction direction, Fluid fluid, Fraction fraction) {
10899
Optional<Map.Entry<Integer, FluidVolume>> matchingVolumeOptional = this.getContents().entrySet().stream().filter(entry -> {
109-
return canInsert(direction, entry.getValue(), entry.getKey()) && entry.getValue().getFluid() == fluid;
100+
return canInsert(direction, entry.getValue(), entry.getKey()) && entry.getValue().canAccept(volume.getFluid());
110101
}).findFirst();
111102

112103
if (matchingVolumeOptional.isPresent()) {
113-
matchingVolumeOptional.get().getValue().add(fraction);
104+
matchingVolumeOptional.get().getValue().moveFrom(volume, Fraction.bottle());
114105
return new TypedActionResult<>(ActionResult.SUCCESS, matchingVolumeOptional.get().getValue());
115106
} else {
116107
return new TypedActionResult<>(ActionResult.FAIL, null);
@@ -173,13 +164,7 @@ default FluidVolume getFirstExtractableVolume(Direction direction) {
173164

174165
@Nullable
175166
default FluidVolume getFirstInsertableVolume(FluidVolume volume, Direction direction) {
176-
return getContents().entrySet().stream().filter((entry) -> canInsert(direction, entry.getValue(), entry.getKey()) && (entry.getValue().isEmpty() || (entry.getValue().getFluid() == volume.getFluid() && entry.getValue().hasAvailable(volume.getAmount())))).map(
177-
Map.Entry::getValue).findFirst().orElse(null);
178-
}
179-
180-
@Nullable
181-
default FluidVolume getFirstInsertableVolume(Fluid fluid, Direction direction) {
182-
return getContents().entrySet().stream().filter((entry) -> canInsert(direction, entry.getValue(), entry.getKey()) && (entry.getValue().isEmpty() || (entry.getValue().getFluid() == fluid))).map(Map.Entry::getValue).findFirst().orElse(null);
167+
return getContents().entrySet().stream().filter((entry) -> canInsert(direction, volume, entry.getKey()) && (entry.getValue().canAccept(volume.getFluid()) && entry.getValue().hasAvailable(volume.getAmount()))).map(Map.Entry::getValue).findFirst().orElse(null);
183168
}
184169

185170
default TypedActionResult<FluidVolume> extract(Direction direction, int slot, Fraction fraction) {

0 commit comments

Comments
 (0)