Skip to content

Commit

Permalink
Merge pull request #1 from StellarWitch7/main
Browse files Browse the repository at this point in the history
A very messy, early implementation of a bangboo registry
  • Loading branch information
vanillyn authored Aug 29, 2024
2 parents a3a1e76 + d61476c commit dbe7321
Show file tree
Hide file tree
Showing 81 changed files with 622 additions and 902 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.21+build.9
loader_version=0.15.11

# Mod Properties
mod_version=0.0.5
mod_version=0.0.6
maven_group=world.vanillyn
archives_base_name=bangboo

Expand Down
111 changes: 33 additions & 78 deletions src/client/java/world/vanillyn/BangbooClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,100 +7,55 @@
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.event.player.UseEntityCallback;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.ActionResult;
import org.lwjgl.glfw.GLFW;
import world.vanillyn.entity.Bangboo.*;
import world.vanillyn.render.Model.Bangboo.BangbooModel;
import world.vanillyn.render.Renderer.BangbooRenderer;
import world.vanillyn.render.Screen.Entity.Handler;

import static world.vanillyn.entity.BangbooEntities.*;
import world.vanillyn.entity.bangboo.*;
import world.vanillyn.render.model.BangbooModel;
import world.vanillyn.render.render.BangbooRenderer;
import world.vanillyn.render.screen.entity.Handler;


@Environment(EnvType.CLIENT)
public class BangbooClient implements ClientModInitializer {
public static final EntityModelLayer MODEL_BANGBOO_LAYER = new EntityModelLayer(BangbooMod.id("blankboo"), "main");

private static KeyBinding OpenMenu;

@Override
@Override
public void onInitializeClient() {


EntityModelLayerRegistry.registerModelLayer(MODEL_BANGBOO_LAYER, BangbooModel::getTexturedModelData);

FabricDefaultAttributeRegistry.register(BANGBOO_BLANKBOO, Bangboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_BLANKBOO, BangbooRenderer::new);


FabricDefaultAttributeRegistry.register(BANGBOO_EOUS, Eous.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_EOUS, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_BAGBOO, Bagboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_BAGBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_SHARKBOO, Sharkboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_SHARKBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_EXPLOREBOO, Exploreboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_EXPLOREBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_AMILLION, Amillion.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_AMILLION, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_MAGNETIBOO, Magnetiboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_MAGNETIBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_LUCKYBOO, Luckyboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_LUCKYBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_BUTLER, Butler.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_BUTLER, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_SAFETY, Safety.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_SAFETY, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_OFFICER_CUI, OfficerCui.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_OFFICER_CUI, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_AVOCABOO, Avocaboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_AVOCABOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_CRYBOO, Cryboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_CRYBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_BOOLSEYE, Boolseye.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_BOOLSEYE, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_DEVILBOO, Devilboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_DEVILBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_ELECTROBOO, Electroboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_ELECTROBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_PAPERBOO, Paperboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_PAPERBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_PENGUINBOO, Penguinboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_PENGUINBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_PLUGBOO, Plugboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_PLUGBOO, BangbooRenderer::new);

FabricDefaultAttributeRegistry.register(BANGBOO_SUMOBOO, Sumoboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_SUMOBOO, BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BANGBOO_BADDIEBOO, Baddieboo.createMobAttributes());
EntityRendererRegistry.register(BANGBOO_BADDIEBOO, BangbooRenderer::new);
OpenMenu = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.Bangboo.openscreen",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_O,
"debugging.Bangboo"
));
EntityRendererRegistry.register(BangbooType.EOUS.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.BAGBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.SHARKBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.EXPLOREBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.AMILLION.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.MAGNETIBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.LUCKYBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.BUTLER.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.SAFETY.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.OFFICER_CUI.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.AVOCABOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.CRYBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.BOOLLSEYE.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.DEVILBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.ELECTROBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.PAPERBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.PENGUINBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.PLUGBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.SUMOBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.BADDIEBOO.entityType(), BangbooRenderer::new);
EntityRendererRegistry.register(BangbooType.BLANKBOO.entityType(), BangbooRenderer::new);

KeyBinding openMenu = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.Bangboo.openscreen",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_O,
"debugging.Bangboo"
));

UseEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> {
if (world.isClient) {
Expand Down

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions src/client/java/world/vanillyn/render/Screen/Entity/Handler.java

This file was deleted.

35 changes: 0 additions & 35 deletions src/client/java/world/vanillyn/render/Screen/TestScreen.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package world.vanillyn.render.Model.Bangboo;
package world.vanillyn.render.model;

import net.minecraft.client.model.*;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.math.MatrixStack;
import world.vanillyn.entity.Bangboo.Bangboo;
import world.vanillyn.entity.bangboo.Bangboo;



Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package world.vanillyn.render.Renderer;
package world.vanillyn.render.render;

import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.entity.MobEntityRenderer;
import net.minecraft.util.Identifier;
import world.vanillyn.BangbooClient;
import world.vanillyn.entity.Bangboo.Bangboo;
import world.vanillyn.render.Model.Bangboo.BangbooModel;
import world.vanillyn.entity.bangboo.Bangboo;
import world.vanillyn.render.model.BangbooModel;

public class BangbooRenderer extends MobEntityRenderer<Bangboo, BangbooModel> {

Expand All @@ -15,6 +15,6 @@ public BangbooRenderer(EntityRendererFactory.Context context) {

@Override
public Identifier getTexture(Bangboo entity) {
return entity.getBangbooTexture();
return entity.type().texture();
}
}
40 changes: 40 additions & 0 deletions src/client/java/world/vanillyn/render/screen/TestScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package world.vanillyn.render.screen;

import io.wispforest.owo.ui.base.BaseUIModelScreen;
import io.wispforest.owo.ui.component.ButtonComponent;
import io.wispforest.owo.ui.component.LabelComponent;
import io.wispforest.owo.ui.container.FlowLayout;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.text.Text;
import world.vanillyn.BangbooMod;
import world.vanillyn.entity.bangboo.Bangboo;
import world.vanillyn.net.BangbooChannel;


public class TestScreen extends BaseUIModelScreen<FlowLayout> {

Bangboo bangboo;
String bangbooName;
Item core;
PlayerEntity player;

public TestScreen(Bangboo bangboo, PlayerEntity player) {

super(FlowLayout.class, DataSource.asset(BangbooMod.id("meow")));
this.bangboo = bangboo;
this.bangbooName = bangboo.getType().getName().getString();
this.core = bangboo.type().coreItem();
this.player = player;
}

//this is another example on how to read buttons and write stuff into the text! the id's come from the xml
@Override
protected void build(FlowLayout rootComponent) {
rootComponent.childById(ButtonComponent.class, "pickup").onPress(button -> {
BangbooChannel.SCREEN_CHANNEL.clientHandle().send(new BangbooChannel.DropBangboo(bangboo.getUuid()));
close();
});
rootComponent.childById(LabelComponent.class, "hp").text(Text.of(String.valueOf(bangboo.getMaxHealth())));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package world.vanillyn.render.screen.bangboo;

public class FixBangboo {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package world.vanillyn.render.Screen.Bangboo;
package world.vanillyn.render.screen.bangboo;

import io.wispforest.owo.ui.base.BaseUIModelScreen;
import io.wispforest.owo.ui.component.ButtonComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package world.vanillyn.render.screen.bangboo;

public class WishBangboo {
}
20 changes: 20 additions & 0 deletions src/client/java/world/vanillyn/render/screen/entity/Handler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package world.vanillyn.render.screen.entity;

import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import world.vanillyn.BangbooMod;
import world.vanillyn.entity.bangboo.Bangboo;
import world.vanillyn.render.screen.TestScreen;

public class Handler {
// previously, if the entity wasn't Bangboo, it'd throw a cast exception in the usage of this method
// fixed so that you don't run into that -- Aurora
public static void handleEntityInteraction(PlayerEntity player, Entity entity) {
if (player.isSneaking() && entity instanceof Bangboo bangboo) {
//lazy example of me sending data over. not pretty but it works!

MinecraftClient.getInstance().setScreen(new TestScreen(bangboo, player));
}
}
}
13 changes: 7 additions & 6 deletions src/main/java/world/vanillyn/BangbooMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import world.vanillyn.block.BangbooBlocks;
import world.vanillyn.data.items.RatingComponent;
import world.vanillyn.entity.bangboo.Bangboo;
import world.vanillyn.item.data.RatingComponent;
import world.vanillyn.entity.BangbooEntities;
import world.vanillyn.items.BangbooItems;
import world.vanillyn.net.NetChannel;
import world.vanillyn.item.BangbooItems;
import world.vanillyn.net.BangbooChannel;

import static world.vanillyn.net.NetChannel.SCREEN_CHANNEL;
import static world.vanillyn.net.BangbooChannel.SCREEN_CHANNEL;

public class BangbooMod implements ModInitializer {
public static final String MOD_ID = "bangboo";
Expand All @@ -25,8 +26,8 @@ public void onInitialize() {
BangbooEntities.init();
BangbooBlocks.init();
RatingComponent.init();
SCREEN_CHANNEL.registerClientbound(NetChannel.ScreenPacket.class, (message, access) -> {

SCREEN_CHANNEL.registerServerbound(BangbooChannel.DropBangboo.class, (message, access) -> {
Bangboo.dropBangbooAsItem(access.player().getServerWorld(), message.id());
});
}
public static Identifier id(String path) {
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/world/vanillyn/block/BangbooBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import world.vanillyn.BangbooMod;
import world.vanillyn.block.Block.Crt;
import world.vanillyn.block.Block.SubHollow;

import static world.vanillyn.BangbooMod.LOGGER;
import static world.vanillyn.items.BangbooItems.BOOPON;
import static world.vanillyn.item.BangbooItems.BOOPON;

public class BangbooBlocks {
public static final Block CRT = register(new Crt(AbstractBlock.Settings.create(), BOOPON), "crt", true);
Expand Down
Loading

0 comments on commit dbe7321

Please sign in to comment.