Skip to content

Commit

Permalink
Ported /carpet extremeBehaviours from fabric-carpet
Browse files Browse the repository at this point in the history
  • Loading branch information
Dioswilson committed Jan 25, 2022
1 parent 4e4abab commit 11535d6
Show file tree
Hide file tree
Showing 15 changed files with 3,048 additions and 67 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ Here i will list we did:
/carpet commandInventory(coded by slowik)
/carpet scoreboardStats
/carpet blockStateSyncing
/carpet extremeBehaviours
```

13 changes: 13 additions & 0 deletions carpetmodSrc/carpet/CarpetSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,19 @@ private static boolean validateDoorCheckOptimization(boolean value) {
@Rule(desc = "Fixes block states in F3 debug mode not updating for hoppers, droppers and dispensers.", category = {FIX, EXPERIMENTAL, BULLET})
public static boolean blockStateSyncing;

@Rule(
desc = "Edge cases are as frequent as common cases, for testing only!!",
extra = {"Velocities of items from dispensers, blaze projectiles, fireworks ",
"Directions of fireballs, wither skulls, fishing bobbers, ",
"items dropped from blocks and inventories, llamas spit, triggered trap horses",
"Damage dealt with projectiles",
"Blaze aggro sensitivity",
"Mobs spawned follow range"
},
category = {CREATIVE, EXPERIMENTAL, BULLET}
)
public static boolean extremeBehaviours;

// ===== API ===== //

/**
Expand Down
10 changes: 10 additions & 0 deletions carpetmodSrc/carpet/utils/RandomTools.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package carpet.utils;

import java.util.Random;

public class RandomTools {
public static double nextNotGaussian(Random rand) {
rand.nextDouble();
return 16.0D * rand.nextDouble() - 8.0D;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--- ../src-base/minecraft/net/minecraft/dispenser/BehaviorDefaultDispenseItem.java
+++ ../src-work/minecraft/net/minecraft/dispenser/BehaviorDefaultDispenseItem.java
@@ -1,5 +1,7 @@
package net.minecraft.dispenser;

+import carpet.CarpetSettings;
+import carpet.utils.RandomTools;
import net.minecraft.block.BlockDispenser;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
@@ -45,9 +47,16 @@
entityitem.field_70159_w = (double)p_82486_3_.func_82601_c() * d3;
entityitem.field_70181_x = 0.20000000298023224D;
entityitem.field_70179_y = (double)p_82486_3_.func_82599_e() * d3;
- entityitem.field_70159_w += p_82486_0_.field_73012_v.nextGaussian() * 0.007499999832361937D * (double)p_82486_2_;
- entityitem.field_70181_x += p_82486_0_.field_73012_v.nextGaussian() * 0.007499999832361937D * (double)p_82486_2_;
- entityitem.field_70179_y += p_82486_0_.field_73012_v.nextGaussian() * 0.007499999832361937D * (double)p_82486_2_;
+ if (!CarpetSettings.extremeBehaviours) {
+ entityitem.field_70159_w += p_82486_0_.field_73012_v.nextGaussian() * 0.007499999832361937D * (double)p_82486_2_;
+ entityitem.field_70181_x += p_82486_0_.field_73012_v.nextGaussian() * 0.007499999832361937D * (double)p_82486_2_;
+ entityitem.field_70179_y += p_82486_0_.field_73012_v.nextGaussian() * 0.007499999832361937D * (double)p_82486_2_;
+ }
+ else {
+ entityitem.field_70159_w += RandomTools.nextNotGaussian(p_82486_0_.field_73012_v) * 0.007499999832361937D * (double)p_82486_2_;
+ entityitem.field_70181_x += RandomTools.nextNotGaussian(p_82486_0_.field_73012_v) * 0.007499999832361937D * (double)p_82486_2_;
+ entityitem.field_70179_y += RandomTools.nextNotGaussian(p_82486_0_.field_73012_v) * 0.007499999832361937D * (double)p_82486_2_;
+ }
p_82486_0_.func_72838_d(entityitem);
}

Loading

0 comments on commit 11535d6

Please sign in to comment.