-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Flag of Ireland and started base flag code
- Loading branch information
Showing
25 changed files
with
479 additions
and
141 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
2 changes: 2 additions & 0 deletions
2
src/generated/resources/.cache/a431173a1250b236f5ca7b4180a731b3361fdfd5
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,2 @@ | ||
// 1.21 2024-08-18T01:17:53.362797 Languages: en_us for mod: bratacha | ||
d92039e67986396c9d9fbee3ca06a6d89a33d74e assets/bratacha/lang/en_us.json |
2 changes: 2 additions & 0 deletions
2
src/generated/resources/.cache/cccdb8749d846564d1e007ef02ed794e7d573c95
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,2 @@ | ||
// 1.21 2024-08-18T01:14:13.725058 Item Models: bratacha | ||
cf8093f06e45e999b05e55f9ba4ebb156029e5c0 assets/bratacha/models/item/flag.json |
2 changes: 2 additions & 0 deletions
2
src/generated/resources/.cache/dce6ae3019801b317a0a103472312fe1b1fe5520
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,2 @@ | ||
// 1.21 2024-08-18T01:21:47.558581 Languages: ga_ie for mod: bratacha | ||
b2db30ced2ae2bc64e1dbcf041da6c2104d3a439 assets/bratacha/lang/ga_ie.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,3 @@ | ||
{ | ||
"block.bratacha.flag": "Flag of Ireland" | ||
} |
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,3 @@ | ||
{ | ||
"block.bratacha.flag": "Bratach na hÉireann" | ||
} |
6 changes: 6 additions & 0 deletions
6
src/generated/resources/assets/bratacha/models/item/flag.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,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "bratacha:item/flag" | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/main/java/irish/eimi/bratacha/client/BratachaModClient.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,15 @@ | ||
package irish.eimi.bratacha.client; | ||
|
||
import irish.eimi.bratacha.BratachaMod; | ||
import irish.eimi.bratacha.client.init.RegistrationClient; | ||
import net.neoforged.api.distmarker.Dist; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.fml.common.Mod; | ||
|
||
@Mod(value = BratachaMod.MODID, dist = Dist.CLIENT) | ||
public class BratachaModClient { | ||
|
||
public BratachaModClient(IEventBus modBus) { | ||
modBus.addListener(RegistrationClient::registerRenders); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/irish/eimi/bratacha/client/init/RegistrationClient.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,14 @@ | ||
package irish.eimi.bratacha.client.init; | ||
|
||
import irish.eimi.bratacha.client.renderer.block.FlagBlockEntityRenderer; | ||
import irish.eimi.bratacha.common.entities.blocks.FlagBlockEntity; | ||
import irish.eimi.bratacha.common.init.Registration; | ||
import net.neoforged.neoforge.client.event.EntityRenderersEvent; | ||
|
||
public class RegistrationClient { | ||
|
||
public static void registerRenders(final EntityRenderersEvent.RegisterRenderers event) { | ||
event.registerBlockEntityRenderer(Registration.FLAG_BLOCK_ENTITY.get(), | ||
FlagBlockEntityRenderer::new); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/irish/eimi/bratacha/client/models/FlagModel.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,23 @@ | ||
package irish.eimi.bratacha.client.models; | ||
|
||
import irish.eimi.bratacha.BratachaMod; | ||
import irish.eimi.bratacha.common.entities.blocks.FlagBlockEntity; | ||
import net.minecraft.resources.ResourceLocation; | ||
import software.bernie.geckolib.model.GeoModel; | ||
|
||
public class FlagModel extends GeoModel<FlagBlockEntity> { | ||
@Override | ||
public ResourceLocation getModelResource(FlagBlockEntity animatable) { | ||
return ResourceLocation.fromNamespaceAndPath(BratachaMod.MODID,"geo/block/flag.geo.json"); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getTextureResource(FlagBlockEntity animatable) { | ||
return ResourceLocation.fromNamespaceAndPath(BratachaMod.MODID,"textures/block/flag.png"); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getAnimationResource(FlagBlockEntity animatable) { | ||
return ResourceLocation.fromNamespaceAndPath(BratachaMod.MODID,"animations/block/flag.animation.json"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/irish/eimi/bratacha/client/renderer/block/FlagBlockEntityRenderer.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,14 @@ | ||
package irish.eimi.bratacha.client.renderer.block; | ||
|
||
import irish.eimi.bratacha.client.models.FlagModel; | ||
import irish.eimi.bratacha.common.entities.blocks.FlagBlockEntity; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; | ||
import net.minecraft.client.renderer.entity.EntityRendererProvider; | ||
import software.bernie.geckolib.model.GeoModel; | ||
import software.bernie.geckolib.renderer.GeoBlockRenderer; | ||
|
||
public class FlagBlockEntityRenderer extends GeoBlockRenderer<FlagBlockEntity> { | ||
public FlagBlockEntityRenderer(BlockEntityRendererProvider.Context context) { | ||
super(new FlagModel()); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/main/java/irish/eimi/bratacha/common/blocks/FlagBlock.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,71 @@ | ||
package irish.eimi.bratacha.common.blocks; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import irish.eimi.bratacha.common.entities.blocks.FlagBlockEntity; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.world.item.context.BlockPlaceContext; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.*; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import net.minecraft.world.level.block.state.BlockBehaviour; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.block.state.StateDefinition; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class FlagBlock extends DirectionalBlock implements EntityBlock { | ||
public static final MapCodec<FlagBlock> CODEC = simpleCodec(FlagBlock::new); | ||
public FlagBlock(BlockBehaviour.Properties properties) { | ||
super(properties); | ||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.SOUTH)); | ||
} | ||
|
||
@Override | ||
public @Nullable BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) { | ||
return new FlagBlockEntity(blockPos,blockState); | ||
} | ||
|
||
@Override | ||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) { | ||
builder.add(FACING); | ||
} | ||
|
||
/** | ||
* Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed blockstate. | ||
*/ | ||
@Override | ||
protected BlockState rotate(BlockState state, Rotation rot) { | ||
return state.setValue(FACING, rot.rotate(state.getValue(FACING))); | ||
} | ||
|
||
/** | ||
* Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed blockstate. | ||
*/ | ||
@Override | ||
protected BlockState mirror(BlockState state, Mirror mirror) { | ||
return state.rotate(mirror.getRotation(state.getValue(FACING))); | ||
} | ||
@Override | ||
protected RenderShape getRenderShape(BlockState state) { | ||
return RenderShape.ENTITYBLOCK_ANIMATED; | ||
} | ||
|
||
|
||
@Override | ||
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { | ||
return super.getShape(state, level, pos, context); | ||
} | ||
|
||
@Override | ||
protected MapCodec<? extends FlagBlock> codec() { | ||
return CODEC; | ||
} | ||
|
||
@Override | ||
public BlockState getStateForPlacement(BlockPlaceContext context) { | ||
return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite().getOpposite()); | ||
} | ||
} |
Oops, something went wrong.