Skip to content

Commit

Permalink
angry bozu
Browse files Browse the repository at this point in the history
  • Loading branch information
Partonetrain committed Jul 21, 2024
1 parent eb1ebc5 commit a444cde
Show file tree
Hide file tree
Showing 21 changed files with 441 additions and 25 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This mod does the following:
- Adds additional post-Gaia weapon, the Gaia Greatsword, which can use all of your Patreon colors
- Buffs player-spawned pixies by making them always have the +2 damage bonus that would normally only be applied when the player is holding the Elementium Sword
- Adds Gaia Gifts: "secret" weapon(s) obtained by defeating Gaia II under specific conditions
- 2.2.0 Adds "Angry Angry Bozu", an "evil upgrade" to Botania's Teru Teru Bozu that can summon thunderstorms. Useful for Channeling Tridents and Thundercaller.

If [Better Combat](https://www.curseforge.com/minecraft/mc-mods/better-combat-by-daedelus) is installed, it also does the following:

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ org.gradle.parallel=true
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.15.6
loader_version=0.15.7

# Mod Properties
mod_version=1.20.1-2.1.3
mod_version=1.20.1-2.2.0
maven_group=info.partonetrain
archives_base_name=botaniacombat

Expand All @@ -18,7 +18,7 @@ archives_base_name=botaniacombat
fabric_version=0.92.0+1.20.1

#botania
botania_version=1.20.1-443
botania_version=1.20.1-445
#clothconfig
clothconfig_version=11.0.99
#bettercombat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import info.partonetrain.botaniacombat.item.GaiaGreatswordItem;
import info.partonetrain.botaniacombat.item.TerrasteelWeaponItem;
import info.partonetrain.botaniacombat.registry.BotaniaCombatShieldItems;
import info.partonetrain.botaniacombat.render.entity.BotaniaCombatEntityRenderers;
import net.bettercombat.api.AttackHand;
import net.bettercombat.api.client.BetterCombatClientEvents;
import net.fabricmc.api.ClientModInitializer;
Expand All @@ -16,11 +17,13 @@
import net.minecraft.client.model.ShieldModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.client.resources.model.Material;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionResult;
import vazkii.botania.client.render.entity.EntityRenderers;
import vazkii.botania.common.item.equipment.tool.StarcallerItem;
import vazkii.botania.common.item.equipment.tool.terrasteel.TerraBladeItem;

Expand Down Expand Up @@ -56,6 +59,8 @@ public void onInitializeClient() {
renderBanner(stack, matrices, vertexConsumers, light, overlay, modelElementiumShield, ELEMENTIUM_BANNER_SHIELD_BASE, ELEMENTIUM_BANNER_SHIELD_BASE_NO_PATTERN);
});
}

BotaniaCombatEntityRenderers.registerBlockEntityRenderers(BlockEntityRenderers::register);
}

public void checkSwing(LocalPlayer clientPlayerEntity, AttackHand attackHand) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package info.partonetrain.botaniacombat.render.block_entity;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import info.partonetrain.botaniacombat.BotaniaCombat;
import info.partonetrain.botaniacombat.block.block_entity.AngryBozuBlockEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.model.BotaniaModelLayers;
import vazkii.botania.client.model.TeruTeruBozuModel;
import vazkii.botania.client.render.block_entity.TeruTeruBozuBlockEntityRenderer;
import vazkii.botania.common.helper.VecHelper;

import java.util.Random;

import static vazkii.botania.client.core.handler.ClientTickHandler.partialTicks;

