[factions-banking] Start of shop keeper stuff. Not working - but on wrong branch. Oh well!
This commit is contained in:
parent
e164a489b2
commit
415983edca
@ -1,19 +1,26 @@
|
|||||||
package jesse.keeblarcraft;
|
package jesse.keeblarcraft;
|
||||||
|
|
||||||
|
import jesse.keeblarcraft.Entities.EntityRegistration;
|
||||||
|
import jesse.keeblarcraft.GuiMgr.Entities.ShopKeeperRenderer;
|
||||||
import jesse.keeblarcraft.gui.ClientHandlers;
|
import jesse.keeblarcraft.gui.ClientHandlers;
|
||||||
// import jesse.keeblarcraft.gui.ScreenManager;
|
|
||||||
// import jesse.keeblarcraft.gui.widgets.TreeWidget;
|
|
||||||
import jesse.keeblarcraft.Shortcuts.ShortcutManager;
|
import jesse.keeblarcraft.Shortcuts.ShortcutManager;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
|
||||||
|
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
|
||||||
public class KeeblarcraftClient implements ClientModInitializer {
|
public class KeeblarcraftClient implements ClientModInitializer {
|
||||||
|
public static final EntityModelLayer SHOP_KEEPER_LAYER = new EntityModelLayer(new Identifier("textures/entity/villager/villager.png"), "VILLAGE_ENTITY_MODEL_LAYER");
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
ShortcutManager.RegisterKeybinds();
|
ShortcutManager.RegisterKeybinds();
|
||||||
ClientHandlers.RegisterHandlers();
|
ClientHandlers.RegisterHandlers();
|
||||||
|
|
||||||
|
// EntityRendererRegistry.INSTANCE.register(EntityRegistration.SHOP_KEEPER_ENTITY_TYPE, (context) -> {
|
||||||
|
// return new ShopKeeperRenderer(context);
|
||||||
|
// });
|
||||||
|
|
||||||
// ScreenManager.GetInstance();
|
// ScreenManager.GetInstance();
|
||||||
// ScreenManager.AddWidget(TreeWidget.class, 10);
|
// ScreenManager.AddWidget(TreeWidget.class, 10);
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,7 @@ public final class BankManager {
|
|||||||
/// @param[in] player Player object to change default accounts of
|
/// @param[in] player Player object to change default accounts of
|
||||||
///
|
///
|
||||||
/// @param[in] The new default account global account identifier
|
/// @param[in] The new default account global account identifier
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
public void ChangeDefaultPlayerAccount(ServerPlayerEntity player, String newDefaultAccount) {
|
public void ChangeDefaultPlayerAccount(ServerPlayerEntity player, String newDefaultAccount) {
|
||||||
Integer routingNumber = AccountNumberGenerator.GetRoutingNumberFromId(newDefaultAccount);
|
Integer routingNumber = AccountNumberGenerator.GetRoutingNumberFromId(newDefaultAccount);
|
||||||
if (banks.containsKey(routingNumber)) {
|
if (banks.containsKey(routingNumber)) {
|
||||||
|
@ -31,7 +31,5 @@ public class ChatFormatting {
|
|||||||
case RED -> colorStr + "4";
|
case RED -> colorStr + "4";
|
||||||
case GREEN -> colorStr + "2";
|
case GREEN -> colorStr + "2";
|
||||||
};
|
};
|
||||||
|
|
||||||
// If this code is reachable, then someone has not properly handled the above switch-case
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package jesse.keeblarcraft.Entities;
|
||||||
|
|
||||||
|
import jesse.keeblarcraft.Keeblarcraft;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.SpawnGroup;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.Registry;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
public class EntityRegistration {
|
||||||
|
public static final EntityType<ShopKeeper> SHOP_KEEPER_ENTITY_TYPE = Registry.register(
|
||||||
|
Registries.ENTITY_TYPE,
|
||||||
|
Identifier.of(Keeblarcraft.MOD_ID, "shop_keeper"),
|
||||||
|
EntityType.Builder.create(ShopKeeper::new, SpawnGroup.MISC).setDimensions(1.0f, 1.0f).build("shop_keeper")
|
||||||
|
);
|
||||||
|
|
||||||
|
public static void RegisterEntities() {
|
||||||
|
Keeblarcraft.LOGGER.info("Registering custom entities...");
|
||||||
|
FabricDefaultAttributeRegistry.register(SHOP_KEEPER_ENTITY_TYPE, ShopKeeper.createMobAttributes());
|
||||||
|
}
|
||||||
|
}
|
30
src/main/java/jesse/keeblarcraft/Entities/ShopKeeper.java
Normal file
30
src/main/java/jesse/keeblarcraft/Entities/ShopKeeper.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package jesse.keeblarcraft.Entities;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.passive.MerchantEntity;
|
||||||
|
import net.minecraft.entity.passive.PassiveEntity;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.village.TradeOffer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class ShopKeeper extends MerchantEntity {
|
||||||
|
public ShopKeeper(EntityType<? extends MerchantEntity> entityType, World world) {
|
||||||
|
super(entityType, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void afterUsing(TradeOffer offer) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void fillRecipes() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable PassiveEntity createChild(ServerWorld world, PassiveEntity entity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package jesse.keeblarcraft.GuiMgr.Entities;
|
||||||
|
|
||||||
|
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||||
|
import net.minecraft.client.render.entity.VillagerEntityRenderer;
|
||||||
|
|
||||||
|
public class ShopKeeperRenderer extends VillagerEntityRenderer {
|
||||||
|
public ShopKeeperRenderer(EntityRendererFactory.Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
}
|
@ -7,8 +7,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// color colour
|
|
||||||
|
|
||||||
package jesse.keeblarcraft;
|
package jesse.keeblarcraft;
|
||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
@ -18,7 +16,6 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
|||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||||
import net.kyrptonaught.customportalapi.api.CustomPortalBuilder;
|
import net.kyrptonaught.customportalapi.api.CustomPortalBuilder;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.entity.mob.HostileEntity;
|
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
|
Loading…
Reference in New Issue
Block a user