Merge branch 'master' into 1.15
This commit is contained in:
commit
c0d9b6ecb6
4 files changed
+50
-1
No files matched your search
@@ -30,7 +30,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
|||||||
|
|
||||||
public class CarpetServer // static for now - easier to handle all around the code, its one anyways
|
public class CarpetServer // static for now - easier to handle all around the code, its one anyways
|
||||||
{
|
{
|
||||||
public static final Random rand = new Random((int)((2>>16)*Math.random()));
|
public static final Random rand = new Random();
|
||||||
public static MinecraftServer minecraft_server;
|
public static MinecraftServer minecraft_server;
|
||||||
private static CommandDispatcher<ServerCommandSource> currentCommandDispatcher;
|
private static CommandDispatcher<ServerCommandSource> currentCommandDispatcher;
|
||||||
public static CarpetScriptServer scriptServer;
|
public static CarpetScriptServer scriptServer;
|
||||||
|
|||||||
@@ -511,4 +511,11 @@ public class CarpetSettings
|
|||||||
category = {EXPERIMENTAL, CREATIVE}
|
category = {EXPERIMENTAL, CREATIVE}
|
||||||
)
|
)
|
||||||
public static boolean flatWorldStructureSpawning = false;
|
public static boolean flatWorldStructureSpawning = false;
|
||||||
|
|
||||||
|
@Rule(
|
||||||
|
desc = "Edge cases are as frequent as common cases, for testing only!!",
|
||||||
|
extra = "Dispensers and Droppers will use extreme random velocity values",
|
||||||
|
category = CREATIVE
|
||||||
|
)
|
||||||
|
public static boolean extremeBehaviours = false;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetServer;
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.dispenser.ItemDispenserBehavior;
|
||||||
|
import net.minecraft.entity.ItemEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Position;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(ItemDispenserBehavior.class)
|
||||||
|
public class ItemDispenserBehaviour_extremeBehavioursMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "spawnItem", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/entity/ItemEntity;setVelocity(DDD)V"
|
||||||
|
))
|
||||||
|
private static void setExtremeVelocity(ItemEntity itemEntity, double x, double y, double z,
|
||||||
|
World world, ItemStack stack, int offset, Direction side, Position pos)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.extremeBehaviours)
|
||||||
|
{
|
||||||
|
double g = CarpetServer.rand.nextDouble() * 0.1D + 0.2D;
|
||||||
|
itemEntity.setVelocity(
|
||||||
|
(16*world.random.nextDouble()-8) * 0.007499999832361937D * (double) offset + (double) side.getOffsetX() * g,
|
||||||
|
(16*world.random.nextDouble()-8) * 0.007499999832361937D * (double) offset + 0.20000000298023224D,
|
||||||
|
(16*world.random.nextDouble()-8) * 0.007499999832361937D * (double) offset + (double) side.getOffsetZ() * g
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemEntity.setVelocity(x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -114,6 +114,8 @@
|
|||||||
"PickaxeItem_missingToolsMixin",
|
"PickaxeItem_missingToolsMixin",
|
||||||
"ShearsItem_missingToolsMixin",
|
"ShearsItem_missingToolsMixin",
|
||||||
|
|
||||||
|
"ItemDispenserBehaviour_extremeBehavioursMixin",
|
||||||
|
|
||||||
"ArmorStandEntity_scarpetMarkerMixin",
|
"ArmorStandEntity_scarpetMarkerMixin",
|
||||||
"Entity_scarpetEventsMixin",
|
"Entity_scarpetEventsMixin",
|
||||||
"LivingEntity_scarpetEventsMixin",
|
"LivingEntity_scarpetEventsMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user