Jump to content

ElTotisPro50

Members
  • Posts

    266
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ElTotisPro50

  1. oh shoot you are right i didnt mention the minecraft version, but ServerWorld serverWorld = null; String name = "CowDude"; Entity entity = serverWorld.getEntities(); //this line is giving an error that line of Entity entity = ... is not working(Incompatible types. Found: 'java.util.stream.Stream<net.minecraft.entity.Entity>', required: 'net.minecraft.entity.Entity') is saying i cant use Entity that i need to use Entity, wtf
  2. doesnt exist world.getEntities().getAllEntities (i think you put Level because it is un 1.17 but im in1.16.5) and how can i "avoid looping throught all entities"
  3. ok this should work: String name = "CowDude"; Entity entity = playerIn.getEntity(); if(entity.getName().equals(name)) { entity.setFire(5); } just 1 more thing, how do i get all entities in the world, this: Entity entity = playerIn.getEntity(); doesnt work for obvious and i cant find a world.getAllEntities or something like that Please is the only thing left
  4. is there a way to call a method for a entity for example: entity.hurt() but only for all entities with a specific name EXAMPLE: Entities affected(with name COW)= cow with name COW=yes creeper with name CoW=no player with name PL=no player with name COW=yes that "yes" is for affect all those entities(named COW) with a entity method
  5. ok, so HOW I HURT ALL ENTITIES WITH THE NAME CowDude(is saved in a string: String name = "" + entity.getCustomName();) example: String name = "" + entity.getCustomName(); if(entity.hasName == name) { hurt all entities with "name" }
  6. what do people mean by Something#something(for example what you said: Entity#hurt)
  7. i want to kill ANY entity with the CowDude name, not just cows or a specific entity, and i saved in a string the entity name with .getCustomName(), so once o have the name how can i kill the entities?
  8. so i have a String in my code with a name, for example(String name = "CowDude") and i have a entity with a nametag called "CowDude", so if i right click my item i want to kill all the entities named CowDude
  9. so i just need to know how to create a custom textfield in my screen gui
  10. now is showing correctly but is not printing anything in chat(before it worked and i only changed the height to 20 as you told me) public class ResearcherScreen extends ContainerScreen<ResearcherContainer> { private final ResourceLocation GUI = new ResourceLocation(TotisMod.MOD_ID, "textures/gui/researcher_gui.png"); public ResearcherScreen(ResearcherContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) { super(screenContainer, inv, titleIn); } private Button myButton; @Override public void init() { super.init(); buttons.clear(); this.addButton(new Button(66,60,103,20,new StringTextComponent("hola"),this::actionPerformed)); } public void actionPerformed(Button button) { if(button == myButton) { PlayerEntity player = Minecraft.getInstance().player; player.sendStatusMessage(new StringTextComponent("Button clicked"),false); } } @Override public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); this.renderHoveredTooltip(matrixStack, mouseX, mouseY); } @Override protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { RenderSystem.color4f(1f, 1f, 1f, 1f); this.minecraft.getTextureManager().bindTexture(GUI); int i = this.guiLeft; int j = this.guiTop; this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize); } }
  11. i created a GUI and the screen is render and working perfectly, but why THE FUCK my button is like this HAHAHA https://imgur.com/a/ofhWSiW public class ResearcherScreen extends ContainerScreen<ResearcherContainer> { private final ResourceLocation GUI = new ResourceLocation(TotisMod.MOD_ID, "textures/gui/researcher_gui.png"); public ResearcherScreen(ResearcherContainer screenContainer, PlayerInventory inv, ITextComponent titleIn) { super(screenContainer, inv, titleIn); } private Button myButton; @Override public void init() { super.init(); buttons.clear(); myButton = addButton(new Button(66,66,103,50,new TranslationTextComponent("hola"),this::actionPerformed)); } public void actionPerformed(Button button) { if(button == myButton) { PlayerEntity player = Minecraft.getInstance().player; player.sendStatusMessage(new StringTextComponent("Button clicked"),false); } } @Override public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { this.renderBackground(matrixStack); super.render(matrixStack, mouseX, mouseY, partialTicks); this.renderHoveredTooltip(matrixStack, mouseX, mouseY); } @Override protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) { RenderSystem.color4f(1f, 1f, 1f, 1f); this.minecraft.getTextureManager().bindTexture(GUI); int i = this.guiLeft; int j = this.guiTop; this.blit(matrixStack, i, j, 0, 0, this.xSize, this.ySize); } }
  12. come on is minecraft you can even change the physics(if you know everything about modding and programming) how could you change players camera, add animations, etc but you cant change the slime block :c
  13. no is there a way that my block doesnt stick to slime and slime doesnt stick to my block?? i saw some mods that do that(but the source code isnt available)
  14. no i dont want it to stick to slime/honey but it does at the 4 sides of the block, at the BOTTOM AND TOP it works correctly, nothing should stick to my block except the same block(as i wrote in the code) but apparently is ignoring the 4 sides of the block
  15. thats exactly what i did i told you that it works but only for the top and the bottom of the block(slime/honey doesnt stick to my block and for example stone sticks BUT ONLY FOR THE TOP AND THE BOTTOM), for the 4 sides of the block(north,south,west and east any block sticks) https://imgur.com/a/rGlm9Dq, i need a fix for it to work on all 6 sides(only works in 2 sides)
  16. ok this works exactly how it suposed to work but only at the top and the bottom of the block: @Override public boolean isStickyBlock(BlockState state) { return true; } @Override public boolean canStickTo(BlockState state, BlockState other) { if(other.getBlock() == Blocks.SLIME_BLOCK || other.getBlock() == Blocks.HONEY_BLOCK) return false; if(other.getBlock() == ModBlocks.SLIMEBLOCK_RED.get()) return true; return super.canStickTo(state, other); } if i put slime/honey at t he top or bottom of my block it doesnt stick and with a normal block it sticks, but at the 4 sides of the block it sticks to sticky blocks and normal blocks(in resume my block work but only at the top and the bottom) A EXAMPLE OF WHAT IM SAYING: https://imgur.com/a/rGlm9Dq
  17. kind of, i will make more slime blocks of all colors so they cant stick between them or between normal slime block or honey block
  18. if i do: return !other.isStickyBlock(); could it work?
  19. if i return false the block doesnt stick to anything
  20. oh god i made this and it works but is the opposite, is sticking to slime/honey but not to normal blocks @Override public boolean canStickTo(BlockState state, BlockState other) { if(other.getBlock() == Blocks.SLIME_BLOCK || other.getBlock() == Blocks.HONEY_BLOCK) return true; return other.isStickyBlock(); } i tried to return false: if(other.getBlock() == Blocks.SLIME_BLOCK || other.getBlock() == Blocks.HONEY_BLOCK) return true; or put != but nope, how do i invert this?? i cant put if(!other.getBlock)
  21. in canStickTo o made some combinations for the logic but none of them worked: if(state.getBlock() != Blocks.SLIME_BLOCK || state.getBlock() != Blocks.HONEY_BLOCK) return true; return state.isStickyBlock() || other.isStickyBlock(); if(state.getBlock() = Blocks.SLIME_BLOCK || state.getBlock() = Blocks.HONEY_BLOCK) return true; return state.isStickyBlock() || other.isStickyBlock(); if(state.getBlock() != Blocks.SLIME_BLOCK || state.getBlock() != Blocks.HONEY_BLOCK) return false; return state.isStickyBlock() || other.isStickyBlock(); if(state.getBlock() = Blocks.SLIME_BLOCK || state.getBlock() = Blocks.HONEY_BLOCK) return false; return state.isStickyBlock() || other.isStickyBlock(); i dont think the logic is different than this...
  22. ok i tried some shit and didnt work, isStickyBlock should be always true right?, so i returned true in there without any condition, but how do i get it work @Override public boolean isStickyBlock(BlockState state) { return true; } @Override public boolean canStickTo(BlockState state, BlockState other) { if(state.getBlock() == Blocks.SLIME_BLOCK || state.getBlock() == Blocks.HONEY_BLOCK) return false; return state.isStickyBlock() || other.isStickyBlock(); } it sticks to all blocks again, what should i do please just code quickly the answer
  23. ok i put "!=" operator in isStickyWork and now it sticks... but to every block and it supose to mean that it doesnt stick to slime or honey @Override public boolean isStickyBlock(BlockState state) { return state.getBlock() != Blocks.SLIME_BLOCK || state.getBlock() != Blocks.HONEY_BLOCK; } @Override public boolean canStickTo(BlockState state, BlockState other) { if(state.getBlock() == Blocks.SLIME_BLOCK || state.getBlock() == Blocks.HONEY_BLOCK) return false; return state.isStickyBlock() || other.isStickyBlock(); }
  24. I made a red slime block with all its properties, but mine isnt sticking to normal blocks or honey/slime blocks; i added 2 overrides(isStickyBlock and canStickTo) but is not changing anything and slime block and honey block doesnt have those 2 properties of stick bu them work public class RedSlimeBlock extends BreakableBlock { public RedSlimeBlock(Properties properties) { super(properties); } public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) { if (entityIn.isSuppressingBounce()) { super.onFallenUpon(worldIn, pos, entityIn, fallDistance); } else { entityIn.onLivingFall(fallDistance, 0.0F); } } /** * Called when an Entity lands on this Block. This method *must* update motionY because the entity will not do that * on its own */ public void onLanded(IBlockReader worldIn, Entity entityIn) { if (entityIn.isSuppressingBounce()) { super.onLanded(worldIn, entityIn); } else { this.bounceEntity(entityIn); } } @Override public boolean isStickyBlock(BlockState state) { return state.getBlock() == Blocks.SLIME_BLOCK || state.getBlock() == Blocks.HONEY_BLOCK; } @Override public boolean canStickTo(BlockState state, BlockState other) { if(state.getBlock() == Blocks.SLIME_BLOCK || state.getBlock() == Blocks.HONEY_BLOCK) return false; return state.isStickyBlock() || other.isStickyBlock(); } private void bounceEntity(Entity entity) { Vector3d vector3d = entity.getMotion(); if (vector3d.y < 0.0D) { double d0 = entity instanceof LivingEntity ? 1.0D : 0.8D; entity.setMotion(vector3d.x, -vector3d.y * d0, vector3d.z); } } /** * Called when the given entity walks on this Block */ public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) { double d0 = Math.abs(entityIn.getMotion().y); if (d0 < 0.1D && !entityIn.isSteppingCarefully()) { double d1 = 0.4D + d0 * 0.2D; entityIn.setMotion(entityIn.getMotion().mul(d1, 1.0D, d1)); } super.onEntityWalk(worldIn, pos, entityIn); } }
  25. how do i make the same block has 2 models for all 4 rotations? i think thats was what you mean
×
×
  • Create New...

Important Information

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