Jump to content

Recommended Posts

Posted

Summary: This hook would allow modders to replace the right-click behavior of existing blocks.

 

Reasoning: I'm the developer of Somnia, and I'm currently using the ISleepHandler implementation I submitted.  Currently, beds still explode if you sleep in them in other worlds (Nether, The End), and it's something I'd like to change in my mod.  I could edit BlockBed, but a Forge hook seems to be a better option.  But why limit the hook to just the bed block?

 

Details: Modders would be able to register an IBlockActivation with Forge.  A hook would need to be inserted into the various PlayerController classes in the onPlayerRightClick method.  The hook would consume all the same arguments as the Block.blockActivated method plus the Block type.  It would return true if an activation occurred by a registered IBlockActivation or false if not.  In the false case, it would fall through to call Block.blockActivated normally.

 

Offer to Implement: I will gladly implement this hook myself on the client-side, but someone else would need to do the server-side implementation.

Posted
  On 6/22/2012 at 10:32 PM, OvermindDL1 said:

Slightly offtopic, but I still wonder if there is any chance for an MP capable version of Somnia?  :)

I'd love to make that happen someday, but I have very little time to devote to new development.  It's mostly maintenance these days.

 

Edit: Official modding support is supposedly coming in 1.4.  I'm eager to see how far that will take me as far as preserving compatibility.

Posted
  On 6/26/2012 at 7:10 AM, MALfunction84 said:

So I think I have a client-side hooks that works, but I'm a bit lost on how to share it.

 

Just give me the link to your github. In the admin tab, make me (ScottKillen) a collaborator.

Posted
  On 6/26/2012 at 9:36 AM, OvermindDL1 said:

Github in its help has full descriptions for how to do pull requests, let me see if I can find it for you, this is not quite the one I was looking for but is a nice and raw start:  https://help.github.com/articles/fork-a-repo

Regardless, githubs general help has all the information you would need:  https://help.github.com/

Thanks!  I have my repo set up now with ScottKillen as a collaborator.  Right now, it's just an unmodified fork.  I'd like to test my changes before I commit them, but when I run build.bat, I get errors...

 

=================================== Build Start =================================
src_work -> src
1872 File(s) copied

forge_client -> minecraft
[snip]
17 File(s) copied

forge_server -> minecraft_server
[snip]
3 File(s) copied

forge_common -> minecraft
[snip]
57 File(s) copied

forge_common -> minecraft_server
[snip]
57 File(s) copied

'inject_version.bat' is not recognized as an internal or external command, operable program or batch file.
'inject_version.bat' is not recognized as an internal or external command, operable program or batch file.
== MCP 6.2 (data: 6.2, client: 1.2.5, server: 1.2.5) ==
# found jad, ff, jad patches, ff patches, osx patches, srgs, name csvs, doc csvs, param csvs, astyle, astyle config
== Recompiling client ==
> Cleaning bin
> Recompiling
'"C:\Program Files\Java\jdk1.6.0_33\bin\javac" -Xlint:-options -deprecation -g -source 1.6 -target 1....' failed : 1

== ERRORS FOUND ==

src\minecraft\net\minecraft\src\forge\ForgeHooks.java:392: warning: [deprecation] net.minecraft.src.forge.ISpecialMobSpawnHandler in net.minecraft.src.forge has  been deprecated
    static LinkedList<ISpecialMobSpawnHandler> specialMobSpawnHandlers = new LinkedList<ISpecialMobSpawnHandler>();
                      ^

src\minecraft\net\minecraft\src\forge\MinecraftForge.java:181: warning: [deprecation] net.minecraft.src.forge.ISpecialMobSpawnHandler in net.minecraft.src.forge has been deprecated
    public static void registerSpecialMobSpawnHandler(ISpecialMobSpawnHandler handler)
                                                      ^

src\minecraft\net\minecraft\src\forge\ModCompatibilityClient.java:8: cannot find symbol
symbol  : class CodecIBXM
location: package paulscode.sound.codecs
import paulscode.sound.codecs.CodecIBXM;
                             ^

src\minecraft\net\minecraft\src\forge\ModCompatibilityClient.java:130: cannot find symbol
symbol  : class CodecIBXM
location: class net.minecraft.src.forge.ModCompatibilityClient
        SoundSystemConfig.setCodec("xm",  CodecIBXM.class);
                                          ^

