Skip to content

Commit

Permalink
Ball Distributor Fixes & Add Bat
Browse files Browse the repository at this point in the history
  • Loading branch information
FirstMegaGame4 committed Jun 14, 2024
1 parent 733be6f commit 2df2583
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 76 deletions.
74 changes: 37 additions & 37 deletions src/main/generated/.cache/97a4721ed155c6fdfa3ad558e447c8340a205f56

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21 Release Candidate 1 2024-06-12T21:51:03.825944 Extravaganza!/Language (en_us)
c97108fb2b9a6fa37c3e763e13a968c19e27e664 assets\extravaganza\lang\en_us.json
// 1.21 2024-06-14T21:36:35.6278477 Extravaganza!/Language (en_us)
8b3ce59154608fdd4efd4b6035db5217ad5728c8 assets\extravaganza\lang\en_us.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"variants": {
"facing=east,half=lower": {
"model": "extravaganza:block/ball_distributor_down"
"model": "extravaganza:block/ball_distributor_down",
"y": 90
},
"facing=east,half=upper": {
"model": "extravaganza:block/ball_distributor_up"
"model": "extravaganza:block/ball_distributor_up",
"y": 90
},
"facing=north,half=lower": {
"model": "extravaganza:block/ball_distributor_down",
"y": 270
"model": "extravaganza:block/ball_distributor_down"
},
"facing=north,half=upper": {
"model": "extravaganza:block/ball_distributor_up",
"y": 270
"model": "extravaganza:block/ball_distributor_up"
},
"facing=south,half=lower": {
"model": "extravaganza:block/ball_distributor_down",
"y": 90
"y": 180
},
"facing=south,half=upper": {
"model": "extravaganza:block/ball_distributor_up",
"y": 90
"y": 180
},
"facing=west,half=lower": {
"model": "extravaganza:block/ball_distributor_down",
"y": 180
"y": 270
},
"facing=west,half=upper": {
"model": "extravaganza:block/ball_distributor_up",
"y": 180
"y": 270
}
}
}
1 change: 1 addition & 0 deletions src/main/generated/assets/extravaganza/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,7 @@
"block.extravaganza.yellow_wooded_festive_rubber_slab": "Yellow Wooded Festive Rubber Slab",
"block.extravaganza.yellow_wooded_festive_rubber_stairs": "Yellow Wooded Festive Rubber Stairs",
"block.extravaganza.yellow_wooded_festive_rubber_wall": "Yellow Wooded Festive Rubber Wall",
"item.extravaganza.bat": "Bat",
"item.extravaganza.black_festive_ball": "Black Festive Ball",
"item.extravaganza.blue_festive_ball": "Blue Festive Ball",
"item.extravaganza.brown_festive_ball": "Brown Festive Ball",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

import com.mmodding.extravaganza.block.BallDistributorBlock;
import com.mmodding.extravaganza.init.ExtravaganzaBlocks;
import com.mmodding.extravaganza.init.ExtravaganzaItems;
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.minecraft.block.*;
import net.minecraft.block.enums.DoorHinge;
import net.minecraft.block.enums.DoubleBlockHalf;
import net.minecraft.data.client.*;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;

