generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
3.1 Regions Unexplored support New Creative tab graphic
- Loading branch information
Showing
446 changed files
with
7,616 additions
and
39 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
9 changes: 9 additions & 0 deletions
9
src/main/java/net/xanthian/variantbarrels/block/VariantBarrelBlock.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,9 @@ | ||
package net.xanthian.variantbarrels.block; | ||
|
||
import net.minecraft.world.level.block.BarrelBlock; | ||
|
||
public class VariantBarrelBlock extends BarrelBlock { | ||
public VariantBarrelBlock(Properties pProperties) { | ||
super(pProperties); | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
src/main/java/net/xanthian/variantbarrels/block/compat/RegionsUnexplored.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,78 @@ | ||
package net.xanthian.variantbarrels.block.compat; | ||
|
||
import net.minecraft.world.item.BlockItem; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.crafting.RecipeType; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.state.BlockBehaviour; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import net.minecraftforge.registries.RegistryObject; | ||
import net.xanthian.variantbarrels.Initialise; | ||
import net.xanthian.variantbarrels.block.VariantBarrelBlock; | ||
import net.xanthian.variantbarrels.item.ModItems; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class RegionsUnexplored { | ||
|
||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, Initialise.MOD_ID); | ||
|
||
public static final RegistryObject<Block> RU_ALPHA_BARREL = register("ru_alpha_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_BAOBAB_BARREL = register("ru_baobab_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_BLACK_PAINTED_BARREL = register("ru_black_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_BLACKWOOD_BARREL = register("ru_blackwood_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_BLUE_PAINTED_BARREL = register("ru_blue_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_BROWN_PAINTED_BARREL = register("ru_brown_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_CYAN_PAINTED_BARREL = register("ru_cyan_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_CYPRESS_BARREL = register("ru_cypress_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_DEAD_BARREL = register("ru_dead_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 0); | ||
public static final RegistryObject<Block> RU_EUCALYPTUS_BARREL = register("ru_eucalyptus_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_GREEN_PAINTED_BARREL = register("ru_green_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_GRAY_PAINTED_BARREL = register("ru_gray_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_JOSHUA_BARREL = register("ru_joshua_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_LARCH_BARREL = register("ru_larch_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_LIGHT_BLUE_PAINTED_BARREL = register("ru_light_blue_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_LIGHT_GRAY_PAINTED_BARREL = register("ru_light_gray_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_LIME_PAINTED_BARREL = register("ru_lime_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_MAGENTA_PAINTED_BARREL = register("ru_magenta_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_MAPLE_BARREL = register("ru_maple_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_MAUVE_BARREL = register("ru_mauve_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_ORANGE_PAINTED_BARREL = register("ru_orange_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_PALM_BARREL = register("ru_palm_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_PINE_BARREL = register("ru_pine_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_PINK_PAINTED_BARREL = register("ru_pink_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_PURPLE_PAINTED_BARREL = register("ru_purple_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_RED_PAINTED_BARREL = register("ru_red_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_REDWOOD_BARREL = register("ru_redwood_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_WHITE_PAINTED_BARREL = register("ru_white_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_WILLOW_BARREL = register("ru_willow_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_YELLOW_PAINTED_BARREL = register("ru_yellow_painted_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_BLUE_BIOSHROOM_BARREL = register("ru_blue_bioshroom_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_BRIMWOOD_BARREL = register("ru_brimwood_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 0); | ||
public static final RegistryObject<Block> RU_COBALT_BARREL = register("ru_cobalt_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 0); | ||
public static final RegistryObject<Block> RU_GREEN_BIOSHROOM_BARREL = register("ru_green_bioshroom_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_KAPOK_BARREL = register("ru_kapok_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_MAGNOLIA_BARREL = register("ru_magnolia_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_PINK_BIOSHROOM_BARREL = register("ru_pink_bioshroom_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_SOCOTRA_BARREL = register("ru_socotra_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 300); | ||
public static final RegistryObject<Block> RU_YELLOW_BIOSHROOM_BARREL = register("ru_yellow_bioshroom_barrel", () -> new VariantBarrelBlock(BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)), 0); | ||
|
||
private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block, int burnTime) { | ||
RegistryObject<T> toReturn = BLOCKS.register(name, block); | ||
registerBlockItem(name, toReturn, burnTime); | ||
return toReturn; | ||
} | ||
|
||
private static <T extends Block> RegistryObject<BlockItem> registerBlockItem(String name, RegistryObject<T> block, int burnTime) { | ||
return ModItems.ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties()) { | ||
@Override | ||
public int getBurnTime(ItemStack itemStack, @Nullable RecipeType<?> recipeType) { | ||
return burnTime; | ||
} | ||
}); | ||
} | ||
} |
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
40 changes: 24 additions & 16 deletions
40
src/main/java/net/xanthian/variantbarrels/util/ModPOITypes.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 |
---|---|---|
@@ -1,32 +1,40 @@ | ||
package net.xanthian.variantbarrels.util; | ||
|
||
import com.google.common.collect.ImmutableSet; | ||
import net.minecraft.world.entity.ai.village.poi.PoiType; | ||
import net.minecraft.world.entity.ai.village.poi.PoiTypes; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import net.minecraftforge.registries.RegistryObject; | ||
import net.xanthian.variantbarrels.block.Vanilla; | ||
import net.xanthian.variantbarrels.block.VariantBarrelBlock; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.function.Consumer; | ||
|
||
public class ModPOITypes { | ||
|
||
public static DeferredRegister<PoiType> POI_TYPES = DeferredRegister.create(ForgeRegistries.POI_TYPES, "minecraft"); | ||
public static RegistryObject<PoiType> FISHERMAN = POI_TYPES.register("fisherman", () -> | ||
new PoiType(ImmutableSet.copyOf(getPOIBlockStates()), 1, 1)); | ||
|
||
// Credit to cech12 & BrickFurnace mod | ||
|
||
public static RegistryObject<PoiType> FISHERMAN = POI_TYPES.register("fisherman", () -> { | ||
HashSet<BlockState> states = new HashSet<>(ForgeRegistries.POI_TYPES.getDelegateOrThrow(PoiTypes.FISHERMAN).get().matchingStates()); | ||
RegistryObject<Block>[] barrelRegistryObjects = new RegistryObject[]{ | ||
Vanilla.ACACIA_BARREL, Vanilla.BAMBOO_BARREL, Vanilla.CHERRY_BARREL, | ||
Vanilla.CRIMSON_BARREL, Vanilla.DARK_OAK_BARREL, Vanilla.JUNGLE_BARREL, | ||
Vanilla.MANGROVE_BARREL, Vanilla.OAK_BARREL, Vanilla.WARPED_BARREL | ||
}; | ||
for (RegistryObject<Block> barrelRegistryObject : barrelRegistryObjects) { | ||
states.addAll(barrelRegistryObject.get().getStateDefinition().getPossibleStates()); | ||
} | ||
return new PoiType(states, 1, 1); | ||
}); | ||
private static Set<BlockState> getPOIBlockStates() { | ||
Set<BlockState> states = new HashSet<>(); | ||
|
||
ForgeRegistries.BLOCKS.getValues().stream() | ||
.filter(ModPOITypes::isVariantBarrel) | ||
.forEach(addAllBlockStates(states)); | ||
return states; | ||
} | ||
|
||
@NotNull | ||
private static Consumer<Block> addAllBlockStates(Set<BlockState> states) { | ||
return block -> states.addAll(block.getStateDefinition().getPossibleStates()); | ||
} | ||
|
||
private static boolean isVariantBarrel(Block block) { | ||
return block instanceof VariantBarrelBlock; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/resources/assets/variantbarrels/blockstates/ru_alpha_barrel.json
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,56 @@ | ||
{ | ||
"variants": { | ||
"facing=down,open=false": { | ||
"model": "variantbarrels:block/ru_alpha_barrel", | ||
"x": 180 | ||
}, | ||
"facing=down,open=true": { | ||
"model": "variantbarrels:block/ru_alpha_barrel_open", | ||
"x": 180 | ||
}, | ||
"facing=east,open=false": { | ||
"model": "variantbarrels:block/ru_alpha_barrel", | ||
"x": 90, | ||
"y": 90 | ||
}, | ||
"facing=east,open=true": { | ||
"model": "variantbarrels:block/ru_alpha_barrel_open", | ||
"x": 90, | ||
"y": 90 | ||
}, | ||
"facing=north,open=false": { | ||
"model": "variantbarrels:block/ru_alpha_barrel", | ||
"x": 90 | ||
}, | ||
"facing=north,open=true": { | ||
"model": "variantbarrels:block/ru_alpha_barrel_open", | ||
"x": 90 | ||
}, | ||
"facing=south,open=false": { | ||
"model": "variantbarrels:block/ru_alpha_barrel", | ||
"x": 90, | ||
"y": 180 | ||
}, | ||
"facing=south,open=true": { | ||
"model": "variantbarrels:block/ru_alpha_barrel_open", | ||
"x": 90, | ||
"y": 180 | ||
}, | ||
"facing=up,open=false": { | ||
"model": "variantbarrels:block/ru_alpha_barrel" | ||
}, | ||
"facing=up,open=true": { | ||
"model": "variantbarrels:block/ru_alpha_barrel_open" | ||
}, | ||
"facing=west,open=false": { | ||
"model": "variantbarrels:block/ru_alpha_barrel", | ||
"x": 90, | ||
"y": 270 | ||
}, | ||
"facing=west,open=true": { | ||
"model": "variantbarrels:block/ru_alpha_barrel_open", | ||
"x": 90, | ||
"y": 270 | ||
} | ||
} | ||
} |
Oops, something went wrong.