Jump to content

SSilvamc

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by SSilvamc

  1. Doesn't seem to be what I'm looking for. Though this allows vanilla multiblocks and visualization, it doesn't include a master-slave relation between blocks.
  2. I'm trying to come up with a way to create multiblock structures where a controller block will be notified when any of the slave blocks in the structure is broken. Is it possible to do this using vanilla blocks as slaves? I've read a bit of the Tinkers' Construct approach to multiblocks, but part of its method uses TileEntities for every slave block. This means that it wouldn't be possible to use blocks without tile entities in the structure using this approach (for instance, using wooden planks as part of the building). To be more precise in what I'm looking for, I'm trying to transform buildings into multiblock structures. Inside the building there must be a controller block. Whenever any of the blocks of the structure is broken, the structure will lose health (which I guess would be stored in the TileEntity) and the broken block will come back to its place. When the structure's health reaches zero, it will be removed. What are some other approaches to multiblock structures that could work? What other mods use multiblock structures? Do any use vanilla blocks as slaves? Thanks
  3. I was using it with FallingBlockEntity. Then again, that class does not override onKillEntity, it just takes it from the Entity class. This was my code: This gets called whenever any entity is killed, but not when the player is killed. I'm using an IndirectEntityDamageSource because the onDeath method in LivingEntity (which is where the onKillEntity method is triggered; it's the only reference to such method in the code, apart from the one in ZombieEntity which turns villagers to zombie villagers) gets the entity causing the damage with getTrueSource(), and if I use a simple DamageSource, this is set to null (and the onKillEntity method is never called)
  4. The onKillEntity method seems to work with any entity, but it doesn't seem to be activated when a player dies. I figure I can get over this issue by using the LivingDeathEvent and checking whether the entity in question is a player, but i just want to know if this is an error or an intended feature (or, if there is another method I could use besides the event).
  5. That was the problem, thanks! I thought registering the EmpiresSetup class with the @SubscribeEvent functions would suffice, but apparently not. Added this to the main class constructor fixed it: MOD_EVENT_BUS.addListener(EmpiresSetup::setupCommon); MOD_EVENT_BUS.addListener(EmpiresSetup::setupClient);
  6. Crash report: Entity model: Entity renderer: Main class: Entity registry: Setup class:
  7. bump Figured I'd use one vector for the player's look, and then a second vector which is a scaling of the first based on the distance I want. This works in order to create a RayTraceResult for blocks, but how would I go about doing this on entities? Also, is ray tracing only client-side?
  8. I've seen some ways on how to go about doing this for extended sword reach (checks entities in surrounding AABB, checks if the length of the vector from the player's eye to an entity is within said range, checks the angle, then hits the entity). I found an example of this being applied in the Aether mod's source code (here) which with just a few changes works well in 1.15.2. The thing is, I was trying to think of another ways to make this work. For instance, I'd like to use the player's eyesight vector and ray trace from there to a certain length (say, 8 blocks' distance) and check if the ray hits an entity's bounding box. This way, I wouldn't need to check all the surrounding entities. Endermen use the canEntityBeSeen method, and that one draws a vector and checks that it doesn't collide with any blocks. The problem is, this method already knows the position of both the enderman in question and the player. One option was to use a method found in the Minecraft class, but of course, that would only work client-side. Also, by the way, is there any replacement for onEntitySwing on 1.15.2? I've been using onItemRightClick for now to test, but I want to check for entities using it (so a skeleton, for instance, can use it as a sword). Which method would I have to override?
  9. TL;DR: How can I make a block update data whenever one block of a specific list of blocks forming a structure updates? I have an idea for a structure that will store "health": it's a structure made of vanilla blocks (like, say, a villager house) that has a central controller. I want the controller to update its health data every time a player breaks one of the component blocks, but I don't know what approach I should take for this. One possibility is to create a multi block structure, with a controller and different parts (which would take many tile entities, and as far as I know, that's not very desirable), but this also gives me the problem of not using vanilla blocks. Of course, I could just make the multiblock parts take the vanilla textures, but that probably wouldn't be ideal. Is there a way to do this only using only one tile entity? How would I come about "marking" certain blocks around the controller so that they would send updates every time they're broken? Thanks!
  10. I want to play a sound when an item is picked up (EntityItemPickup), but only if a certain advancement has been already get. It seems I can use ServerPlayerEntity and get the advancements from there, with the help of AdvancementManager: PlayerEntity player = event.getPlayer(); World world = player.getEntityWorld(); AdvancementManager manager = new AdvancementManager(); if(world.isRemote){ boolean flag = ((ServerPlayerEntity) player).getAdvancements().getProgress(manager.getAdvancement(new ResourceLocation("minecraft:story/mine_diamond"))).isDone(); if(!flag){ #play the sound } } The flag doesn't seem to be working. How do I refer to the advancements of the client efficiently? Is this the correct way? Perhaps the resource location is not working- how do I get the correct resource? Alternatively, is there any event for when the player gets a specific achievement?
×
×
  • Create New...

Important Information

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