Skip to content

Commit

Permalink
Merge pull request #332 from Mixinors/development-1.16.3
Browse files Browse the repository at this point in the history
1.11.4
  • Loading branch information
Shnupbups authored Oct 14, 2020
2 parents fff1e64 + 9ac941a commit fb75818
Show file tree
Hide file tree
Showing 197 changed files with 745 additions and 3,046 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum MaterialItemType {
DUST,
TINY_DUST,
GEAR,
PLATES,
PLATE,
WIRE,
PICKAXE,
AXE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public Builder metal() {
ingot();
nugget();
block();
plates();
plate();
return gear();
}

Expand Down Expand Up @@ -223,8 +223,8 @@ public Builder gear() {
return addType(GEAR, new Identifier("c", name + "_gears"));
}

public Builder plates() {
return addType(PLATES, new Identifier("c", name + "_plates"));
public Builder plate() {
return addType(PLATE, new Identifier("c", name + "_plates"));
}

public Builder wire() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ public String get(String oldPath) {

@Override
public String register(String oldPath, String newPath) {
if (this.containsKey(newPath)) {
if(oldPath.equals(newPath)) throw new IllegalArgumentException("Invalid Identifier fix attempted with paths " + oldPath + " and " + newPath+", paths identical");
else if (this.containsKey(newPath)) {
if (this.get(newPath).equals(oldPath))
throw new IllegalArgumentException("Recursive Identifier fix attempted with paths " + oldPath + " and " + newPath);
throw new IllegalArgumentException("Invalid Identifier fix attempted with paths " + oldPath + " and " + newPath+", would cause recursion");
else return this.register(oldPath, this.get(newPath));
} else return super.register(oldPath, newPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import com.github.chainmailstudios.astromine.common.utilities.FluidUtilities;
import com.github.chainmailstudios.astromine.common.volume.handler.FluidHandler;
import com.github.vini2003.blade.client.utilities.Layers;
import com.github.vini2003.blade.common.widget.base.AbstractWidget;
import com.github.vini2003.blade.common.widget.base.ButtonWidget;
import com.github.vini2003.blade.common.widget.base.SlotWidget;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.RenderLayer;
Expand All @@ -30,78 +30,80 @@
import java.util.function.Supplier;

public class FluidFilterWidget extends ButtonWidget {
private final Identifier FLUID_BACKGROUND = AstromineCommon.identifier("textures/widget/fluid_filter_background.png");

private Supplier<Fluid> fluidSupplier = () -> Fluids.EMPTY;

private Consumer<Fluid> fluidConsumer = fluid -> {};

public Supplier<Fluid> getFluidSupplier() {
return fluidSupplier;
}

public void setFluidSupplier(Supplier<Fluid> fluidSupplier) {
this.fluidSupplier = fluidSupplier;
}

public Consumer<Fluid> getFluidConsumer() {
return fluidConsumer;
}

public void setFluidConsumer(Consumer<Fluid> fluidConsumer) {
this.fluidConsumer = fluidConsumer;
}

public Identifier getBackgroundTexture() {
return FLUID_BACKGROUND;
}

@NotNull
@Override
public List<Text> getTooltip() {
Identifier fluidId = Registry.FLUID.getId(fluidSupplier.get());

return Collections.singletonList(new TranslatableText(String.format("block.%s.%s", fluidId.getNamespace(), fluidId.getPath())));
}

@Override
public void onMouseClicked(float x, float y, int button) {
super.onMouseClicked(x, y, button);

ItemStack stack = getHandler().getPlayer().inventory.getCursorStack();

if (isWithin(x, y)) {
if (!stack.isEmpty()) {
FluidHandler.ofOptional(stack).ifPresent(fluids -> {
fluidSupplier = () -> fluids.getFirst().getFluid();
fluidConsumer.accept(fluidSupplier.get());
});
} else if (button == 2) {
fluidSupplier = () -> Fluids.EMPTY;
fluidConsumer.accept(fluidSupplier.get());
}
}
}

@Override
public void drawWidget(@NotNull MatrixStack matrices, @NotNull VertexConsumerProvider provider) {
if (getHidden()) {
return;
}

float x = getPosition().getX();
float y = getPosition().getY();

float sX = getSize().getWidth();
float sY = getSize().getHeight();

RenderLayer layer = Layers.get(getBackgroundTexture());

BaseRenderer.drawTexturedQuad(matrices, provider, layer, x, y, getSize().getWidth(), getSize().getHeight(), getBackgroundTexture());

if (fluidSupplier.get() != Fluids.EMPTY) {
SpriteRenderer.beginPass().setup(provider, RenderLayer.getSolid()).sprite(FluidUtilities.texture(fluidSupplier.get())[0]).color(FluidUtilities.color(MinecraftClient.getInstance().player, fluidSupplier.get())).light(0x00f000f0).overlay(
OverlayTexture.DEFAULT_UV).alpha(0xff).normal(matrices.peek().getNormal(), 0, 0, 0).position(matrices.peek().getModel(), x + 1, y + 1, x + sX - 1, y + sY - 1, 0F).next(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
}
}
private final Identifier FLUID_BACKGROUND = AstromineCommon.identifier("textures/widget/fluid_filter_background.png");

private Supplier<Fluid> fluidSupplier = () -> Fluids.EMPTY;

private Consumer<Fluid> fluidConsumer = fluid -> {};

public Supplier<Fluid> getFluidSupplier() {
return fluidSupplier;
}

public void setFluidSupplier(Supplier<Fluid> fluidSupplier) {
this.fluidSupplier = fluidSupplier;
}

public Consumer<Fluid> getFluidConsumer() {
return fluidConsumer;
}

public void setFluidConsumer(Consumer<Fluid> fluidConsumer) {
this.fluidConsumer = fluidConsumer;
}

public Identifier getBackgroundTexture() {
return FLUID_BACKGROUND;
}

@NotNull
@Override
public List<Text> getTooltip() {
Identifier fluidId = Registry.FLUID.getId(fluidSupplier.get());

return Collections.singletonList(new TranslatableText(String.format("block.%s.%s", fluidId.getNamespace(), fluidId.getPath())));
}

@Environment(EnvType.CLIENT)
@Override
public void onMouseClicked(float x, float y, int button) {
super.onMouseClicked(x, y, button);

ItemStack stack = getHandler().getPlayer().inventory.getCursorStack();

if (isWithin(x, y)) {
if (!stack.isEmpty()) {
FluidHandler.ofOptional(stack).ifPresent(fluids -> {
fluidSupplier = () -> fluids.getFirst().getFluid();
fluidConsumer.accept(fluidSupplier.get());
});
} else if (button == 2) {
fluidSupplier = () -> Fluids.EMPTY;
fluidConsumer.accept(fluidSupplier.get());
}
}
}

@Environment(EnvType.CLIENT)
@Override
public void drawWidget(@NotNull MatrixStack matrices, @NotNull VertexConsumerProvider provider) {
if (getHidden()) {
return;
}

float x = getPosition().getX();
float y = getPosition().getY();

float sX = getSize().getWidth();
float sY = getSize().getHeight();

RenderLayer layer = Layers.get(getBackgroundTexture());

BaseRenderer.drawTexturedQuad(matrices, provider, layer, x, y, getSize().getWidth(), getSize().getHeight(), getBackgroundTexture());

if (fluidSupplier.get() != Fluids.EMPTY) {
SpriteRenderer.beginPass().setup(provider, RenderLayer.getSolid()).sprite(FluidUtilities.texture(fluidSupplier.get())[0]).color(FluidUtilities.color(MinecraftClient.getInstance().player, fluidSupplier.get())).light(0x00f000f0).overlay(
OverlayTexture.DEFAULT_UV).alpha(0xff).normal(matrices.peek().getNormal(), 0, 0, 0).position(matrices.peek().getModel(), x + 1, y + 1, x + sX - 1, y + sY - 1, 0F).next(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class IdentifierMixin {

@Inject(method = "<init>([Ljava/lang/String;)V", at = @At("RETURN"))
private void init(String[] strings, CallbackInfo ci) {
if (AstromineConfig.get().compatibilityMode && namespace.equals(AstromineCommon.MOD_ID) && IdentifierFixRegistry.INSTANCE.containsKey(path)) {
if (namespace.equals(AstromineCommon.MOD_ID) && AstromineConfig.get().compatibilityMode && IdentifierFixRegistry.INSTANCE.containsKey(path)) {
String oldPath = path;
path = IdentifierFixRegistry.INSTANCE.get(path);
AstromineCommon.LOGGER.info("Fixed identifier path from " + oldPath + " to " + path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@

package com.github.chainmailstudios.astromine.registry;

import com.github.chainmailstudios.astromine.common.registry.IdentifierFixRegistry;

public class AstromineIdentifierFixes {
public static void initialize() {

}

public static void register(String oldPath, String newPath) {
IdentifierFixRegistry.INSTANCE.register(oldPath, newPath);
}
}
42 changes: 21 additions & 21 deletions astromine-core/src/main/resources/assets/astromine/lang/en_au.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,24 @@
"item.astromine.fools_gold_tiny_dust": "Fool's Gold Tiny Dust",
"item.astromine.glowstone_tiny_dust": "Glowstone Tiny Dust",
"item.astromine.meteoric_steel_tiny_dust": "Meteoric Steel Tiny Dust",
"item.astromine.iron_plates": "Iron Plates",
"item.astromine.metite_plates": "Metite Plates",
"item.astromine.gold_plates": "Gold Plates",
"item.astromine.netherite_plates": "Netherite Plates",
"item.astromine.stellum_plates": "Stellum Plates",
"item.astromine.univite_plates": "Univite Plates",
"item.astromine.tin_plates": "Tin Plates",
"item.astromine.copper_plates": "Copper Plates",
"item.astromine.silver_plates": "Silver Plates",
"item.astromine.lead_plates": "Lead Plates",
"item.astromine.bronze_plates": "Bronze Plates",
"item.astromine.steel_plates": "Steel Plates",
"item.astromine.electrum_plates": "Electrum Plates",
"item.astromine.rose_gold_plates": "Rose Gold Plates",
"item.astromine.sterling_silver_plates": "Sterling Silver Plates",
"item.astromine.fools_gold_plates": "Fool's Gold Plates",
"item.astromine.lunum_plates": "Lunum Plates",
"item.astromine.meteoric_steel_plates": "Meteoric Steel Plates",
"item.astromine.iron_plate": "Iron Plate",
"item.astromine.metite_plate": "Metite Plate",
"item.astromine.gold_plate": "Gold Plate",
"item.astromine.netherite_plate": "Netherite Plate",
"item.astromine.stellum_plate": "Stellum Plate",
"item.astromine.univite_plate": "Univite Plate",
"item.astromine.tin_plate": "Tin Plate",
"item.astromine.copper_plate": "Copper Plate",
"item.astromine.silver_plate": "Silver Plate",
"item.astromine.lead_plate": "Lead Plate",
"item.astromine.bronze_plate": "Bronze Plate",
"item.astromine.steel_plate": "Steel Plate",
"item.astromine.electrum_plate": "Electrum Plate",
"item.astromine.rose_gold_plate": "Rose Gold Plate",
"item.astromine.sterling_silver_plate": "Sterling Silver Plate",
"item.astromine.fools_gold_plate": "Fool's Gold Plate",
"item.astromine.lunum_plate": "Lunum Plate",
"item.astromine.meteoric_steel_plate": "Meteoric Steel Plate",
"item.astromine.iron_gear": "Iron Gear",
"item.astromine.metite_gear": "Metite Gear",
"item.astromine.gold_gear": "Gold Gear",
Expand Down Expand Up @@ -727,7 +727,7 @@
"text.astromine.components.plates.page_one.title": "Plates",
"text.astromine.components.plates.page_one.text": "Thin sheets of metal, plates are useful for constructing $(thing)housing$() for $(thing)machinery$().",
"text.astromine.components.plates.page_two.title": "Recipe",
"text.astromine.components.plates.page_two.text": "While the recipe shown is clearly for $(item)Iron Plates$(), simply substituting the $(item)Iron Ingots$() with any other $(thing)Ingots$() will create plates of that type.",
"text.astromine.components.plates.page_two.text": "While the recipe shown is clearly for an $(item)Iron Plate$(), simply substituting the $(item)Iron Ingots$() with any other $(thing)Ingots$() will create a plate of that type.",
"text.astromine.creatures.space_slime.title": "Space Slime",
"text.astromine.creatures.space_slime.page_one.title": "Space Slime",
"text.astromine.creatures.space_slime.page_one.text": "A fierce adversary which inhabits large sections of traversable space.",
Expand Down Expand Up @@ -1017,8 +1017,8 @@
"advancements.astromine.get_triturator.description": "Craft a Triturator",
"advancements.astromine.get_gear.title": "Grinds Your Gears",
"advancements.astromine.get_gear.description": "Craft a Gear",
"advancements.astromine.get_plates.title": "Flat Ingots",
"advancements.astromine.get_plates.description": "Craft some Plates",
"advancements.astromine.get_plate.title": "Flat Ingots",
"advancements.astromine.get_plate.description": "Craft a metal Plate",
"advancements.astromine.get_rose_gold_ingot.title": "Pretty in Pink",
"advancements.astromine.get_rose_gold_ingot.description": "Obtain a Rose Gold Ingot",
"advancements.astromine.get_basic_circuit.title": "Circuit Maker",
Expand Down
42 changes: 21 additions & 21 deletions astromine-core/src/main/resources/assets/astromine/lang/en_ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,24 +318,24 @@
"item.astromine.fools_gold_tiny_dust": "Fool's Gold Tiny Dust",
"item.astromine.glowstone_tiny_dust": "Glowstone Tiny Dust",
"item.astromine.meteoric_steel_tiny_dust": "Meteoric Steel Tiny Dust",
"item.astromine.iron_plates": "Iron Plates",
"item.astromine.metite_plates": "Metite Plates",
"item.astromine.gold_plates": "Gold Plates",
"item.astromine.netherite_plates": "Netherite Plates",
"item.astromine.stellum_plates": "Stellum Plates",
"item.astromine.univite_plates": "Univite Plates",
"item.astromine.tin_plates": "Tin Plates",
"item.astromine.copper_plates": "Copper Plates",
"item.astromine.silver_plates": "Silver Plates",
"item.astromine.lead_plates": "Lead Plates",
"item.astromine.bronze_plates": "Bronze Plates",
"item.astromine.steel_plates": "Steel Plates",
"item.astromine.electrum_plates": "Electrum Plates",
"item.astromine.rose_gold_plates": "Rose Gold Plates",
"item.astromine.sterling_silver_plates": "Sterling Silver Plates",
"item.astromine.fools_gold_plates": "Fool's Gold Plates",
"item.astromine.lunum_plates": "Lunum Plates",
"item.astromine.meteoric_steel_plates": "Meteoric Steel Plates",
"item.astromine.iron_plate": "Iron Plate",
"item.astromine.metite_plate": "Metite Plate",
"item.astromine.gold_plate": "Gold Plate",
"item.astromine.netherite_plate": "Netherite Plate",
"item.astromine.stellum_plate": "Stellum Plate",
"item.astromine.univite_plate": "Univite Plate",
"item.astromine.tin_plate": "Tin Plate",
"item.astromine.copper_plate": "Copper Plate",
"item.astromine.silver_plate": "Silver Plate",
"item.astromine.lead_plate": "Lead Plate",
"item.astromine.bronze_plate": "Bronze Plate",
"item.astromine.steel_plate": "Steel Plate",
"item.astromine.electrum_plate": "Electrum Plate",
"item.astromine.rose_gold_plate": "Rose Gold Plate",
"item.astromine.sterling_silver_plate": "Sterling Silver Plate",
"item.astromine.fools_gold_plate": "Fool's Gold Plate",
"item.astromine.lunum_plate": "Lunum Plate",
"item.astromine.meteoric_steel_plate": "Meteoric Steel Plate",
"item.astromine.iron_gear": "Iron Gear",
"item.astromine.metite_gear": "Metite Gear",
"item.astromine.gold_gear": "Gold Gear",
Expand Down Expand Up @@ -727,7 +727,7 @@
"text.astromine.components.plates.page_one.title": "Plates",
"text.astromine.components.plates.page_one.text": "Thin sheets of metal, plates are useful for constructing $(thing)housing$() for $(thing)machinery$().",
"text.astromine.components.plates.page_two.title": "Recipe",
"text.astromine.components.plates.page_two.text": "While the recipe shown is clearly for $(item)Iron Plates$(), simply substituting the $(item)Iron Ingots$() with any other $(thing)Ingots$() will create plates of that type.",
"text.astromine.components.plates.page_two.text": "While the recipe shown is clearly for an $(item)Iron Plate$(), simply substituting the $(item)Iron Ingots$() with any other $(thing)Ingots$() will create a plate of that type.",
"text.astromine.creatures.space_slime.title": "Space Slime",
"text.astromine.creatures.space_slime.page_one.title": "Space Slime",
"text.astromine.creatures.space_slime.page_one.text": "A fierce adversary which inhabits large sections of traversable space.",
Expand Down Expand Up @@ -1017,8 +1017,8 @@
"advancements.astromine.get_triturator.description": "Craft a Triturator",
"advancements.astromine.get_gear.title": "Grinds Your Gears",
"advancements.astromine.get_gear.description": "Craft a Gear",
"advancements.astromine.get_plates.title": "Flat Ingots",
"advancements.astromine.get_plates.description": "Craft some Plates",
"advancements.astromine.get_plate.title": "Flat Ingots",
"advancements.astromine.get_plate.description": "Craft a metal Plate",
"advancements.astromine.get_rose_gold_ingot.title": "Pretty in Pink",
"advancements.astromine.get_rose_gold_ingot.description": "Obtain a Rose Gold Ingot",
"advancements.astromine.get_basic_circuit.title": "Circuit Maker",
Expand Down
Loading

0 comments on commit fb75818

Please sign in to comment.