Jump to content

Recommended Posts

Posted

good days

 

i have a mod i wanna split in multi parts,

 

per example

in the minecraft 1.7  the mod alienvs predator made by arisux  has main mod package AIRI.jar its contains the materials and blocks for the mod.

and the package AliensVsPredator.jar  has the mobs and  the weapons.

 

and the  package  AliensVsPredator.jar demands AIRI as dependency

 

someone  tellme that can be done whith a modified version of graddle but google has not confirm it

in the other side google speaks about an utility from chikenBones but for 1.7 and this 1.8

 

how this could be achive

Posted

I'm not sure how that mod specifically does it, but I think generally these are just separate mods that are dependent and maybe have an API to better facilitate the interaction between them.

 

The dependencies have to be arranged in the proper order. For example, if one part's code references a block from the other part's code, then you need that mod loaded first.

 

The API exposes the methods you want for interaction, so if you had for example a vampire entity in one part and wanted to allow other parts create new vampire types, then you'd provide an API for createVampireEntity() or similar.

 

The key point though is that those guys didn't just take an existing mod and split it -- instead they coded their mod from the start to be in multiple parts. That takes good structured approach to the mods.

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Why do you want to split your mod anyway? If you want people to be able to only enable certain things in your mods, you could more easily just make it configuration options.  The Minecraft Forge wiki has a tutorial on that here: http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file

 

You can even make a nice GUI so the player can change the configuration from within the game (instead of manually editing the config text file). I have a tutorial on making a config GUI here: http://jabelarminecraft.blogspot.com/p/minecraft-modding-configuration-guis.html

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Why do you want to split your mod anyway? If you want people to be able to only enable certain things in your mods, you could more easily just make it configuration options.  The Minecraft Forge wiki has a tutorial on that here: http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file

 

I'm doing it right now because while the n mods together share a theme, they are not reliant on each other and people can decide to only download the ones they actually want.  Maybe they want one aspect and not the others.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I'm doing it right now because while the n mods together share a theme, they are not reliant on each other and people can decide to only download the ones they actually want.  Maybe they want one aspect and not the others.

 

Sure. You can also just allow the players to configure one mod the way they want. I usually have configuration options to disable certain things. It just seems like splitting a mod might be a lot of work. I know you're an experienced modder, so I'm not questioning whether you should do it, but the guy who started this thread may not be as confident.

 

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

I could, but there are a lot of things that work in tandem. Aside from things that are truly configurable (e.g. length of a year), my configs don't have much in them. You can't just turn one thing of and expect everything else to work.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Why do you want to split your mod anyway? If you want people to be able to only enable certain things in your mods, you could more easily just make it configuration options.  The Minecraft Forge wiki has a tutorial on that here: http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file

 

You can even make a nice GUI so the player can change the configuration from within the game (instead of manually editing the config text file). I have a tutorial on making a config GUI here: http://jabelarminecraft.blogspot.com/p/minecraft-modding-configuration-guis.html

Just a random FYI about your tutorial comments: the 'Mod Settings' gui in Forge was never intended to be functional - it was added by cpw purely as an example for modders to see what was possible with the config API. Many of the features (parent/child menus etc) need to be implemented by the modder, but Forge will correctly interpret them.

 

You may want to check out GotoLink's Battlegear2 config code - it's not really 'replacing' the gui menu so much as adding yours to the list of mods with config guis using IModGuiFactory.

Posted

damm

no i have more doubs than in the begining

 

 

the trouble begins here 

http://www.minecraftforge.net/forum/index.php?topic=29261.0

 

i could'n add more weapons to mi mod  whithout damage the game textures

and i need add more weapons

 

 

lets say i just let this modmercenario1.8.jar here whith most of the tools materials gui keybind and items

 

and lets say i do a second mod called  modmercenario_moreweapons1.8.jar

 

i need reference the materials from the first mod to make the recipes in the second

 

so here comes mi first cuestion

 

eclipse can load and alredy compiled mod0.jar  while is working on a mod1 and call the clases from mod0 to use them in mod1 ??

 

Posted

Why do you want to split your mod anyway? If you want people to be able to only enable certain things in your mods, you could more easily just make it configuration options.  The Minecraft Forge wiki has a tutorial on that here: http://www.minecraftforge.net/wiki/How_to_make_an_advanced_configuration_file

 

You can even make a nice GUI so the player can change the configuration from within the game (instead of manually editing the config text file). I have a tutorial on making a config GUI here: http://jabelarminecraft.blogspot.com/p/minecraft-modding-configuration-guis.html

Just a random FYI about your tutorial comments: the 'Mod Settings' gui in Forge was never intended to be functional - it was added by cpw purely as an example for modders to see what was possible with the config API. Many of the features (parent/child menus etc) need to be implemented by the modder, but Forge will correctly interpret them.

 

You may want to check out GotoLink's Battlegear2 config code - it's not really 'replacing' the gui menu so much as adding yours to the list of mods with config guis using IModGuiFactory.

 

Thanks.  I think my tutorial does the right thing though. In the main menu if you select mods I implement the config gui (yes pretty much just implementing the example). However I also handle the in-game pause menu config gui and replace the example with proper configuration settings. The one piece I hadn't worked through was how to handle multiple mods having ingame config so I'll check out GotoLink's stuff to see if that what he's solving.

 

But basically I think it is weirder to have the in-game pause menu have a GUI that only contains example stuff instead of handling it as appropriate to your mod. At very least people should disable that GUI then for their mod if they're not going to use it.

 

I personally think that all mods should be able to be configured in-game if possible. Whether or not that uses the actual Configuration or GuiCofig classes is up to the modder, although I think it would also be cool if everyone settled on a standard where you could go in and change settings for all your mods through a common interface.

 

Regarding Draco's comment -- I find configurations are perfectly capable of turning off things in your mod. Since the majority of stuff is in registries you can quite simply just not register blocks and stuff (the original poster is citing an example where the blocks are in one part, entities in another). Certainly there can be cases where there is more interaction but I'm not sure how splitting the JARs would make that any easier to manage.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

CoolAlias, I checked out GotoLink's code. It is pretty much the same as what I'm doing. I create a GUI factory and call a GuiConfig, whereas he calls a custom GuiScreen. Or maybe I'm missing what you were trying to point out to me...

 

The cool thing about the built in config gui (even if it is just a starting point) is that it automatically creates all the buttons and layout simply based on your Configuration file. So once you set it up, you just have to manage the Configuration and the GUI automatically will show those options, limit the range, allow reset to default, etc. It is pretty slick in my opinion.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.