-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from AnnsAnns/1.20.5
Minecraft 1.21 Support
- Loading branch information
Showing
40 changed files
with
153 additions
and
11 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
48 changes: 48 additions & 0 deletions
48
fabric/remappedSrc/eu/annsann/flowerpower/FlowerPower.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,48 @@ | ||
package eu.annsann.flowerpower; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; | ||
import net.minecraft.block.*; | ||
import net.minecraft.item.ItemGroup; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Identifier; | ||
|
||
import java.util.Arrays; | ||
|
||
import static eu.annsann.flowerpower.Flowers.*; | ||
|
||
public class FlowerPower implements ModInitializer { | ||
public static final String MOD_NAME = "flower_power"; | ||
public static final RegistryKey<ItemGroup> ITEM_GROUP = RegistryKey.of( | ||
RegistryKeys.ITEM_GROUP, | ||
new Identifier(MOD_NAME, MOD_NAME + "_group") | ||
); | ||
|
||
/** | ||
* Runs the mod initializer. | ||
*/ | ||
@Override | ||
public void onInitialize() { | ||
GenericPetalHelper.registerPetal("red_petals", RED_PETALS); | ||
GenericPetalHelper.registerPetal("yellow_petals", YELLOW_PETALS); | ||
GenericPetalHelper.registerPetal("blue_petals", BLUE_PETALS); | ||
GenericPetalHelper.registerPetal("orchid_petals", ORCHID_PETALS); | ||
GenericPetalHelper.registerPetal("orange_petals", ORANGE_PETALS); | ||
GenericPetalHelper.registerPetal("grey_petals", GREY_PETALS); | ||
GenericPetalHelper.registerPetal("pink_petals", PINK_PETALS); | ||
GenericPetalHelper.registerPetal("white_petals", WHITE_PETALS); | ||
GenericPetalHelper.registerPetal("magenta_petals", MAGENTA_PETALS); | ||
GenericPetalHelper.registerPetal("black_petals", BLACK_PETALS); | ||
|
||
Registry.register(Registries.ITEM_GROUP, ITEM_GROUP, FabricItemGroup.builder() | ||
.displayName(Text.translatable("itemGroup.flower_power.flower_power")) | ||
.icon(() -> new ItemStack(Blocks.TORCHFLOWER)) | ||
.entries((context, entries) -> Arrays.stream(Petals).forEach(entries::add)) | ||
.build()); | ||
} | ||
} |
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,33 @@ | ||
package eu.annsann.flowerpower; | ||
|
||
import net.minecraft.block.Block; | ||
import net.minecraft.block.FlowerbedBlock; | ||
import net.minecraft.registry.RegistryKeys; | ||
import net.minecraft.registry.tag.TagKey; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class Flowers { | ||
public static final FlowerbedBlock RED_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock YELLOW_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock BLUE_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock ORCHID_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock ORANGE_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock GREY_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock PINK_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock WHITE_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock MAGENTA_PETALS = GenericPetalHelper.createNewPetal(); | ||
public static final FlowerbedBlock BLACK_PETALS = GenericPetalHelper.createNewPetal(); | ||
|
||
public static final Block[] Petals = { | ||
RED_PETALS, | ||
YELLOW_PETALS, | ||
BLUE_PETALS, | ||
ORCHID_PETALS, | ||
ORANGE_PETALS, | ||
GREY_PETALS, | ||
PINK_PETALS, | ||
WHITE_PETALS, | ||
MAGENTA_PETALS, | ||
BLACK_PETALS | ||
}; | ||
} |
37 changes: 37 additions & 0 deletions
37
fabric/remappedSrc/eu/annsann/flowerpower/GenericPetalHelper.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,37 @@ | ||
package eu.annsann.flowerpower; | ||
|
||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; | ||
import net.minecraft.block.AbstractBlock; | ||
import net.minecraft.block.FlowerbedBlock; | ||
import net.minecraft.block.piston.PistonBehavior; | ||
import net.minecraft.item.AliasedBlockItem; | ||
import net.minecraft.item.BlockItem; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.sound.BlockSoundGroup; | ||
import net.minecraft.util.Identifier; | ||
|
||
import static eu.annsann.flowerpower.FlowerPower.*; | ||
|
||
public class GenericPetalHelper { | ||
public static FlowerbedBlock createNewPetal() { | ||
return new FlowerbedBlock( | ||
AbstractBlock.Settings | ||
.create() | ||
.noCollision() | ||
.sounds(BlockSoundGroup.PINK_PETALS) | ||
.pistonBehavior(PistonBehavior.DESTROY) | ||
); | ||
} | ||
|
||
public static void registerPetal(String name, FlowerbedBlock entry) { | ||
Registry.register(Registries.BLOCK, | ||
new Identifier(MOD_NAME, name), | ||
entry); | ||
Registry.register(Registries.ITEM, | ||
new Identifier(MOD_NAME, name), | ||
new BlockItem(entry, new Item.Settings())); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
fabric/remappedSrc/eu/annsann/flowerpower/client/FlowerPowerClient.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,24 @@ | ||
package eu.annsann.flowerpower.client; | ||
|
||
import eu.annsann.flowerpower.FlowerPower; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.client.render.RenderLayer; | ||
|
||
import java.util.Arrays; | ||
|
||
import static eu.annsann.flowerpower.Flowers.*; | ||
|
||
public class FlowerPowerClient implements ClientModInitializer { | ||
/** | ||
* Runs the mod initializer on the client environment. | ||
*/ | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
Arrays.stream(Petals).forEach( | ||
block -> BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout()) | ||
); | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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