Skip to content

Commit

Permalink
Should be good to merge now
Browse files Browse the repository at this point in the history
  • Loading branch information
StellarWitch7 committed Aug 29, 2024
1 parent 7f69891 commit d61476c
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 67 deletions.
30 changes: 5 additions & 25 deletions src/client/java/world/vanillyn/BangbooClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
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 world.vanillyn.render.model.BangbooModel;
import world.vanillyn.render.render.BangbooRenderer;
import world.vanillyn.render.screen.entity.Handler;


@Environment(EnvType.CLIENT)
Expand All @@ -30,45 +29,26 @@ public void onInitializeClient() {
EntityModelLayerRegistry.registerModelLayer(MODEL_BANGBOO_LAYER, BangbooModel::getTexturedModelData);

EntityRendererRegistry.register(BangbooType.EOUS.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.EOUS.entityType(), Eous.createMobAttributes());
EntityRendererRegistry.register(BangbooType.BAGBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.BAGBOO.entityType(), Bagboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.SHARKBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.SHARKBOO.entityType(), Sharkboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.EXPLOREBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.EXPLOREBOO.entityType(), Exploreboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.AMILLION.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.AMILLION.entityType(), Amillion.createMobAttributes());
EntityRendererRegistry.register(BangbooType.MAGNETIBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.MAGNETIBOO.entityType(), Magnetiboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.LUCKYBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.LUCKYBOO.entityType(), Luckyboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.BUTLER.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.BUTLER.entityType(), Butler.createMobAttributes());
EntityRendererRegistry.register(BangbooType.SAFETY.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.SAFETY.entityType(), Safety.createMobAttributes());
EntityRendererRegistry.register(BangbooType.OFFICER_CUI.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.OFFICER_CUI.entityType(), OfficerCui.createMobAttributes());
EntityRendererRegistry.register(BangbooType.AVOCABOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.AVOCABOO.entityType(), Avocaboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.CRYBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.CRYBOO.entityType(), Cryboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.BOOLLSEYE.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.BOOLLSEYE.entityType(), Boollseye.createMobAttributes());
EntityRendererRegistry.register(BangbooType.DEVILBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.DEVILBOO.entityType(), Devilboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.ELECTROBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.ELECTROBOO.entityType(), Electroboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.PAPERBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.PAPERBOO.entityType(), Paperboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.PENGUINBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.PENGUINBOO.entityType(), Penguinboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.PLUGBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.PLUGBOO.entityType(), Plugboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.SUMOBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.SUMOBOO.entityType(), Sumoboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.BADDIEBOO.entityType(), BangbooRenderer::new);
FabricDefaultAttributeRegistry.register(BangbooType.BADDIEBOO.entityType(), Baddieboo.createMobAttributes());
EntityRendererRegistry.register(BangbooType.BLANKBOO.entityType(), BangbooRenderer::new);

KeyBinding openMenu = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"key.Bangboo.openscreen",
Expand All @@ -79,7 +59,7 @@ public void onInitializeClient() {

UseEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> {
if (world.isClient) {
Handler.handleEntityInteraction(player, (Bangboo) entity);
Handler.handleEntityInteraction(player, entity);
}
return ActionResult.PASS;
});
Expand Down

This file was deleted.

This file was deleted.

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

import net.minecraft.client.model.*;
import net.minecraft.client.render.VertexConsumer;
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.render.model.BangbooModel;

public class BangbooRenderer extends MobEntityRenderer<Bangboo, BangbooModel> {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package world.vanillyn.render.Screen;
package world.vanillyn.render.screen;

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 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 {
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package world.vanillyn.render.Screen.Entity;
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;
import world.vanillyn.render.screen.TestScreen;

public class Handler {
public static void handleEntityInteraction(PlayerEntity player, Bangboo entity) {
if (player.isSneaking() && entity instanceof Bangboo) {
// 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(entity, player));
} else if(player.isSneaking()) {
BangbooMod.LOGGER.warn("Interacted entity is not Bangboo");
MinecraftClient.getInstance().setScreen(new TestScreen(bangboo, player));
}
}
}
47 changes: 25 additions & 22 deletions src/main/java/world/vanillyn/entity/bangboo/BangbooType.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package world.vanillyn.entity.bangboo;

import com.mojang.serialization.Lifecycle;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.attribute.DefaultAttributeContainer;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
Expand All @@ -15,30 +17,30 @@ public record BangbooType<T extends Bangboo>(EntityType<T> entityType, BangbooCo
public static final RegistryKey<Registry<BangbooType>> REGISTRY_KEY = RegistryKey.ofRegistry(BangbooMod.id("bangboo"));
public static final Registry<BangbooType> REGISTRY = new SimpleRegistry<>(REGISTRY_KEY, Lifecycle.stable());

public static final BangbooType<Amillion> AMILLION = register("amillion", Amillion::new, 's');
public static final BangbooType<Avocaboo> AVOCABOO = register("avocaboo", Avocaboo::new, 's');
public static final BangbooType<Baddieboo> BADDIEBOO = register("baddieboo", Baddieboo::new, 's');
public static final BangbooType<Bagboo> BAGBOO = register("bagboo", Bagboo::new, 's');
public static final BangbooType<Boollseye> BOOLLSEYE = register("boollseye", Boollseye::new, 's');
public static final BangbooType<Butler> BUTLER = register("butler", Butler::new, 's');
public static final BangbooType<Cryboo> CRYBOO = register("cryboo", Cryboo::new, 's');
public static final BangbooType<Devilboo> DEVILBOO = register("devilboo", Devilboo::new, 's');
public static final BangbooType<Electroboo> ELECTROBOO = register("electroboo", Electroboo::new, 's');
public static final BangbooType<Eous> EOUS = register("eous", Eous::new, 's');
public static final BangbooType<Exploreboo> EXPLOREBOO = register("exploreboo", Exploreboo::new, 's');
public static final BangbooType<Luckyboo> LUCKYBOO = register("luckyboo", Luckyboo::new, 's');
public static final BangbooType<Magnetiboo> MAGNETIBOO = register("magnetiboo", Magnetiboo::new, 's');
public static final BangbooType<OfficerCui> OFFICER_CUI = register("officer_cui", OfficerCui::new, 's');
public static final BangbooType<Paperboo> PAPERBOO = register("paperboo", Paperboo::new, 's');
public static final BangbooType<Penguinboo> PENGUINBOO = register("penguinboo", Penguinboo::new, 's');
public static final BangbooType<Plugboo> PLUGBOO = register("plugboo", Plugboo::new, 's');
public static final BangbooType<Safety> SAFETY = register("safety", Safety::new, 's');
public static final BangbooType<Sumoboo> SUMOBOO = register("sumoboo", Sumoboo::new, 's');
public static final BangbooType<Sharkboo> SHARKBOO = register("sharkboo", Sharkboo::new, 's');
public static final BangbooType<Amillion> AMILLION = register("amillion", Amillion::new, Amillion.createMobAttributes(), 's');
public static final BangbooType<Avocaboo> AVOCABOO = register("avocaboo", Avocaboo::new, Avocaboo.createMobAttributes(), 's');
public static final BangbooType<Baddieboo> BADDIEBOO = register("baddieboo", Baddieboo::new, Baddieboo.createMobAttributes(), 's');
public static final BangbooType<Bagboo> BAGBOO = register("bagboo", Bagboo::new, Bagboo.createMobAttributes(), 's');
public static final BangbooType<Boollseye> BOOLLSEYE = register("boollseye", Boollseye::new, Boollseye.createMobAttributes(), 's');
public static final BangbooType<Butler> BUTLER = register("butler", Butler::new, Butler.createMobAttributes(), 's');
public static final BangbooType<Cryboo> CRYBOO = register("cryboo", Cryboo::new, Cryboo.createMobAttributes(), 's');
public static final BangbooType<Devilboo> DEVILBOO = register("devilboo", Devilboo::new, Devilboo.createMobAttributes(), 's');
public static final BangbooType<Electroboo> ELECTROBOO = register("electroboo", Electroboo::new, Electroboo.createMobAttributes(), 's');
public static final BangbooType<Eous> EOUS = register("eous", Eous::new, Eous.createMobAttributes(), 's');
public static final BangbooType<Exploreboo> EXPLOREBOO = register("exploreboo", Exploreboo::new, Exploreboo.createMobAttributes(), 's');
public static final BangbooType<Luckyboo> LUCKYBOO = register("luckyboo", Luckyboo::new, Luckyboo.createMobAttributes(), 's');
public static final BangbooType<Magnetiboo> MAGNETIBOO = register("magnetiboo", Magnetiboo::new, Magnetiboo.createMobAttributes(), 's');
public static final BangbooType<OfficerCui> OFFICER_CUI = register("officer_cui", OfficerCui::new, OfficerCui.createMobAttributes(), 's');
public static final BangbooType<Paperboo> PAPERBOO = register("paperboo", Paperboo::new, Paperboo.createMobAttributes(), 's');
public static final BangbooType<Penguinboo> PENGUINBOO = register("penguinboo", Penguinboo::new, Penguinboo.createMobAttributes(), 's');
public static final BangbooType<Plugboo> PLUGBOO = register("plugboo", Plugboo::new, Plugboo.createMobAttributes(), 's');
public static final BangbooType<Safety> SAFETY = register("safety", Safety::new, Safety.createMobAttributes(), 's');
public static final BangbooType<Sumoboo> SUMOBOO = register("sumoboo", Sumoboo::new, Sumoboo.createMobAttributes(), 's');
public static final BangbooType<Sharkboo> SHARKBOO = register("sharkboo", Sharkboo::new, Sharkboo.createMobAttributes(), 's');

public static final BangbooType<Blankboo> BLANKBOO = register("blankboo", Blankboo::new, 's');
public static final BangbooType<Blankboo> BLANKBOO = register("blankboo", Blankboo::new, Blankboo.createMobAttributes(), 's');

public static <T extends Bangboo> BangbooType<T> register(String name, EntityType.EntityFactory<T> bangbooFactory, char rating) {
public static <T extends Bangboo> BangbooType<T> register(String name, EntityType.EntityFactory<T> bangbooFactory, DefaultAttributeContainer.Builder defaultAttributesBuilder, char rating) {
var entityType = Registry.register(Registries.ENTITY_TYPE,
BangbooMod.id("bangboo_" + name),
EntityType.Builder.create(bangbooFactory, SpawnGroup.MISC)
Expand All @@ -48,6 +50,7 @@ public static <T extends Bangboo> BangbooType<T> register(String name, EntityTyp
BangbooMod.id("bangboo_core_" + name),
new BangbooCore<>(entityType, rating));

FabricDefaultAttributeRegistry.register(entityType, defaultAttributesBuilder);
return Registry.register(REGISTRY,
BangbooMod.id(name),
new BangbooType<>(entityType,
Expand Down

0 comments on commit d61476c

Please sign in to comment.