Jump to content

[1.16] Creating a W value alongside X, Y, and Z


BliX5

Recommended Posts

I'm developing a Minecraft 4th dimension concept mod, so I'm starting by adding a W value (trength) that the game can take into account when generating and rendering blocks, or at least make it show up on the F3 screen. I just wanted to know if this was possible, and where I should even start to look into how I could implement this in my mod. 

Link to comment
Share on other sites

40 minutes ago, B3tcha said:

What would the difference be between a w cord and the World dimension as I feel it already is very hard to miss if you are in overworld or the end?

I'm not making a mod between the normal Minecraft dimensions, but the mod will generate 60 million different alternate versions of your normal world, with many things slightly different, which is why I need a W value. It's kind of complex

Link to comment
Share on other sites

That's basically dimensions.

Also, no computer would be able to run 60 million dimensions at once.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1 minute ago, Draco18s said:

That's basically dimensions.

Also, no computer would be able to run 60 million dimensions at once.

I don't think you understand. The computer doesn't run all 60 million dimensions at once, just like how a computer doesn't run all 60 million by 60 million blocks in the world at once. It will use the seed and each 60 million W values to generate new terrain in a certain distance from the player, which will probably be 10 chunks. There will definitely be a performance drop, but nothing too severe, maybe only twice the load. 

Also, what I'm making is not normal Minecraft dimensions. It's naturally generating the same world multiple times except with one more variable when generating, which will create a W axis with 60 million blocks. There will be two keys to press on the keyboard to move left and right across this axis, and as you do so, the world will deform just slightly. Rivers may change shape; mountains and valleys may shrink or grow; and forests, lakes, oceans, vegetation, and biomes may also do the same, therefore becoming 3D instead of 2D including the W axis. Structures will get larger and smaller as well depending on your W axis. Try researching into a 4th dimension concept to understand it better. This video perfectly describes it, except that game is in a small, enclosed space, while Minecraft is much larger. 

9 minutes ago, B3tcha said:

Then its a -p cord for parallel is it not?

 

?

Link to comment
Share on other sites

I understand what you mean, its kinda something like shifting between differents planes of existance, where things might change slightly from plane to plane. I suppose when you press your key that moves across the "W" axis you would need to manually recreate the chunks in a certain radius around the player taking into account the elements that were contained into the chunk and applying the new generation accordingly, though the performance would drop critically and i am not sure you would be able to achieve all the modifications you listed above, for example the structures one.

Probably there are better ways to do that (if it is even possibile to do that)? But to me this sound like a very difficult thing to achieve without changing the inner core workings of minecraf itself

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

9 hours ago, BliX5 said:

It will use the seed and each 60 million W values to generate new terrain in a certain distance from the player, which will probably be 10 chunks. There will definitely be a performance drop, but nothing too severe, maybe only twice the load

I don't think you understand the math involved here.

 

Area of a circle:

πr^2

Volume of a sphere:

4/3 πr^3

 

Plugging "5" in as our chunk radius...

Circe: 78

Sphere: 523

 

And I know what Miegakure is, and they've been working on it for literally decades, you're not going to achieve something similar in Minecraft in only a few weeks. Especially if you want to let the player rotate their view in such a way to swap one of X/Z for W.

 

I also don't know how you're going to generate "the same world, but actually not" because that's not how Minecraft seeds work. Even the Miegakure folks don't have a 4D model editor.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1 hour ago, Draco18s said:

Plugging "5" in as our chunk radius...

Circe: 78

Sphere: 523

Since it's 4D projected into 3D, the entire area of generation won't be projected at once, so the load will maybe be more than twice, but not as much as you would think. 

1 hour ago, Draco18s said:

And I know what Miegakure is, and they've been working on it for literally decades, you're not going to achieve something similar in Minecraft in only a few weeks. Especially if you want to let the player rotate their view in such a way to swap one of X/Z for W.

