-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5142f60
commit 6434a0e
Showing
6 changed files
with
177 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
accessWidener v1 named | ||
|
||
accessible field com/mojang/blaze3d/platform/NativeImage pixels i | ||
accessible field com/mojang/blaze3d/platform/NativeImage pixels J | ||
|
||
accessible method net/minecraft/util/thread/BlockableEventLoop submitAsync(Ljava/lang/Runnable;) Ljava/util/concurrent/CompletableFuture; | ||
accessible method net/minecraft/util/thread/BlockableEventLoop submitAsync (Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; |
67 changes: 67 additions & 0 deletions
67
loader-fabric/src/main/java/org/cyclops/iconexporter/IconExporterFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.cyclops.iconexporter; | ||
|
||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.minecraft.commands.CommandBuildContext; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.commands.Commands; | ||
import org.cyclops.cyclopscore.config.ConfigHandlerCommon; | ||
import org.cyclops.cyclopscore.init.ModBaseFabric; | ||
import org.cyclops.cyclopscore.proxy.IClientProxyCommon; | ||
import org.cyclops.cyclopscore.proxy.ICommonProxyCommon; | ||
import org.cyclops.iconexporter.command.CommandExport; | ||
import org.cyclops.iconexporter.command.CommandExportMetadata; | ||
import org.cyclops.iconexporter.helpers.IconExporterHelpersFabric; | ||
import org.cyclops.iconexporter.proxy.ClientProxyFabric; | ||
import org.cyclops.iconexporter.proxy.CommonProxyFabric; | ||
|
||
/** | ||
* The main mod class of IconExporter. | ||
* @author rubensworks | ||
*/ | ||
public class IconExporterFabric extends ModBaseFabric<IconExporterFabric> implements ModInitializer { | ||
|
||
/** | ||
* The unique instance of this mod. | ||
*/ | ||
public static IconExporterFabric _instance; | ||
|
||
public IconExporterFabric() { | ||
super(Reference.MOD_ID, (instance) -> _instance = instance); | ||
} | ||
|
||
@Override | ||
protected LiteralArgumentBuilder<CommandSourceStack> constructBaseCommand(Commands.CommandSelection selection, CommandBuildContext context) { | ||
LiteralArgumentBuilder<CommandSourceStack> root = super.constructBaseCommand(selection, context); | ||
|
||
if (getModHelpers().getMinecraftHelpers().isClientSide()) { | ||
IconExporterHelpersFabric helpers = new IconExporterHelpersFabric(); | ||
root.then(CommandExport.make(context, this, helpers)); | ||
root.then(CommandExportMetadata.make(context, this, helpers)); | ||
} | ||
|
||
return root; | ||
} | ||
|
||
@Override | ||
protected IClientProxyCommon constructClientProxy() { | ||
return new ClientProxyFabric(); | ||
} | ||
|
||
@Override | ||
protected ICommonProxyCommon constructCommonProxy() { | ||
return new CommonProxyFabric(); | ||
} | ||
|
||
@Override | ||
protected boolean hasDefaultCreativeModeTab() { | ||
return false; | ||
} | ||
|
||
@Override | ||
protected void onConfigsRegister(ConfigHandlerCommon configHandler) { | ||
super.onConfigsRegister(configHandler); | ||
|
||
configHandler.addConfigurable(new GeneralConfig<>(this)); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
loader-fabric/src/main/java/org/cyclops/iconexporter/helpers/IconExporterHelpersFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.cyclops.iconexporter.helpers; | ||
|
||
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; | ||
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributes; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.world.item.CreativeModeTab; | ||
import net.minecraft.world.level.material.Fluid; | ||
import org.cyclops.cyclopscore.helper.IModHelpersFabric; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author rubensworks | ||
*/ | ||
public class IconExporterHelpersFabric extends IconExporterHelpersCommon { | ||
@Override | ||
public List<CreativeModeTab> getCreativeTabs() { | ||
return BuiltInRegistries.CREATIVE_MODE_TAB.stream() | ||
.filter(tab -> !tab.getBackgroundTexture().equals(CreativeModeTab.createTextureLocation("item_search"))) | ||
.toList(); | ||
} | ||
|
||
@Override | ||
public String getFluidLocalName(Fluid fluid) { | ||
return FluidVariantAttributes.getName(FluidVariant.of(fluid)).getString(); | ||
} | ||
|
||
@Override | ||
public void renderFluidSlot(GuiGraphics gui, Fluid fluid) { | ||
IModHelpersFabric.get().getGuiHelpers().renderFluidSlot(gui, FluidVariant.of(fluid), IModHelpersFabric.get().getFluidHelpers().getBucketVolume(), 0, 0); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
loader-fabric/src/main/java/org/cyclops/iconexporter/proxy/ClientProxyFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.cyclops.iconexporter.proxy; | ||
|
||
import org.cyclops.iconexporter.IconExporterFabric; | ||
import org.cyclops.cyclopscore.init.ModBaseFabric; | ||
import org.cyclops.cyclopscore.proxy.ClientProxyComponentFabric; | ||
|
||
/** | ||
* Proxy for the client side. | ||
* | ||
* @author rubensworks | ||
* | ||
*/ | ||
public class ClientProxyFabric extends ClientProxyComponentFabric { | ||
|
||
public ClientProxyFabric() { | ||
super(new CommonProxyFabric()); | ||
} | ||
|
||
@Override | ||
public ModBaseFabric<?> getMod() { | ||
return IconExporterFabric._instance; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
loader-fabric/src/main/java/org/cyclops/iconexporter/proxy/CommonProxyFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.cyclops.iconexporter.proxy; | ||
|
||
import org.cyclops.cyclopscore.init.ModBaseFabric; | ||
import org.cyclops.cyclopscore.proxy.CommonProxyComponentFabric; | ||
import org.cyclops.iconexporter.IconExporterFabric; | ||
|
||
/** | ||
* Proxy for server and client side. | ||
* @author rubensworks | ||
* | ||
*/ | ||
public class CommonProxyFabric extends CommonProxyComponentFabric { | ||
|
||
@Override | ||
public ModBaseFabric<?> getMod() { | ||
return IconExporterFabric._instance; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "${mod_id}", | ||
"version": "${mod_version}", | ||
|
||
"name": "${mod_name}", | ||
"description": "${description}", | ||
"authors": [ | ||
"${mod_author}" | ||
], | ||
"contact": { | ||
"homepage": "${display_url}", | ||
"sources": "${issue_tracker_url}" | ||
}, | ||
|
||
"license": "${license}", | ||
"icon": "logo.png", | ||
|
||
"environment": "*", | ||
"entrypoints": { | ||
"main": [ | ||
"org.cyclops.iconexporter.IconExporterFabric" | ||
] | ||
}, | ||
"accessWidener" : "iconexporter.accesswidener", | ||
|
||
"depends": { | ||
"cyclopscore": ">=${cyclopscore_version_semver}", | ||
"fabricloader": ">=${fabric_loader_version}", | ||
"fabric-api": ">=${fabric_version}", | ||
"java": ">=${java_version}" | ||
} | ||
} |