Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 9e9326e

Browse files
committed
Make requested changes.
Mainly adding Override annotations to methods for interfaces, but a few other things as well.
1 parent 85cddc7 commit 9e9326e

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

patchwork-events-lifecycle/src/main/java/net/patchworkmc/mixin/event/lifecycle/MixinMinecraftServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
@Mixin(MinecraftServer.class)
3232
public class MixinMinecraftServer {
3333
@Inject(method = "run", at = @At(value = "INVOKE", target = "net/minecraft/server/MinecraftServer.exit ()V"))
34-
void serverStoppedHook(CallbackInfo ci) {
34+
private void serverStoppedHook(CallbackInfo ci) {
3535
LifecycleEvents.handleServerStopped((MinecraftServer) (Object) this);
3636
}
3737
}

patchwork-loot/src/main/java/net/patchworkmc/impl/loot/LootHooks.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
import net.patchworkmc.impl.event.loot.LootEvents;
4141

42+
// NOTE: this class is more or less a direct copy of parts of Forge's ForgeHooks.
4243
public class LootHooks {
4344
@Unique
4445
private static ThreadLocal<Deque<LootTableContext>> lootContext = new ThreadLocal<Deque<LootTableContext>>();

patchwork-loot/src/main/java/net/patchworkmc/mixin/loot/MixinLootPool.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public class MixinLootPool implements PatchworkLootPool, ForgeLootPool {
4444

4545
// implementation detail
4646
// TODO: if we could have an inner class that was also a mixin, we could set this as protected?
47+
@Override
4748
public void patchwork$setName(String name) {
4849
this.name = name;
4950
}
@@ -52,23 +53,28 @@ public class MixinLootPool implements PatchworkLootPool, ForgeLootPool {
5253

5354
// TODO: freezing stuff
5455

56+
@Override
5557
public String getName() {
5658
return this.name;
5759
}
5860

61+
@Override
5962
public LootTableRange getRolls() {
6063
return rollsRange;
6164
}
6265

66+
@Override
6367
public LootTableRange getBonusRolls() {
6468
return this.bonusRollsRange;
6569
}
6670

71+
@Override
6772
public void setRolls(UniformLootTableRange v) {
6873
// checkFrozen();
6974
this.rollsRange = v;
7075
}
7176

77+
@Override
7278
public void setBonusRolls(UniformLootTableRange v) {
7379
// checkFrozen();
7480
this.bonusRollsRange = v;

patchwork-loot/src/main/java/net/patchworkmc/mixin/loot/MixinLootPoolBuilder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,15 @@ public abstract class MixinLootPoolBuilder implements ForgeLootPool.Builder {
4444
private void addNameToConstructor(CallbackInfoReturnable<LootPool> cir) {
4545
LootPool ret = cir.getReturnValue();
4646
((PatchworkLootPool) ret).patchwork$setName(name);
47-
48-
// is this necessary?
49-
cir.setReturnValue(ret);
5047
}
5148

49+
@Override
5250
public LootPool.Builder name(String name) {
5351
this.name = name;
5452
return (LootPool.Builder) (Object) this;
5553
}
5654

55+
@Override
5756
public LootPool.Builder bonusRolls(float min, float max) {
5857
this.bonusRollsRange = new UniformLootTableRange(min, max);
5958
return (LootPool.Builder) (Object) this;

patchwork-loot/src/main/java/net/patchworkmc/mixin/loot/MixinLootTable.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ public class MixinLootTable implements ForgeLootTable {
4141

4242
// TODO: freezing stuff
4343

44+
@Override
4445
public LootPool getPool(String name) {
4546
return ((FabricLootSupplier) this).getPools().stream().filter(e -> name.equals(((ForgeLootPool) e).getName())).findFirst().orElse(null);
4647
}
4748

49+
@Override
4850
public LootPool removePool(String name) {
4951
// checkFrozen();
5052
for (int idx = 0; idx < pools.length; ++idx) {
@@ -60,6 +62,7 @@ public LootPool removePool(String name) {
6062
return null;
6163
}
6264

65+
@Override
6366
public void addPool(LootPool pool) {
6467
// checkFrozen();
6568
if (((FabricLootSupplier) this).getPools().stream().anyMatch(e -> e == pool || ((ForgeLootPool) e).getName().equals(((ForgeLootPool) pool).getName()))) {

0 commit comments

Comments
 (0)