Jump to content

Anubis

Members
  • Posts

    39
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Anubis's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I know I can do this, but this not permanently. After next build with gradle, for example after forge update, I have to do it again. I would like to set it in the gradle or something, so it is always set after every build
  2. Using different projects simultaneously, sometimes to compare different aspects of the code or because of working on multiple at a time I allways have one Issue with eclipse: All launch files generated with gradle have the same name (runClient.launch etc.). And I can't figure out how to chance the name in the gradle without breaking them. You can add the mod name at the build.grade to the runs { client { part to set them run { client_modname { and this changes the name of the launchfile (runClient_modname) but eclipse then doesn't know the main class anymore and it is not usable anymore (resp. you have to put in the main class every time but then I can also change the launch file name afterwards, which is not the goal). Has anyone an idea what I can do? I normally don't do much with the gradle part, I am just happy it works. But the same name of the launch-file for all projects is very confusing some times and it would be quit helpful if I could change this. Thanks for reply
  3. I hope it is right in this way: https://github.com/AlmightyAnubis/Ore_Test
  4. If you are still interested, I uploaded the code to github: https://github.com/AlmightyAnubis/Crushing_Project Would be a great honor, if a expert like you will check for mistakes. Many things where I couldn't find a good answer in the internet and looked in the minecraft code to copy similar behavior, which resulted in botching in some cases I guess... But I know, that you have better thinks to do, so now problem if you don't have time for that. I deleted all the json files, because github forced me to 100 files upload limit. But many of them can be recovered with a run of runData
  5. Ok, I thanks. I will use setBlockState. The code was a bit older, so I don't know why I used notifyBlockUpdate, but I checked setBlockState and it seems to call notifyBlockUpdate finally to. It calls markAndNotifyBlock which calls notifyBlockUpdate after much more other logic. I like to prevent other logics and the the process time comes down. I think this is why I used notifyBlockUpdate in the first case. But when you say setBlockState is the better way, I will trust you. I work in 1.15, i don't know if there is a difference to other versions.
  6. Yes I know. My block has 2 states, weather it is working or not. See pictures below. The working state: The default state: The gui: The Gui in progress: The recipes have there own working time, so when you click the recipe you want, the work time is read from the recipe. Here is on example recipe: { "type": "crushing_project:lumbermilling", "ingredients": [ { "item": "crushing_project:throable_flint", "count": 2 } ], "result": "crushing_project:flint_and_flint", "count": 1, "crafttime": 50 } I don't use github at the moment, so posting wont help me so much, especially because my problems are solved. Thanks for the help.
  7. So, only call it on start an end of the crafting progress? Max work time is the end time and is include in the json of the recipe, the current work time is the time which is ticking and resets at the end. So while no recipe is executed, the current work time is 0 and the progress bar stays at 0%. And when recipe starts, the max work time is defined, so the scaling can be done with every recipe on its own.
  8. Ok, I remove the isRemote check in the tile entity. Now it works, but can this create any other issues?
  9. I created a tile entity, that can perform a crafting operation. Everything works as expected, but when I close the screen while working and open it after it has finished, the sceen shows the progress of when I closed the screen. Starting a new craftingoperation solves the problem, but this isn't right. I used the FunctionalIntReferenceHolder to keep track of the values of the tile entity, but I am not sure if this is the right way. Here is my code: The screen: private void drawProgress() { RenderSystem.color4f(1F, 1F, 1F, 1F); minecraft.getTextureManager().bindTexture(BACKGROUND); int up = 0; int left = xSize; int down = ySizeProgress; int currentTime = this.container.currentWorktime.get(); int maxTime = this.container.maxWorktime.get(); int right = (int) Math.round(xSizeProgress * currentTime / maxTime); int gui_grafic_size = 256; blit(guiLeft + 52, guiTop + 56, left, up, right, down, gui_grafic_size, gui_grafic_size); } The container: @Override public void init() { tileEntity.getInventory().ifPresent(handler -> { addSlot(new SlotItemHandler(handler, 0, 20, 76)); addSlot(new SlotItemHandler(handler, 1, 139, 76)); }); addPlayerInventory(8, 113); this.trackInt(currentWorktime = new FunctionalIntReferenceHolder(() -> ((FlintFactoryTile_Entity) this.tileEntity).currentWorkTime, v -> this.tileEntity.currentWorkTime = v)); this.trackInt(maxWorktime = new FunctionalIntReferenceHolder( () -> ((FlintFactoryTile_Entity) this.tileEntity).maxWorkTime, v -> this.tileEntity.maxWorkTime = v)); currentWorktime.get(); maxWorktime.get(); } And the tile entity ticking part: @Override public void tick() { boolean dirty = false; if (world != null && !this.world.isRemote) { boolean work = false; if (this.factoryinventory.isPresent()) { Inventory inventory = getinventoryasInventory(); Inventory inputinv = new Inventory(inventory.getStackInSlot(0)); Inventory outputinv = new Inventory(inventory.getStackInSlot(1)); if (this.selectedRecipe != null) { ItemStack output = this.selectedRecipe.getCraftingResult(inputinv); boolean flag = inputinv.getStackInSlot(0).getCount() >= this.selectedRecipe.getIngredientCount(); if(!flag) { this.selectedRecipe=null; currentWorkTime=0; } work = outputinv.isEmpty() && flag; if (!work) { ItemStack itemStack = outputinv.getStackInSlot(0); boolean equal = itemStack.isItemEqual(output); boolean fitting = itemStack.getMaxStackSize() >= output.getCount() + itemStack.getCount(); work = equal && fitting && flag; } if (work) { dirty = true; if (this.currentWorkTime < this.maxWorkTime) { this.currentWorkTime++; } else { this.currentWorkTime = 0; outputinv.addItem(output); this.selectedRecipe = null; this.factoryinventory.ifPresent(consumer -> { consumer.setStackInSlot(1, outputinv.getStackInSlot(0)); consumer.getStackInSlot(0).shrink(2); }); } } } } this.world.setBlockState(this.getPos(), this.getBlockState().with(FlintFactoryBlock.WORKING, work)); } if (dirty) { this.markDirty(); this.world.notifyBlockUpdate(this.pos, this.getBlockState(), this.getBlockState(), Constants.BlockFlags.BLOCK_UPDATE); } Thanks for help
  10. Maybe it was the hat and not the body or look vector from the LookRandomGoal. Now I used: Vec3d look =Vec3d.fromPitchYaw((float) Math.PI/2, this.entity.getRotationYawHead()); and it worked. Thanks for help
  11. public boolean shouldExecute() { if (eatTimer == 0 && entity.getIdleTime() > 100) { BlockPos pos = this.entity.getPosition(); float width = this.entity.getWidth()/2; Vec3d look = this.entity.getLookVec(); look = look.add(0, -look.y, 0); look = look.scale(width); pos = pos.add(round(look.x), 0, round(look.z)); if (entity.world instanceof ServerWorld) { ServerWorld world = (ServerWorld) entity.world; for (int i = -1; i <= 1; i++) { if (blocks.contains(world.getBlockState(pos.add(0, i, 0)).getBlock())) { eatPos = pos.add(0, i, 0); eatWorld = world; entityPos = entity.getPosition(); eatTimer = entityEatTime; entity.setIdleTime(0); return true; } } } } return false; } This is the should executemethode of the goal. The look-vector always stays the same, so the entity couldn't find the block to eat.
  12. I am not sure, but the entity model changed direction of look but the look vector didnt change... die he could only eat at one pos
  13. I created my own goal, similar to the eat gras goal of the sheep. But my entity is a bit larger, so I used the entity.getLookVec(); to get the direction it is looking and multiplied by half of the width. But the entity always only picked one block, so I tracked everything and it seem that the look random goal only changes the looking of the Entity client side, but not server side. Am I right or am I doing something wrong. And is there a way to get it serverside? I tried the entity.getLookController(), but this also didn't work. Anyone an Idea?
  14. Thanks for all. Sorry, I am no fan of cheating but I hate, when my PC is blocked for mc and I cant do other stuff like modding How can I close topic?
  15. Normally you can use F3 + T to reload resourses and keep the mouse clicked for using a cobble generator for example. But this requires mc to be focused and doesnt allow my computer to be used in an other context. I just want to allow my computer doing other stuff while simply breaking blocks in background. If the F3 + T combination is considert as cheating, then I am sorry for asking such questions her
×
×
  • Create New...

Important Information

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