public class AngryBozuBlockEntityRenderer implements BlockEntityRenderer<AngryBozuBlockEntity> {

private static final ResourceLocation texture = new ResourceLocation(BotaniaCombat.MOD_ID, "textures/model/angry_bozu.png");
private final TeruTeruBozuModel model;

public AngryBozuBlockEntityRenderer(BlockEntityRendererProvider.Context ctx){
model = new TeruTeruBozuModel(ctx.bakeLayer(BotaniaModelLayers.TERU_TERU_BOZU));
}

@Override
public void render(AngryBozuBlockEntity blockEntity, float partialTick, PoseStack poseStack, MultiBufferSource buffer, int packedLight, int packedOverlay) {
poseStack.pushPose();
poseStack.mulPose(VecHelper.rotateX(180));
double time = ClientTickHandler.ticksInGame + partialTicks;
boolean hasWorld = blockEntity != null && blockEntity.getLevel() != null;
poseStack.translate(0.5F, -1.5F, -0.5F);
if (hasWorld) {
poseStack.mulPose(VecHelper.rotateY((float) (time * 0.3)));
float rotZ = 4F * (float) Math.sin(time * 0.05F);
//"rage"
if(time % 10 == 0 || time % 10 == 2 || time % 10 == 4){
rotZ -= 1;
}else if(time % 10 == 1 || time % 10 == 3 || time % 10 == 5){
rotZ += 1;
}
poseStack.mulPose(VecHelper.rotateZ(rotZ));
}

VertexConsumer vertexConsumer = buffer.getBuffer(model.renderType(texture));
model.renderToBuffer(poseStack, vertexConsumer, packedLight, packedOverlay, 1, 1, 1, 1);
poseStack.popPose();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package info.partonetrain.botaniacombat.render.entity;

import info.partonetrain.botaniacombat.registry.BotaniaCombatBlockEntities;
import info.partonetrain.botaniacombat.render.block_entity.AngryBozuBlockEntityRenderer;
import vazkii.botania.client.render.entity.EntityRenderers;

public class BotaniaCombatEntityRenderers {
public static void registerBlockEntityRenderers(EntityRenderers.BERConsumer consumer) {
consumer.register(BotaniaCombatBlockEntities.ANGRY_BOZU, AngryBozuBlockEntityRenderer::new);
}

}
10 changes: 5 additions & 5 deletions src/main/java/info/partonetrain/botaniacombat/BotaniaCombat.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import info.partonetrain.botaniacombat.item.GaiaGreatswordItem;
import info.partonetrain.botaniacombat.item.TerrasteelWeaponItem;
import info.partonetrain.botaniacombat.item.shield.ElementiumBannerShieldItem;
import info.partonetrain.botaniacombat.registry.BotaniaCombatItems;
import info.partonetrain.botaniacombat.registry.BotaniaCombatRangedItems;
import info.partonetrain.botaniacombat.registry.BotaniaCombatShieldItems;
import info.partonetrain.botaniacombat.registry.*;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer;
import net.fabricmc.api.ModInitializer;
Expand Down Expand Up @@ -38,12 +36,14 @@ public void onInitialize() {
BotaniaCombatShieldItems.init();
ShieldBlockCallback.EVENT.register(ElementiumBannerShieldItem::BlockAttack); //register summon pixie event to FSL event
}

if (RANGED_WEAPON_API_INSTALLED) {
BotaniaCombatRangedItems.init();
}

LOGGER.info("BotaniaCombat initialized");
BotaniaCombatBlocks.init();
BotaniaCombatBlockEntities.init();

PsiContributorColors.get();
LOGGER.info("BotaniaCombat initialized");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package info.partonetrain.botaniacombat.block;

import info.partonetrain.botaniacombat.block.block_entity.AngryBozuBlockEntity;
import info.partonetrain.botaniacombat.registry.BotaniaCombatBlockEntities;
import net.minecraft.commands.Commands;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import vazkii.botania.common.block.TeruTeruBozuBlock;
import vazkii.botania.common.helper.EntityHelper;

public class AngryBozuBlock extends TeruTeruBozuBlock implements EntityBlock {
public AngryBozuBlock(Properties builder) {
super(builder);
}

@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity e) {
if (!world.isClientSide && e instanceof ItemEntity item) {
ItemStack stack = item.getItem();
if (isWitherRose(stack) && startThunder(world)) {
EntityHelper.shrinkItem(item);
return;
}
}
super.entityInside(state, world, pos, e);
}

@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
ItemStack stack = player.getItemInHand(hand);
if (!stack.isEmpty() && (isWitherRose(stack) && startThunder(world))) {
if (!player.getAbilities().instabuild) {
stack.shrink(1);
}
return InteractionResult.sidedSuccess(world.isClientSide());
}
return super.use(state, world, pos, player, hand, hit);
}

private boolean isWitherRose(ItemStack stack) {
return stack.is(Blocks.WITHER_ROSE.asItem());
}

@NotNull
@Override
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
return new AngryBozuBlockEntity(pos, state);
}

@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) {
if (!level.isClientSide) {
return createTickerHelper(type, BotaniaCombatBlockEntities.ANGRY_BOZU, AngryBozuBlockEntity::serverTick);
}
return null;
}

private boolean startThunder(Level world) {
if (!world.isThundering()) {
if(!world.isRaining()){
world.getLevelData().setRaining(true);
}
AngryBozuBlockEntity.resetThunderTime(world); //this is what actually makes it thunder
return true;
}
return false;
}

