Luis_ST
Members-
Posts
5704 -
Joined
-
Last visited
-
Days Won
72
Everything posted by Luis_ST
-
if there is no way to prevent it then i try to create my own method that enchants the item
-
i know i just look at this methods but why i can get the an enchantment twice with the same level? and how do I prevent that? okay thats clear okay that's a mistake on my part -> int enchLevel = Math.min(enchantment.getMaxLevel(), rng.nextInt(5) + 1); will fix that
-
first the problem with two enchantments on the same tool: public static BasicTrade creatTradeEmeraldForEnchantedItem(Item item, int level, boolean allowTreasure, int tradeLevel) { int count = rng.nextInt(level + level) + level; ItemStack stack = new ItemStack(item); EnchantmentHelper.addRandomEnchantment(rng, stack, level, allowTreasure); return new BasicTrade(new ItemStack(Items.EMERALD, count), ItemStack.EMPTY, stack, 16, randomXp(tradeLevel), 0.2f); } second why i can add the protection Enchantment to a Sword? and third i can trade at the villager with the profession "enchanter" enchanted books with ench level 0 this is the way i creat books // i creat a list of Trades because when i use one trade i got every time the same Enchantment (it will reset when i start minecraft again public static List<BasicTrade> creatTradeEmeraldForEnchantedBookList(int size, int tradeLevel) { List<BasicTrade> trades = new ArrayList<>(); for (int i = 0; i < size; i++) { trades.add(enchantedBook(randomXp(tradeLevel))); } return trades; } private static BasicTrade enchantedBook(int xp) { ItemStack book = new ItemStack(Items.ENCHANTED_BOOK); List<Enchantment> enchantments = Registry.ENCHANTMENT.stream().filter((enchantment) -> { return !enchantment.isCurse(); }).collect(Collectors.toList()); Enchantment enchantment = enchantments.get(rng.nextInt(enchantments.size())); int enchLevel = Math.min(enchantment.getMaxLevel(), rng.nextInt(5)); EnchantedBookItem.addEnchantment(book, new EnchantmentData(enchantment, enchLevel)); int count = 2 + rng.nextInt(5 + enchLevel * 10) + 3 * enchLevel + 5; return new BasicTrade(new ItemStack(Items.EMERALD, count > 64 ? 64 : count), new ItemStack(Items.BOOK), book, 16, xp, 0.2f); }
-
Thanks now it work (sometimes im a bit lost when it comes to understanding things)
-
I created some enchantments in my mod. Then I checked whether my enchantments could be traded by my custom villager (profession) and found that there were some enchantments traded with incompactable enchantments, or several enchantments with the same level on a item. When I try to enchant the item with the enchant command, the normal vanilla error message comes up. But if I combine enchantment in the Amposs with a item that dosent sopport the enchantment it works with all Vanilla Enchantments, for example: i can enchant protection on a sword. Now my question is this a bug or is it because of the test version of Minecraft which use the IDE?
-
So if 0 is the wrong effect and then i have to use 1 but why it dosent work package net.luis.cave.blocks; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; public class TintedGlass extends Block { public TintedGlass() { super(Block.Properties.create(Material.ROCK) .zeroHardnessAndResistance() .sound(SoundType.GLASS) .notSolid()); } @Override public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos) { return 0.2f; } @Override public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) { return false; } @Override public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) { return 1; } @Override @SuppressWarnings("deprecation") public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) { return adjacentBlockState.isIn(this) ? true : super.isSideInvisible(state, adjacentBlockState, side); } }
-
okay i understand but if i understand this correctly i have to return 0. but when i set the value to 0 it dosent work and when i set it to 1 (for testing) it also dosent work
-
I think yes the int returned is the light going through the block so 0 will retrun no light through the block or is that wrong?
-
i just looked at it but is this not controlled by method propagatesSkylightDown beacause: and it dosent work. @Deprecated public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) { if (state.isOpaqueCube(worldIn, pos)) { return worldIn.getMaxLightLevel(); } else { return state.propagatesSkylightDown(worldIn, pos) ? 0 : 1; } } this is currently my block class: https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/blocks/TintedGlass.java
-
I just want to change the villager MerchantOffers when rightclickt with a custom item. So i creat this the offer will set but when i close the gui and open it again the offers will reset but why have i to save them? or is there something wrong/is there a better way to do this? @SubscribeEvent public static void EntityInteractSpecific(PlayerInteractEvent.EntityInteractSpecific event) { PlayerEntity player = event.getPlayer(); LivingEntity target = (LivingEntity) event.getTarget(); World world = event.getWorld(); if (target instanceof VillagerEntity) { VillagerEntity villager = (VillagerEntity) target; MerchantOffers offers = villager.getOffers(); MerchantOffers newOffers = new MerchantOffers(offers.write()); String uuid = villager.getUniqueID().toString().replace("-", ""); int uniqueInteger = Integer.parseInt(uniqueHex(uuid, 2), 16) / 10; player.sendMessage(new StringTextComponent("uniqueInteger: " + uniqueInteger), player.getUniqueID()); if (world.getDayTime() >= 3000 && world.getDayTime() <= 10000) { for (MerchantOffer merchantOffer : offers) { merchantOffer.resetUses(); } } if (player.getHeldItem(event.getHand()).getItem() == CaveItems.RUBY_APPLE.get()) { if (!player.abilities.isCreativeMode) { player.getHeldItem(event.getHand()).shrink(1); } for (MerchantOffer merchantOffer : newOffers) { player.sendMessage(new StringTextComponent("getSpecialPrice: " + merchantOffer.getSpecialPrice() * (-1)), player.getUniqueID()); ItemStack buyingStack = merchantOffer.getBuyingStackFirst(); ItemStack sellingStack = merchantOffer.getSellingStack(); if (buyingStack.getCount() > 1) { merchantOffer.setSpecialPrice(uniqueInteger * (-1)); } else if (sellingStack.getCount() > 1) { } } villager.setOffers(newOffers); } } }
-
thank that fine work there is no fill method
-
I just want to render a overlay (i have creat a spyglass likt that from 1.17) and now i want to render the Overlay this is the code of the event i used: @SubscribeEvent(priority = EventPriority.HIGHEST) public static void RenderSpyglassOverlay(RenderGameOverlayEvent event) { PlayerEntity player = Minecraft.getInstance().player; int posX = event.getWindow().getScaledWidth() / 2; int posY = event.getWindow().getScaledHeight() / 2; if (player.getActiveItemStack().getItem() == CaveItems.SPYGLASS.get()) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableAlphaTest(); Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("cave:textures/misc/spyglass_scope.png")); Minecraft.getInstance().ingameGUI.blit(event.getMatrixStack(), posX - 128, posY - 128, 0, 0, posX * 2, posY * 2, 256, 256); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); RenderSystem.enableAlphaTest(); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); } } but the overlay looks like this: https://drive.google.com/file/d/15llZaiIqNWK7WRqcihIJY7oaAszkFKnn/view?usp=sharing so my question: 1 .how to render the game overlay translucent 2. how to set the outside of the overlay to black
-
In that second I found out for myself but thanks
-
i just found this. now another question i test this: if (player.getActiveItemStack().getItem() == CaveItems.SPYGLASS.get()) and this in my Item Class but why it doesent work+ it always return air @Override public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) { player.setActiveHand(hand); return super.onItemRightClick(world, player, hand); }
-
Is there a way to set the FOV when a player use an item or creat a camera zoom
-
I want to creat a block wich is translucent but disable sky light through the block i just creat this: https://github.com/Luis-st/Forge-1.16.5-36.0.1-mdk/blob/main/forge-1.16.5-36.0.1-mdk/src/main/java/net/luis/cave/blocks/TintedGlass.java but when i stand in a cube of my glass there is a skylight:
-
but when i try this to set the weather to thunder ((ServerWorld) world).func_241113_a_(0, world.rand.nextInt(1000), true, true); i get an error: java.lang.ClassCastException: class net.minecraft.client.world.ClientWorld cannot be cast to class net.minecraft.world.server.ServerWorld (net.minecraft.client.world.ClientWorld and net.minecraft.world.server.ServerWorld are in unnamed module of loader cpw.mods.modlauncher.TransformingClassLoader @4cc36c19) at net.luis.cave.events.entity.OnEntityAttack.EntityAttack(OnEntityAttack.java:78) ~[main/:?] {re:classloading} at net.minecraftforge.eventbus.ASMEventHandler_17_OnEntityAttack_EntityAttack_LivingAttackEvent.invoke(.dynamic) ~[?:?] {} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {} at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:325) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.LivingEntity.attackEntityFrom(LivingEntity.java:991) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.passive.AnimalEntity.attackEntityFrom(AnimalEntity.java:80) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.player.PlayerEntity.attackTargetEntityWithCurrentItem(PlayerEntity.java:1167) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.multiplayer.PlayerController.attackEntity(PlayerController.java:373) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1343) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:1688) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1507) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:979) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {}
-
How to get the ServerWorld from a World in version 1.16.5. There was .getWorld to get the ServerWorld in the version 1.16.1 but how to do this in 1.16.5 ?
-
@kiou.23 if you konw json its the better way you also can overide the loot tables with a datapack so i think its the better way. and I didn't know that there was this possibility. but I'm open to new things.
-
i just tell you the best way i think is a loot table
-
so 1.16.5 dont need the NashornScriptEngineFactory
-
so i have to use 1.16.5 ?
-
a new mdk?
-
I had to reinstall my IDE because it got hung up, but now when I try to run client / server I get an error message: I had this error before the reason was the lib version of the project, because Java 15 removed the NashornScriptEngineFactory, I think, but the library of my project is version 1.8, I have already reimported the project, changed the java version but I get always the same error. Exception in thread "main" [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: java.lang.NoClassDefFoundError: jdk/nashorn/api/scripting/NashornScriptEngineFactory [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at net.minecraftforge.coremod.CoreModEngine.loadCoreMod(CoreModEngine.java:48) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at net.minecraftforge.coremod.CoreModProvider.addCoreMod(CoreModProvider.java:12) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:274) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at net.minecraftforge.fml.loading.LoadingModList.addCoreMods(LoadingModList.java:85) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at net.minecraftforge.fml.loading.moddiscovery.ModDiscoverer.discoverMods(ModDiscoverer.java:129) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at net.minecraftforge.fml.loading.FMLLoader.beginModScan(FMLLoader.java:215) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at net.minecraftforge.fml.loading.FMLServiceProvider.runScan(FMLServiceProvider.java:107) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at cpw.mods.modlauncher.TransformationServiceDecorator.runScan(TransformationServiceDecorator.java:114) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at cpw.mods.modlauncher.TransformationServicesHandler.lambda$runScanningTransformationServices$8(TransformationServicesHandler.java:115) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1766) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at cpw.mods.modlauncher.TransformationServicesHandler.runScanningTransformationServices(TransformationServicesHandler.java:116) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:63) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at cpw.mods.modlauncher.Launcher.run(Launcher.java:76) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1048]: at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1057]: Caused by: java.lang.ClassNotFoundException: jdk.nashorn.api.scripting.NashornScriptEngineFactory [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1057]: at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1057]: at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1057]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) [11:45:41] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1057]: ... 33 more