src\minecraft\net\minecraft\src\forge\ModCompatibilityClient.java:131: cannot find symbol
symbol  : class CodecIBXM
location: class net.minecraft.src.forge.ModCompatibilityClient
        SoundSystemConfig.setCodec("s3m", CodecIBXM.class);
                                          ^

src\minecraft\net\minecraft\src\forge\ModCompatibilityClient.java:132: cannot find symbol
symbol  : class CodecIBXM
location: class net.minecraft.src.forge.ModCompatibilityClient
        SoundSystemConfig.setCodec("mod", CodecIBXM.class);
                                          ^

4 errors
2 warnings
==================

== Recompiling server ==
> Cleaning bin
> Recompiling
- Done in 5.47 seconds
=================================== Build Finished 0 =================================

 

The file inject_version.bat is not present in the repo anywhere.  It was removed on April 6, 2012.

 

I have no idea why CodecIBXM.class is not found.  Actually, that's not true.  In build.bat, it only copies the forge_client\src\net path, which omits forge_client\src\paulscode and forgeclient\src\ibxm...

 

xcopy /Y /E forge\forge_client\src\net\* src\minecraft\net

 

My only thought is that I must have set up my workspace incorrectly or I'm calling the wrong scripts to test.  Any pointers?

Posted

You must of done something wrong because you're using 1/2 updated shit.

inject_versions was MOVED to a python script int he same commit, it was not removed completely.

Not sure how you managed that one.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted
  On 7/1/2012 at 11:04 PM, LexManos said:

You must of done something wrong because you're using 1/2 updated shit.

inject_versions was MOVED to a python script int he same commit, it was not removed completely.

Not sure how you managed that one.

Thanks for responding.  There are still references to inject_version.bat in build.bat, so I guess I shouldn't be using build.bat at all?

 

Actually, I've replaced the contents of build.bat with the following, and it seems to work:

@echo off
..\runtime\bin\python\python_mcp build.py %*

build.sh and setup.sh should probably be similarly altered to invoke their corresponding python scripts, but all this is outside the scope of the feature I'm trying to add.

Posted