I didn't say, making the mod would take a few weeks. It could take a year. All I'm saying is Miegakure was a useful resource in making the mod concept. Also, a lot of the time making Miegakure was probably spent on the levels and their 4D counterparts, especially since everything is those levels were made from scratch, while Minecraft should do it instantly. Also, in Miegakure, objects aren't blocks, they're 3d models. Blocks are a lot easier to work with when switching between 4 dimensions because (with enough time) you could possibly make some algorithm that finds different planes around a changing block to deform accordingly. 

As for the rotation, I have an idea to have all of the axes visible, as well as the W, but that's not important right now. 

 

7 hours ago, Beethoven92 said:

Probably there are better ways to do that (if it is even possibile to do that)? But to me this sound like a very difficult thing to achieve without changing the inner core workings of minecraf itself

I'm not sure if this is possible, which is one of the reasons I asked this question here in the first place. 

Link to comment
Share on other sites

13 minutes ago, BliX5 said:

It could take a year.

It too me a year to make a standard mod that did things that Minecraft and Forge already supported. You're doing something that requires completely rewriting whole swaths of the codebase to do something it doesn't already do.

 

15 minutes ago, BliX5 said:

while Minecraft should do it instantly.

No.

No it will not. Minecraft's world generation system is not in any way set up to handle 4D terrain in a sensible manner. Yes it is "just cubes" but no, there is not some "easy to write" code that will do what you want. And you're going to need to write that code yourself.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Here's my dumb rotation diagram idea:eeeee.thumb.png.b59a9d128a76817c0a7c9c98fd28f7cc.png

I don't know how long this thing will take me and I don't even think I'll finish it. If it requires a good PC, then that's fine because the mod is just for me and my friends anyways. I'll just do some research on displaying a value on the F3 screen

Link to comment
Share on other sites

A fourth dimensional concept is problematic for many reasons. You would almost need to rip out all physics handled by minecraft to write a custom engine that can handle all the data properly. Graphics-wise, yes, the computations would be the same in regular world movement. However, transition spaces would cause a terrible amount of lag as chunks would be loaded and unloaded and drawn every time you move along this axis. This is not even to discount the fact that Draco is completely right on the math there. In three dimensional space, all you have to is load a circle of the required information. Four dimensional space requires a sphere to be loaded at all times which is a dramatic increase.

 

For reference, there is no nth-dimensional tool out there for rendering or physics. Closest that's been achieved is through 4d Toys, and that barely meets that requirement. It would take an expert in either field upwards of about 10 years to get a semi-efficient concept working well with current day technology. A non-euclidean environment in minecraft would take less time and work much more efficiently and that requires a good amount of work too.

 

You can attempt to make one, but you're better off writing an entirely new game instead.

Link to comment
Share on other sites

2 hours ago, ChampionAsh5357 said:

For reference, there is no nth-dimensional tool out there for rendering or physics. Closest that's been achieved is through 4d Toys, and that barely meets that requirement. It would take an expert in either field upwards of about 10 years to get a semi-efficient concept working well with current day technology.

4D toys was made by the same guy as Miegakure, he published a paper about it, and had it accepted to SIGGRAPH within the last year, and oh yes, it took him 10 years. 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

  • 1 month later...

I know this topic is kinda dead, but I wanted to bring a different way to implement this mod. I'm removing all of my ideas before as well. 

 

Each W value can be a dimension, and this may sound extremely CPU-intensive, but there is a solution. 60,000,000 total dimensions is possible. Granted, the player won't be going through every single dimension, just as the player doesn't go through every single Minecraft chunk. The game doesn't register every dimension on startup, but it generates these dimensions like chunks. Take Minecraft's April Fools snapshot from this year. You can write anything in a book and chuck it into a portal, and as soon as you jump through, it generates a completely random dimension. If I could come up with some method to make a 3D biome map and I just made every generated dimension a new overworld, this could be possible, of course with some major tweaks to structures and mob AIs. 

The gameplay will act similar to Miegakure's, so instead of clicking two buttons to move left and right across the W axis, there are two buttons to rotate left and right, or rather, ana and kata. I'm still deciding whether I should make the rotation a full 360 degrees or just 4 selections of rotation: XYZ, WYZ, XWZ, and XYW. A 360 degree rotation function would have a mix of all the values depending on how long the player holds each button for. While I don't entirely know how the splicing of dimensions will be done, I'm sure there's some way to do this. 

