Jump to content

Zacomat

Members
  • Posts

    91
  • Joined

  • Last visited

  • Days Won

    1

Zacomat last won the day on July 20 2023

Zacomat had the most liked content!

Converted

  • Gender
    Male
  • URL
    http://www.patreon.com/user?u=4995675
  • Personal Text
    I am new!

Recent Profile Visitors

87240 profile views

Zacomat's Achievements

Stone Miner

Stone Miner (3/8)

3

Reputation

  1. 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.
  2. 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 } }
  3. Do I need to create a dummy ServerPlayer? This is what I tried, but without success... Or is there some other way?
  4. 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"); }
  5. Your textures path should be for example resources/assets/firstmod/textures/item/plutonium.png and your mod id must be firstmod
  6. 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));
  7. 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
  8. I was referring to version 1.20.1. I apologize for mentioning the wrong version.
  9. 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
  10. 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.
  11. For example during the PlayerLoggedInEvent ServerPlayer p= (ServerPlayer)event.getEntity(); p.connection.getRemoteAddress(); this will return an InetSocketAddress if the client is remote
  12. the json is error free but do you have the line "render_type": "cutout" in your model class?
  13. 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?
  14. At the end, I fell into the GLFW library.
×
×
  • Create New...

Important Information

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