Expand Down Expand Up @@ -61,22 +61,25 @@ private <T> String makeItReadable(RegistryKey<T> key) {

public static class ExtravaganzaModelProvider extends FabricModelProvider {

private static final Predicate<Block> UNCOMMON = block ->
private static final Predicate<Block> UNCOMMON_BLOCKS = block ->
block instanceof TransparentBlock ||
block instanceof LadderBlock ||
block.equals(ExtravaganzaBlocks.BALL_POOL_CORE) ||
block.equals(ExtravaganzaBlocks.BALL_POOL_CONTENT) ||
block.equals(ExtravaganzaBlocks.BALL_DISTRIBUTOR) ||
block.equals(ExtravaganzaBlocks.PINATA);

private static final Predicate<Item> UNCOMMON_ITEMS = item ->
item.equals(ExtravaganzaItems.BAT);

private ExtravaganzaModelProvider(FabricDataOutput output) {
super(output);
}

@Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
Extravaganza.executeForRegistry(Registries.BLOCK, block -> {
if (!ExtravaganzaModelProvider.UNCOMMON.test(block)) {
if (!ExtravaganzaModelProvider.UNCOMMON_BLOCKS.test(block)) {
if (!(block instanceof StairsBlock) && !(block instanceof SlabBlock) && !(block instanceof WallBlock)) {
BlockStateModelGenerator.BlockTexturePool pool = blockStateModelGenerator.registerCubeAllModelTexturePool(block);
Identifier identifier = Registries.BLOCK.getId(block);
Expand All @@ -101,58 +104,58 @@ else if (block.equals(ExtravaganzaBlocks.BALL_DISTRIBUTOR)) {
.coordinate(
BlockStateVariantMap.create(BallDistributorBlock.FACING, BallDistributorBlock.HALF)
.register(
Direction.SOUTH,
Direction.NORTH,
DoubleBlockHalf.UPPER,
BlockStateVariant.create()
.put(VariantSettings.MODEL, up)
.put(VariantSettings.Y, VariantSettings.Rotation.R90)
)
.register(
Direction.WEST,
Direction.EAST,
DoubleBlockHalf.UPPER,
BlockStateVariant.create()
.put(VariantSettings.MODEL, up)
.put(VariantSettings.Y, VariantSettings.Rotation.R180)
.put(VariantSettings.Y, VariantSettings.Rotation.R90)
)
.register(
Direction.NORTH,
Direction.SOUTH,
DoubleBlockHalf.UPPER,
BlockStateVariant.create()
.put(VariantSettings.MODEL, up)
.put(VariantSettings.Y, VariantSettings.Rotation.R270)
.put(VariantSettings.Y, VariantSettings.Rotation.R180)
)
.register(
Direction.EAST,
Direction.WEST,
DoubleBlockHalf.UPPER,
BlockStateVariant.create()
.put(VariantSettings.MODEL, up)
.put(VariantSettings.Y, VariantSettings.Rotation.R270)
)
.register(
Direction.SOUTH,
Direction.NORTH,
DoubleBlockHalf.LOWER,
BlockStateVariant.create()
.put(VariantSettings.MODEL, down)
.put(VariantSettings.Y, VariantSettings.Rotation.R90)
)
.register(
Direction.WEST,
Direction.EAST,
DoubleBlockHalf.LOWER,
BlockStateVariant.create()
.put(VariantSettings.MODEL, down)
.put(VariantSettings.Y, VariantSettings.Rotation.R180)
.put(VariantSettings.Y, VariantSettings.Rotation.R90)
)
.register(
Direction.NORTH,
Direction.SOUTH,
DoubleBlockHalf.LOWER,
BlockStateVariant.create()
.put(VariantSettings.MODEL, down)
.put(VariantSettings.Y, VariantSettings.Rotation.R270)
.put(VariantSettings.Y, VariantSettings.Rotation.R180)
)
.register(
Direction.EAST,
Direction.WEST,
DoubleBlockHalf.LOWER,
BlockStateVariant.create()
.put(VariantSettings.MODEL, down)
.put(VariantSettings.Y, VariantSettings.Rotation.R270)
)
)
);
Expand All @@ -166,7 +169,7 @@ else if (block.equals(ExtravaganzaBlocks.BALL_POOL_CONTENT) || block.equals(Extr
@Override
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
Extravaganza.executeForRegistry(Registries.ITEM, item -> {
if (!(item instanceof BlockItem)) {
if (!(item instanceof BlockItem) && !ExtravaganzaModelProvider.UNCOMMON_ITEMS.test(item)) {
itemModelGenerator.register(item, Models.GENERATED);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,19 @@ public BlockState getPlacementState(ItemPlacementContext ctx) {
World world = ctx.getWorld();
if (blockPos.getY() < world.getTopY() - 1 && world.getBlockState(blockPos.up()).canReplace(ctx)) {
return this.getDefaultState()
.with(BallDistributorBlock.FACING, ctx.getHorizontalPlayerFacing())
.with(BallDistributorBlock.FACING, ctx.getHorizontalPlayerFacing().getOpposite())
.with(BallDistributorBlock.HALF, DoubleBlockHalf.LOWER);
}
else {
return null;
}
}

@Override
protected BlockRenderType getRenderType(BlockState state) {
return super.getRenderType(state);
}

@Override
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
world.setBlockState(pos.up(), state.with(HALF, DoubleBlockHalf.UPPER), Block.NOTIFY_ALL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class ExtravaganzaItems {
public static final Item HOT_DOG = new Item(new Item.Settings().food(new FoodComponent.Builder().nutrition(4).saturationModifier(1.0f).snack().build()));
public static final Item HOT_DOG_WITH_MAYONNAISE = new Item(new Item.Settings().food(new FoodComponent.Builder().nutrition(4).saturationModifier(1.5f).snack().build()));

public static final Item BAT = new Item(new Item.Settings().maxCount(1));

public static void register() {
Registry.register(Registries.ITEM, Extravaganza.createId("wrench_aganza"), ExtravaganzaItems.WRENCH_AGANZA);
Registry.register(Registries.ITEM, Extravaganza.createId("common_festive_coin"), ExtravaganzaItems.COMMON_FESTIVE_COIN);
Expand All @@ -43,6 +45,7 @@ public static void register() {
Registry.register(Registries.ITEM, Extravaganza.createId("red_candy_cane"), ExtravaganzaItems.RED_CANDY_CANE);
Registry.register(Registries.ITEM, Extravaganza.createId("hot_dog"), ExtravaganzaItems.HOT_DOG);
Registry.register(Registries.ITEM, Extravaganza.createId("hot_dog_with_mayonnaise"), ExtravaganzaItems.HOT_DOG_WITH_MAYONNAISE);
Registry.register(Registries.ITEM, Extravaganza.createId("bat"), ExtravaganzaItems.BAT);

Stream<Item> stream = Extravaganza.extractFromRegistry(Registries.ITEM);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"texture_size": [48, 48],
"textures": {
"main": "extravaganza:block/ball_distributor_up",
"balls": "extravaganza:block/ball_pool_content",
Expand Down Expand Up @@ -323,12 +323,12 @@
"from": [0, 0, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 4, 4], "texture": "#main"},
"east": {"uv": [0, 4, 4, 8], "texture": "#main"},
"south": {"uv": [4, 0, 8, 4], "texture": "#main"},
"west": {"uv": [4, 4, 8, 8], "texture": "#main"},
"up": {"uv": [4, 12, 0, 8], "texture": "#main"},
"down": {"uv": [12, 0, 8, 4], "texture": "#main"}
"north": {"uv": [0, 0, 5.33333, 5.33333], "texture": "#main"},
"east": {"uv": [0, 5.33333, 5.33333, 10.66667], "texture": "#main"},
"south": {"uv": [5.33333, 0, 10.66667, 5.33333], "texture": "#main"},
"west": {"uv": [5.33333, 5.33333, 10.66667, 10.66667], "texture": "#main"},
"up": {"uv": [5.33333, 16, 0, 10.66667], "texture": "#main"},
"down": {"uv": [16, 0, 10.66667, 5.33333], "texture": "#main"}
}
}
]
Expand Down
74 changes: 74 additions & 0 deletions src/main/resources/assets/extravaganza/models/item/bat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"credit": "Made with Blockbench",
"texture_size": [32, 32],
"textures": {
"main": "extravaganza:item/bat",
"particle": "extravaganza:item/bat"
},
"elements": [
{
"from": [6, 0, 6],
"to": [10, 2, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 7]},
"faces": {
"north": {"uv": [7, 8.5, 9, 9.5], "texture": "#main"},
"east": {"uv": [9, 0, 11, 1], "texture": "#main"},
"south": {"uv": [9, 1, 11, 2], "texture": "#main"},
"west": {"uv": [9, 2, 11, 3], "texture": "#main"},
"up": {"uv": [5, 10, 3, 8], "texture": "#main"},
"down": {"uv": [10, 4.5, 8, 6.5], "texture": "#main"}
}
},
{
"from": [7, 2, 7],
"to": [9, 11, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 2, 7]},
"faces": {
"north": {"uv": [0, 8, 1, 12.5], "texture": "#main"},
"east": {"uv": [8, 0, 9, 4.5], "texture": "#main"},
"south": {"uv": [1, 8, 2, 12.5], "texture": "#main"},
"west": {"uv": [2, 8, 3, 12.5], "texture": "#main"},
"up": {"uv": [10, 4, 9, 3], "texture": "#main"},
"down": {"uv": [10, 8.5, 9, 9.5], "texture": "#main"}
}
},
{
"from": [6, 11, 6],
"to": [10, 27, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 11, 7]},
"faces": {
"north": {"uv": [0, 0, 2, 8], "texture": "#main"},
"east": {"uv": [2, 0, 4, 8], "texture": "#main"},
"south": {"uv": [4, 0, 6, 8], "texture": "#main"},
"west": {"uv": [6, 0, 8, 8], "texture": "#main"},
"up": {"uv": [7, 10, 5, 8], "texture": "#main"},
"down": {"uv": [10, 6.5, 8, 8.5], "texture": "#main"}
}
}
],
"display": {
"firstperson_righthand": {
"rotation": [-11.75, -90, 0],
"translation": [1.13, 4.45, -0.37],
"scale": [0.68, 0.68, 0.68]
},
"firstperson_lefthand": {
"rotation": [-11.75, -90, 0],
"translation": [1.13, 4.45, -0.37],
"scale": [0.68, 0.68, 0.68]
},
"ground": {
"translation": [0, 2, 0],
"scale": [0.5, 0.5, 0.5]
},
"gui": {
"rotation": [30, 225, 25],
"translation": [-0.25, -2.75, 0],
"scale": [0.525, 0.525, 0.525]
},
"fixed": {
"translation": [0, -3.5, 0],
"scale": [0.5, 0.5, 0.5]
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2df2583

Please sign in to comment.