Skip to content

Commit

Permalink
Merge pull request #2 from luomolhx/fotmat-test
Browse files Browse the repository at this point in the history
Fotmat test
  • Loading branch information
luomolhx authored Dec 16, 2023
2 parents 824c331 + f78dfc1 commit c78b0d0
Show file tree
Hide file tree
Showing 25 changed files with 1,874 additions and 2,008 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ curseForgeRelations =
# Optional parameter to prevent the source code from being published
# noPublishedSources =
# Uncomment this to disable spotless checks
#disableSpotless=true
# disableSpotless=true
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
disableCheckstyle=true
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions src/main/java/com/silvermoon/boxplusplus/api/IBoxable.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import gregtech.api.recipe.RecipeMap;

/**
* Implements this on GT_MetaTileEntity_MultiBlockBase to allow your machine encapsulating in Box System.
* If you don't have a standard getRecipeMap(), override getRealRecipeMap().
* Do remember to call boxRegister.registerMachineToBox() on postInit!
* Implements this on GT_MetaTileEntity_MultiBlockBase to allow your machine encapsulating in Box System. If you don't
* have a standard getRecipeMap(), override getRealRecipeMap(). Do remember to call boxRegister.registerMachineToBox()
* on postInit!
* <p>
* 为GT_MetaTileEntity_MultiBlockBase实现此接口,将允许Box封装你的机器。如果你的机器有多种模式,重写getRealRecipeMap()来返回你期望封装的那个。
* 记得在postInit调用一次boxRegister.registerMachineToBox()!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class boxRegister {
* Use this to register your boxable machine. **Should be called on CommonProxy.postInit().**
* <p>
* 在CommonProxy.postInit()阶段调用本方法。确保传入的GT_MetaTileEntity_MultiBlockBase已经实现了IBoxable。
*
*
* @param machineList You can put multi-GTMultiMachines in this parameter.
* <p>
* 可以接受多个参数
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/silvermoon/boxplusplus/boxplusplus.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
modid = Tags.MODID,
version = Tags.VERSION,
name = Tags.MODNAME,
dependencies = "required-after:IC2;" + "required-after:structurelib;"
dependencies = "required-after:IC2;"
+ "required-after:structurelib;"
+ "required-after:modularui;"
+ "after:GalacticraftCore;"
+ "required-after:bartworks;"
Expand Down
52 changes: 27 additions & 25 deletions src/main/java/com/silvermoon/boxplusplus/client/BoxNEIHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ public class BoxNEIHandler {

@SubscribeEvent
public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) {
if (event.gui instanceof GuiRecipe gui && gui.firstGui instanceof ModularGui mui
&& mui.getContext()
.isWindowOpen(10)) {
if (event.gui instanceof GuiRecipe gui && gui.firstGui instanceof ModularGui mui && mui.getContext()
.isWindowOpen(10)) {
EntityPlayer player = ((ModularGui) gui.firstGui).getContext()
.getPlayer();
GTMachineBox box = Util.boxMap.get(player);
Expand All @@ -47,36 +46,34 @@ public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) {
getRecipesPerPage = GuiRecipe.class.getDeclaredMethod("getRecipesPerPage");
getRecipesPerPage.setAccessible(true);
recipesPerPage = (int) getRecipesPerPage.invoke(gui);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) {}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException ignored) {
}
buttons = new GuiButton[recipesPerPage];
int OVERLAY_BUTTON_ID_START = ObfuscationReflectionHelper
.getPrivateValue(GuiRecipe.class, gui, "OVERLAY_BUTTON_ID_START");
int OVERLAY_BUTTON_ID_START = ObfuscationReflectionHelper.getPrivateValue(
GuiRecipe.class,
gui,
"OVERLAY_BUTTON_ID_START");
int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, gui, "field_147009_r");
int buttonWidth = ObfuscationReflectionHelper.getPrivateValue(GuiRecipe.class, gui, "buttonWidth");
int buttonHeight = ObfuscationReflectionHelper.getPrivateValue(GuiRecipe.class, gui, "buttonHeight");
HandlerInfo handlerInfo = ObfuscationReflectionHelper.getPrivateValue(GuiRecipe.class, gui, "handlerInfo");
for (int i = 0; i < recipesPerPage; i++) {
buttons[i] = new GuiNEIButton(
OVERLAY_BUTTON_ID_START + i,
buttons[i] = new GuiNEIButton(OVERLAY_BUTTON_ID_START + i,
(gui.width / 2) + 65,
guiTop + 16 + (handlerInfo.getHeight() * (i + 1)) - 2,
buttonWidth,
buttonHeight,
"B");
}
int counts = Math.min(
gui.getHandler()
.numRecipes() - (gui.page * recipesPerPage),
recipesPerPage);
int counts = Math.min(gui.getHandler()
.numRecipes() - (gui.page * recipesPerPage), recipesPerPage);
for (int i = 0; i < buttons.length; i++) {
if (i >= counts) {
buttons[i].visible = false;
} else {
buttons[i].visible = RecipeInfo.hasOverlayHandler(
GuiPatternTermEx.class,
buttons[i].visible = RecipeInfo.hasOverlayHandler(GuiPatternTermEx.class,
gui.getHandler()
.getOverlayIdentifier())
&& gui.getHandler() instanceof GT_NEI_DefaultHandler;
.getOverlayIdentifier()) && gui.getHandler() instanceof GT_NEI_DefaultHandler;
}
}
Collections.addAll(buttonList, buttons);
Expand All @@ -85,22 +82,27 @@ public void onDrawScreen(GuiScreenEvent.DrawScreenEvent.Post event) {

@SubscribeEvent
public void onActionPerformedEventPre(GuiScreenEvent.ActionPerformedEvent.Pre event) {
if (event.gui instanceof GuiRecipe gui && gui.firstGui instanceof ModularGui mui
&& mui.getContext()
.isWindowOpen(10)) {
if (event.gui instanceof GuiRecipe gui && gui.firstGui instanceof ModularGui mui && mui.getContext()
.isWindowOpen(10)) {
EntityPlayer player = ((ModularGui) gui.firstGui).getContext()
.getPlayer();
List<GuiButton> overlayButtons = new ArrayList<>(
Arrays.asList(ObfuscationReflectionHelper.getPrivateValue(GuiRecipe.class, gui, "overlayButtons")));
int OVERLAY_BUTTON_ID_START = ObfuscationReflectionHelper
.getPrivateValue(GuiRecipe.class, gui, "OVERLAY_BUTTON_ID_START");
List<GuiButton> overlayButtons = new ArrayList<>(Arrays.asList(ObfuscationReflectionHelper.getPrivateValue(
GuiRecipe.class,
gui,
"overlayButtons")));
int OVERLAY_BUTTON_ID_START = ObfuscationReflectionHelper.getPrivateValue(
GuiRecipe.class,
gui,
"OVERLAY_BUTTON_ID_START");
if (event.button.id >= OVERLAY_BUTTON_ID_START
&& event.button.id < OVERLAY_BUTTON_ID_START + overlayButtons.size()) {
IRecipeHandler handler = (IRecipeHandler) gui.currenthandlers.get(gui.recipetype);
if (recipesPerPage >= 0 && handler != null) {
int recipe = gui.page * recipesPerPage + event.button.id - OVERLAY_BUTTON_ID_START;
BoxRoutings
.makeRouting((GT_NEI_DefaultHandler) gui.currenthandlers.get(gui.recipetype), recipe, player);
BoxRoutings.makeRouting(
(GT_NEI_DefaultHandler) gui.currenthandlers.get(gui.recipetype),
recipe,
player);
event.setCanceled(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ public class ClientProxy extends CommonProxy {
public void init(FMLInitializationEvent e) {
super.init(e);
ClientRegistry.bindTileEntitySpecialRenderer(TEBoxRing.class, new RenderBoxRing());
ClientRegistry.bindTileEntitySpecialRenderer(
(Class<? extends TileEntity>) TileEntitiesLoader.DroneMaintainingCentre.getBaseMetaTileEntity()
.getClass(),
new RenderDrone());
ClientRegistry.bindTileEntitySpecialRenderer((Class<? extends TileEntity>) TileEntitiesLoader.DroneMaintainingCentre.getBaseMetaTileEntity()
.getClass(), new RenderDrone());
MinecraftForge.EVENT_BUS.register(BoxNEIHandler.instance);
}
}
45 changes: 21 additions & 24 deletions src/main/java/com/silvermoon/boxplusplus/common/BoxModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@ public class BoxModule {
public static BoxModule AMD_Wafer_Fabrication_Plant = new BoxModule("AMD_Wafer_Fabrication_Plant", 17, 6, -2);
public static BoxModule Liquid_Level_Regulator = new BoxModule("Liquid_Level_Regulator", 1, 6, -18);
public static BoxModule Solid_State_Reshaper = new BoxModule("Solid_State_Reshaper", -15, 6, -2);
public static BoxModule Residential_Flush_Toilet_with_Built_in_Pump = new BoxModule(
"Residential_Flush_Toilet_with_Built_in_Pump",
public static BoxModule Residential_Flush_Toilet_with_Built_in_Pump = new BoxModule("Residential_Flush_Toilet_with_Built_in_Pump",
1,
6,
14);
public static BoxModule Extreme_Temperature_Difference_Generation_Tower = new BoxModule(
"Extreme_Temperature_Difference_Generation_Tower",
public static BoxModule Extreme_Temperature_Difference_Generation_Tower = new BoxModule("Extreme_Temperature_Difference_Generation_Tower",
23,
6,
-1);
public static BoxModule Superstructure_Assembly_Plant = new BoxModule("Superstructure_Assembly_Plant", 2, 6, -23);
public static BoxModule Phase_Parallel_Matrix = new BoxModule("Phase_Parallel_Matrix", -21, 6, -1);
public static BoxModule Arrayed_and_Maneuverable_Hyperbeam_Receiver_Redirector = new BoxModule(
"Arrayed_and_Maneuverable_Hyperbeam_Receiver_Redirector",
public static BoxModule Arrayed_and_Maneuverable_Hyperbeam_Receiver_Redirector = new BoxModule("Arrayed_and_Maneuverable_Hyperbeam_Receiver_Redirector",
2,
7,
-1);
Expand Down Expand Up @@ -113,19 +110,19 @@ public static int[] transMachinesToModule(BoxRoutings routing) {
.substring(17)) {
case "industrialmixer.controller.tier.single", "multimachine.chemicalreactor" -> new int[] { 0, 0 };
case "gtplusplus.autocrafter.multi", "mxrandomlargemolecularassembler" -> new int[] { 1, 0 };
case "multimachine.cracker", "megadistillationtower", "multimachine.adv.distillationtower", "megaoilcracker", "multimachine.distillationtower" -> new int[] {
2, 0 };
case "multimachine.multifurnace", "industrialthermalcentrifuge.controller.tier.single", "industrialarcfurnace.controller.tier.single", "industrialalloysmelter.controller.tier.single" -> new int[] {
3, 0 };
case "multimachine.cracker", "megadistillationtower", "multimachine.adv.distillationtower", "megaoilcracker", "multimachine.distillationtower" ->
new int[] { 2, 0 };
case "multimachine.multifurnace", "industrialthermalcentrifuge.controller.tier.single", "industrialarcfurnace.controller.tier.single", "industrialalloysmelter.controller.tier.single" ->
new int[] { 3, 0 };
case "industrialmultimachine.controller.tier.single" -> new int[] { 4, 0 };
case "industrialrockcrusher.controller.tier.single", "industrialfluidheater.controller.tier.single", "ompressor" -> new int[] {
5, 0 };
case "industrialcuttingmachine.controller.tier.01", "industrialmacerator.controller.tier.single", "industrialbender.controller.tier.single", "industrialextruder.controller.tier.single", "industrialwiremill.controller.tier.single", "industrialhammer.controller.tier.single" -> new int[] {
6, 0 };
case "industrialwashplant.controller.tier.single", "industrialsifter.controller.tier.single", "industrialcentrifuge.controller.tier.single", "industrialelectrolyzer.controller.tier.single", "digester", "basicmachine.electromagneticseparator.tier.06" -> new int[] {
7, 0 };
case "industrialcokeoven.controller.tier.single", "multimachine.pyro", "multimachine.vacuumfreezer", "multimachine.adv.industrialfreezer" -> new int[] {
8, 0 };
case "industrialrockcrusher.controller.tier.single", "industrialfluidheater.controller.tier.single", "ompressor" ->
new int[] { 5, 0 };
case "industrialcuttingmachine.controller.tier.01", "industrialmacerator.controller.tier.single", "industrialbender.controller.tier.single", "industrialextruder.controller.tier.single", "industrialwiremill.controller.tier.single", "industrialhammer.controller.tier.single" ->
new int[] { 6, 0 };
case "industrialwashplant.controller.tier.single", "industrialsifter.controller.tier.single", "industrialcentrifuge.controller.tier.single", "industrialelectrolyzer.controller.tier.single", "digester", "basicmachine.electromagneticseparator.tier.06" ->
new int[] { 7, 0 };
case "industrialcokeoven.controller.tier.single", "multimachine.pyro", "multimachine.vacuumfreezer", "multimachine.adv.industrialfreezer" ->
new int[] { 8, 0 };
case "multimachine.assemblyline" -> new int[] { 9, 0 };
case "industrialsalloyamelter.controller.tier.single" -> new int[] { 10, 0 };
case "moleculartransformer.controller.tier.single", "gtpp.multimachine.replicator" -> new int[] { 0, 1 };
Expand All @@ -135,12 +132,12 @@ public static int[] transMachinesToModule(BoxRoutings routing) {
case "multimachine.pcbfactory", "circuitassemblyline" -> new int[] { 4, 1 };
case "largefusioncomputer5" -> new int[] { 5, 1 };
case "dissolution_tank", "bw.biovat" -> new int[] { 7, 1 };
case "electricimplosioncompressor", "componentassemblyline", "projectmoduleassemblert3" -> new int[] { 9,
1 };
case "multimachine.plasmaforge", "multimachine.transcendentplasmamixer", "multimachine.nanoforge" -> new int[] {
8, 1 };
case "quantumforcetransformer.controller.tier.single", "frf", "industrialmassfab.controller.tier.single" -> new int[] {
10, 1 };
case "electricimplosioncompressor", "componentassemblyline", "projectmoduleassemblert3" ->
new int[] { 9, 1 };
case "multimachine.plasmaforge", "multimachine.transcendentplasmamixer", "multimachine.nanoforge" ->
new int[] { 8, 1 };
case "quantumforcetransformer.controller.tier.single", "frf", "industrialmassfab.controller.tier.single" ->
new int[] { 10, 1 };
default -> {
for (GT_MetaTileEntity_MultiBlockBase machine : customerMachineList) {
if (GT_Utility.areStacksEqual(machine.getStackForm(1), routing.RoutingMachine, true)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public void registerBlock() {
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
for (int i = 0; i < 15; i++) {
ModuleIcon[i] = iconRegister
.registerIcon(Tags.MODID + (!isUpdate ? ":modules/BoxModule" : ":modules/BoxModulePlus") + i);
ModuleIcon[i] = iconRegister.registerIcon(Tags.MODID + (!isUpdate
? ":modules/BoxModule"
: ":modules/BoxModulePlus") + i);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ public boolean getHasSubtypes() {
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean p_77624_4_) {
boolean update = ((BlockBoxModuleCore) field_150939_a).isUpdate;
list.add(
EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD
+ i18n("tile.boxplusplus.boxUI.module.context." + (stack.getItemDamage() + 1) + (update ? "f" : "a")));
list.add(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + i18n(
"tile.boxplusplus.boxUI.module.context." + (stack.getItemDamage() + 1) + (update ? "f" : "a")));
if (update) {
list.add(
EnumChatFormatting.GOLD + i18n("tile.boxplusplus.boxUI.module." + (stack.getItemDamage() + 1))
+ " (T2)");
list.add(EnumChatFormatting.GOLD
+ i18n("tile.boxplusplus.boxUI.module." + (stack.getItemDamage() + 1))
+ " (T2)");
}
list.add(i18n("tile.boxplusplus.boxUI.module.context." + (stack.getItemDamage() + 1) + (update ? "d" : "b")));
if (customUpdatedModuleList.containsKey(stack.getItemDamage())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public int getMetadata(int p_77647_1_) {

@Override
public void addInformation(ItemStack item, EntityPlayer player, List list, boolean b) {
list.add(
Util.i18n(
("tile.boxplusplus_maintainingDrone%.desc".replaceAll("%", String.valueOf(item.getItemDamage())))));
list.add(Util.i18n(("tile.boxplusplus_maintainingDrone%.desc".replaceAll(
"%",
String.valueOf(item.getItemDamage())))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,26 @@

public class BlockRegister {

public static BlockMachineBase SpaceExtend = new BlockMachineBase("boxplusplus_SpaceExtend", Material.iron, 0)
.setHarvest("wrench", 3);
public static BlockMachineBase SpaceConstraint = new BlockMachineBase(
"boxplusplus_SpaceConstraint",
public static BlockMachineBase SpaceExtend = new BlockMachineBase(
"boxplusplus_SpaceExtend",
Material.iron,
0).setHarvest("wrench", 3);
public static BlockMachineBase SpaceConstraint = new BlockMachineBase("boxplusplus_SpaceConstraint",
Material.iron,
2).setHarvest("wrench", 3);
public static BlockMachineBase SpaceCompress = new BlockMachineBase("boxplusplus_SpaceCompress", Material.iron, 1)
.setHarvest("wrench", 3);
public static BlockMachineBase SpaceWall = new BlockMachineBase("boxplusplus_SpaceWall", Material.iron, 3)
.setHarvest("wrench", 3);
public static BlockBoxModuleCore BoxModule = new BlockBoxModuleCore("boxplusplus_boxmodule", Material.iron, false)
.setHarvest("wrench", 5);
public static BlockBoxModuleCore BoxModuleUpgrad = new BlockBoxModuleCore(
"boxplusplus_boxmoduleplus",
public static BlockMachineBase SpaceCompress = new BlockMachineBase(
"boxplusplus_SpaceCompress",
Material.iron,
1).setHarvest("wrench", 3);
public static BlockMachineBase SpaceWall = new BlockMachineBase(
"boxplusplus_SpaceWall",
Material.iron,
3).setHarvest("wrench", 3);
public static BlockBoxModuleCore BoxModule = new BlockBoxModuleCore(
"boxplusplus_boxmodule",
Material.iron,
false).setHarvest("wrench", 5);
public static BlockBoxModuleCore BoxModuleUpgrad = new BlockBoxModuleCore("boxplusplus_boxmoduleplus",
Material.iron,
true).setHarvest("wrench", 5);
public static BlockBoxRing BoxRing = new BlockBoxRing(1);
Expand Down
Loading

0 comments on commit c78b0d0

Please sign in to comment.