-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug, refactor: Fixed elevator assembly issue
- Loading branch information
1 parent
94ea051
commit f33182a
Showing
6 changed files
with
82 additions
and
22 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
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
46 changes: 46 additions & 0 deletions
46
src/main/java/rbasamoyai/createbigcannons/cannon_loading/CBCModifiedContraptionRegistry.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,46 @@ | ||
package rbasamoyai.createbigcannons.cannon_loading; | ||
|
||
import com.simibubi.create.content.contraptions.Contraption; | ||
import com.simibubi.create.content.contraptions.ContraptionType; | ||
|
||
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet; | ||
import rbasamoyai.createbigcannons.index.CBCContraptionTypes; | ||
import rbasamoyai.createbigcannons.remix.HasFragileContraption; | ||
|
||
public class CBCModifiedContraptionRegistry { | ||
|
||
private static final ReferenceOpenHashSet<ContraptionType> CANNON_LOADER_TYPES = new ReferenceOpenHashSet<>(); | ||
private static final ReferenceOpenHashSet<ContraptionType> FRAGILE_TYPES = new ReferenceOpenHashSet<>(); | ||
|
||
public static void registerCannonLoaderType(ContraptionType type) { | ||
if (CANNON_LOADER_TYPES.contains(type)) | ||
throw new IllegalStateException("Already registered big cannon loader contraption type"); | ||
CANNON_LOADER_TYPES.add(type); | ||
} | ||
|
||
public static void registerFragileType(ContraptionType type) { | ||
if (FRAGILE_TYPES.contains(type)) | ||
throw new IllegalStateException("Already registered fragile contraption type"); | ||
FRAGILE_TYPES.add(type); | ||
} | ||
|
||
public static boolean canLoadBigCannon(Contraption contraption) { | ||
return CANNON_LOADER_TYPES.contains(contraption.getType()) && contraption instanceof CanLoadBigCannon; | ||
} | ||
|
||
public static boolean isFragileContraption(Contraption contraption) { | ||
return FRAGILE_TYPES.contains(contraption.getType()) && contraption instanceof HasFragileContraption; | ||
} | ||
|
||
public static void registerDefaults() { | ||
registerCannonLoaderType(CBCContraptionTypes.CANNON_LOADER); | ||
registerCannonLoaderType(ContraptionType.PISTON); | ||
registerCannonLoaderType(ContraptionType.GANTRY); | ||
registerCannonLoaderType(ContraptionType.PULLEY); | ||
registerFragileType(CBCContraptionTypes.CANNON_LOADER); | ||
registerFragileType(ContraptionType.PISTON); | ||
registerFragileType(ContraptionType.GANTRY); | ||
registerFragileType(ContraptionType.PULLEY); | ||
} | ||
|
||
} |
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