-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fabric energy salepoint implementation
- Loading branch information
1 parent
13a853f
commit 551c45b
Showing
58 changed files
with
1,581 additions
and
58 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
common/src/generated/resources/.cache/630af4bded938901e0e1fd57c58a2ac245292828
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
2 changes: 1 addition & 1 deletion
2
common/src/generated/resources/.cache/6ba62358bf8e130d42215f5f9edbedd611809677
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
2 changes: 1 addition & 1 deletion
2
common/src/generated/resources/.cache/816056b233c115f7af92c9ed2c207f096721f5cf
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,2 +1,2 @@ | ||
// 1.20.1 2024-08-05T17:31:05.725976583 Create: Numismatics/Numismatics EMI excluded tags | ||
// 1.20.1 2024-08-06T08:53:15.205438956 Create: Numismatics/Numismatics EMI excluded tags | ||
b57edab6f7e7a6e1b1211daa4c3b217ffd09ce62 assets/emi/tag/exclusions/numismatics.json |
2 changes: 1 addition & 1 deletion
2
common/src/generated/resources/.cache/c6e4c19894bc5aece2976a0277ba8e1dbf023865
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 +1 @@ | ||
// 1.20.1 2024-08-05T17:31:05.741816291 Create: Numismatics/Numismatics' Sequenced Assembly Recipes | ||
// 1.20.1 2024-08-06T08:53:15.210829061 Create: Numismatics/Numismatics' Sequenced Assembly Recipes |
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
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
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
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
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
63 changes: 63 additions & 0 deletions
63
...a/dev/ithundxr/createnumismatics/content/backend/AuthorizationCheckingDeductableImpl.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,63 @@ | ||
/* | ||
* 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.backend; | ||
|
||
import com.simibubi.create.foundation.utility.Components; | ||
import dev.ithundxr.createnumismatics.content.backend.sub_authorization.Authorization; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
class AuthorizationCheckingDeductableImpl implements IAuthorizationCheckingDeductable { | ||
private final @NotNull IDeductable wrapped; | ||
private final @NotNull Authorization authorization; | ||
private final @NotNull IAuthorizationChecker authorizationChecker; | ||
|
||
AuthorizationCheckingDeductableImpl(@NotNull IDeductable wrapped, @NotNull Authorization authorization, @NotNull IAuthorizationChecker authorizationChecker) { | ||
this.wrapped = wrapped; | ||
this.authorization = authorization; | ||
this.authorizationChecker = authorizationChecker; | ||
} | ||
|
||
@Override | ||
public boolean deduct(Coin coin, int amount, ReasonHolder reasonHolder) { | ||
if (!authorizationChecker.isAuthorized(authorization)) { | ||
reasonHolder.setMessage(Components.translatable("error.numismatics.card.not_authorized")); | ||
return false; | ||
} | ||
|
||
return wrapped.deduct(coin, amount, reasonHolder); | ||
} | ||
|
||
@Override | ||
public boolean deduct(int spurs, ReasonHolder reasonHolder) { | ||
if (!authorizationChecker.isAuthorized(authorization)) { | ||
reasonHolder.setMessage(Components.translatable("error.numismatics.card.not_authorized")); | ||
return false; | ||
} | ||
|
||
return wrapped.deduct(spurs, reasonHolder); | ||
} | ||
|
||
@Override | ||
public int getMaxWithdrawal() { | ||
if (!authorizationChecker.isAuthorized(authorization)) | ||
return 0; | ||
|
||
return wrapped.getMaxWithdrawal(); | ||
} | ||
} |
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
25 changes: 25 additions & 0 deletions
25
...n/src/main/java/dev/ithundxr/createnumismatics/content/backend/IAuthorizationChecker.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,25 @@ | ||
/* | ||
* 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.backend; | ||
|
||
import dev.ithundxr.createnumismatics.content.backend.sub_authorization.Authorization; | ||
|
||
public interface IAuthorizationChecker { | ||
boolean isAuthorized(Authorization authorization); | ||
} |
34 changes: 34 additions & 0 deletions
34
...java/dev/ithundxr/createnumismatics/content/backend/IAuthorizationCheckingDeductable.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,34 @@ | ||
/* | ||
* 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.backend; | ||
|
||
import dev.ithundxr.createnumismatics.content.backend.sub_authorization.Authorization; | ||
|
||
/** | ||
* This is a marker interface, which should be used on {@link IDeductable} implementations that re-check the authorization before every deduction. | ||
*/ | ||
public interface IAuthorizationCheckingDeductable extends IDeductable { | ||
|
||
static IAuthorizationCheckingDeductable of(IDeductable deductable, Authorization authorization, IAuthorizationChecker checker) { | ||
if (deductable instanceof IAuthorizationCheckingDeductable authorizationCheckingDeductable) | ||
return authorizationCheckingDeductable; | ||
|
||
return new AuthorizationCheckingDeductableImpl(deductable, authorization, checker); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.