Skip to content

Commit

Permalink
misc (#1626)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwer523 authored Aug 3, 2024
1 parent 36da46a commit d3ca95e
Show file tree
Hide file tree
Showing 25 changed files with 139 additions and 93 deletions.
6 changes: 5 additions & 1 deletion src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,9 @@
"block.gtceu.nonconducting_casing": "buısɐƆ buıʇɔnpuoɔuoN",
"block.gtceu.normal_duct_pipe": "ǝdıԀ ʇɔnᗡ ןɐɯɹoN",
"block.gtceu.normal_laser_pipe": "ǝdıԀ ɹǝsɐꞀ ןɐɯɹoN",
"block.gtceu.normal_laser_pipe.tooltip": "sǝuıן ʇɥbıɐɹʇs uı ㄥ§ssoן ouɟ§ ɥʇıʍ ɹǝʍod buıʇʇıɯsuɐɹ⟘ㄥ§",
"block.gtceu.normal_optical_pipe": "ǝןqɐƆ ɹǝqıℲ ןɐɔıʇdO",
"block.gtceu.normal_optical_pipe.tooltip": "ɐʇɐᗡ uoıʇɐʇndɯoƆ ɹo ɥɔɹɐǝsǝᴚ buıʇʇıɯsuɐɹ⟘",
"block.gtceu.normal_optical_pipe.tooltip": "ㄥ§ɐʇɐᗡ ɥɔɹɐǝsǝᴚɟ§ ɹo ㄥ§uoıʇɐʇndɯoƆɟ§ buıʇʇıɯsuɐɹ⟘ㄥ§",
"block.gtceu.object_holder": "ɹǝpןoH ʇɔǝظqO",
"block.gtceu.oil_heavy": "ןıO ʎʌɐǝH",
"block.gtceu.oil_light": "ןıO ʇɥbıꞀ",
Expand Down Expand Up @@ -3735,6 +3736,9 @@
"gtceu.research_station": "uoıʇɐʇS ɥɔɹɐǝsǝᴚ",
"gtceu.rock_breaker": "ɹǝʞɐǝɹᗺ ʞɔoᴚ",
"gtceu.scanner": "ɹǝuuɐɔS",
"gtceu.scanner.copy_stick_empty": "ʞɔıʇS ʎʇdɯƎo§",
"gtceu.scanner.copy_stick_from": "ʎdoƆ oʇ ʞɔıʇSo§",
"gtceu.scanner.copy_stick_to": "ʞɔıʇS ɟo ʎdoƆo§",
"gtceu.sifter": "ɹǝʇɟıS",
"gtceu.steam_boiler": "ɹǝןıoᗺ ɯɐǝʇS",
"gtceu.steam_turbine": "ǝuıqɹn⟘ ɯɐǝʇS",
Expand Down
6 changes: 5 additions & 1 deletion src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,9 @@
"block.gtceu.nonconducting_casing": "Nonconducting Casing",
"block.gtceu.normal_duct_pipe": "Normal Duct Pipe",
"block.gtceu.normal_laser_pipe": "Normal Laser Pipe",
"block.gtceu.normal_laser_pipe.tooltip": "§7Transmitting power with §fno loss§7 in straight lines",
"block.gtceu.normal_optical_pipe": "Optical Fiber Cable",
"block.gtceu.normal_optical_pipe.tooltip": "Transmitting Research or Computation Data",
"block.gtceu.normal_optical_pipe.tooltip": "§7Transmitting §fComputation§7 or §fResearch Data§7",
"block.gtceu.object_holder": "Object Holder",
"block.gtceu.oil_heavy": "Heavy Oil",
"block.gtceu.oil_light": "Light Oil",
Expand Down Expand Up @@ -3735,6 +3736,9 @@
"gtceu.research_station": "Research Station",
"gtceu.rock_breaker": "Rock Breaker",
"gtceu.scanner": "Scanner",
"gtceu.scanner.copy_stick_empty": "§oEmpty Stick",
"gtceu.scanner.copy_stick_from": "§oStick to Copy",
"gtceu.scanner.copy_stick_to": "§oCopy of Stick",
"gtceu.sifter": "Sifter",
"gtceu.steam_boiler": "Steam Boiler",
"gtceu.steam_turbine": "Steam Turbine",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
@NoArgsConstructor
public class FluidProperty implements IMaterialProperty<FluidProperty>, FluidStorage {

@Getter
private final FluidStorageImpl storage = new FluidStorageImpl();
@Getter
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ public void verifyProperty(MaterialProperties properties) {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof WireProperties)) return false;
WireProperties that = (WireProperties) o;
if (!(o instanceof WireProperties that)) return false;
return voltage == that.voltage &&
amperage == that.amperage &&
lossPerBlock == that.lossPerBlock &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

import org.jetbrains.annotations.Nullable;

import javax.annotation.ParametersAreNonnullByDefault;

@ParametersAreNonnullByDefault
public class LaserPipeBlockItem extends PipeBlockItem implements IItemRendererProvider {

public LaserPipeBlockItem(PipeBlock block, Properties properties) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
package com.gregtechceu.gtceu.api.item;

import com.gregtechceu.gtceu.common.block.OpticalPipeBlock;
import com.gregtechceu.gtceu.utils.GTUtil;

import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider;
import com.lowdragmc.lowdraglib.client.renderer.IRenderer;

import net.minecraft.network.chat.Component;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

import org.jetbrains.annotations.Nullable;

import java.util.List;

import javax.annotation.ParametersAreNonnullByDefault;

@ParametersAreNonnullByDefault
Expand All @@ -26,18 +20,6 @@ public OpticalPipeBlockItem(OpticalPipeBlock block, Properties properties) {
super(block, properties);
}

@Override
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltip,
TooltipFlag isAdvanced) {
tooltip.add(Component.translatable("block.gtceu.normal_optical_pipe.tooltip"));

if (GTUtil.isShiftDown()) {
tooltip.add(Component.translatable("gtceu.tool_action.wire_cutter.connect"));
} else {
tooltip.add(Component.translatable("gtceu.tool_action.show_tooltips"));
}
}

@Nullable
@Override
@OnlyIn(Dist.CLIENT)
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/gregtechceu/gtceu/api/item/PipeBlockItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;

import org.jetbrains.annotations.Nullable;

import java.util.List;

import javax.annotation.ParametersAreNonnullByDefault;

/**
Expand All @@ -36,6 +43,17 @@ public PipeBlock getBlock() {
return (PipeBlock) super.getBlock();
}

@Override
public void appendHoverText(ItemStack stack, @Nullable Level level, List<Component> tooltip,
TooltipFlag isAdvanced) {
super.appendHoverText(stack, level, tooltip, isAdvanced);
if (GTUtil.isShiftDown()) {
tooltip.add(Component.translatable("gtceu.tool_action.wire_cutter.connect"));
} else {
tooltip.add(Component.translatable("gtceu.tool_action.show_tooltips"));
}
}

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public boolean placeBlock(BlockPlaceContext context, BlockState state) {
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ public class GTRecipeType implements RecipeType<GTRecipe> {
protected List<Function<CompoundTag, String>> dataInfos = new ArrayList<>();
@Setter
@Getter
protected int maxTooltips = 3;
@Setter
@Getter
protected boolean isFuelRecipeType;
@Getter
@Setter
Expand Down Expand Up @@ -168,6 +165,16 @@ public GTRecipeType setUiBuilder(BiConsumer<GTRecipe, WidgetGroup> uiBuilder) {
return this;
}

public GTRecipeType setMaxTooltips(int maxTooltips) {
this.recipeUI.setMaxTooltips(maxTooltips);
return this;
}

public GTRecipeType setXEIVisible(boolean XEIVisible) {
this.recipeUI.setXEIVisible(XEIVisible);
return this;
}

public GTRecipeType addDataInfo(Function<CompoundTag, String> dataInfo) {
this.dataInfos.add(dataInfo);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public class GTRecipeTypeUI {

@Getter
@Setter
private boolean JEIVisible = true;
private boolean XEIVisible = true;

private CompoundTag customUICache;
private Size jeiSize;
private Size xeiSize;
@Getter
private int originalWidth;

Expand Down Expand Up @@ -132,15 +132,15 @@ public boolean hasCustomUI() {

public void reloadCustomUI() {
this.customUICache = null;
this.jeiSize = null;
this.xeiSize = null;
}

public Size getJEISize() {
Size size = this.jeiSize;
Size size = this.xeiSize;
if (size == null) {
var originalSize = createEditableUITemplate(false, false).createDefault().getSize();
this.originalWidth = originalSize.width;
this.jeiSize = size = new Size(Math.max(originalWidth, 150),
this.xeiSize = size = new Size(Math.max(originalWidth, 150),
getPropertyHeightShift() + 5 + originalSize.height);
}
return size;
Expand Down Expand Up @@ -394,7 +394,7 @@ protected IGuiTexture getOverlaysForSlot(boolean isOutput, RecipeCapability<?> c
* @return the height used to determine size of background texture in JEI
*/
public int getPropertyHeightShift() {
int maxPropertyCount = recipeType.getMaxTooltips() + recipeType.getDataInfos().size();
int maxPropertyCount = maxTooltips + recipeType.getDataInfos().size();
return maxPropertyCount * 10; // GTRecipeWidget#LINE_HEIGHT
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ public void setActive(boolean active, int duration) {
} else if (!this.isActive && active) {
this.isActive = true;
stateChanged = true;
TaskHandler.enqueueServerTask((ServerLevel) getLevel(), () -> {
setActive(false, -1);
}, duration);
TaskHandler.enqueueServerTask((ServerLevel) getLevel(), () -> setActive(false, -1), duration);
}

if (stateChanged) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
public class ServerCommands {

private static final SimpleCommandExceptionType ERROR_CLEAR_EVERYTHING_FAILED = new SimpleCommandExceptionType(
Component.translatable("effect.clear.everything.failed"));
Component.translatable("commands.effect.clear.everything.failed"));
private static final SimpleCommandExceptionType ERROR_GIVE_FAILED = new SimpleCommandExceptionType(
Component.translatable("effect.give.failed"));
Component.translatable("commands.effect.give.failed"));

public static List<LiteralArgumentBuilder<CommandSourceStack>> createServerCommands() {
return List.of(
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -2234,7 +2234,7 @@ public Component getItemName(ItemStack stack) {

public static ItemEntry<ComponentItem> BOTTLE_PURPLE_DRINK = REGISTRATE.item("purple_drink", ComponentItem::create)
.lang("Purple Drink")
.onRegister(attach(new FoodStats(GTFoods.DRINK, true, () -> Items.GLASS_BOTTLE.getDefaultInstance())))
.onRegister(attach(new FoodStats(GTFoods.DRINK, true, Items.GLASS_BOTTLE::getDefaultInstance)))
.onRegister(compassNode(GTCompassSections.MISC))
.register();
public static ItemEntry<ComponentItem> PLANT_BALL = REGISTRATE.item("plant_ball", ComponentItem::create)
Expand Down Expand Up @@ -2668,7 +2668,7 @@ public Component getItemName(ItemStack stack) {
.onRegister(compassNode(GTCompassSections.MISC)).register();

public static ItemEntry<RecordItem> SUS_RECORD = REGISTRATE
.item("sus_record", p -> new RecordItem(15, () -> GTSoundEntries.SUS_RECORD.getMainEvent(), p, 820))
.item("sus_record", p -> new RecordItem(15, GTSoundEntries.SUS_RECORD::getMainEvent, p, 820))
.lang("Music Disc")
.register();
public static ItemEntry<Item> NAN_CERTIFICATE = REGISTRATE.item("nan_certificate", Item::new)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ public class GTRecipeTypes {
.setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT)
.setSlotOverlay(false, false, GuiTextures.SCANNER_OVERLAY)
.setSlotOverlay(true, false, GuiTextures.RESEARCH_STATION_OVERLAY)
.addCustomRecipeLogic(new ResearchManager.DataStickCopyScannerLogic())
.setScanner(true)
.setMaxTooltips(4)
.setSound(GTValues.FOOLS.get() ? GTSoundEntries.SCIENCE : GTSoundEntries.COMPUTATION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.List;

/**
* @see gregtech.common.ToolEventHandlers#onHarvestDrops(BlockEvent.HarvestDropsEvent)
* @see com.gregtechceu.gtceu.common.item.tool.ToolEventHandlers#onHarvestDrops
*/
public class HarvestIceBehavior implements IToolBehavior {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,12 @@ protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand
setAllowInputFromOutputSideFluids(false);
playerIn.sendSystemMessage(
Component.translatable("gtceu.machine.basic.input_from_output_side.disallow")
.append(Component.translatable("gtceu.creative.chest.fluid")));
.append(Component.translatable("gtceu.creative.tank.fluid")));
} else {
setAllowInputFromOutputSideFluids(true);
playerIn.sendSystemMessage(
Component.translatable("gtceu.machine.basic.input_from_output_side.allow")
.append(Component.translatable("gtceu.creative.chest.fluid")));
.append(Component.translatable("gtceu.creative.tank.fluid")));
}
}
return InteractionResult.SUCCESS;
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/com/gregtechceu/gtceu/data/lang/BlockLang.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ private static void initCasingLang(RegistrateLangProvider provider) {
replace(provider, "block.gtceu.reaction_safe_mixing_casing", "Reaction-Safe Mixing Casing");
replace(provider, "block.gtceu.vibration_safe_casing", "Vibration-Safe Casing");

// todo multiblock tanks
// replace(provider, "tile.steam_casing.wood_wall.name", "Wooden Wall");

// todo fusion
replace(provider, "block.gtceu.superconducting_coil", "Superconducting Coil Block");
replace(provider, "block.gtceu.fusion_coil", "Fusion Coil Block");
replace(provider, "block.gtceu.fusion_casing", "Fusion Machine Casing");
Expand All @@ -91,6 +87,9 @@ private static void initCasingLang(RegistrateLangProvider provider) {
provider.add("block.gtceu.powderbarrel.drops_tooltip",
"Slightly larger than TNT, drops all destroyed Blocks as Items");
provider.add("block.gtceu.itnt.drops_tooltip", "Much larger than TNT, drops all destroyed Blocks as Items");
provider.add("block.gtceu.normal_optical_pipe.tooltip", "Transmitting Research or Computation Data");

provider.add("block.gtceu.normal_laser_pipe.tooltip",
"§7Transmitting power with §fno loss§7 in straight lines");
provider.add("block.gtceu.normal_optical_pipe.tooltip", "§7Transmitting §fComputation§7 or §fResearch Data§7");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ protected static void init(RegistrateLangProvider provider) {
provider.add("gtceu.machine.world_accelerator.mode_tile", "Block Entity Mode");
provider.add("gtceu.machine.world_accelerator.mode_entity", "Random Tick Mode");

// Scanner
provider.add("gtceu.scanner.copy_stick_from", "§oStick to Copy");
provider.add("gtceu.scanner.copy_stick_empty", "§oEmpty Stick");
provider.add("gtceu.scanner.copy_stick_to", "§oCopy of Stick");

// HPCA Components
provider.add("gtceu.machine.hpca.empty_component.tooltip", "Just for filling space");
provider.add("gtceu.machine.hpca.heat_sink_component.tooltip", "Free cooling! Is anything free?");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public static void addShapedRecipe(Consumer<FinishedRecipe> provider, boolean wi
}
}
for (Character c : set) {
builder.define(c, ToolHelper.getToolFromSymbol(c.charValue()).itemTags.get(0));
builder.define(c, ToolHelper.getToolFromSymbol(c).itemTags.get(0));
}
builder.save(provider);

Expand Down Expand Up @@ -307,7 +307,7 @@ public static void addShapedEnergyTransferRecipe(Consumer<FinishedRecipe> provid
}
}
for (Character c : set) {
builder.define(c, ToolHelper.getToolFromSymbol(c.charValue()).itemTags.get(0));
builder.define(c, ToolHelper.getToolFromSymbol(c).itemTags.get(0));
}
builder.save(provider);

Expand Down Expand Up @@ -355,7 +355,7 @@ public static void addShapelessRecipe(Consumer<FinishedRecipe> provider, @NotNul
} else if (content instanceof ItemProviderEntry<?> entry) {
builder.requires(entry.asStack());
} else if (content instanceof Character c) {
builder.requires(ToolHelper.getToolFromSymbol(c.charValue()).itemTags.get(0));
builder.requires(ToolHelper.getToolFromSymbol(c).itemTags.get(0));
}
}
builder.save(provider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.gregtechceu.gtceu.integration.emi.recipe.GTRecipeTypeEmiCategory;

import com.lowdragmc.lowdraglib.LDLib;
import com.lowdragmc.lowdraglib.Platform;
import com.lowdragmc.lowdraglib.gui.modular.ModularUIContainer;

import net.minecraft.core.registries.BuiltInRegistries;
Expand Down Expand Up @@ -45,7 +46,7 @@ public void register(EmiRegistry registry) {
registry.addCategory(GTBedrockFluidEmiCategory.CATEGORY);
for (RecipeType<?> recipeType : BuiltInRegistries.RECIPE_TYPE) {
if (recipeType instanceof GTRecipeType gtRecipeType) {
if (gtRecipeType.getRecipeUI().isJEIVisible()) {
if (Platform.isDevEnv() || gtRecipeType.getRecipeUI().isXEIVisible()) {
registry.addCategory(GTRecipeTypeEmiCategory.CATEGORIES.apply(gtRecipeType));
}
}
Expand Down
Loading

0 comments on commit d3ca95e

Please sign in to comment.