From 9789ae387484ce4458b1e3668727deb9ad94952f Mon Sep 17 00:00:00 2001 From: xkball <45330674+xkball@users.noreply.github.com> Date: Tue, 6 Jun 2023 18:37:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E9=99=90=E6=B0=B4=E4=BB=93=20?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=B7=A5=E5=85=B7=20=E8=B7=A8=E7=BB=B4?= =?UTF-8?q?=E5=BA=A6=E6=95=B0=E6=8D=AE(=E6=9C=AA=E5=AE=8C=E6=88=90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 2 +- .../me/oganesson/gregica/GCEventHandler.java | 8 ++ .../java/me/oganesson/gregica/Gregica.java | 9 +- .../me/oganesson/gregica/api/GCValues.java | 3 + .../api/capability/fluid/InfFluidTank.java | 66 +++++++++++ .../gregica/api/data/CrossWorldData.java | 15 +++ .../oganesson/gregica/client/GCTextures.java | 9 +- .../gregica/common/data/CWDataType.java | 50 ++++++++ .../common/data/CrossWorldDataHandler.java | 105 ++++++++++++++++ .../gregica/common/data/DataEventHandler.java | 37 ++++++ .../common/recipes/xkball/XkballRecipe.java | 2 + .../recipes/xkball/laser/LaserRecipes.java | 2 +- .../XkballCraftingTableRecipe.java | 25 ++++ .../tileentities/mte/GCMetaEntities.java | 3 + .../mte/multipart/MTEInfWaterHatch.java | 112 ++++++++++++++++++ .../mte/multipart/MTELaserHatch.java | 83 +++++++++---- .../me/oganesson/gregica/config/GCConfig.java | 6 + .../gregica/config/GCConfigValue.java | 5 + .../mixin/gregtech/MixinMetaItemClient.java | 46 +++++++ .../oganesson/gregica/proxy/CommonProxy.java | 7 ++ .../oganesson/gregica/utils/GCLangUtil.java | 73 ++++++++++++ .../gregica/utils/GCRecipeUtils.java | 96 +++++++++++++++ .../oganesson/gregica/utils/RecipeUtils.java | 67 ----------- .../resources/assets/gregica/lang/en_US.lang | 5 + .../resources/assets/gregica/lang/zh_CN.lang | 7 +- .../textures/blocks/multipart/inf_water.png | Bin 0 -> 2130 bytes .../blocks/multipart/inf_water.png.mcmeta | 7 ++ src/main/resources/mixins.gregica_late.json | 3 +- 28 files changed, 754 insertions(+), 99 deletions(-) create mode 100644 src/main/java/me/oganesson/gregica/api/capability/fluid/InfFluidTank.java create mode 100644 src/main/java/me/oganesson/gregica/api/data/CrossWorldData.java create mode 100644 src/main/java/me/oganesson/gregica/common/data/CWDataType.java create mode 100644 src/main/java/me/oganesson/gregica/common/data/CrossWorldDataHandler.java create mode 100644 src/main/java/me/oganesson/gregica/common/data/DataEventHandler.java create mode 100644 src/main/java/me/oganesson/gregica/common/recipes/xkball/worktablerecipe/XkballCraftingTableRecipe.java create mode 100644 src/main/java/me/oganesson/gregica/common/tileentities/mte/multipart/MTEInfWaterHatch.java create mode 100644 src/main/java/me/oganesson/gregica/mixin/gregtech/MixinMetaItemClient.java create mode 100644 src/main/java/me/oganesson/gregica/utils/GCLangUtil.java create mode 100644 src/main/java/me/oganesson/gregica/utils/GCRecipeUtils.java delete mode 100644 src/main/java/me/oganesson/gregica/utils/RecipeUtils.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multipart/inf_water.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/multipart/inf_water.png.mcmeta diff --git a/gradle.properties b/gradle.properties index 77080e4..6b4288c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.daemon=false ## mod info archives_base_name=Gregica++ minecraft_version=1.12.2 -current_version=0.0.3 +current_version=0.4.3 current_state=alpha ## Hard Dependensies diff --git a/src/main/java/me/oganesson/gregica/GCEventHandler.java b/src/main/java/me/oganesson/gregica/GCEventHandler.java index 18db37c..251bb54 100644 --- a/src/main/java/me/oganesson/gregica/GCEventHandler.java +++ b/src/main/java/me/oganesson/gregica/GCEventHandler.java @@ -15,6 +15,7 @@ import me.oganesson.gregica.common.unification.materials.ore.GCOrePrefixs; import me.oganesson.gregica.network.GCNetworkManager; import me.oganesson.gregica.network.packets.MouseEventToSeverPacker; +import me.oganesson.gregica.utils.GCLangUtil; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -24,6 +25,7 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -85,4 +87,10 @@ public static void initMaterialInfo(GregTechAPI.RegisterEvent public static void initComponents(GregTechAPI.RegisterEvent event) { GCYSCraftingComponent.init(); } + + @SubscribeEvent + @SideOnly(Side.CLIENT) + public static void onClientEvent(TickEvent.ClientTickEvent event){ + GCLangUtil.updateModifier(); + } } diff --git a/src/main/java/me/oganesson/gregica/Gregica.java b/src/main/java/me/oganesson/gregica/Gregica.java index 390bc1b..222f043 100644 --- a/src/main/java/me/oganesson/gregica/Gregica.java +++ b/src/main/java/me/oganesson/gregica/Gregica.java @@ -1,6 +1,6 @@ package me.oganesson.gregica; -import gregtech.common.ConfigHolder; +import gregtech.api.event.HighTierEvent; import me.oganesson.gregica.client.render.BlocksHighlightRenderer; import me.oganesson.gregica.proxy.CommonProxy; import net.minecraft.block.Block; @@ -42,7 +42,7 @@ public class Gregica { @EventHandler public void onConstruction(FMLConstructionEvent event) { - ConfigHolder.machines.highTierContent = true; + // ConfigHolder.machines.highTierContent = true; } @EventHandler @@ -66,6 +66,11 @@ public static ResourceLocation gcResource(String path){ @Mod.EventBusSubscriber public static class ObjectRegistryHandler { /** Listen for the register event for creating custom items */ + + @SubscribeEvent + public static void onCheckHighTier(HighTierEvent event){ + event.enableHighTier(); + } @SubscribeEvent public static void addItems(RegistryEvent.Register event) { proxy.registerItems(event); diff --git a/src/main/java/me/oganesson/gregica/api/GCValues.java b/src/main/java/me/oganesson/gregica/api/GCValues.java index 05fc3d9..7f6e1c0 100644 --- a/src/main/java/me/oganesson/gregica/api/GCValues.java +++ b/src/main/java/me/oganesson/gregica/api/GCValues.java @@ -36,6 +36,9 @@ public class GCValues { public static final boolean IS_TC_LOADED = Loader.isModLoaded("thaumcraft"); + @SuppressWarnings("SpellCheckingInspection") + public static final boolean IS_BilingualName_LOADED = Loader.isModLoaded("bilingualname"); + //用于writeCustomData public static final int UPDATE_TIER = 114514; public static final int REQUIRE_DATA_UPDATE = 1919; diff --git a/src/main/java/me/oganesson/gregica/api/capability/fluid/InfFluidTank.java b/src/main/java/me/oganesson/gregica/api/capability/fluid/InfFluidTank.java new file mode 100644 index 0000000..740cad0 --- /dev/null +++ b/src/main/java/me/oganesson/gregica/api/capability/fluid/InfFluidTank.java @@ -0,0 +1,66 @@ +package me.oganesson.gregica.api.capability.fluid; + +import gregtech.api.capability.impl.NotifiableFluidTank; +import gregtech.api.metatileentity.MetaTileEntity; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.Nullable; + +public class InfFluidTank extends NotifiableFluidTank { + + final Fluid fluidType; + final FluidStack stack; + + public InfFluidTank(FluidStack fluidStack, MetaTileEntity entityToNotify, boolean isExport) { + super(Integer.MAX_VALUE, entityToNotify, isExport); + this.fluid = fluidStack; + this.fluidType = fluidStack.getFluid(); + this.stack = new FluidStack(fluid,Integer.MAX_VALUE); + } + + @Nullable + @Override + public FluidStack getFluid() { + return stack; + } + + @Override + public void setFluid(@Nullable FluidStack fluid) { + } + + public void update(){ + this.onContentsChanged(); + } + @Override + public boolean canFill() { + return false; + } + + @Override + public boolean canDrain() { + return true; + } + + @Override + public FluidStack drain(FluidStack resource, boolean doDrain) { + return resource; + } + + @Override + public FluidStack drain(int maxDrain, boolean doDrain) { + if(fluid != null){ + return new FluidStack(fluid,maxDrain); + } + return null; + } + + @Override + public int fill(FluidStack resource, boolean doFill) { + return 0; + } + + @Override + public int getFluidAmount() { + return Integer.MAX_VALUE; + } +} diff --git a/src/main/java/me/oganesson/gregica/api/data/CrossWorldData.java b/src/main/java/me/oganesson/gregica/api/data/CrossWorldData.java new file mode 100644 index 0000000..854528d --- /dev/null +++ b/src/main/java/me/oganesson/gregica/api/data/CrossWorldData.java @@ -0,0 +1,15 @@ +package me.oganesson.gregica.api.data; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IStringSerializable; + +public interface CrossWorldData extends IStringSerializable { + + void load(NBTTagCompound tagCompound); + + NBTTagCompound save(); + + boolean isDirty(); + + void init(); +} diff --git a/src/main/java/me/oganesson/gregica/client/GCTextures.java b/src/main/java/me/oganesson/gregica/client/GCTextures.java index e7acc58..dd5f43d 100644 --- a/src/main/java/me/oganesson/gregica/client/GCTextures.java +++ b/src/main/java/me/oganesson/gregica/client/GCTextures.java @@ -39,6 +39,8 @@ public class GCTextures { public static SimpleOverlayRenderer LASER_COLORED; + public static SimpleOverlayRenderer INF_WATER; + public static SimpleSidedCubeRenderer LAPOTRONIC_CASING; public static OrientedOverlayRenderer LAPOTRONIC_CAPACITOR; @@ -80,9 +82,9 @@ public class GCTextures { public static OrientedOverlayRenderer SONICATOR_OVERLAY = new OrientedOverlayRenderer("multiblock/sonicator"); public static OrientedOverlayRenderer CATALYTIC_REFORMER_OVERLAY = new OrientedOverlayRenderer("multiblock/catalytic_reformer"); public static OrientedOverlayRenderer INDUSTRIAL_DRILL_OVERLAY = new OrientedOverlayRenderer("multiblock/industrial_drill"); - public static OrientedOverlayRenderer SUPRACHRONAL_OVERLAY = new OrientedOverlayRenderer("multiblock/suprachronal_assembler"); - - public static SimpleOverlayRenderer SUPRACHRONAL_CASING = new SimpleOverlayRenderer("casings/solid/suprachronal_casing"); +// public static OrientedOverlayRenderer SUPRACHRONAL_OVERLAY = new OrientedOverlayRenderer("multiblock/suprachronal_assembler"); +// +// public static SimpleOverlayRenderer SUPRACHRONAL_CASING = new SimpleOverlayRenderer("casings/solid/suprachronal_casing"); public static void preInit() { @@ -113,6 +115,7 @@ public static void preInit() { FLOTATION_CELL_REGULATOR = new SimpleOverlayRenderer("flotation_casing"); VACUUM_CASING = new SimpleOverlayRenderer("vacuum_casing"); LASER_COLORED = new SimpleOverlayRenderer("multipart/laser_hatch_colored"); + INF_WATER = new SimpleOverlayRenderer("multipart/inf_water"); } } \ No newline at end of file diff --git a/src/main/java/me/oganesson/gregica/common/data/CWDataType.java b/src/main/java/me/oganesson/gregica/common/data/CWDataType.java new file mode 100644 index 0000000..438a0e7 --- /dev/null +++ b/src/main/java/me/oganesson/gregica/common/data/CWDataType.java @@ -0,0 +1,50 @@ +package me.oganesson.gregica.common.data; + +import me.oganesson.gregica.api.data.CrossWorldData; + +import java.util.HashMap; +import java.util.Map; + +public enum CWDataType { + + ; + private final String name; + private final Class aClass; + + private static final Map tableMap = new HashMap<>(); + + CWDataType(String name, Class aClass) { + this.name = name; + this.aClass = aClass; + + } + + public static CrossWorldData byName(String s){ + if(tableMap.isEmpty()){ + for(CWDataType table : CWDataType.values()){ + tableMap.put(table.name,table); + } + } + if(tableMap.containsKey(s)){ + return tableMap.get(s).newInstance(); + } + return null; + } + + public String getName() { + return name; + } + + public Class getaClass() { + return aClass; + } + + public CrossWorldData newInstance() { + try { + return (CrossWorldData) this.getaClass().newInstance(); + } catch (InstantiationException | IllegalAccessException e) { + return null; + } + } + +} diff --git a/src/main/java/me/oganesson/gregica/common/data/CrossWorldDataHandler.java b/src/main/java/me/oganesson/gregica/common/data/CrossWorldDataHandler.java new file mode 100644 index 0000000..b9e4d4c --- /dev/null +++ b/src/main/java/me/oganesson/gregica/common/data/CrossWorldDataHandler.java @@ -0,0 +1,105 @@ +package me.oganesson.gregica.common.data; + +import codechicken.lib.util.DirectoryWalker; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import me.oganesson.gregica.api.data.CrossWorldData; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraftforge.common.DimensionManager; + +import java.io.File; +import java.io.IOException; +import java.util.Map; + +public enum CrossWorldDataHandler { + INSTANCE; + + private static File dataFold; + + private final Map data = new Object2ObjectOpenHashMap<>(); + private int loadStack = 0; + + public CrossWorldData getOrCreate(CWDataType type){ + if(data.containsKey(type.getName())){ + return data.get(type.getName()); + } + CrossWorldData result = type.newInstance(); + if (result != null) { + result.init(); + } + return result; + } + + public CrossWorldData getData(String key){ + return data.get(key); + } + + public void loadWorld(int dimension) throws IOException { + if(this.loadStack == 0){ + DirectoryWalker walker = new DirectoryWalker(DirectoryWalker.FALSE,DirectoryWalker.TRUE); + for(File file : walker.walk(dataFold)){ + CrossWorldData crossWorldData = CWDataType.byName(file.getName()); + if(crossWorldData != null){ + crossWorldData.load(CompressedStreamTools.read(file)); + } + else { + //noinspection ResultOfMethodCallIgnored + file.delete(); + } + } + } + this.loadStack++; + } + + public void unloadWorld(int dimension) throws IOException { + this.loadStack--; + if(this.loadStack <= 0){ + for(CrossWorldData crossWorldData : data.values()){ + File file = new File(dataFold,crossWorldData.getName()); + if(!file.exists()){ + //noinspection ResultOfMethodCallIgnored + file.createNewFile(); + CompressedStreamTools.safeWrite(crossWorldData.save(),file); + } + } + this.data.clear(); + ((Object2ObjectOpenHashMap)this.data).trim(); + } + } + + public void save(int dimension) throws IOException { + for(CrossWorldData crossWorldData : data.values()){ + if(crossWorldData.isDirty()){ + File file = new File(dataFold,crossWorldData.getName()); + if(!file.exists()){ + //noinspection ResultOfMethodCallIgnored + file.createNewFile(); + CompressedStreamTools.safeWrite(crossWorldData.save(),file); + } + } + } + } + + public int getLoadStack() { + return loadStack; + } + + public void setLoadStack(int loadStack) { + this.loadStack = loadStack; + } + + + static { + dataFold = DimensionManager.getCurrentSaveRootDirectory(); + if(dataFold != null){ + dataFold = new File(dataFold,"gregica_data"); + if(!dataFold.exists()){ + //noinspection ResultOfMethodCallIgnored + dataFold.mkdirs(); + } + } + else { + throw new RuntimeException("Gregica cannot get data directory."); + } + } + +} diff --git a/src/main/java/me/oganesson/gregica/common/data/DataEventHandler.java b/src/main/java/me/oganesson/gregica/common/data/DataEventHandler.java new file mode 100644 index 0000000..969831c --- /dev/null +++ b/src/main/java/me/oganesson/gregica/common/data/DataEventHandler.java @@ -0,0 +1,37 @@ +package me.oganesson.gregica.common.data; + +import me.oganesson.gregica.Gregica; +import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.io.IOException; + +@Mod.EventBusSubscriber(modid = Gregica.MOD_ID) +public class DataEventHandler { + + @SubscribeEvent + public static void onWorldLoad(WorldEvent.Load event){ + try { + CrossWorldDataHandler.INSTANCE.loadWorld(event.getWorld().provider.getDimension()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @SubscribeEvent + public static void onWorldSave(WorldEvent.Save event) throws IOException { + CrossWorldDataHandler.INSTANCE.save(event.getWorld().provider.getDimension()); + } + + @SubscribeEvent + public static void onWorldUnload(WorldEvent.Unload event){ + try { + CrossWorldDataHandler.INSTANCE.unloadWorld(event.getWorld().provider.getDimension()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + +} diff --git a/src/main/java/me/oganesson/gregica/common/recipes/xkball/XkballRecipe.java b/src/main/java/me/oganesson/gregica/common/recipes/xkball/XkballRecipe.java index 301e0fb..abdfd72 100644 --- a/src/main/java/me/oganesson/gregica/common/recipes/xkball/XkballRecipe.java +++ b/src/main/java/me/oganesson/gregica/common/recipes/xkball/XkballRecipe.java @@ -1,9 +1,11 @@ package me.oganesson.gregica.common.recipes.xkball; import me.oganesson.gregica.common.recipes.xkball.laser.LaserRecipes; +import me.oganesson.gregica.common.recipes.xkball.worktablerecipe.XkballCraftingTableRecipe; public class XkballRecipe { public static void init(){ LaserRecipes.init(); + XkballCraftingTableRecipe.init(); } } diff --git a/src/main/java/me/oganesson/gregica/common/recipes/xkball/laser/LaserRecipes.java b/src/main/java/me/oganesson/gregica/common/recipes/xkball/laser/LaserRecipes.java index 3d116f5..4af10ec 100644 --- a/src/main/java/me/oganesson/gregica/common/recipes/xkball/laser/LaserRecipes.java +++ b/src/main/java/me/oganesson/gregica/common/recipes/xkball/laser/LaserRecipes.java @@ -14,7 +14,7 @@ import me.oganesson.gregica.common.tileentities.mte.GCMetaEntities; import me.oganesson.gregica.common.tileentities.mte.multipart.MTELaserHatch; -import static me.oganesson.gregica.utils.RecipeUtils.*; +import static me.oganesson.gregica.utils.GCRecipeUtils.*; public class LaserRecipes { diff --git a/src/main/java/me/oganesson/gregica/common/recipes/xkball/worktablerecipe/XkballCraftingTableRecipe.java b/src/main/java/me/oganesson/gregica/common/recipes/xkball/worktablerecipe/XkballCraftingTableRecipe.java new file mode 100644 index 0000000..70b3004 --- /dev/null +++ b/src/main/java/me/oganesson/gregica/common/recipes/xkball/worktablerecipe/XkballCraftingTableRecipe.java @@ -0,0 +1,25 @@ +package me.oganesson.gregica.common.recipes.xkball.worktablerecipe; + +import gregtech.api.recipes.ModHandler; +import gregtech.api.unification.material.MarkerMaterials; +import gregtech.api.unification.material.Materials; +import gregtech.api.unification.ore.OrePrefix; +import gregtech.api.unification.stack.UnificationEntry; +import me.oganesson.gregica.common.tileentities.mte.GCMetaEntities; +import me.oganesson.gregica.utils.GCRecipeUtils; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class XkballCraftingTableRecipe { + + public static void init(){ + ModHandler.addShapedRecipe("infinite_water_hatch", GCMetaEntities.INF_WATER_HATCH.getStackForm(), + "KEK", "UWU","RTR", + 'E', GCRecipeUtils.getComponent(GCRecipeUtils.Component.PUMP, MarkerMaterials.Tier.LuV).getStackForm(), + 'T', GCRecipeUtils.Component.CASING.getAsStack(MarkerMaterials.Tier.LuV), + 'R',new UnificationEntry(OrePrefix.circuit, MarkerMaterials.Tier.LuV), + 'K',new UnificationEntry(OrePrefix.plate, Materials.Osmium), + 'W',GCRecipeUtils.Component.FIELD_GENERATOR.getAsStack(MarkerMaterials.Tier.LuV), + 'U',new ItemStack(Items.WATER_BUCKET)); + } +} diff --git a/src/main/java/me/oganesson/gregica/common/tileentities/mte/GCMetaEntities.java b/src/main/java/me/oganesson/gregica/common/tileentities/mte/GCMetaEntities.java index ff54cd3..32a7410 100644 --- a/src/main/java/me/oganesson/gregica/common/tileentities/mte/GCMetaEntities.java +++ b/src/main/java/me/oganesson/gregica/common/tileentities/mte/GCMetaEntities.java @@ -69,6 +69,8 @@ public class GCMetaEntities { public static MTELaserHatch[] LASER_HATCH_INPUT = new MTELaserHatch[(GTValues.V.length-5)*6]; public static MTELaserHatch[] LASER_HATCH_OUTPUT = new MTELaserHatch[(GTValues.V.length-5)*6]; + + public static MTEInfWaterHatch INF_WATER_HATCH; public static final MTECreativeEnergyHatch[] CREATIVE_ENERGY_HATCHES = new MTECreativeEnergyHatch[GTValues.V.length]; @@ -204,6 +206,7 @@ private static void initMultiPart(){ new MTELaserHatch(gcID("laser_hatch_output_"+GTValues.VN[i]+"_a_"+a),i,a,HatchType.OUTPUT)); } } + INF_WATER_HATCH = registerMetaTileEntity(nextMultiPartID(),new MTEInfWaterHatch(gcID("infinite_water_hatch"))); } private static void initSingleMachine(){ diff --git a/src/main/java/me/oganesson/gregica/common/tileentities/mte/multipart/MTEInfWaterHatch.java b/src/main/java/me/oganesson/gregica/common/tileentities/mte/multipart/MTEInfWaterHatch.java new file mode 100644 index 0000000..75210ee --- /dev/null +++ b/src/main/java/me/oganesson/gregica/common/tileentities/mte/multipart/MTEInfWaterHatch.java @@ -0,0 +1,112 @@ +package me.oganesson.gregica.common.tileentities.mte.multipart; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import gregtech.api.capability.impl.FluidTankList; +import gregtech.api.gui.ModularUI; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtech.api.metatileentity.multiblock.IMultiblockAbilityPart; +import gregtech.api.metatileentity.multiblock.MultiblockAbility; +import gregtech.api.metatileentity.multiblock.MultiblockControllerBase; +import gregtech.api.unification.material.Materials; +import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityMultiblockNotifiablePart; +import me.oganesson.gregica.api.capability.fluid.InfFluidTank; +import me.oganesson.gregica.client.GCTextures; +import me.oganesson.gregica.utils.GCLangUtil; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +//Infinite water +public class MTEInfWaterHatch extends MetaTileEntityMultiblockNotifiablePart implements IMultiblockAbilityPart { + + private final InfFluidTank tank; + + private boolean needUpgrade = false; + + public MTEInfWaterHatch(ResourceLocation metaTileEntityId) { + super(metaTileEntityId, 6, false); + this.tank = new InfFluidTank(Materials.Water.getFluid(1000),this,false); + this.initializeInventory(); + } + + @Override + public void update() { + super.update(); + if(!this.getWorld().isRemote && needUpgrade){ + needUpgrade = false; + this.tank.update(); + } + } + + @Override + protected FluidTankList createImportFluidHandler() { + return new FluidTankList(true,this.tank); + } + + @Override + public void addToMultiBlock(MultiblockControllerBase controllerBase) { + super.addToMultiBlock(controllerBase); + this.needUpgrade = true; + } + + @Override + public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { + super.renderMetaTileEntity(renderState, translation, pipeline); + if(this.shouldRenderOverlay()){ + GCTextures.INF_WATER.renderSided(getFrontFacing(),renderState,translation,pipeline); + } + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEntity) { + return new MTEInfWaterHatch(this.metaTileEntityId); + } + + @Override + protected ModularUI createUI(EntityPlayer entityPlayer) { + return null; + } + + @Override + protected boolean openGUIOnRightClick() { + return false; + } + + @Override + public MultiblockAbility getAbility() { + return MultiblockAbility.IMPORT_FLUIDS; + } + + @Override + public void registerAbilities(List list) { + list.add(this.tank); + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, @Nullable World world, @NotNull List tooltip, boolean advanced) { + super.addInformation(stack, world, tooltip, advanced); + tooltip.add(I18n.format("gregica.tooltip.inf_water1")); + tooltip.add(I18n.format("gregica.tooltip.inf_water3")); + String tooltip2 = I18n.format("gregica.tooltip.inf_water2"); + if(tooltip2.contains("§")){ + tooltip.add(tooltip2); + tooltip.add(GCLangUtil.currentRainbowModifier()+GCLangUtil.getEnglishLang("gregica.tooltip.inf_water2")); + } + else { + tooltip.add(GCLangUtil.currentRainbowModifier()+tooltip2); + } + } +} diff --git a/src/main/java/me/oganesson/gregica/common/tileentities/mte/multipart/MTELaserHatch.java b/src/main/java/me/oganesson/gregica/common/tileentities/mte/multipart/MTELaserHatch.java index 33b34fe..f3f0051 100644 --- a/src/main/java/me/oganesson/gregica/common/tileentities/mte/multipart/MTELaserHatch.java +++ b/src/main/java/me/oganesson/gregica/common/tileentities/mte/multipart/MTELaserHatch.java @@ -37,6 +37,8 @@ import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -133,7 +135,6 @@ else if(getOffsetTimer() % 100 == 0){ } public void updateTarget(){ - boolean buff = this.renderLaser; if(this.color != -1){ this.renderLaser = false; World world = getWorld(); @@ -165,7 +166,7 @@ public void updateTarget(){ } } - if(buff != this.renderLaser){ + if(this.renderLaser){ this.writeCustomData(GCValues.RENDER_UPDATE,(b) -> b.writeBoolean(renderLaser)); } } @@ -192,26 +193,59 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick float b = (float)(r_color & 255) / 255.0F; Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); if (entity != null) { -// bufferBuilder.begin(8, DefaultVertexFormats.POSITION_COLOR); -// double sideDelta = 6.283185307179586 / (double)10; -// double phi = 0; -// double cosTheta = 1.0; -// double sinTheta = 0.0; -// for (int j = 0; j <= 10; ++j) { -// phi += sideDelta; -// double cosPhi = MathHelper.cos((float) phi); -// double sinPhi = MathHelper.sin((float) phi); -// double dist = r + 0.1 * cosPhi; -// bufferBuilder.pos(x + sinTheta * dist, y + 0.1 * sinPhi, z + cosTheta * dist).color(r, g, b, a).endVertex(); -// bufferBuilder.pos(x + sinTheta1 * dist, y + 0.1 * sinPhi, z + cosTheta1 * dist).color(r, g, b, a).endVertex(); + BlockPos self = this.getPos(); + int dist = (int) target.getDistance(self.getX(),self.getY(),self.getZ()); - - // } -// bufferBuilder.pos(x+0.4,y+0.4,z+0.4).color(r,g,b,a).endVertex(); -// bufferBuilder.pos(target.getX()+0.4,target.getY()+0.4,target.getZ()+0.4).color(r,g,b,a).endVertex(); -// bufferBuilder.pos(x+0.6,y+0.6,z+0.6).color(r,g,b,a).endVertex(); -// bufferBuilder.pos(target.getX()+0.6,target.getY()+0.6,target.getZ()+0.6).color(r,g,b,a).endVertex(); -// Tessellator.getInstance().draw(); + EnumFacing.Axis axis = this.getFrontFacing().getAxis(); + bufferBuilder.begin(8, DefaultVertexFormats.POSITION_COLOR); + double x1 = x + 0.5; + double y1 = y + 0.5; + double z1 = z + 0.5; + switch (axis){ + case X:{ + dist = dist*this.getFrontFacing().getXOffset(); + bufferBuilder.pos(x,y1+0.1,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x+dist,y1+0.1,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x+dist,y1+0.1,z1-0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x,y1+0.1,z1-0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x+dist,y1-0.1,z1-0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x,y1-0.1,z1-0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x+dist,y1-0.1,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x,y1-0.1,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x+dist,y1+0.1,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x,y1+0.1,z1+0.1).color(r,g,b,a).endVertex(); + break; + } + case Y:{ + dist = dist*this.getFrontFacing().getYOffset(); + bufferBuilder.pos(x1+0.1,y,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y+dist,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y+dist,z1-0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y,z1-0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1-0.1,y+dist,z1-0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1-0.1,y,z1-0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1-0.1,y+dist,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1-0.1,y,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y+dist,z1+0.1).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y,z1+0.1).color(r,g,b,a).endVertex(); + break; + } + case Z:{ + dist = dist*this.getFrontFacing().getZOffset(); + bufferBuilder.pos(x1+0.1,y1+0.1,z).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y1+0.1,z+dist).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y1-0.1,z+dist).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y1-0.1,z).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1-0.1,y1-0.1,z+dist).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1-0.1,y1-0.1,z).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1-0.1,y1+0.1,z+dist).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1-0.1,y1+0.1,z).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y1+0.1,z+dist).color(r,g,b,a).endVertex(); + bufferBuilder.pos(x1+0.1,y1+0.1,z).color(r,g,b,a).endVertex(); + } + } + + Tessellator.getInstance().draw(); } }); } @@ -220,8 +254,10 @@ public void renderMetaTileEntity(double x, double y, double z, float partialTick @Override public AxisAlignedBB getRenderBoundingBox() { if(target != null){ - return new AxisAlignedBB(this.getPos().offset(this.getFrontFacing().getOpposite()).offset(this.getFrontFacing().rotateY()), - target.offset(this.getFrontFacing().getOpposite()).offset(this.getFrontFacing().rotateY())); + EnumFacing front = this.getFrontFacing(); + boolean b = front.getAxis() == EnumFacing.Axis.Y; + return new AxisAlignedBB(this.getPos().offset(front.getOpposite(),2).offset(b?front.rotateAround(EnumFacing.Axis.X) : front.rotateY(),2), + target.offset(front.getOpposite(),2).offset((b?front.rotateAround(EnumFacing.Axis.X) : front.rotateY()).getOpposite(),2)); } return new AxisAlignedBB(this.getPos(),this.getPos()); } @@ -373,6 +409,7 @@ public List getDataInfo() { result.add(new TextComponentString("target: x:"+target.getX()+" y:"+target.getY()+" z:"+target.getZ())); BlockPosHighlightRenderer.renderBlockBoxHighLight(target,10000); } + result.add(new TextComponentString(String.valueOf(this.renderLaser))); return result; } diff --git a/src/main/java/me/oganesson/gregica/config/GCConfig.java b/src/main/java/me/oganesson/gregica/config/GCConfig.java index ead1cac..aa29a4a 100644 --- a/src/main/java/me/oganesson/gregica/config/GCConfig.java +++ b/src/main/java/me/oganesson/gregica/config/GCConfig.java @@ -37,6 +37,12 @@ public static class Misc { @Config.Comment("Enable the TJCore combat") @Config.RequiresMcRestart public static boolean enableTjcore = false; + + @Config.RequiresMcRestart + public static boolean enableMetaItemShows_en_us_nameOnOtherLanguage = true; + + @Config.RequiresMcRestart + public static boolean forceBilingualName = false; } public static class CircuitOverrides { diff --git a/src/main/java/me/oganesson/gregica/config/GCConfigValue.java b/src/main/java/me/oganesson/gregica/config/GCConfigValue.java index 4467e60..32e67e6 100644 --- a/src/main/java/me/oganesson/gregica/config/GCConfigValue.java +++ b/src/main/java/me/oganesson/gregica/config/GCConfigValue.java @@ -1,5 +1,7 @@ package me.oganesson.gregica.config; +import me.oganesson.gregica.api.GCValues; + public class GCConfigValue { static { if(!GCConfig.configLoaded){ @@ -22,8 +24,11 @@ public class GCConfigValue { public final static boolean disableAmmoniaProcessing = GCConfig.ChainOverrides.disableAmmoniaProcessing; public final static boolean disableMolybdenumProcessing = GCConfig.ChainOverrides.disableMolybdenumProcessing; + public final static boolean enableMetaItemShows_en_us_nameOnOtherLanguage = GCConfig.Misc.enableMetaItemShows_en_us_nameOnOtherLanguage || GCValues.IS_BilingualName_LOADED; + //cannot use in mixin public final static boolean enableNerfSteamSolarBoiler = GCConfig.Nerf.enableNerfSteamSolarBoiler; + public final static boolean enableNerfGCYMParallelHatch = GCConfig.Nerf.enableNerfGCYMParallelHatch; } diff --git a/src/main/java/me/oganesson/gregica/mixin/gregtech/MixinMetaItemClient.java b/src/main/java/me/oganesson/gregica/mixin/gregtech/MixinMetaItemClient.java new file mode 100644 index 0000000..2756bae --- /dev/null +++ b/src/main/java/me/oganesson/gregica/mixin/gregtech/MixinMetaItemClient.java @@ -0,0 +1,46 @@ +package me.oganesson.gregica.mixin.gregtech; + +import gregtech.api.items.metaitem.MetaItem; +import me.oganesson.gregica.config.GCConfigValue; +import me.oganesson.gregica.utils.GCLangUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; + +import static me.oganesson.gregica.utils.GCLangUtil.EN_US; +import static me.oganesson.gregica.utils.GCLangUtil.tryFindingKey; + +//borrow some code from https://github.com/friendlyhj/BilingualName +@Mixin(MetaItem.class) +public abstract class MixinMetaItemClient.MetaValueItem> extends Item { + + @Shadow(remap = false) @Nullable public abstract T getItem(ItemStack itemStack); + + @Inject(method = "addInformation",at = @At(value = "RETURN",remap = false)) + public void onAddInfo(ItemStack itemStack, @Nullable World worldIn, @Nonnull List lines, @Nonnull ITooltipFlag tooltipFlag, CallbackInfo ci){ + if (!GCConfigValue.enableMetaItemShows_en_us_nameOnOtherLanguage + || Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getJavaLocale().equals(java.util.Locale.US)){ + return; + } + T metaValueItem = this.getItem(itemStack); + if(metaValueItem != null){ + @SuppressWarnings("SpellCheckingInspection") + String key = tryFindingKey(EN_US,"metaitem."+metaValueItem.unlocalizedName); + if (key.isEmpty()) return; + String localizedName = TextFormatting.GREEN + EN_US.formatMessage(key, GCLangUtil.NONE_ARRAY); + lines.add(localizedName); + } + } +} diff --git a/src/main/java/me/oganesson/gregica/proxy/CommonProxy.java b/src/main/java/me/oganesson/gregica/proxy/CommonProxy.java index d63871b..fd6cb80 100644 --- a/src/main/java/me/oganesson/gregica/proxy/CommonProxy.java +++ b/src/main/java/me/oganesson/gregica/proxy/CommonProxy.java @@ -23,13 +23,16 @@ import me.oganesson.gregica.common.tileentities.te.EssentiaHatch; import me.oganesson.gregica.common.tileentities.te.TELaserPipe; import me.oganesson.gregica.common.unification.materials.ore.GCOres; +import me.oganesson.gregica.config.GCConfig; import me.oganesson.gregica.crossmod.top.TOPCompatibility; +import me.oganesson.gregica.utils.GCLangUtil; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -71,6 +74,10 @@ public void preInit( FMLPreInitializationEvent event ) { //GCYS GCYSMetaBlocks.init(); GCYSRecipeLoader.initHandlers(); + + if(GCConfig.Misc.forceBilingualName && !GCValues.IS_BilingualName_LOADED){ + MinecraftForge.EVENT_BUS.register(GCLangUtil.class); + } } public void init( FMLInitializationEvent event ) { diff --git a/src/main/java/me/oganesson/gregica/utils/GCLangUtil.java b/src/main/java/me/oganesson/gregica/utils/GCLangUtil.java new file mode 100644 index 0000000..d6b0058 --- /dev/null +++ b/src/main/java/me/oganesson/gregica/utils/GCLangUtil.java @@ -0,0 +1,73 @@ +package me.oganesson.gregica.utils; + +import com.google.common.collect.Lists; +import gregtech.api.GTValues; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.Locale; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.List; + +//borrow some code from https://github.com/friendlyhj/BilingualName +public class GCLangUtil { + public static final Locale EN_US = new Locale(); + public static final Object[] NONE_ARRAY = new Object[0]; + + public static final String[] modifiers = new String[]{ + "§0","§1","§2","§3", + "§4","§5","§6","§7", + "§8","§9","§a","§b", + "§c","§d","§e","§f" + }; + + public static int currentIndex = 0; + + static { + EN_US.loadLocaleDataFiles(Minecraft.getMinecraft().getResourceManager(), Lists.newArrayList("en_us")); + } + + public static String tryFindingKey(Locale locale, ItemStack stack) { + String key = stack.getTranslationKey(); + if (locale.hasKey(key)) return key; + key += ".name"; + if (locale.hasKey(key)) return key; + key = stack.getItem().getUnlocalizedNameInefficiently(stack); + if (locale.hasKey(key)) return key; + key += ".name"; + if (locale.hasKey(key)) return key; + return ""; + } + + public static String tryFindingKey(Locale locale, String key) { + if (locale.hasKey(key)) return key; + key += ".name"; + if (locale.hasKey(key)) return key; + return ""; + } + + @SubscribeEvent + public static void onTooltip(ItemTooltipEvent event) { + if (Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getJavaLocale().equals(java.util.Locale.US)) return; + ItemStack stack = event.getItemStack(); + List tooltip = event.getToolTip(); + String key = GCLangUtil.tryFindingKey(EN_US, stack); + if (key.isEmpty()) return; + String localizedName = TextFormatting.GREEN + EN_US.formatMessage(key, NONE_ARRAY); + tooltip.add(localizedName); + } + + public static String getEnglishLang(String key){ + return EN_US.formatMessage(key,NONE_ARRAY); + } + + public static String currentRainbowModifier(){ + return modifiers[currentIndex]; + } + + public static void updateModifier(){ + currentIndex = (int) (GTValues.CLIENT_TIME%16); + } +} diff --git a/src/main/java/me/oganesson/gregica/utils/GCRecipeUtils.java b/src/main/java/me/oganesson/gregica/utils/GCRecipeUtils.java new file mode 100644 index 0000000..f90c6ee --- /dev/null +++ b/src/main/java/me/oganesson/gregica/utils/GCRecipeUtils.java @@ -0,0 +1,96 @@ +package me.oganesson.gregica.utils; + +import gregtech.api.GTValues; +import gregtech.api.items.metaitem.MetaItem; +import gregtech.api.unification.material.MarkerMaterials; +import gregtech.api.unification.material.Material; +import gregtech.common.blocks.BlockMachineCasing; +import gregtech.common.blocks.MetaBlocks; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import me.oganesson.gregica.api.GCValues; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.registry.ForgeRegistries; + +import java.util.function.IntFunction; + +public class GCRecipeUtils { + public static final MetaItem META_ITEM_1 = (MetaItem) ForgeRegistries.ITEMS.getValue(new ResourceLocation(GCValues.CEu_MOD_ID,"meta_item_1")); + + public static final Int2ObjectMap int2TierMaterialMap; + + public static final Object2IntMap tierMaterial2intMap; + public static final IntFunction intToMaterialsTier; + + public static MetaItem.MetaValueItem getComponent(Component component,int tier){ + //noinspection ConstantConditions + return META_ITEM_1.getItem(component.name+GTValues.VN[tier].toLowerCase()); + } + + public static MetaItem.MetaValueItem getComponent(Component component,Material tier){ + return getComponent(component,tierMaterial2intMap.get(tier)); + } + + static { + int2TierMaterialMap = new Int2ObjectOpenHashMap<>(); + int2TierMaterialMap.put(0,MarkerMaterials.Tier.ULV); + int2TierMaterialMap.put(1,MarkerMaterials.Tier.LV); + int2TierMaterialMap.put(2,MarkerMaterials.Tier.MV); + int2TierMaterialMap.put(3,MarkerMaterials.Tier.HV); + int2TierMaterialMap.put(4,MarkerMaterials.Tier.EV); + int2TierMaterialMap.put(5,MarkerMaterials.Tier.IV); + int2TierMaterialMap.put(6,MarkerMaterials.Tier.LuV); + int2TierMaterialMap.put(7,MarkerMaterials.Tier.ZPM); + int2TierMaterialMap.put(8,MarkerMaterials.Tier.UV); + int2TierMaterialMap.put(9,MarkerMaterials.Tier.UHV); + int2TierMaterialMap.put(10,MarkerMaterials.Tier.UEV); + int2TierMaterialMap.put(11,MarkerMaterials.Tier.UIV); + int2TierMaterialMap.put(12,MarkerMaterials.Tier.UXV); + int2TierMaterialMap.put(13,MarkerMaterials.Tier.OpV); + int2TierMaterialMap.put(14,MarkerMaterials.Tier.MAX); + + tierMaterial2intMap = new Object2IntOpenHashMap<>(); + tierMaterial2intMap.put(MarkerMaterials.Tier.ULV,0); + tierMaterial2intMap.put(MarkerMaterials.Tier.LV,1); + tierMaterial2intMap.put(MarkerMaterials.Tier.MV,2); + tierMaterial2intMap.put(MarkerMaterials.Tier.HV,3); + tierMaterial2intMap.put(MarkerMaterials.Tier.EV,4); + tierMaterial2intMap.put(MarkerMaterials.Tier.IV,5); + tierMaterial2intMap.put(MarkerMaterials.Tier.LuV,6); + tierMaterial2intMap.put(MarkerMaterials.Tier.ZPM,7); + tierMaterial2intMap.put(MarkerMaterials.Tier.UV,8); + tierMaterial2intMap.put(MarkerMaterials.Tier.UHV,9); + tierMaterial2intMap.put(MarkerMaterials.Tier.UEV,10); + tierMaterial2intMap.put(MarkerMaterials.Tier.UIV,11); + tierMaterial2intMap.put(MarkerMaterials.Tier.UXV,12); + tierMaterial2intMap.put(MarkerMaterials.Tier.OpV,13); + tierMaterial2intMap.put(MarkerMaterials.Tier.MAX,14); + + intToMaterialsTier = (i) -> int2TierMaterialMap.getOrDefault(i,MarkerMaterials.Tier.ULV); + } + + public enum Component{ + CASING("casing"){ + @Override + public ItemStack getAsStack(Material tier) { + return MetaBlocks.MACHINE_CASING.getItemVariant(BlockMachineCasing.MachineCasingType.values()[tierMaterial2intMap.get(tier)]); + } + }, + EMITTER("emitter."), + PUMP("electric.pump."), + FIELD_GENERATOR("field.generator."), + SENSOR("sensor."); + final String name; + + Component(String name) { + this.name = name; + } + + public ItemStack getAsStack(Material tier){ + return GCRecipeUtils.getComponent(this,tier).getStackForm(); + } + } +} diff --git a/src/main/java/me/oganesson/gregica/utils/RecipeUtils.java b/src/main/java/me/oganesson/gregica/utils/RecipeUtils.java deleted file mode 100644 index 9f7e42f..0000000 --- a/src/main/java/me/oganesson/gregica/utils/RecipeUtils.java +++ /dev/null @@ -1,67 +0,0 @@ -package me.oganesson.gregica.utils; - -import gregtech.api.GTValues; -import gregtech.api.items.metaitem.MetaItem; -import gregtech.api.unification.material.MarkerMaterials; -import gregtech.api.unification.material.Material; -import me.oganesson.gregica.api.GCValues; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.registry.ForgeRegistries; - -import java.util.function.IntFunction; - -public class RecipeUtils { - public static final MetaItem META_ITEM_1 = (MetaItem) ForgeRegistries.ITEMS.getValue(new ResourceLocation(GCValues.CEu_MOD_ID,"meta_item_1")); - - public static final IntFunction intToMaterialsTier = (i) ->{ - switch (i){ - case (1): - return MarkerMaterials.Tier.LV; - case (2): - return MarkerMaterials.Tier.MV; - case (3): - return MarkerMaterials.Tier.HV; - case (4): - return MarkerMaterials.Tier.EV; - case (5): - return MarkerMaterials.Tier.IV; - case (6): - return MarkerMaterials.Tier.LuV; - case (7): - return MarkerMaterials.Tier.ZPM; - case (8): - return MarkerMaterials.Tier.UV; - case (9): - return MarkerMaterials.Tier.UHV; - case (10): - return MarkerMaterials.Tier.UEV; - case (11): - return MarkerMaterials.Tier.UIV; - case (12): - return MarkerMaterials.Tier.UXV; - case (13): - return MarkerMaterials.Tier.OpV; - case (14): - return MarkerMaterials.Tier.MAX; - default: - return MarkerMaterials.Tier.ULV; - } - }; - - public static MetaItem.MetaValueItem getComponent(Component component,int tier){ - //noinspection ConstantConditions - return META_ITEM_1.getItem(component.name+GTValues.VN[tier].toLowerCase()); - } - - public enum Component{ - CASING("casing"), - EMITTER("emitter."), - PUMP("electric.pump."), - SENSOR("sensor."); - final String name; - - Component(String name) { - this.name = name; - } - } -} diff --git a/src/main/resources/assets/gregica/lang/en_US.lang b/src/main/resources/assets/gregica/lang/en_US.lang index 41c1b71..69f341b 100644 --- a/src/main/resources/assets/gregica/lang/en_US.lang +++ b/src/main/resources/assets/gregica/lang/en_US.lang @@ -324,6 +324,11 @@ gregica.machine.laser_hatch_input_max_a_16384.name=Laser Target Hatch MAX 16384A gregica.machine.laser_hatch_input_max_a_65536.name=Laser Target Hatch MAX 65536A/t gregica.machine.laser_hatch_input_max_a_262144.name=Laser Target Hatch MAX 262144A/t +gregica.machine.infinite_water_hatch.name=Infinite Water Hatch +gregica.tooltip.inf_water1=Supply 2^31-1 mb/t water. +gregica.tooltip.inf_water2=I N F I N I T E +gregica.tooltip.inf_water3=Can only supply water for MultiBlocks.You cannot pump out water from it. + tile.laser_vacuum_pipe_opaque.name=Laser Vacuum Pipe tile.laser_vacuum_pipe_transparent.name=Transparent Laser Vacuum Pipe diff --git a/src/main/resources/assets/gregica/lang/zh_CN.lang b/src/main/resources/assets/gregica/lang/zh_CN.lang index 60f305e..97c0196 100644 --- a/src/main/resources/assets/gregica/lang/zh_CN.lang +++ b/src/main/resources/assets/gregica/lang/zh_CN.lang @@ -115,7 +115,7 @@ gregica.machine.creative_generator.uv.name=创造模式发电机 UV gregica.machine.creative_generator.uhv.name=创造模式发电机 UHV gregica.machine.creative_generator.uev.name=创造模式发电机 UEV gregica.machine.creative_generator.uiv.name=创造模式发电机 UIV -gregica.machine.creative_generator.uxv.name=创造模式发电机 UXU +gregica.machine.creative_generator.uxv.name=创造模式发电机 UXV gregica.machine.creative_generator.opv.name=创造模式发电机 OPV gregica.machine.creative_generator.max.name=创造模式发电机 MAX gregica.machine.creative_generator.amperage=能量输出 %d A @@ -241,6 +241,11 @@ gregica.machine.laser_hatch_input_max_a_4096.name=激光靶仓 MAX 4096A/t gregica.machine.laser_hatch_input_max_a_16384.name=激光靶仓 MAX 16384A/t gregica.machine.laser_hatch_input_max_a_65536.name=激光靶仓 MAX 65536A/t gregica.machine.laser_hatch_input_max_a_262144.name=激光靶仓 MAX 262144A/t +gregica.machine.infinite_water_hatch.name=无限水仓 + +gregica.tooltip.inf_water1=供水 2^31-1 mb/t +gregica.tooltip.inf_water2=§9百 度 贴 吧 +gregica.tooltip.inf_water3=只能给多方块结构供水,你不能从中抽水. gregica.machine.catalyst_hatch.name=催化剂仓 diff --git a/src/main/resources/assets/gregtech/textures/blocks/multipart/inf_water.png b/src/main/resources/assets/gregtech/textures/blocks/multipart/inf_water.png new file mode 100644 index 0000000000000000000000000000000000000000..1992cce64526e04db0b4b34afd6ccd76700f4b0c GIT binary patch literal 2130 zcmbVN2~ZPP7+%oIr5Ln26qT+EQ}IZ4H-tb|qLKt5#bCHbtXDU?3)vybhTVk_m8#gP zsGwE_tXSgJ@fdY#?Z|jhb&7a`qE_pH*WiH%qHWcx(-)46?bteXXLk4Pd*A!M|Nr0r z|66QKPUz(y;txSkFMXme6}%Nnl;uIq_F$zXXsxXB#GD^XiBIP7Q#>8~(*Kt&yI{~`()Bkh-c%B6XNLt>T$6c20 z%pnq40i3C`vvAUw+|H4Oh1-*bASrhds1eG2`V5V9PP6YFfeu=SnE|B#kry2>fy)vd zB+tZUgJ``Y>rh}i>Mqs}FVKHF*uM5gVRyknw{QMD0cI1#HyETow+E#C>PagX7ZzIF{s>-iCn|k~{+`9Gg*VTC$tGdswYs*5R zJ4qFOC+B`r+}QDXoQ|qlzQXwyH)P zSaPW8%%}aE7E_bFw)5S)jq--5#sJ?0$|w!I{BX1Z8pE6jAM^SZ{i~1njQY9v$`(08 zEB$*koI721`(R7`c_g#~0ghfbkL%ve3%Xb%scVCvQH7I(7G9e2dct`pL_cx0ZeHMX zaCYx6q0sVOw{rD4q2*7tOE#=ck==+pnig|o7qZOs1!RMS+D-mWWBAhJnj5)#XB9GX z$a1!HRm02QgDfXXE0htxoVq(my8imuD$|SF6(z5mvl5j90`mg>po-}ik{}oNY?W)p zx^3z)mX^Vj2L#tG!3Txi9@sx19=jF>%oCf|oY*pHV0F`urFCu1vqE34^qy7bV;EIa z?6dLS+?}!5)EuJs*s$Ry*AJRdXre2;ap1!H_fzQX@$s?MGn+FH?5I0cjf|YZH=n(^ z*0z%>G&UT7D&$1|t%Dby7M-4~40+Xi>Vk#NrQ?KsC0yVqspG;^dlr8<{OH_uE$Z@P zAfggv+Q$pZBZE>>3R_=ZeLl0$74YE6i)+zwxy#a4&M;4Q|Mm6p$-3>D&x`&7ZjB69 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/multipart/inf_water.png.mcmeta b/src/main/resources/assets/gregtech/textures/blocks/multipart/inf_water.png.mcmeta new file mode 100644 index 0000000..ff5f269 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/multipart/inf_water.png.mcmeta @@ -0,0 +1,7 @@ +{ + "animation":{ + "frametime":3, + "width": 16, + "height": 16 + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.gregica_late.json b/src/main/resources/mixins.gregica_late.json index cc7f226..c90816e 100644 --- a/src/main/resources/mixins.gregica_late.json +++ b/src/main/resources/mixins.gregica_late.json @@ -17,7 +17,8 @@ "gcym.MixinMTEParallelHatchClient", "gregtech.MixinBlockGlassCasing", "gregtech.MixinMachineItemBlock", - "gregtech.MixinSolarBoilerClient" + "gregtech.MixinSolarBoilerClient", + "gregtech.MixinMetaItemClient" ], "server": [