While this idea is most likely nearly impossible for Forge, I'm not dropping the concept just yet. I've been working with datapacks recently, and since dimensions are written in json now, most of these concepts will be performed via a datapack. 

For now, the rendering is the least of my worries. 

 

I'm not giving up on this concept, and I'm not dropping any of these ideas unless anyone has any better method, which is likely the case. 

Link to comment
Share on other sites

6 hours ago, BliX5 said:

While I don't entirely know how the splicing of dimensions will be done, I'm sure there's some way to do this. 

The Miegakure team had to write a custom rendering engine for it.

Have fun.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • 마에바시 이발소 카카오톡 〓BCGAME88·COM♤ 마에바시 이발소 새주소 월드컵 마에바시 이발소 위치 야구 이발소 추천 수구 이발소 오픈채팅[본사문의 텔레 @JBOX7] 마에바시 이발소 시스템 사이클 마에바시 이발소 업소모집 멀리뛰기 이발소 모임 정보 쇼트트랙 이발소 틱톡[총판문의 카톡 JBOX7] 마에바시 이발소 리조트 창던지기 마에바시 이발소 야동 펜싱 이발소 총판 럭비 이발소 오픈채팅[각종 오피 커뮤니티 제작] 마에바시 이발소 동영상 스키 마에바시 이발소 동영상 멀리뛰기 이발소 동영상 역도 이발소 방송[마케팅문의] 마에바시 이발소 동호회 택견 마에바시 이발소 트위터 멀리뛰기 이발소 구인광고 창던지기 이발소 구인광고 [카지노본사] 마에바시 이발소 인스타그램 스키 마에바시 이발소 인스타그램 보트경기 이발소 모임 정보 농구 이발소 총판 [스포츠본사] 마에바시 이발소 틱톡 배구 마에바시 이발소 위치 택견 이발소 방송 유도 이발소 추천[토토본사 문의] 마에바시 이발소 최신주소 하키 마에바시 이발소 이야기 테니스 이발소 여행 스키 이발소 링크 [토토총판 구매] 마에바시 이발소 오픈채팅 철봉 마에바시 이발소 접속 농구 이발소 위치 럭비 이발소 최신주소[카지노총판] 마에바시 이발소 오픈채팅 유도 마에바시 이발소 최신주소 씨름 이발소 주소 킥복싱 이발소 틱톡[야마토본사] 마에바시 이발소 이야기 펜싱 마에바시 이발소 동호회 피겨 이발소 영상 골프 이발소 동영상[바카라총판] 마에바시 이발소 방송 테니스 마에바시 이발소 하는곳 쇼트트랙 이발소 트위터 보치아 이발소 이야기[경마총판] 마에바시 이발소 총판 창던지기 마에바시 이발소 야동 라켓볼 이발소 트위터 창던지기 이발소 최신주소[BCGAME 비씨게임 총판문의]알림 설정 추천 구독 좋아요
    • 2023(2024 Remidial Admission Form for Ritman University, Ikot Ekpene, Pre degree/Direct-Entry form ☎️08039816237 OR {2348039816237} JUPEB Form, Postgraduate Form,Pre-Degree Form (08039816237, Jupeb form IJMB Form, masters form,Ph.D Form,Sandwich Form,Diploma Form,Change of institution form,Part-Time call (08039816237 OR {08039816237} Change of course Form,POST UTME Form.
    • I don't know why my entity can attack any entity but players This is the entity's code package mymod.entities.chicken; import com.google.common.collect.ImmutableList; import com.google.errorprone.annotations.Immutable; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.stats.Stats; import net.minecraft.util.RandomSource; import net.minecraft.util.TimeUtil; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.*; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.ai.goal.*; import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.ai.goal.target.ResetUniversalAngerTargetGoal; import net.minecraft.world.entity.animal.*; import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import oshi.util.tuples.Pair; import mymod._Entities; import mymod._EntityDataSerializers; import mymod._Items; import mymod._Sounds; import mymod.ai.ZombieAttackChickenEggGoal; import mymod.entities.BredWithMobStorable; import mymod.util.delayedtask.DelayedTask; import mymod.util.delayedtask.DelayedTasksHolder; import java.util.EnumSet; import java.util.Optional; import java.util.UUID; import java.util.function.Supplier; public class Rooster extends AbstractChicken implements NeutralMob, BredWithMobStorable, DelayedTasksHolder<Rooster> { private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(60, 1800); private int remainingPersistentAngerTime; private UUID persistentAngerTarget; private boolean crowing; private int crowTicks; private int diggingAnimTicks; private int featherDropCoolDown; private static final EntityDataAccessor<FourFeathers> DATA_FEATHERS = SynchedEntityData.defineId(Rooster.class, _EntityDataSerializers.ROOSTER_FEATHERS.get()); private static final EntityDataAccessor<Optional<UUID>> DATA_MOB_BRED_WITH = SynchedEntityData.defineId(Rooster.class, EntityDataSerializers.OPTIONAL_UUID); public Rooster(EntityType<? extends Rooster> entityType, Level world) { super(entityType, world); } @Override public int getRemainingPersistentAngerTime() { return remainingPersistentAngerTime; } @Override public void setRemainingPersistentAngerTime(int remainingPersistentAngerTime) { this.remainingPersistentAngerTime = remainingPersistentAngerTime; } @Nullable @Override public UUID getPersistentAngerTarget() { return persistentAngerTarget; } @Override public void setPersistentAngerTarget(@Nullable UUID persistentAngerTarget) { this.persistentAngerTarget = persistentAngerTarget; } @Override public void startPersistentAngerTimer() { setRemainingPersistentAngerTime(PERSISTENT_ANGER_TIME.sample(random)); } @Override protected void defineSynchedData() { super.defineSynchedData(); entityData.define(DATA_FEATHERS, new FourFeathers((byte) random.nextInt(3), (byte) random.nextInt(3), (byte) random.nextInt(3), (byte) random.nextInt(3))); entityData.define(DATA_MOB_BRED_WITH, Optional.empty()); } public FourFeathers getFeatherData() { return entityData.get(DATA_FEATHERS); } public void setFeatherData(FourFeathers featherData) { entityData.set(DATA_FEATHERS, featherData); } @Override public void addAdditionalSaveData(@NotNull CompoundTag nbt) { super.addAdditionalSaveData(nbt); addPersistentAngerSaveData(nbt); nbt.put("FeatherData", getFeatherData().writeTag()); nbt.putBoolean("isCrowing", crowing); } @Override public void readAdditionalSaveData(@NotNull CompoundTag nbt) { super.readAdditionalSaveData(nbt); readPersistentAngerSaveData(level(), nbt); if (nbt.contains("FeatherData", Tag.TAG_COMPOUND)) setFeatherData(FourFeathers.readTag(nbt.getCompound("FeatherData"))); else setFeatherData(FourFeathers.NONE); crowing = nbt.contains("isCrowing", Tag.TAG_BYTE) && nbt.getBoolean("isCrowing"); } @Override protected void registerGoals() { goalSelector.addGoal(0, new FloatGoal(this)); goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.4, true)); // I even have a MeleeAttackGoal, rooster just runs to player but not hurting him goalSelector.addGoal(1, new RoosterRandomTryFindFoodGoal()); goalSelector.addGoal(2, new RoosterBreedGoal()); goalSelector.addGoal(3, new TemptGoal(this, 1, FOOD_ITEMS, false)); goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1)); goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6)); goalSelector.addGoal(7, new RandomLookAroundGoal(this)); targetSelector.addGoal(4, new RoosterRandomAttackNearbyRoosterGoal()); targetSelector.addGoal(1, new NearestAttackableTargetGoal<>(this, LivingEntity.class, true, entity -> entity instanceof Fox || (entity instanceof Ocelot ocelot && !ocelot.isBaby()) || (entity instanceof Cat cat && !cat.isBaby() && !cat.isTame()) || (entity instanceof Zombie zombie && zombie.goalSelector .getRunningGoals().anyMatch(wrappedGoal -> wrappedGoal.getGoal() instanceof ZombieAttackChickenEggGoal)) || isAngryAt(entity))); targetSelector.addGoal(2, new HurtByTargetGoal(this)); targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, false)); } @Override public void setMobBredWith(@Nullable UUID uuid) { entityData.set(DATA_MOB_BRED_WITH, Optional.ofNullable(uuid)); } @Override @Nullable public UUID getMobBredWith() { return entityData.get(DATA_MOB_BRED_WITH).orElse(null); } // Goals class RoosterRandomAttackNearbyRoosterGoal extends NearestAttackableTargetGoal<Rooster> { RoosterRandomAttackNearbyRoosterGoal() { super(Rooster.this, Rooster.class, true); } @Override public boolean canUse() { return super.canUse() && random.nextInt(300) == 0; } @Override public boolean canContinueToUse() { return super.canContinueToUse() && mob.getLastHurtMob() != targetMob; } } class RoosterBreedGoal extends BreedGoal { RoosterBreedGoal() { super(Rooster.this, 1, Chicken.class); } @Override protected void breed() { ServerPlayer serverplayer = animal.getLoveCause(); if (serverplayer == null && this.partner.getLoveCause() != null) { serverplayer = this.partner.getLoveCause(); } if (serverplayer != null) { serverplayer.awardStat(Stats.ANIMALS_BRED); CriteriaTriggers.BRED_ANIMALS.trigger(serverplayer, this.animal, this.partner, null); } ((BredWithMobStorable) partner).setMobBredWith(animal.getUUID()); ((BredWithMobStorable) animal).setMobBredWith(partner.getUUID()); animal.setAge(6000); partner.setAge(6000); animal.resetLove(); partner.resetLove(); RandomSource randomsource = animal.getRandom(); if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomsource.nextInt(7) + 1)); } } } private static final DelayedTask<Rooster> CROW_LATER = new DelayedTask<>(30) { @Override protected void execute() { entity.crow(); } }; private static final DelayedTask<Rooster> ANGRY_CLUCK_LATER = new DelayedTask<>(30) { @Override protected void execute() { entity.playSound(_Sounds.ROOSTER_ANGRY_CLUCK.get()); } }; @Override public ImmutableList<DelayedTask<Rooster>> getTasks() { return ImmutableList.of(CROW_LATER, ANGRY_CLUCK_LATER); } class RoosterRandomTryFindFoodGoal extends Goal { private final Rooster rooster; private int tickCount; private int maxTickCount; private int lastDugTicks; private int roosterLastHurtByMobTimestamp; private double lookAtXOld, lookAtYOld, lookAtZOld; private Vec3 pos; private boolean didEndSuccessfully; private Vec3 lookingAtPos; private static final UniformInt POSSIBLE_MAX_TICK_COUNT = TimeUtil.rangeOfSeconds(4, 10); RoosterRandomTryFindFoodGoal() { super(); this.rooster = Rooster.this; setFlags(EnumSet.of(Flag.LOOK)); } @Override public boolean canUse() { return (isStandingOn(Blocks.GRASS_BLOCK) || isStandingOn(Blocks.DIRT) || isStandingOn(Blocks.PODZOL)) && rooster.random.nextInt(3000) == 20; } @Override public boolean canContinueToUse() { if (rooster.getLastHurtByMobTimestamp() != roosterLastHurtByMobTimestamp) { didEndSuccessfully = false; return false; } else if (tickCount >= maxTickCount) { didEndSuccessfully = true; return false; } return true; } @Override public boolean requiresUpdateEveryTick() { return true; } @Override public void start() { lastDugTicks = 20; roosterLastHurtByMobTimestamp = rooster.getLastHurtByMobTimestamp(); lookAtXOld = rooster.getLookControl().getWantedX(); lookAtYOld = rooster.getLookControl().getWantedY(); lookAtZOld = rooster.getLookControl().getWantedZ(); pos = new Vec3(rooster.position().toVector3f()); lookingAtPos = rooster.position().subtract(0, 1, 0); rooster.getLookControl().setLookAt(lookingAtPos); maxTickCount = POSSIBLE_MAX_TICK_COUNT.sample(rooster.random); } @Override public void stop() { rooster.getLookControl().setLookAt(lookAtXOld, lookAtYOld, lookAtZOld); if (didEndSuccessfully) { int resultItemPercentage = rooster.random.nextInt(100); if (resultItemPercentage <= 1) { rooster.spawnAtLocation(Items.DIAMOND, -1); Rooster.ANGRY_CLUCK_LATER.startExecution(rooster); } else if (resultItemPercentage <= 5) { rooster.spawnAtLocation(Items.GOLD_NUGGET, -1); Rooster.ANGRY_CLUCK_LATER.startExecution(rooster); } else if (resultItemPercentage <= 20) { Rooster.ANGRY_CLUCK_LATER.startExecution(rooster); } else { rooster.spawnAtLocation(FOOD_ITEMS.getItems()[rooster.random.nextInt( FOOD_ITEMS.getItems().length)], -1); Rooster.CROW_LATER.startExecution(rooster); } } } @Override public void tick() { ++tickCount; rooster.getLookControl().setLookAt(lookingAtPos); rooster.getMoveControl().setWantedPosition(pos.x, pos.y, pos.z, rooster.getMoveControl().getSpeedModifier()); if (lastDugTicks <= 0) { lastDugTicks = 20; rooster.diggingAnimTicks = 10; rooster.playSound(rooster.level().getBlockState(rooster.blockPosition().below()) .getSoundType(rooster.level(), rooster.blockPosition().below(), rooster) .getHitSound()); } else lastDugTicks--; } private boolean isStandingOn(Block block) { return rooster.level().getBlockState(rooster.blockPosition().below()).is(block); } } // Feather data storage @Immutable public record FourFeathers(@NotNull FeatherType first, @NotNull FeatherType second, @NotNull FeatherType third, @NotNull FeatherType forth) { public static final FourFeathers NONE = new FourFeathers(FeatherType.NONE, FeatherType.NONE, FeatherType.NONE, FeatherType.NONE); public FourFeathers(byte first, byte second, byte third, byte forth) { this(FeatherType.fromByte(first), FeatherType.fromByte(second), FeatherType.fromByte(third), FeatherType.fromByte(forth)); } public @NotNull Pair<ItemStack, FourFeathers> removeRandom(RandomSource randomSource) { if (NONE.equals(this)) return new Pair<>(ItemStack.EMPTY, this); int randomNum = randomSource.nextInt(4); while (get(randomNum) == null) randomNum = randomSource.nextInt(4); ItemStack retVal0 = get(randomNum).getDefaultInstance(); FourFeathers retVal1 = switch (randomNum) { case 0 -> new FourFeathers(FeatherType.NONE, second, third, forth); case 1 -> new FourFeathers(first, FeatherType.NONE, third, forth); case 2 -> new FourFeathers(first, second, FeatherType.NONE, forth); case 3 -> new FourFeathers(first, second, third, FeatherType.NONE); default -> null; // unreachable }; return new Pair<>(retVal0, retVal1); } @Nullable public Item get(int i) { return (switch (i) { case 0 -> first; case 1 -> second; case 2 -> third; case 3 -> forth; default -> throw new IllegalStateException("Unexpected value: " + i); }).asItem(); } // NBT Utils @NotNull public CompoundTag writeTag() { CompoundTag nbt = new CompoundTag(); nbt.putString("first", first.name().toLowerCase()); nbt.putString("second", second.name().toLowerCase()); nbt.putString("third", third.name().toLowerCase()); nbt.putString("forth", forth.name().toLowerCase()); return nbt; } @NotNull public static FourFeathers readTag(@NotNull CompoundTag nbt) { return new FourFeathers(tryRead(nbt, "first"), tryRead(nbt, "second"), tryRead(nbt, "third"), tryRead(nbt, "forth")); } private static FeatherType tryRead(CompoundTag tag, String toRead) { if (tag.contains(toRead, Tag.TAG_STRING)) { try { return FeatherType.valueOf(tag.getString(toRead).toUpperCase()); } catch (IllegalArgumentException e) { return FeatherType.NONE; } } return FeatherType.NONE; } } public enum FeatherType implements ItemLike { RED(_Items.RED_FEATHER, (byte) 0), YELLOW(_Items.YELLOW_FEATHER, (byte) 1), GREEN(_Items.GREEN_FEATHER, (byte) 2), BLUE(_Items.BLUE_FEATHER, (byte) 3), NONE(() -> null, (byte) -1); private final Supplier<Item> itemSup; private final byte byteVal; FeatherType(Supplier<Item> itemSup, byte byteVal) { this.itemSup = itemSup; this.byteVal = byteVal; } public static FeatherType fromByte(byte item) { return switch (item) { case -1 -> NONE; case 0 -> RED; case 1 -> YELLOW; case 2 -> GREEN; case 3 -> BLUE; default -> throw new IllegalArgumentException("item: " + item); }; } @Override public @Nullable Item asItem() { return itemSup.get(); } public byte asByte() { return byteVal; } } // Sounds @Override protected SoundEvent getAmbientSound() { return _Sounds.ROOSTER_AMBIENT.get(); } @Override protected SoundEvent getHurtSound(@NotNull DamageSource damageSource) { return _Sounds.ROOSTER_HURT.get(); } @Override protected SoundEvent getDeathSound() { return _Sounds.ROOSTER_DEATH.get(); } public static AttributeSupplier.Builder createAttributes() { // Maybe something's missing here? return createMobAttributes() .add(Attributes.ATTACK_DAMAGE, 2) .add(Attributes.MAX_HEALTH, 8) .add(Attributes.MOVEMENT_SPEED, .3); } @Override public boolean isBaby() { return false; } @Override public boolean canMate(@NotNull Animal other) { if (this == other) return false; else if (!(other instanceof Chicken)) return false; else return isInLove() && other.isInLove(); } @Override protected void doAIStep() { if (!level().isClientSide) { updatePersistentAnger((ServerLevel) level(), true); } } @Override public void setBaby(boolean baby) { if (baby) { Chick me = convertTo(_Entities.CHICK.get(), false); if (me != null) { me.setBoy(true); } } } @Override public @NotNull InteractionResult mobInteract(@NotNull Player player, @NotNull InteractionHand hand) { if (isFood(player.getItemInHand(hand))) { return super.mobInteract(player, hand); } else if (player.getItemInHand(hand) == ItemStack.EMPTY) { dropFeather(player); return InteractionResult.CONSUME; } return InteractionResult.PASS; } private void dropFeather(LivingEntity target) { Pair<ItemStack, FourFeathers> resFeathers = getFeatherData().removeRandom(random); setFeatherData(resFeathers.getB()); if (resFeathers.getA() != null && featherDropCoolDown == 0) { spawnAtLocation(resFeathers.getA()); playSound(SoundEvents.ITEM_PICKUP); setTarget(target); featherDropCoolDown = random.nextIntBetweenInclusive(20, 30); } } @Override public void setTarget(@Nullable LivingEntity target) { super.setTarget(target); if (target != null) { setPersistentAngerTarget(target.getUUID()); startPersistentAngerTimer(); } } public void crow() { if (!crowing) { crowing = true; crowTicks = 70; var lookControl = getLookControl(); lookControl.setLookAt(lookControl.getWantedX(), position().y + .2, lookControl.getWantedZ()); playSound(_Sounds.ROOSTER_CROW.get()); level().getEntitiesOfClass(Chicken.class, getBoundingBox().inflate(20)) .forEach(chicken -> chicken.setTarget(this)); } } public boolean isCrowing() { return crowing; } @Override public void tick() { super.tick(); if (!level().isClientSide) { if (level().getDayTime() == 0L || level().getDayTime() % 24000L == 13000L) crow(); } if (crowing && --crowTicks <= 0) { crowing = false; } if (diggingAnimTicks > 0) --diggingAnimTicks; if (featherDropCoolDown > 0) --featherDropCoolDown; tickTasks(); } public int getDiggingAnimTicks() { return diggingAnimTicks; } @Override public boolean isBoy() { return true; } }  
    • 동남아 홀덤 단톡방☜BCGAME88·COM▩ 세네갈 홀덤 방송 동남아 크라운카지노 홀덤 전략 [본사문의 텔레 JBOX7]동남아 홀덤 ◑ª 본사 남아프리카 홀덤 동영상 동남아 영국 동남아 홀덤 영상 [총판문의 카톡 JBOX7]동남아 홀덤 ㈜▼ 총판 코소보 홀덤 업체 동남아 포르투갈 동남아 홀덤 투어 [각종 오피 커뮤니티 제작]동남아 홀덤 †♡ 놀이터 모나코 홀덤 전략 동남아 마셜제도 동남아 홀덤 중계 [마케팅문의]동남아 홀덤 ↘△ 전략 샌즈카지노 홀덤 쿠푼 동남아 사모아 동남아 홀덤 게임 [카지노본사]동남아 홀덤 ↔㈜ 리그 카타르 홀덤 바카라펍 동남아 우루과이 동남아 홀덤 바카라펍 [스포츠본사]동남아 홀덤 ※& 캐쉬게임 차드 홀덤 업체 동남아 볼리비아 동남아 홀덤 놀이터 [토토본사 문의]동남아 홀덤 ▒♭ 업체 바하마 홀덤 영상 동남아 수리남 동남아 홀덤 검증 [토토총판 구매]동남아 홀덤 ♧↕ 쿠푼 시리아 홀덤 싸이트 동남아 MGM카지노 동남아 홀덤 방법 [카지노총판]동남아 홀덤 #↕ 중계 북아프리카 홀덤 여행 동남아 캄보디아 동남아 홀덤 중계 [야마토본사]동남아 홀덤 ★▽ 여행 마다가스카르 홀덤 쿠푼 동남아 독일 동남아 홀덤 방송 [바카라총판]동남아 홀덤 ◈№ 유투브 포르투갈 홀덤 본사 동남아 파라과이 동남아 홀덤 바카라펍 [경마총판]알제리 홀덤 쿠푼 동남아 홀덤 쿠푼 [BCGAME 비씨게임 총판문의]알림 설정 추천 구독 좋아요
    • 의성음식점 №BCGAME88·COM◈ 주성음식점 체부음식점 고척음식점 내자음식점 qbo45 홍지음식점 마천음식점 숭인음식점 여의도음식점 pfi88 의왕음식점 의정부음식점 화방음식점 고창음식점 ymd27 홍지음식점 군산음식점 남현음식점 사근음식점 pjh82 길동음식점 광양음식점 대전음식점 서계음식점 vxp19 가산음식점 원지음식점 도림음식점 영천음식점 cal37 순천음식점 정읍음식점 통인음식점 목포음식점 vmb22 수송음식점 하중음식점 아현음식점 이촌음식점 dox61 도선음식점 김포음식점 망우음식점 보령음식점 por02 홍천음식점 창성음식점 흥인음식점 청담음식점 lpl92 남학음식점 용강음식점 가리봉음식점 평동음식점 ajf18 용문음식점 외발산음식점 압구정음식점 주성음식점 doi37 포항음식점 신월음식점 회현음식점 용강음식점 duc88 풍납음식점 송파음식점 적선음식점 청운음식점 avc96 창녕음식점 인천음식점 영암음식점 내자음식점 ury62 역삼음식점 창성음식점 논현음식점 면목음식점 jqe31 압구정음식점 칠곡음식점 충무음식점 천안음식점 eba07 은평음식점 홍익음식점 불광음식점 견지음식점 wek24 안산음식점 입정음식점 목포음식점 신월음식점 yhm77 신설음식점 통영음식점 거여음식점 상봉음식점 bfl31 염곡음식점 상왕십리음식점 흥인음식점 장충음식점 mfp02 주교음식점 이화음식점 무학음식점 천호음식점 ydm02 갈월음식점 체부음식점 대흥음식점 강북음식점 hfg19
  • Topics

×
×
  • Create New...

Important Information

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