Skip to content

Commit

Permalink
fix operation when Create Crafts & Additions is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
techno-sam committed Aug 6, 2024
1 parent 4f5f067 commit 0e9c747
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Numismatics
* Copyright (c) 2024 The Railways Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package dev.ithundxr.createnumismatics.content.salepoint.states.fabric;

import dev.ithundxr.createnumismatics.content.salepoint.containers.InvalidatableWrappingEnergyBuffer;
import dev.ithundxr.createnumismatics.content.salepoint.containers.fabric.InvalidatableWrappingEnergyBufferStorage;
import dev.ithundxr.createnumismatics.content.salepoint.types.EnergyBuffer;

public class CCACompat {
public static InvalidatableWrappingEnergyBuffer createBufferWrapper(EnergyBuffer buffer) {
return new InvalidatableWrappingEnergyBufferStorage(buffer);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package dev.ithundxr.createnumismatics.content.salepoint.states.fabric;

import dev.ithundxr.createnumismatics.compat.Mods;
import dev.ithundxr.createnumismatics.content.salepoint.containers.InvalidatableWrappingEnergyBuffer;
import dev.ithundxr.createnumismatics.content.salepoint.containers.fabric.InvalidatableWrappingEnergyBufferStorage;
import dev.ithundxr.createnumismatics.content.salepoint.types.EnergyBuffer;

public class EnergySalepointStateImpl {
public static InvalidatableWrappingEnergyBuffer createBufferWrapper(EnergyBuffer buffer) {
return new InvalidatableWrappingEnergyBufferStorage(buffer);
return Mods.CREATEADDITION.runIfInstalled(
() -> () -> CCACompat.createBufferWrapper(buffer)
).orElseGet(() -> new InvalidatableWrappingEnergyBuffer(buffer));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Numismatics
* Copyright (c) 2024 The Railways Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package dev.ithundxr.createnumismatics.content.salepoint.states.forge;

import dev.ithundxr.createnumismatics.content.salepoint.containers.InvalidatableWrappingEnergyBuffer;
import dev.ithundxr.createnumismatics.content.salepoint.containers.forge.InvalidatableWrappingEnergyBufferStorage;
import dev.ithundxr.createnumismatics.content.salepoint.types.EnergyBuffer;

public class CCACompat {
public static InvalidatableWrappingEnergyBuffer createBufferWrapper(EnergyBuffer buffer) {
return new InvalidatableWrappingEnergyBufferStorage(buffer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@

package dev.ithundxr.createnumismatics.content.salepoint.states.forge;

import dev.ithundxr.createnumismatics.compat.Mods;
import dev.ithundxr.createnumismatics.content.salepoint.containers.InvalidatableWrappingEnergyBuffer;
import dev.ithundxr.createnumismatics.content.salepoint.containers.forge.InvalidatableWrappingEnergyBufferStorage;
import dev.ithundxr.createnumismatics.content.salepoint.types.EnergyBuffer;

public class EnergySalepointStateImpl {
public static InvalidatableWrappingEnergyBuffer createBufferWrapper(EnergyBuffer buffer) {
return new InvalidatableWrappingEnergyBufferStorage(buffer);
return Mods.CREATEADDITION.runIfInstalled(
() -> () -> CCACompat.createBufferWrapper(buffer)
).orElseGet(() -> new InvalidatableWrappingEnergyBuffer(buffer));
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ enable_cc = true
createaddition_fabric_version = vV4bZmhm
# forge-1.20.1-1.2.4d
createaddition_forge_version = eh2ccol5
enable_createaddition = true
enable_createaddition = false

# Publishing
# Modrinth
Expand Down

0 comments on commit 0e9c747

Please sign in to comment.