-
Posts
94 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Zacomat
-
In Minecraft version 1.20.4, using Forge 49.1.0, the BaseEntityBlock class has an abstract method protected abstract MapCodec<? extends BaseEntityBlock> codec();. Can someone please explain how to implement this method? Returning null doesn't seem to cause crashes... Thanks!
-
Hi all! I want to find the obfuscated names for various fields in recent versions of Minecraft (greater than 1.20.2). Can someone please tell me where to search? Thanks very much!
-
I am trying to port my mod from 1.20.2 to 1.21, but I am encountering difficulties regarding the classes for rendering the GUI and related events. What are the equivalents of the following classes? net.minecraftforge.client.event.RenderGuiOverlayEvent net.minecraftforge.client.gui.overlay.NamedGuiOverlay net.minecraftforge.client.gui.overlay.ForgeGui net.minecraftforge.client.gui.overlay.GuiOverlayManager net.minecraftforge.client.gui.overlay.IGuiOverlay thx
-
[Solved][ 1.20.1] How to make mobs open chests?
Zacomat replied to Zacomat's topic in Modder Support
I think that simply sending a message from the server to all clients when a chest is opening or closing would be sufficient. There no difference if player opening the chest is not the ClientPlayer. The problem is that every implementation of BaseContainerBlockEntity handles the opening and closing in its own way. So, I created the interface BaseContainerBlockEntityWrapper and its specific implementations: BarrelBlockEntityWrapper ChestBlockEntityWrapper ShulkerBoxBlockEntityWrapper DefaultBaseContainerBlockEntityWrapper In each of these implementations, I wrote specific code to handle the wrapped instance. -
Could someone please explain the 'weight' parameter in the 'biome_modifier/my_mob.json' file? Based on my experiments, I've observed the following: Weight 5: Very rare Weight 10: Rare Weight 15: Uncommon Weight 20: Common Weight 25: Very common These results were obtained from exploration in caves and on the surface using the following file: { "type": "forge:add_spawns", "biomes": "#minecraft:is_overworld", "spawners": { "type": "exmplemod:my_mob", "weight":15, "minCount": 1, "maxCount": 1 } }
-
Do I need to create a dummy ServerPlayer? This is what I tried, but without success... Or is there some other way?
-
in 1.20 how would I make a right click detector for a specific item
Zacomat replied to LittleLDude's topic in Modder Support
if you have a class for your sword that extends SwordItem just override the methos use: @Override public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) { System.err.println("use hand=" + hand); return super.use(level, player, hand); } else you can use events in MinecraftForge.EVENT_BUS: @SubscribeEvent public void onLivingEntityUseItemEventStart(RightClickItem event) { System.err.println("RightClickItem"); } @SubscribeEvent public void onLivingEntityUseItemEventFinish(RightClickBlock event) { System.err.println("RightClickBlock"); } @SubscribeEvent public void onLivingEntityUseItemEventStop(EntityInteract event) { System.err.println("EntityInteract"); } @SubscribeEvent public void onLivingEntityUseItemEventTick(EntityInteractSpecific event) { System.err.println("EntityInteractSpecific"); } -
Your textures path should be for example resources/assets/firstmod/textures/item/plutonium.png and your mod id must be firstmod
-
How would I select an area to deal damge in
Zacomat replied to LittleLDude's topic in Modder Support
I think this should work: ServerPlayer player = ...; double radius = 8; List<LivingEntity> list = player.level().getEntitiesOfClass(LivingEntity.class, player.getBoundingBox().inflate(radius,radius,radius), e->(/*filter entities and return true if accetted*/true)); -
I all! I want to rename my output file that is "examplemod-1.0.0.jar" to a new filename containing mc version: "examplemod-1.20.1-1.0.0.jar" What i have done is to copy the output file to a new file with new filename and then delete the old file. This works but i'd like to know what is the correct way to do it. this is my code: tasks.named('build') { doLast { def orig_file = "${buildDir}/libs/${mod_id}-${mod_version}.jar" println "orig_file: ${orig_file}" def source_file = "${buildDir}/libs/${mod_id}-${minecraft_version}-${mod_version}.jar" println "source_file: ${source_file}" copy { from "${orig_file}" into "${buildDir}/libs" rename "${mod_id}-${mod_version}.jar", "${mod_id}-${minecraft_version}-${mod_version}.jar" } delete "${orig_file}" def dest_client_dir = "$projectDir/../client-${minecraft_version}-${forge_version}/mods/" println "dest_client_dir: ${dest_client_dir}" def dest_server_dir = "$projectDir/../server-${minecraft_version}-${forge_version}/mods/" println "dest_server_dir: ${dest_server_dir}" copy { from "${source_file}" into "${dest_client_dir}" } if("${displayTestLine}"!="displayTest=\"IGNORE_ALL_VERSION\"") copy { from "${source_file}" into "${dest_server_dir}" } } } thx
-
I was referring to version 1.20.1. I apologize for mentioning the wrong version.
-
if you have a sword class you should override the method use(Level p_41432_, Player p_41433_, InteractionHand hand) that is called when you hold use key (right mouse button). Or else you can subscribe to PlayerInteractEvent subclasses: EntityInteractSpecific EntityInteract RightClickBlock RightClickItem
-
It seems that in TravelersBackpack-1.19.2-8.2.30.jar mod they forgot to register travelersbackpack:bee. Remove this mod or change version and try again.
-
For example during the PlayerLoggedInEvent ServerPlayer p= (ServerPlayer)event.getEntity(); p.connection.getRemoteAddress(); this will return an InetSocketAddress if the client is remote
- 1 reply
-
- 1
-
the json is error free but do you have the line "render_type": "cutout" in your model class?
-
I'd like to move the camera freely away from player. The solution i found is to create a dummy entity to set in minecraft.setCameraEntity(myEntity). So i extended Entity: public class Cameraman extends Entity { public Cameraman(EntityType<Cameraman> p_19870_, Level p_19871_) { super(p_19870_, p_19871_); } @Override protected void defineSynchedData() { // TODO Auto-generated method stub } @Override protected void readAdditionalSaveData(CompoundTag p_20052_) { // TODO Auto-generated method stub } @Override protected void addAdditionalSaveData(CompoundTag p_20139_) { // TODO Auto-generated method stub } } then registered entity type: public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, MODID); public static final RegistryObject<EntityType<Cameraman>> MY_ENTITY_TYPE = ENTITY_TYPES.register("cameraman", () -> EntityType.Builder.of(Cameraman::new, MobCategory.MISC).build(MODID + ":cameraman")); public static Cameraman cameraman; and finally i try to instantiate my entity: // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public static class ClientModEvents { @SubscribeEvent public static void onClientSetup(FMLClientSetupEvent event) { //both not working //cameraman = MY_ENTITY_TYPE.get().create(Minecraft.getInstance().level); cameraman = new Cameraman(MY_ENTITY_TYPE.get(), Minecraft.getInstance().level); } } The result is: Exception message: java.lang.NullPointerException: Registry Object not present: giacomos_prova:cameraman It seems that i sould register the cameraman entity. How is it done?
-
At the end, I fell into the GLFW library.
-
Found MouseDragged event!
-
Hi all I would like to implement a camera mode where the camera can be rotated with the mouse. To change the angles, I found the event ViewportEvent.ComputeCameraAngles. But how can I set the angles based on mouse movement? I haven't found an InputEvent for mouse movement. Thx
-
I would like to display the distance of the player from the center of a filled map or from map decorations if present. I have found that the world coordinates of decorations are in the item's tag. However, for banners or maps without decorations, they are not present in the tag. I found in the MapItemSavedData class the coordinates of the center: "centerX" and "centerZ," which would be perfect for my case. However, this class seems to be updated only on the server side. How can I determine the absolute coordinates of banners or the map center on the client side? Thank you very much!
- 1 reply
-
- 1
-
1.20 A problem occurred configuring root project 'forge-1.20-46.0.2-mdk'
Zacomat replied to Zacomat's topic in ForgeGradle
PR = pull request -
1.20 A problem occurred configuring root project 'forge-1.20-46.0.2-mdk'
Zacomat replied to Zacomat's topic in ForgeGradle
I replaced in file build.gradle minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" with: minecraft "net.minecraftforge:forge:1.20-46.0.2" and it works now. It seems that ${forge_version} contains ${minecraft_version} -
I want to install the mdk for the latest version 1.20 but the command ./gradlew genEclipseRuns fails: FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'forge-1.20-46.0.2-mdk'. > Could not resolve dependency: net.minecraftforge:forge:1.20-1.20-46.0.2:userdev * Exception is: org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'forge-1.20-46.0.2-mdk'. Caused by: java.lang.IllegalStateException: Could not resolve dependency: net.minecraftforge:forge:1.20-1.20-46.0.2:userdev
-
I have noticed that the third parameter in Level.setBlock(BlockPos, BlockState, int) is a bitmask. I have seen that the value 3 is often passed, sometimes 11, and I manage to make it work. However, I would like to know if there are any defined constants somewhere that explain these bits. Can anyone help me?