@Override
public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
return world.isThundering() ? 15 : 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package info.partonetrain.botaniacombat.block.block_entity;

import info.partonetrain.botaniacombat.registry.BotaniaCombatBlockEntities;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.LevelData;
import net.minecraft.world.level.storage.ServerLevelData;
import vazkii.botania.common.block.block_entity.BotaniaBlockEntity;

public class AngryBozuBlockEntity extends BotaniaBlockEntity {
private boolean wasThundering = false;
public AngryBozuBlockEntity(BlockPos pos, BlockState state) {
super(BotaniaCombatBlockEntities.ANGRY_BOZU, pos, state);
}

public static void serverTick(Level level, BlockPos worldPosition, BlockState state, AngryBozuBlockEntity self) {
boolean isThundering = level.isThundering();

if (self.wasThundering != isThundering) {
level.updateNeighbourForOutputSignal(worldPosition, state.getBlock());
}
self.wasThundering = isThundering;
}

public static void resetThunderTime(Level w) { //sets how long the thunder will last
int time = w.random.nextInt(w.getLevelData().isRaining() ? 12000 : 168000) + 12000;
if(w instanceof ServerLevel sl){
sl.setWeatherParameters(0, time, true, true);
//setWeatherParameters sets LevelData
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package info.partonetrain.botaniacombat.registry;

import info.partonetrain.botaniacombat.BotaniaCombat;
import info.partonetrain.botaniacombat.block.block_entity.AngryBozuBlockEntity;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

import java.util.function.BiFunction;

public class BotaniaCombatBlockEntities {

public static final BlockEntityType<AngryBozuBlockEntity> ANGRY_BOZU = registerBlockEntity("angry_bozu.json", AngryBozuBlockEntity::new);

public static void init() {}

public static <T extends BlockEntity> BlockEntityType<T> registerBlockEntity(String name, BiFunction<BlockPos, BlockState, T> func) {
return Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, new ResourceLocation(BotaniaCombat.MOD_ID, name), FabricBlockEntityTypeBuilder.create(func::apply, BotaniaCombatBlocks.angryBozu).build());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package info.partonetrain.botaniacombat.registry;

import info.partonetrain.botaniacombat.BotaniaCombat;
import info.partonetrain.botaniacombat.block.AngryBozuBlock;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import vazkii.botania.api.BotaniaRegistries;
import vazkii.botania.common.item.block.BlockItemWithSpecialRenderer;

public class BotaniaCombatBlocks {

public static final Block angryBozu = registerBlock ("angry_bozu", new AngryBozuBlock(BlockBehaviour.Properties.of().sound(SoundType.WOOL).instrument(NoteBlockInstrument.GUITAR).mapColor(DyeColor.RED)));

public static void init() {}

public static <T extends Block> T registerBlock(String name, T block) {
ResourceLocation id = new ResourceLocation(BotaniaCombat.MOD_ID, name);
Registry.register(BuiltInRegistries.BLOCK, id, block);
BlockItem blockItem = new BlockItemWithSpecialRenderer(block, new Item.Properties());
Registry.register(BuiltInRegistries.ITEM, id, blockItem);

ItemGroupEvents.modifyEntriesEvent(BotaniaRegistries.BOTANIA_TAB_KEY).register(entries -> entries.accept(block.asItem()));

return block;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ public final class BotaniaCombatItems {
public static final Item.Properties ITEM_PROPERTIES_EPIC = BotaniaCombatItemProperties.defaultItemBuilderWithCustomDamageOnFabric().fireResistant().rarity(Rarity.EPIC);

//manasteel dagger = botania soulscribe
public static final SingleHandedElementiumWeaponItem ELEMENTIUM_DAGGER = register("elementium_dagger", new SingleHandedElementiumWeaponItem(BotaniaCombatTiers.ELEMENTIUM_TIER, config.daggerDamageModifier, config.daggerSpeed, ITEM_PROPERTIES_ELEMENTIUM));
public static final TerrasteelWeaponItem TERRASTEEL_DAGGER = register("terrasteel_dagger", new TerrasteelWeaponItem(BotaniaCombatTiers.TERRASTEEL_TIER, config.daggerDamageModifier, config.daggerSpeed, ITEM_PROPERTIES_TERRASTEEL));
public static final SlaughtersawItem SLAUGHTERSAW = register("slaughtersaw", new SlaughtersawItem(config.slaughtersawDamageModifier, config.slaughtersawSpeed, BotaniaCombatTiers.MANASTEEL_TIER, ITEM_PROPERTIES_MANASTEEL));
public static final SoulstaffItem SOULSTAFF = register("soulstaff", new SoulstaffItem(BotaniaCombatTiers.MANASTEEL_TIER, config.soulstaffDamageModifier, config.soulstaffSpeed, ITEM_PROPERTIES_MANASTEEL));
public static final TwoHandedElementiumWeaponItem ELEMENTIUM_SPEAR = register("elementium_spear", new TwoHandedElementiumWeaponItem(BotaniaCombatTiers.ELEMENTIUM_TIER, config.spearDamageModifier, config.spearSpeed, ITEM_PROPERTIES_ELEMENTIUM));
public static final TerrasteelWeaponItem TERRASTEEL_SPEAR = register("terrasteel_spear", new TerrasteelWeaponItem(BotaniaCombatTiers.TERRASTEEL_TIER, config.spearDamageModifier, config.spearSpeed, ITEM_PROPERTIES_TERRASTEEL));
public static final GaiaGreatswordItem GAIA_GREATSWORD = register("gaia_greatsword", new GaiaGreatswordItem(BotaniaCombatTiers.TERRASTEEL_TIER, config.greatswordDamageModifier, config.greatswordSpeed, ITEM_PROPERTIES_TERRASTEEL));
public static final MjolnirItem MJOLNIR = register("mjolnir", new MjolnirItem(BotaniaCombatTiers.TERRASTEEL_TIER, config.mjolinirDamageModifier, config.mjolnirSpeed, ITEM_PROPERTIES_EPIC));
public static final SingleHandedElementiumWeaponItem ELEMENTIUM_DAGGER = registerItem("elementium_dagger", new SingleHandedElementiumWeaponItem(BotaniaCombatTiers.ELEMENTIUM_TIER, config.daggerDamageModifier, config.daggerSpeed, ITEM_PROPERTIES_ELEMENTIUM));
public static final TerrasteelWeaponItem TERRASTEEL_DAGGER = registerItem("terrasteel_dagger", new TerrasteelWeaponItem(BotaniaCombatTiers.TERRASTEEL_TIER, config.daggerDamageModifier, config.daggerSpeed, ITEM_PROPERTIES_TERRASTEEL));
public static final SlaughtersawItem SLAUGHTERSAW = registerItem("slaughtersaw", new SlaughtersawItem(config.slaughtersawDamageModifier, config.slaughtersawSpeed, BotaniaCombatTiers.MANASTEEL_TIER, ITEM_PROPERTIES_MANASTEEL));
public static final SoulstaffItem SOULSTAFF = registerItem("soulstaff", new SoulstaffItem(BotaniaCombatTiers.MANASTEEL_TIER, config.soulstaffDamageModifier, config.soulstaffSpeed, ITEM_PROPERTIES_MANASTEEL));
public static final TwoHandedElementiumWeaponItem ELEMENTIUM_SPEAR = registerItem("elementium_spear", new TwoHandedElementiumWeaponItem(BotaniaCombatTiers.ELEMENTIUM_TIER, config.spearDamageModifier, config.spearSpeed, ITEM_PROPERTIES_ELEMENTIUM));
public static final TerrasteelWeaponItem TERRASTEEL_SPEAR = registerItem("terrasteel_spear", new TerrasteelWeaponItem(BotaniaCombatTiers.TERRASTEEL_TIER, config.spearDamageModifier, config.spearSpeed, ITEM_PROPERTIES_TERRASTEEL));
public static final GaiaGreatswordItem GAIA_GREATSWORD = registerItem("gaia_greatsword", new GaiaGreatswordItem(BotaniaCombatTiers.TERRASTEEL_TIER, config.greatswordDamageModifier, config.greatswordSpeed, ITEM_PROPERTIES_TERRASTEEL));
public static final MjolnirItem MJOLNIR = registerItem("mjolnir", new MjolnirItem(BotaniaCombatTiers.TERRASTEEL_TIER, config.mjolinirDamageModifier, config.mjolnirSpeed, ITEM_PROPERTIES_EPIC));

public static void init() {}

public static <T extends Item> T register(String name, T item) {
public static <T extends Item> T registerItem(String name, T item) {
Registry.register(BuiltInRegistries.ITEM, new ResourceLocation(BotaniaCombat.MOD_ID, name), item);
ItemGroupEvents.modifyEntriesEvent(BotaniaRegistries.BOTANIA_TAB_KEY).register(entries -> entries.accept(item));

Expand Down
Loading

0 comments on commit a444cde

Please sign in to comment.