Jump to content

TheMajorN

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by TheMajorN

  1. Heya, so I'm making an old-style revolver and have mostly everything working aside from the reload animation. I have a condition set so that the animation is supposed to play while the reload method is being executed. However, the reload method executes immediately and the animation never plays because it never has time to. Will I have to make the item a tile entity for this to work or is there a way for me to use ticks in the class without a tile entity? Here is the relevant methods I used: public static int magazine = 6; public void reload(Level worldIn, Player playerIn) { worldIn.playSound((Player) null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), SoundInit.CALDWELL_RELOAD_SOUND.get(), SoundSource.NEUTRAL, 2.0F, 1.0F); playerIn.getCooldowns().addCooldown(this, 60); magazine = 6; } @Override public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand handIn) { ItemStack stack = player.getItemInHand(InteractionHand.MAIN_HAND); player.getCooldowns().addCooldown(this, 10); if(!level.isClientSide) { if (magazine > 0) { shoot(level, player); } else { reload(level, player); } } player.awardStat(Stats.ITEM_USED.get(this)); return InteractionResultHolder.sidedSuccess(stack, true); } private <E extends IAnimatable>PlayState predicate(AnimationEvent<E> event) { if (magazine > 0) { event.getController().setAnimation(new AnimationBuilder().addAnimation("caldwell_reload_anim", true)); return PlayState.CONTINUE; } else { return PlayState.STOP; } } Any help or points in the right direction are much appreciated!
  2. Thanks for responding, I joined the server and used the bot which fixed the SpriteRenderer method, but it couldn't find RenderingRegistry.
  3. Heya, So I'm trying to update from 1.16.5 to 1.18.2 and I'm trying to register an entity for a firearm using a method in the main, and two methods are coming up as errors: RenderingRegistry and SpriteRenderer. private void registerEntityModels(Supplier<Minecraft> minecraft) { ItemRenderer renderer = minecraft.get().getItemRenderer(); RenderingRegistry.registerEntityRenderingHandler(EntityTypeInit.COMPACT_BULLET_ENTITY.get(), (rendererManager) -> new SpriteRenderer<>(rendererManager, renderer)); } Any points in the right direction are much appreciated!
  4. Heya, I'm sure this is just a really silly error and I'm just missing it, but whenever I put my item in the desiccator container, it disappears if I exit the GUI for it. I'm not quite sure what I'm doing wrong. I followed a tutorial on it since I'm not yet well-versed in containers. Here's the code for the container Here's the code for the screen Here's the code for the tile entity Any help or points in the right direction are much appreciated!
  5. Heya, So I'm trying to create a desiccator block, and I have a GUI set up, but when I try to right click the block in-game, the game immediately crashes with this log. I'm not quite sure what I'm doing wrong. I followed a tutorial since this is my first time actually making a GUI and followed most of the steps to a T (except for some method name differences in the video and my version). If anyone is willing to take a look: Here is my DesiccatorBlock class Here is my DesiccatorTileEntity class Here is my DesiccatorContainer class Here is my DesiccatorScreen class Here is my TileEntityType registry: Any pointers as to what might be wrong are well appreciated!
  6. I'll try these solutions. Thanks Draco
  7. Heya, So, I'm trying to take strips of beef, which is considered a singular item, and place it on a campfire. Ideally, I would like it to produce 4 items of beef jerky, but I'm not quite sure how to do that. I tried typing out "count": 4 in the .json file below the cookingtime but that still produced a 1:1 output of beef jerky. Any tips or helpful points would be much appreciated!
  8. I got it to work with this! if (entities.size() > 0) { MagicItems.LOGGER.info("Creeper Alerted the bell!"); } Thanks so much for the help Diesie.
  9. Alright so that works, thank you very much, but I'm still having some trouble with the comparing of the getEntities to the alarm block's AABB. I just tested with @Override public void tick() { BlockPos pos = getBlockPos().below(3); AxisAlignedBB blockAABB = new AxisAlignedBB(pos).inflate(5, 5, 5); assert level != null; List<CreeperEntity> entities = level.getEntities (EntityType.CREEPER, blockAABB, Predicates.alwaysTrue()); if (entities.equals(blockAABB)) { MagicItems.LOGGER.info("Creeper Alerted the bell!"); } } But that's not doing anything in-game. I'm gonna look through and make sure I have the tile entity correctly set up with my block, just to make sure it's not some dumb error, but I don't think that if statement is doing the job.
  10. Sorry to continue pestering about this, but in the getEntities methods, there are two. I assume I'd have to use the one with 2 parameter, Entity and AABB because I don't see why I'd use a predicate if I'm not searching for some kind of condition in the creepers. If this is the case, is the Entity parameter the searcher or the searched? If it's the searcher, how can I set that to my block? If its the searched, I'm having trouble turning the creeper class to an Entity. Thanks for taking the time to help, I really do appreciate it.
  11. Oh I see, sorry I didn't see your reply to the last post. I'll use getEntities instead and see if that yields any better results
  12. Heya, So I'm trying to call the getNearbyEntities method to check for creepers in an AABB radius, though one of the parameters requires a LivingEntity, and I can't seem to bend the rules around to making a creeper into one. For context, this is for the creeper proximity alarm. Here's the tick method in the tile entity so far: @Override public void tick() { BlockPos pos = getBlockPos().below(3); LivingEntity creeper = ???; AxisAlignedBB blockAABB = new AxisAlignedBB(pos); AxisAlignedBB creeperPos = EntityType.CREEPER.getAABB (5.0, 2.0, 5.0); assert level != null; List<MobEntity> entities = Objects.requireNonNull(Objects.requireNonNull(level .getBlockEntity(pos)).getLevel()).getNearbyEntities (MobEntity.class, EntityPredicate.DEFAULT, creeper, creeperPos); /* Also might need help comparing the entities to the position of the block to make it ring, but that's a problem for later. */ if (entities.equals(blockAABB)) { MagicItems.LOGGER.info("Creeper Alerted the bell!"); } } Unless the LivingEntity parameter is supposed to be the source of the radius? Which in that case how can I make it my block? Any help would be appreciated!
  13. Heya, I'm currently working on a proximity alarm-type block where it's a placeable bell, and if a creeper walks under the bell, it rings. I have a tile entity all set up, but I'm currently having trouble getting the position of the creeper in order to compare it to the position range of the bell. Any help or points to the right direction will be greatly appreciated!
  14. Ah alright, thanks dude.
  15. Thank you so much! Though, what does # mean? I've never seen that before in Java lol
  16. Oh yeah sorry that's what I meant. I would like more blocks of the same type to duplicate from the source block. Thanks for pointing out the unclear point. I'll fix that in the main post.
  17. Heya, I'm trying to create a shield that you place on the ground and it quickly duplicates the source block and creates a 20x20 block wall (stopping at walls and other blocks and conforms to the shape.) I have a tile entity ready and am in the tick method right now but I'm having trouble figuring out what to type as to accomplish such a task. Any points in the right direction would be much appreciated! In the meantime, I'll be doing some digging myself to try and figure it out, though I can't think of another expanding block in Minecraft that I can reference for it. (Not an actual expanding block, just creating more of the same blocks for a certain range.)
  18. Thanks Diesie, I'll take a look at that.
  19. Heya, I'm trying to create a block that plays a sound when it detects a creeper within a certain proximity of it. The problem is that I'm not sure how to make an item do a certain thing when it detects an entity within a certain proximity of it. I'll be looking through the libraries for any leads, but in the mean time, any help or points in the right direction would be much appreciated!
  20. Heya, So I created a crop and have everything in order with it, however I'm trying to change it from the square shape that it uses, as all crops use, to the X shape that flowers use. How would I go about doing that? Any point in the right direction would be appreciated
  21. OH! I didn't even realize I had a line of code in there that made it required to be powered by redstone. I just got rid of that and everything is working mostly fine! I also switched the progress bar from the foreground to background changed the x and y on it, and its in the right place and shows up. The only problem is now that the progress bar cuts off at about 1/4 the way through, but I should be able to find and fix that. I'll also take a look at the getRecipe method for simplificaiton. Thank you so much for the help dude.
  22. Hey so sorry to bother again, but I registered it and everything and the recipe still isn't working for some reason. I was reading through the console and the only thing that looked like was wrong with the recipe is that it wasn't categorized, but I don't think that would completely negate the recipe. I updated the github to the most recent changes just in case I missed something else. Sorry for the trouble.
  23. Ohhh my god I totally missed that. Thanks for your help as always diesie.
  24. It basically means that 1 thing needs to go between those parentheses. If you ctrl+click DinoWorldBiomeProvider it will take you to that method and will show you what type of argument it requires and will give you an idea of what to put in there. Also yeah, you might wanna take a deeper look into java if you didn't know that, 'cause that's like 101 stuff.
×
×
  • Create New...

Important Information

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