ah yes, I ment to delete all the build.* files, they arnt needed anymore. Just for testing, Should probably clean these up.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • 4 weeks later...
  • 2 weeks later...

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

    • https://mclo.gs/9y5ciD2 anyone ever had this issue?  Internal exception illegal argument exception: unable to fit 3194354 into 3
    • Hoffman Law Recovery helped me recovered my lost funds
    • Hi! I'm trying to add my custom models/textures renderer like this: public class PonyPlayerWrapperRenderer extends EntityRenderer<Player> { // wrapper class under my LivingEntityRenderer class implementation private final PonyPlayerRenderer innerRenderer; private final PonyPlayerRenderer innerSlimRenderer; public PonyPlayerWrapperRenderer(final EntityRendererProvider.Context context) { super(context); System.out.println("creating new PonyPlayerWrapperRenderer"); this.innerRenderer = new PonyPlayerRenderer(context, false); this.innerSlimRenderer = new PonyPlayerRenderer(context, true); } @Override public void render(final Player entity, final float yaw, final float partialTicks, final PoseStack poseStack, final MultiBufferSource bufferSource, final int packedLight) { System.out.println("PonyPlayerWrapperRenderer render: " + entity.toString()); if (entity instanceof AbstractClientPlayer clientPlayer) { if (clientPlayer.getModelName().contains("slim")) { innerSlimRenderer.render(clientPlayer, yaw, partialTicks, poseStack, bufferSource, packedLight); } else { innerRenderer.render(clientPlayer, yaw, partialTicks, poseStack, bufferSource, packedLight); } } } @Override public ResourceLocation getTextureLocation(final Player player) { System.out.println("PonyPlayerWrapperRenderer getTextureLocation"); if (player instanceof AbstractClientPlayer clientPlayer) { return clientPlayer.getSkinTextureLocation(); } System.out.println("player instanceof AbstractClientPlayer is false"); return getDefaultSkin(player.getUUID()); } } public class PonyPlayerRenderer extends LivingEntityRenderer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> { private final PlayerModel<AbstractClientPlayer> earthModel; private final PlayerModel<AbstractClientPlayer> pegasusModel; private final PlayerModel<AbstractClientPlayer> unicornModel; public PonyPlayerRenderer(final EntityRendererProvider.Context context, final boolean slim) { super( context, slim ? new PonyModelSlim(context.bakeLayer(PonyModelSlim.LAYER_LOCATION)) : new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)), 0.5f ); System.out.println("creating new PonyPlayerRenderer"); this.earthModel = slim ? new PonyModelSlim(context.bakeLayer(PonyModelSlim.LAYER_LOCATION)) : new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)); this.pegasusModel = new PegasusModel(context.bakeLayer(PegasusModel.LAYER_LOCATION)); this.unicornModel = new UnicornModel(context.bakeLayer(UnicornModel.LAYER_LOCATION)); } @Override public void render(final AbstractClientPlayer player, final float entityYaw, final float partialTicks, final PoseStack poseStack, final MultiBufferSource buffer, final int packedLight) { final PonyRace race = player.getCapability(PONY_DATA) .map(data -> ofNullable(data.getRace()).orElse(PonyRace.EARTH)) .orElse(PonyRace.EARTH); this.model = switch (race) { case PEGASUS -> pegasusModel; case UNICORN -> unicornModel; case EARTH -> earthModel; }; super.render(player, entityYaw, partialTicks, poseStack, buffer, packedLight); } @Override public ResourceLocation getTextureLocation(final AbstractClientPlayer player) { final PonyRace race = player.getCapability(PONY_DATA) .map(data -> ofNullable(data.getRace()).orElse(PonyRace.EARTH)) .orElse(PonyRace.EARTH); return switch (race) { case EARTH -> fromNamespaceAndPath(MODID, "textures/entity/earth_pony.png"); case PEGASUS -> fromNamespaceAndPath(MODID, "textures/entity/pegasus.png"); case UNICORN -> fromNamespaceAndPath(MODID, "textures/entity/unicorn.png"); }; } } @Mod.EventBusSubscriber(modid = MODID, bus = MOD, value = CLIENT) public class ClientRenderers { // mod bus render registration config @SubscribeEvent public static void onRegisterLayerDefinitions(final EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(PonyModel.LAYER_LOCATION, PonyModel::createBodyLayer); event.registerLayerDefinition(PonyModelSlim.LAYER_LOCATION, PonyModelSlim::createBodyLayer); event.registerLayerDefinition(PegasusModel.LAYER_LOCATION, PegasusModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.LAYER_LOCATION, UnicornModel::createBodyLayer); event.registerLayerDefinition(InnerPonyArmorModel.LAYER_LOCATION, InnerPonyArmorModel::createBodyLayer); event.registerLayerDefinition(OuterPonyArmorModel.LAYER_LOCATION, OuterPonyArmorModel::createBodyLayer); } @SubscribeEvent public static void onRegisterRenderers(final EntityRenderersEvent.RegisterRenderers event) { event.registerEntityRenderer(EntityType.PLAYER, PonyPlayerWrapperRenderer::new); System.out.println("onRegisterRenderers end"); } } Method onRegisterRenderers() is called and I can see it being logged. But when I enter the world, my PonyWrapperRenderer render() method doesn't ever seem to be called. I also tried to put my renderer to EntityRenderDispatcher's playerRenderers via reflection: @Mod.EventBusSubscriber(modid = MODID, bus = MOD, value = CLIENT) public class ClientRenderers { @SubscribeEvent public static void onRegisterLayerDefinitions(final EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(PonyModel.LAYER_LOCATION, PonyModel::createBodyLayer); event.registerLayerDefinition(PonyModelSlim.LAYER_LOCATION, PonyModelSlim::createBodyLayer); event.registerLayerDefinition(PegasusModel.LAYER_LOCATION, PegasusModel::createBodyLayer); event.registerLayerDefinition(UnicornModel.LAYER_LOCATION, UnicornModel::createBodyLayer); event.registerLayerDefinition(InnerPonyArmorModel.LAYER_LOCATION, InnerPonyArmorModel::createBodyLayer); event.registerLayerDefinition(OuterPonyArmorModel.LAYER_LOCATION, OuterPonyArmorModel::createBodyLayer); } @SubscribeEvent public static void onClientSetup(final FMLClientSetupEvent event) { event.enqueueWork(() -> { try { final EntityRenderDispatcher dispatcher = Minecraft.getInstance().getEntityRenderDispatcher(); final Field renderersField = getEntityRenderDispatcherField("playerRenderers"); final Field itemInHandRenderer = getEntityRenderDispatcherField("itemInHandRenderer"); @SuppressWarnings("unchecked") final Map<String, EntityRenderer<? extends Player>> playerRenderers = (Map<String, EntityRenderer<? extends Player>>)renderersField.get(dispatcher); final PonyPlayerWrapperRenderer renderer = new PonyPlayerWrapperRenderer( new EntityRendererProvider.Context( dispatcher, Minecraft.getInstance().getItemRenderer(), Minecraft.getInstance().getBlockRenderer(), (ItemInHandRenderer)itemInHandRenderer.get(dispatcher), Minecraft.getInstance().getResourceManager(), Minecraft.getInstance().getEntityModels(), Minecraft.getInstance().font ) ); playerRenderers.put("default", renderer); playerRenderers.put("slim", renderer); System.out.println("Player renderers replaced"); } catch (final Exception e) { throw new RuntimeException("Failed to replace player renderers", e); } }); } private static Field getEntityRenderDispatcherField(final String fieldName) throws NoSuchFieldException { final Field field = EntityRenderDispatcher.class.getDeclaredField(fieldName); field.setAccessible(true); return field; } } But I receive the error before Minecraft Client appears (RuntimeException: Failed to replace player renderers - from ClientRenderers onClientSetup() method - and its cause below): java.lang.IllegalArgumentException: No model for layer anotherlittlepony:earth_pony#main at net.minecraft.client.model.geom.EntityModelSet.bakeLayer(EntityModelSet.java:18) ~[forge-1.20.1-47.4.0_mapped_official_1.20.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRendererProvider$Context.bakeLayer(EntityRendererProvider.java:69) ~[forge-1.20.1-47.4.0_mapped_official_1.20.1-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at com.thuggeelya.anotherlittlepony.client.renderer.pony.PonyPlayerRenderer.<init>(PonyPlayerRenderer.java:32) ~[main/:?] {re:classloading} at com.thuggeelya.anotherlittlepony.client.renderer.pony.PonyPlayerWrapperRenderer.<init>(PonyPlayerWrapperRenderer.java:24) ~[main/:?] {re:classloading} at com.thuggeelya.anotherlittlepony.client.renderer.ClientRenderers.lambda$onClientSetup$0(ClientRenderers.java:79) ~[main/:?] {re:classloading} ... 33 more Problem appears when EntityRendererProvider context tries to bakeLayer with my model layer location: new PonyModel(context.bakeLayer(PonyModel.LAYER_LOCATION)); // PonyPlayerRenderer.java:32 public class PonyModel extends PlayerModel<AbstractClientPlayer> { // the model class itself public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation( ResourceLocation.fromNamespaceAndPath(MODID, "earth_pony"), "main" ); public PonyModel(final ModelPart root) { super(root, false); } public static LayerDefinition createBodyLayer() { // some CubeListBuilder stuff for model appearance } } Textures PNGs are placed at: resources/assets/[my mod id]/textures/entity. My forge version is 1.20.1. Would appreciate any help.
    • Well, a bit more information about what you're trying to do would be helpful. e.g. why you're trying to use "INVOKE_ASSIGN" instead of "INVOKE". "INVOKE_ASSIGN" calls your code after the "target" is called and its value is stored, if applicable. "INVOKE" calls your code before the target is called. "target" expects a fully qualified name, as per the SpongePowered docs, if that name is going to be remapped (which it will be if your injecting into Minecraft itself and not another mod). For more information on fully qualified names versus canonical names, see the Java specifications. Here's an example of a working "@At" from my own code that targets the "getClosestsVulnerablePlayerToEntity" call inside a mob's logic: @At(value = "INVOKE_ASSIGN", target = "net.minecraft.world.World.getClosestVulnerablePlayerToEntity(Lnet/minecraft/entity/Entity;D)Lnet/minecraft/entity/player/EntityPlayer;") Hope this helps!
    • Ran it one more time just to check, and there's no errors this time on the log??? Log : https://mclo.gs/LnuaAiu I tried allocating more memory to the modpack, around 8000MB and it's still the same; stopping at "LOAD_REGISTRIES". Are some of the mods clashing, maybe? I have no clue what to do LOL
  • Topics

×
×
  • Create New...

Important Information

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