-
Notifications
You must be signed in to change notification settings - Fork 9
World conversion #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SuperSoupr
wants to merge
12
commits into
GTNewHorizons:master
Choose a base branch
from
SuperSoupr:world-conversion
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
World conversion #89
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
70f8b37
World conversion skeleton & examples
SuperSoupr 10b9334
More transformations
SuperSoupr 25ae882
documentation
SuperSoupr 2d2754c
Many more mappings
SuperSoupr 10900c1
even more transformations
SuperSoupr fba24f0
cleanup
SuperSoupr bd0d503
add config
SuperSoupr 320ee58
last minute changes
SuperSoupr b43ce3a
Merge branch 'master' into world-conversion
SuperSoupr 01d76af
spotless
SuperSoupr 2c70e96
fixes
SuperSoupr fe1149f
Merge branch 'master' into world-conversion
FourIsTheNumber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/fouristhenumber/utilitiesinexcess/compat/exu/ExuCompat.java
This file contains hidden or 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,33 @@ | ||
| package com.fouristhenumber.utilitiesinexcess.compat.exu; | ||
|
|
||
| import net.minecraft.block.Block; | ||
| import net.minecraft.item.Item; | ||
|
|
||
| import cpw.mods.fml.common.event.FMLMissingMappingsEvent; | ||
| import cpw.mods.fml.common.registry.GameRegistry; | ||
|
|
||
| public class ExuCompat { | ||
|
|
||
| public static void onMissingMappings(FMLMissingMappingsEvent event) { | ||
| for (FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()) { | ||
| if (mapping == null) continue; | ||
|
|
||
| if (Remappings.SKIPPED_MAPPINGS.contains(mapping.name)) { | ||
| mapping.ignore(); | ||
| continue; | ||
| } | ||
|
|
||
| if (mapping.type == GameRegistry.Type.ITEM) { | ||
| Item newItem = Remappings.ITEM_MAPPINGS.get(mapping.name); | ||
| if (newItem != null) { | ||
| mapping.remap(newItem); | ||
| } | ||
| } else { // BLOCK | ||
| Block newBlock = Remappings.BLOCK_MAPPINGS.get(mapping.name); | ||
| if (newBlock != null) { | ||
| mapping.remap(newBlock); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
183 changes: 183 additions & 0 deletions
183
src/main/java/com/fouristhenumber/utilitiesinexcess/compat/exu/Remappings.java
This file contains hidden or 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,183 @@ | ||
| package com.fouristhenumber.utilitiesinexcess.compat.exu; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.HashMap; | ||
| import java.util.HashSet; | ||
| import java.util.List; | ||
| import java.util.Set; | ||
|
|
||
| import net.minecraft.block.Block; | ||
| import net.minecraft.item.Item; | ||
|
|
||
| import com.fouristhenumber.utilitiesinexcess.ModBlocks; | ||
| import com.fouristhenumber.utilitiesinexcess.ModItems; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.IPosteaTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.blocks.CompressedBlocksTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.blocks.ConveyorTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.blocks.DarkPortalTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.blocks.DecoBlock1Transformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.blocks.EnderLilyTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.blocks.SoundMufflerTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.blocks.TrashCanTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.items.DivisionSigilTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.items.GoldenBagTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.items.GoldenLassoTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.items.UnstableIngotTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.items.WateringCanTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.tileentities.FullChestTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.tileentities.GeneratorTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.tileentities.MiniChestTransformation; | ||
| import com.fouristhenumber.utilitiesinexcess.compat.exu.postea.tileentities.SpikeTransformation; | ||
|
|
||
| public enum Remappings { | ||
| // spotless:off | ||
|
|
||
| // make sure to leave a trailing comma | ||
| // Direct block remappings | ||
| ANGEL_BLOCK("ExtraUtilities:angelBlock", ModBlocks.FLOATING_BLOCK), | ||
| BUD("ExtraUtilities:budoff", ModBlocks.BLOCK_UPDATE_DETECTOR), | ||
| DECO_BLOCK_2("ExtraUtilities:decorativeBlock2", ModBlocks.DECORATIVE_GLASS), | ||
| CURTAINS("ExtraUtilities:curtains", ModBlocks.BLACKOUT_CURTAINS), | ||
| PURE_LOVE("ExtraUtilities:pureLove", ModBlocks.PURE_LOVE), | ||
| BEDROCKUIM_BLOCK("ExtraUtilities:block_bedrockium", ModBlocks.BEDROCKIUM_BLOCK), | ||
| GREENSCREEN("ExtraUtilities:greenscreen", ModBlocks.LAPIS_AETHERIUS), | ||
| // PEACEFUL_TABLE("ExtraUtilities:peaceful_table_top", ModBlocks.abc), // TODO: add here once merged | ||
| CURSED_EARTH("ExtraUtilities:cursedearthside", ModBlocks.CURSED_EARTH), | ||
| SPIKE_WOOD("ExtraUtilities:spike_base_wood", ModBlocks.SPIKE_WOOD), | ||
| SPIKE_IRON("ExtraUtilities:spike_base", ModBlocks.SPIKE_IRON), | ||
| SPIKE_GOLD("ExtraUtilities:spike_base_gold", ModBlocks.SPIKE_GOLD), | ||
| SPIKE_DIAMOND("ExtraUtilities:spike_base_diamond", ModBlocks.SPIKE_DIAMOND), | ||
| TIMER("ExtraUtilities:timer", ModBlocks.REDSTONE_CLOCK), | ||
| ETHEREAL_GLASS("ExtraUtilities:etherealglass", ModBlocks.ETHEREAL_GLASS), | ||
| ENDER_PUMP("ExtraUtilities:enderThermicPump", ModBlocks.SMART_PUMP), | ||
| COLORED_STONE_BRICK("ExtraUtilities:colorStoneBrick", ModBlocks.COLORED_STONE_BRICKS), | ||
| COLORED_PLANKS("ExtraUtilities:colorWoodPlanks", ModBlocks.COLORED_WOOD_PLANKS), | ||
| COLORED_GLOWSTONE("ExtraUtilities:color_lightgem", ModBlocks.COLORED_GLOWSTONE), | ||
| COLORED_STONE("ExtraUtilities:color_stone", ModBlocks.COLORED_STONE), | ||
| COLORED_QUARTZ_BLOCK("ExtraUtilities:color_quartzBlock", ModBlocks.COLORED_QUARTZ_BLOCK), | ||
| COLORED_SOUL_SAND("ExtraUtilities:color_hellsand", ModBlocks.COLORED_SOUL_SAND), | ||
| COLORED_REDSTONE_LAMP("ExtraUtilities:color_redstoneLight", ModBlocks.COLORED_REDSTONE_LAMP), | ||
| COLORED_BRICKS("ExtraUtilities:color_brick", ModBlocks.COLORED_BRICKS), | ||
| COLORED_COBBLESTONE("ExtraUtilities:color_stonebrick", ModBlocks.COLORED_COBBLESTONE), | ||
| COLORED_LAPIS_BLOCK("ExtraUtilities:color_blockLapis", ModBlocks.COLORED_LAPIS_BLOCK), | ||
| COLORED_OBSIDIAN("ExtraUtilities:color_obsidian", ModBlocks.COLORED_OBSIDIAN), | ||
| COLORED_REDSTONE_BLOCK("ExtraUtilities:color_blockRedstone", ModBlocks.COLORED_REDSTONE_BLOCK), | ||
| COLORED_COAL_BLOCK("ExtraUtilities:color_blockCoal", ModBlocks.COLORED_COAL_BLOCK), | ||
|
|
||
| // Direct item remappings | ||
| GLOVE("ExtraUtilities:glove", ModItems.GLOVE), | ||
| HEAVENLY_RING("ExtraUtilities:angelRing", ModItems.HEAVENLY_RING), | ||
| FIRE_BATTERY("ExtraUtilities:heatingElement", ModItems.FIRE_BATTERY), | ||
| ARCHITECTS_WAND("ExtraUtilities:buildersWand", ModItems.ARCHITECTS_WAND), | ||
| SUPER_ARCHITECTS_WAND("ExtraUtilities:creativeBuildersWand", ModItems.ARCHITECTS_WAND), | ||
| INVERTED_SWORD("ExtraUtilities:ethericSword", ModItems.ETHERIC_SWORD), | ||
| INVERTED_PICKAXE("ExtraUtilities:destructionpickaxe", ModItems.DESTRUCTION_PICKAXE), | ||
| INVERTED_AXE("ExtraUtilities:defoliageAxe", ModItems.GLUTTONS_AXE), | ||
| INVERTED_SHOVEL("ExtraUtilities:erosionShovel", ModItems.ANTI_PARTICULATE_SHOVEL), | ||
| INVERTED_HOE("ExtraUtilities:temporalHoe", ModItems.REVERSING_HOE), | ||
| INVERTED_SHEARS("ExtraUtilities:shears", ModItems.PRECISION_SHEARS), | ||
| XRAY_GLASSES("ExtraUtilities:sonar_goggles", ModItems.XRAY_GLASSES), | ||
| BEDROCKUIM_INGOT("ExtraUtilities:bedrockiumIngot", ModItems.BEDROCKIUM_INGOT), | ||
| SCANNER("ExtraUtilities:scanner", ModItems.BLOCK_ANALYZER), | ||
|
|
||
| // Item Transformations | ||
| GOLDEN_BAG(new GoldenBagTransformation()), | ||
| WATERING_CAN(new WateringCanTransformation()), | ||
| INVERSION_SIGIL(new DivisionSigilTransformation()), | ||
| MOB_JAR(new GoldenLassoTransformation()), | ||
| INVERTED_INGOT(new UnstableIngotTransformation()), | ||
|
|
||
| // Block Transformations | ||
| SOUND_MUFFLER(new SoundMufflerTransformation()), | ||
| DECO_BLOCK_1(new DecoBlock1Transformation()), | ||
| COMPRESSED_BLOCKS(new CompressedBlocksTransformation()), | ||
| DARK_PORTAL(new DarkPortalTransformation()), | ||
| TRASH_CANS(new TrashCanTransformation()), | ||
| ENDER_LOTUS(new EnderLilyTransformation()), | ||
| CONVEYOR(new ConveyorTransformation()), | ||
|
|
||
| // Tile Entity Transformation | ||
| GENERATORS(new GeneratorTransformation()), | ||
| FULL_CHEST(new FullChestTransformation()), | ||
| MINI_CHEST(new MiniChestTransformation()), | ||
| SPIKES(new SpikeTransformation()), | ||
|
|
||
| // Skipped mappings | ||
| PAINT_BRUSH("ExtraUtilities:paintbrush"), | ||
| DATABLOCK("ExtraUtilities:datablock"), | ||
|
|
||
| ; // leave trailing semicolon | ||
| // spotless:on | ||
|
|
||
| public static final Remappings[] VALUES = values(); | ||
|
|
||
| public static final HashMap<String, Item> ITEM_MAPPINGS = new HashMap<>(); | ||
| public static final HashMap<String, Block> BLOCK_MAPPINGS = new HashMap<>(); | ||
| public static final List<IPosteaTransformation> TRANSFORMATIONS = new ArrayList<>(); | ||
| public static final Set<String> SKIPPED_MAPPINGS = new HashSet<>(); | ||
|
|
||
| public static void preInit() { | ||
| for (Remappings remapping : VALUES) { | ||
| if (remapping.replacementItem != null) { | ||
| ITEM_MAPPINGS.put(remapping.getName(), remapping.replacementItem); | ||
| } | ||
| if (remapping.replacementBlock != null) { | ||
| BLOCK_MAPPINGS.put(remapping.getName(), remapping.replacementBlock); | ||
| } | ||
| if (remapping.transformation != null) { | ||
| TRANSFORMATIONS.add(remapping.transformation); | ||
| } | ||
| if (remapping.isSkipped) { | ||
| SKIPPED_MAPPINGS.add(remapping.getName()); | ||
| } | ||
| if (remapping.transformation != null) { | ||
| remapping.transformation.registerDummies(); | ||
| remapping.transformation.addItemRemappings(ITEM_MAPPINGS); | ||
| remapping.transformation.addBlockRemappings(BLOCK_MAPPINGS); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| public static void init() { | ||
| for (IPosteaTransformation transformation : TRANSFORMATIONS) { | ||
| transformation.registerTEDummies(); | ||
| } | ||
| } | ||
|
|
||
| public static void postInit() { | ||
| for (IPosteaTransformation transformation : TRANSFORMATIONS) { | ||
| transformation.registerTransformations(); | ||
| } | ||
| } | ||
|
|
||
| private String oldName; | ||
| private Block replacementBlock = null; | ||
| private Item replacementItem = null; | ||
| private IPosteaTransformation transformation = null; | ||
|
|
||
| private boolean isSkipped = false; | ||
|
|
||
| Remappings(String oldName, ModBlocks modBlock) { | ||
| this.oldName = oldName; | ||
| this.replacementBlock = modBlock.get(); | ||
| this.replacementItem = modBlock.getItem(); | ||
| } | ||
|
|
||
| Remappings(String oldName, ModItems modItem) { | ||
| this.oldName = oldName; | ||
| this.replacementItem = modItem.get(); | ||
| } | ||
|
|
||
| Remappings(String oldName) { | ||
| this.oldName = oldName; | ||
| isSkipped = true; | ||
| } | ||
|
|
||
| Remappings(IPosteaTransformation posteaTransformation) { | ||
| this.transformation = posteaTransformation; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return oldName; | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/fouristhenumber/utilitiesinexcess/compat/exu/postea/DummyBlock.java
This file contains hidden or 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,11 @@ | ||
| package com.fouristhenumber.utilitiesinexcess.compat.exu.postea; | ||
|
|
||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.material.Material; | ||
|
|
||
| public class DummyBlock extends Block { | ||
|
|
||
| public DummyBlock(Material materialIn) { | ||
| super(materialIn); | ||
| } | ||
| } | ||
57 changes: 57 additions & 0 deletions
57
...n/java/com/fouristhenumber/utilitiesinexcess/compat/exu/postea/IPosteaTransformation.java
This file contains hidden or 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,57 @@ | ||
| package com.fouristhenumber.utilitiesinexcess.compat.exu.postea; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| import net.minecraft.block.Block; | ||
| import net.minecraft.item.Item; | ||
|
|
||
| /** | ||
| * Represents a Postea transformation which handles the process of migrating a now-removed items and blocks | ||
| * in already existing saves. | ||
| * The process goes: | ||
| * "modid:removed" -> FMLMissingMappingsEvent -> "ourmodid:dummyitem" -> Postea -> "ourmodid:corrected_item" | ||
| */ | ||
| public interface IPosteaTransformation { | ||
|
|
||
| /** | ||
| * This method is called during a common FMLPreInitializationEvent, | ||
| * do all your GameRegistry.registerItem and GameRegistry.registerBlock calls here. | ||
| */ | ||
| default void registerDummies() {} | ||
|
|
||
| /** | ||
| * This method is called during a common FMLInitializationEvent, | ||
| * do all your GameRegistry.registerTileEntity calls here. | ||
| */ | ||
| default void registerTEDummies() {} | ||
|
|
||
| /** | ||
| * Called to add your dummy items to be mapped during the FMLMissingMappingsEvent event, | ||
| * add your items with the old item's "modid:itemname" registry name as the key | ||
| * and your dummy {@link Item} instance as the value. | ||
| * <p> | ||
| * See {@link cpw.mods.fml.common.event.FMLMissingMappingsEvent} for more. | ||
| * | ||
| * @param remappings Current running list of remappings, add yours to this. | ||
| */ | ||
| default void addItemRemappings(Map<String, Item> remappings) {} | ||
|
|
||
| /** | ||
| * Called to add your dummy blocks to be mapped during the FMLMissingMappingsEvent event, | ||
| * add your blocks with the old block's "modid:itemname" registry name as the key | ||
| * and your dummy {@link Block} instance as the value. | ||
| * Remember to also add it's ItemBlock instance to addItemRemappings. | ||
| * <p> | ||
| * See {@link cpw.mods.fml.common.event.FMLMissingMappingsEvent} for more. | ||
| * | ||
| * @param remappings Current running list of remappings, add yours to this. | ||
| */ | ||
| default void addBlockRemappings(Map<String, Block> remappings) {} | ||
|
|
||
| /** | ||
| * This method is called during a common FMLPostInitializationEvent, | ||
| * do all your BlockReplacementManager.addBlockReplacement and | ||
| * ItemStackReplacementManager.addItemReplacement calls here. | ||
| */ | ||
| default void registerTransformations() {} | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.