Some blocks
This commit is contained in:
parent
eb12566afa
commit
54c8e3f020
|
@ -5,16 +5,20 @@ import net.minecraft.block.AbstractButtonBlock;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.state.BooleanProperty;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.BlockRayTraceResult;
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v.block.CraftBlock;
|
import org.bukkit.craftbukkit.v.block.CraftBlock;
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
import org.bukkit.event.entity.EntityInteractEvent;
|
import org.bukkit.event.entity.EntityInteractEvent;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
@ -27,23 +31,42 @@ import java.util.Random;
|
||||||
@Mixin(AbstractButtonBlock.class)
|
@Mixin(AbstractButtonBlock.class)
|
||||||
public class AbstractButtonBlockMixin {
|
public class AbstractButtonBlockMixin {
|
||||||
|
|
||||||
@Inject(method = "onBlockActivated", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
|
// @formatter:off
|
||||||
|
@Shadow @Final public static BooleanProperty POWERED;
|
||||||
|
// @formatter:on
|
||||||
|
|
||||||
|
@Inject(method = "onBlockActivated", cancellable = true, at = @At(value = "HEAD"))
|
||||||
public void arclight$blockRedstone1(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit, CallbackInfoReturnable<Boolean> cir) {
|
public void arclight$blockRedstone1(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit, CallbackInfoReturnable<Boolean> cir) {
|
||||||
boolean powered = state.get(AbstractButtonBlock.POWERED);
|
if (!state.get(POWERED)) {
|
||||||
Block block = CraftBlock.at(worldIn, pos);
|
boolean powered = state.get(POWERED);
|
||||||
int old = (powered) ? 15 : 0;
|
Block block = CraftBlock.at(worldIn, pos);
|
||||||
int current = (!powered) ? 15 : 0;
|
int old = (powered) ? 15 : 0;
|
||||||
|
int current = (!powered) ? 15 : 0;
|
||||||
|
|
||||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, old, current);
|
BlockRedstoneEvent event = new BlockRedstoneEvent(block, old, current);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if ((event.getNewCurrent() > 0) == (powered)) {
|
if ((event.getNewCurrent() > 0) == (powered)) {
|
||||||
cir.setReturnValue(true);
|
cir.setReturnValue(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "tick", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
|
@SuppressWarnings({"UnresolvedMixinReference", "UnnecessaryQualifiedMemberReference"})
|
||||||
public void arclight$blockRedstone2(BlockState state, World worldIn, BlockPos pos, Random random, CallbackInfo ci) {
|
@Inject(method = "Lnet/minecraft/block/AbstractButtonBlock;func_196267_b(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Ljava/util/Random;)V", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;func_180501_a(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"), require = 0)
|
||||||
|
public void arclight$blockRedstone2_1_14(BlockState state, World worldIn, BlockPos pos, Random random, CallbackInfo ci) {
|
||||||
|
Block block = CraftBlock.at(worldIn, pos);
|
||||||
|
|
||||||
|
BlockRedstoneEvent event = new BlockRedstoneEvent(block, 15, 0);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.getNewCurrent() > 0) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "tick", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"), require = 0)
|
||||||
|
private void arclight$blockRedstone2_1_15(BlockState state, ServerWorld worldIn, BlockPos pos, Random rand, CallbackInfo ci) {
|
||||||
Block block = CraftBlock.at(worldIn, pos);
|
Block block = CraftBlock.at(worldIn, pos);
|
||||||
|
|
||||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, 15, 0);
|
BlockRedstoneEvent event = new BlockRedstoneEvent(block, 15, 0);
|
||||||
|
|
|
@ -61,8 +61,8 @@ public abstract class BlockMixin implements BlockBridge {
|
||||||
* @author IzzelAliz
|
* @author IzzelAliz
|
||||||
* @reason
|
* @reason
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite(aliases = {"func_220077_a"})
|
||||||
public static List<ItemStack> func_220077_a(BlockState state, ServerWorld worldIn, BlockPos pos, @Nullable TileEntity tileEntityIn, Entity entityIn, ItemStack stack) {
|
public static List<ItemStack> getDrops(BlockState state, ServerWorld worldIn, BlockPos pos, @Nullable TileEntity tileEntityIn, Entity entityIn, ItemStack stack) {
|
||||||
LootContext.Builder lootcontext$builder = (new LootContext.Builder(worldIn)).withRandom(worldIn.rand).withParameter(LootParameters.POSITION, pos).withParameter(LootParameters.TOOL, stack).withNullableParameter(LootParameters.THIS_ENTITY, entityIn).withNullableParameter(LootParameters.BLOCK_ENTITY, tileEntityIn);
|
LootContext.Builder lootcontext$builder = (new LootContext.Builder(worldIn)).withRandom(worldIn.rand).withParameter(LootParameters.POSITION, pos).withParameter(LootParameters.TOOL, stack).withNullableParameter(LootParameters.THIS_ENTITY, entityIn).withNullableParameter(LootParameters.BLOCK_ENTITY, tileEntityIn);
|
||||||
return state.getDrops(lootcontext$builder);
|
return state.getDrops(lootcontext$builder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.block.CactusBlock;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import org.bukkit.craftbukkit.v.block.CraftBlock;
|
import org.bukkit.craftbukkit.v.block.CraftBlock;
|
||||||
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
@ -16,11 +17,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
@Mixin(CactusBlock.class)
|
@Mixin(CactusBlock.class)
|
||||||
public class CactusBlockMixin {
|
public class CactusBlockMixin {
|
||||||
|
|
||||||
@Redirect(method = "tick", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z"))
|
@SuppressWarnings({"UnresolvedMixinReference", "UnnecessaryQualifiedMemberReference"})
|
||||||
public boolean arclight$blockGrow(World world, BlockPos pos, BlockState state) {
|
@Redirect(method = "Lnet/minecraft/block/CactusBlock;func_196267_b(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Ljava/util/Random;)V", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/world/World;func_175656_a(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z"), require = 0)
|
||||||
|
public boolean arclight$blockGrow_1_14(World world, BlockPos pos, BlockState state) {
|
||||||
return CraftEventFactory.handleBlockGrowEvent(world, pos, state);
|
return CraftEventFactory.handleBlockGrowEvent(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z"), require = 0)
|
||||||
|
private boolean arclight$blockGrow_1_15(ServerWorld serverWorld, BlockPos pos, BlockState state) {
|
||||||
|
return CraftEventFactory.handleBlockGrowEvent(serverWorld, pos, state);
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "onEntityCollision", at = @At("HEAD"))
|
@Inject(method = "onEntityCollision", at = @At("HEAD"))
|
||||||
private void arclight$cactusDamage1(BlockState state, World worldIn, BlockPos pos, Entity entityIn, CallbackInfo ci) {
|
private void arclight$cactusDamage1(BlockState state, World worldIn, BlockPos pos, Entity entityIn, CallbackInfo ci) {
|
||||||
CraftEventFactory.blockDamage = CraftBlock.at(worldIn, pos);
|
CraftEventFactory.blockDamage = CraftBlock.at(worldIn, pos);
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package io.izzel.arclight.common.mixin.core.command.arguments;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
|
import net.minecraft.command.arguments.BlockStateParser;
|
||||||
|
import net.minecraft.state.IProperty;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mixin(BlockStateParser.class)
|
||||||
|
public class BlockStateParserMixin {
|
||||||
|
|
||||||
|
// @formatter:off
|
||||||
|
@Shadow @Final @Mutable private Map<IProperty<?>, Comparable<?>> properties;
|
||||||
|
// @formatter:on
|
||||||
|
|
||||||
|
@Inject(method = "<init>", at = @At("RETURN"))
|
||||||
|
private void arclight$init(StringReader readerIn, boolean allowTags, CallbackInfo ci) {
|
||||||
|
this.properties = new LinkedHashMap<>(properties);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package io.izzel.arclight.common.mixin.core.entity.ai.attributes;
|
||||||
|
|
||||||
|
import io.izzel.arclight.common.bridge.entity.ai.attributes.RangedAttributeBridge;
|
||||||
|
import net.minecraft.entity.ai.attributes.Attribute;
|
||||||
|
import net.minecraft.entity.ai.attributes.IAttribute;
|
||||||
|
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@Mixin(RangedAttribute.class)
|
||||||
|
public abstract class RangedAttributeMixin extends Attribute implements RangedAttributeBridge {
|
||||||
|
|
||||||
|
protected RangedAttributeMixin(@Nullable IAttribute parentIn, String unlocalizedNameIn, double defaultValueIn) {
|
||||||
|
super(parentIn, unlocalizedNameIn, defaultValueIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @formatter:off
|
||||||
|
@Override @Accessor("maximumValue") public abstract void bridge$setMaximumValue(double maximumValue);
|
||||||
|
// @formatter:on
|
||||||
|
|
||||||
|
@Inject(method = "clampValue", cancellable = true, at = @At("HEAD"))
|
||||||
|
private void arclight$notNan(double value, CallbackInfoReturnable<Double> cir) {
|
||||||
|
if (Double.isNaN(value)) {
|
||||||
|
cir.setReturnValue(this.getDefaultValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
package io.izzel.arclight.common.mixin.core.entity.ai.attributes;
|
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.entity.ai.attributes.RangedAttributeBridge;
|
|
||||||
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
@Mixin(RangedAttribute.class)
|
|
||||||
public abstract class RangedAttributeMixin_Accessor implements RangedAttributeBridge {
|
|
||||||
|
|
||||||
@Override @Accessor("maximumValue")
|
|
||||||
public abstract void bridge$setMaximumValue(double maximumValue);
|
|
||||||
}
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package io.izzel.arclight.common.mixin.core.entity.ai.brain;
|
||||||
|
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.ai.brain.BrainUtil;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(BrainUtil.class)
|
||||||
|
public class BrainUtilMixin {
|
||||||
|
|
||||||
|
@Inject(method = "throwItemAt", cancellable = true, at = @At("HEAD"))
|
||||||
|
private static void arclight$noEmptyLoot(LivingEntity from, ItemStack stack, LivingEntity to, CallbackInfo ci) {
|
||||||
|
if (stack.isEmpty()) ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
@Mixin(AssignProfessionTask.class)
|
@Mixin(AssignProfessionTask.class)
|
||||||
public class AssignProfessionTaskMixin {
|
public class AssignProfessionTaskMixin {
|
||||||
|
|
||||||
@Redirect(method = "func_212831_a_", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/merchant/villager/VillagerEntity;setVillagerData(Lnet/minecraft/entity/merchant/villager/VillagerData;)V"))
|
@Redirect(method = "startExecuting", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/merchant/villager/VillagerEntity;setVillagerData(Lnet/minecraft/entity/merchant/villager/VillagerData;)V"))
|
||||||
private void arclight$careerChangeHook(VillagerEntity villagerEntity, VillagerData villagerData) {
|
private void arclight$careerChangeHook(VillagerEntity villagerEntity, VillagerData villagerData) {
|
||||||
VillagerProfession profession = villagerData.getProfession();
|
VillagerProfession profession = villagerData.getProfession();
|
||||||
VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(villagerEntity, CraftVillager.nmsToBukkitProfession(profession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(villagerEntity, CraftVillager.nmsToBukkitProfession(profession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||||
|
@ -22,6 +22,5 @@ public class AssignProfessionTaskMixin {
|
||||||
VillagerData newData = villagerEntity.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession()));
|
VillagerData newData = villagerEntity.getVillagerData().withProfession(CraftVillager.bukkitToNmsProfession(event.getProfession()));
|
||||||
villagerEntity.setVillagerData(newData);
|
villagerEntity.setVillagerData(newData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
@Mixin(ChangeJobTask.class)
|
@Mixin(ChangeJobTask.class)
|
||||||
public class ChangeJobTaskMixin {
|
public class ChangeJobTaskMixin {
|
||||||
|
|
||||||
@Redirect(method = "func_212831_a_", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/merchant/villager/VillagerEntity;setVillagerData(Lnet/minecraft/entity/merchant/villager/VillagerData;)V"))
|
@Redirect(method = "startExecuting", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/merchant/villager/VillagerEntity;setVillagerData(Lnet/minecraft/entity/merchant/villager/VillagerData;)V"))
|
||||||
private void arclight$careerChangeHook(VillagerEntity villagerEntity, VillagerData villagerData) {
|
private void arclight$careerChangeHook(VillagerEntity villagerEntity, VillagerData villagerData) {
|
||||||
VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(villagerEntity,
|
VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(villagerEntity,
|
||||||
CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE),
|
CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE),
|
||||||
|
|
|
@ -1,38 +1,29 @@
|
||||||
package io.izzel.arclight.common.mixin.core.entity.ai.brain.task;
|
package io.izzel.arclight.common.mixin.core.entity.ai.brain.task;
|
||||||
|
|
||||||
|
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
||||||
import net.minecraft.entity.ai.brain.task.CreateBabyVillagerTask;
|
import net.minecraft.entity.ai.brain.task.CreateBabyVillagerTask;
|
||||||
import net.minecraft.entity.merchant.villager.VillagerEntity;
|
import net.minecraft.entity.merchant.villager.VillagerEntity;
|
||||||
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Mixin(CreateBabyVillagerTask.class)
|
@Mixin(CreateBabyVillagerTask.class)
|
||||||
public class CreateBabyVillagerTaskMixin {
|
public class CreateBabyVillagerTaskMixin {
|
||||||
|
|
||||||
/**
|
@Inject(method = "func_220480_a", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD,
|
||||||
* @author IzzelAliz
|
at = @At(value = "JUMP", ordinal = 0, opcode = Opcodes.IFNONNULL))
|
||||||
* @reason
|
private void arclight$entityBreed(VillagerEntity lona, VillagerEntity anonymous, CallbackInfoReturnable<Optional<VillagerEntity>> cir, VillagerEntity child) {
|
||||||
*/
|
if (CraftEventFactory.callEntityBreedEvent(child, lona, anonymous, null, null, 0).isCancelled()) {
|
||||||
@Overwrite
|
cir.setReturnValue(Optional.empty());
|
||||||
private Optional<VillagerEntity> func_220480_a(VillagerEntity lona, VillagerEntity anonymous) {
|
} else if (child != null) {
|
||||||
VillagerEntity villager = lona.createChild(anonymous);
|
((WorldBridge) lona.world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.BREEDING);
|
||||||
|
|
||||||
if (CraftEventFactory.callEntityBreedEvent(villager, lona, anonymous, null, null, 0).isCancelled()) {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (villager == null) {
|
|
||||||
return Optional.empty();
|
|
||||||
} else {
|
|
||||||
lona.setGrowingAge(6000);
|
|
||||||
anonymous.setGrowingAge(6000);
|
|
||||||
villager.setGrowingAge(-24000);
|
|
||||||
villager.setLocationAndAngles(lona.posX, lona.posY, lona.posZ, 0.0F, 0.0F);
|
|
||||||
lona.world.addEntity(villager);
|
|
||||||
lona.world.setEntityState(villager, (byte) 12);
|
|
||||||
return Optional.of(villager);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
||||||
@Mixin(FarmTask.class)
|
@Mixin(FarmTask.class)
|
||||||
public abstract class FarmTaskMixin {
|
public abstract class FarmTaskMixin {
|
||||||
|
|
||||||
@Inject(method = "func_212833_d_", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
|
@Inject(method = "updateTask", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
|
||||||
private void on(ServerWorld worldIn, VillagerEntity owner, long gameTime, CallbackInfo ci) {
|
private void on(ServerWorld worldIn, VillagerEntity owner, long gameTime, CallbackInfo ci) {
|
||||||
ArclightCaptures.captureEntityChangeBlock(owner);
|
ArclightCaptures.captureEntityChangeBlock(owner);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package io.izzel.arclight.common.mixin.v1_15.world.biome;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.biome.BiomeContainer;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
@Mixin(BiomeContainer.class)
|
||||||
|
public class BiomeContainerMixin {
|
||||||
|
|
||||||
|
// @formatter:off
|
||||||
|
@Shadow @Final private Biome[] biomes;
|
||||||
|
@Shadow @Final private static int WIDTH_BITS;
|
||||||
|
// @formatter:on
|
||||||
|
|
||||||
|
public void setBiome(int i, int j, int k, Biome biome) {
|
||||||
|
int l = i & BiomeContainer.HORIZONTAL_MASK;
|
||||||
|
int i2 = MathHelper.clamp(j, 0, BiomeContainer.VERTICAL_MASK);
|
||||||
|
int j2 = k & BiomeContainer.HORIZONTAL_MASK;
|
||||||
|
this.biomes[i2 << WIDTH_BITS + WIDTH_BITS | j2 << WIDTH_BITS | l] = biome;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
# Arclight
|
# Arclight 1.14
|
||||||
public net.minecraft.command.impl.TeleportCommand$Facing
|
public net.minecraft.command.impl.TeleportCommand$Facing
|
||||||
public net.minecraft.world.server.TicketManager$ChunkTicketTracker
|
public net.minecraft.world.server.TicketManager$ChunkTicketTracker
|
||||||
public net.minecraft.world.server.Ticket <init>(Lnet/minecraft/world/server/TicketType;ILjava/lang/Object;J)V
|
public net.minecraft.world.server.Ticket <init>(Lnet/minecraft/world/server/TicketType;ILjava/lang/Object;J)V
|
||||||
|
@ -18,6 +18,10 @@ public net.minecraft.util.math.shapes.DoubleCubeMergingList <init>(II)V
|
||||||
public net.minecraft.block.ComposterBlock$EmptyInventory
|
public net.minecraft.block.ComposterBlock$EmptyInventory
|
||||||
public net.minecraft.tileentity.SkullTileEntity field_184299_k #sessionService
|
public net.minecraft.tileentity.SkullTileEntity field_184299_k #sessionService
|
||||||
public net.minecraft.item.crafting.Ingredient <init>(Ljava/util/stream/Stream;)V
|
public net.minecraft.item.crafting.Ingredient <init>(Ljava/util/stream/Stream;)V
|
||||||
|
# Arclight 1.15
|
||||||
|
public net.minecraft.entity.Entity field_70165_t #posX
|
||||||
|
public net.minecraft.entity.Entity field_70163_u #posY
|
||||||
|
public net.minecraft.entity.Entity field_70161_v #posZ
|
||||||
# Bukkit
|
# Bukkit
|
||||||
public net.minecraft.entity.player.PlayerEntity func_190531_bD()I
|
public net.minecraft.entity.player.PlayerEntity func_190531_bD()I
|
||||||
public net.minecraft.entity.item.ItemFrameEntity func_174859_a(Lnet/minecraft/util/Direction;)V
|
public net.minecraft.entity.item.ItemFrameEntity func_174859_a(Lnet/minecraft/util/Direction;)V
|
||||||
|
@ -300,3 +304,34 @@ private-f net.minecraft.server.MinecraftServer field_147144_o
|
||||||
public-f net.minecraft.server.MinecraftServer field_71308_o
|
public-f net.minecraft.server.MinecraftServer field_71308_o
|
||||||
public-f net.minecraft.world.server.TicketType field_223186_k
|
public-f net.minecraft.world.server.TicketType field_223186_k
|
||||||
public-f net.minecraft.world.World field_73011_w
|
public-f net.minecraft.world.World field_73011_w
|
||||||
|
public net.minecraft.entity.monster.GuardianEntity func_110147_ax()V
|
||||||
|
public net.minecraft.entity.monster.ElderGuardianEntity func_110147_ax()V
|
||||||
|
public net.minecraft.world.server.ServerBossInfo func_186759_a(Lnet/minecraft/network/play/server/SUpdateBossInfoPacket$Operation;)V
|
||||||
|
public net.minecraft.world.server.ServerBossInfo field_186764_j
|
||||||
|
public net.minecraft.world.server.TicketManager field_219377_e
|
||||||
|
public net.minecraft.util.datafix.fixes.BlockStateFlatteningMap func_199194_a(ILjava/lang/String;[Ljava/lang/String;)V
|
||||||
|
public net.minecraft.world.dimension.DimensionType <init>(ILjava/lang/String;Ljava/lang/String;Ljava/util/function/BiFunction;ZLnet/minecraft/world/biome/IBiomeMagnifier;)V
|
||||||
|
public net.minecraft.entity.passive.BeeEntity func_226418_eL_()I
|
||||||
|
public net.minecraft.entity.passive.BeeEntity field_226369_bI_
|
||||||
|
public net.minecraft.entity.passive.BeeEntity func_226453_u_(I)V
|
||||||
|
public net.minecraft.entity.passive.BeeEntity func_226447_r_(Z)V
|
||||||
|
public net.minecraft.entity.passive.BeeEntity func_226449_s_(Z)V
|
||||||
|
public net.minecraft.entity.boss.dragon.EnderDragonEntity field_70977_g
|
||||||
|
public net.minecraft.entity.item.FireworkRocketEntity field_213895_d
|
||||||
|
public net.minecraft.entity.passive.FoxEntity field_213509_bB
|
||||||
|
public net.minecraft.entity.passive.FoxEntity field_213510_bD
|
||||||
|
public net.minecraft.entity.passive.MooshroomEntity func_213446_a(Lnet/minecraft/entity/passive/MooshroomEntity$Type;)V
|
||||||
|
public net.minecraft.entity.monster.PillagerEntity field_213677_bz
|
||||||
|
public net.minecraft.entity.player.ServerPlayerEntity func_213846_b(Lnet/minecraft/world/server/ServerWorld;)V
|
||||||
|
public net.minecraft.entity.monster.ZombieVillagerEntity func_191991_a(Ljava/util/UUID;I)V
|
||||||
|
public net.minecraft.item.BucketItem field_77876_a
|
||||||
|
public net.minecraft.world.raid.RaidManager field_215175_a
|
||||||
|
public net.minecraft.world.raid.Raid field_221352_p
|
||||||
|
public net.minecraft.world.raid.Raid field_221345_i
|
||||||
|
public net.minecraft.world.raid.Raid field_221359_w
|
||||||
|
public net.minecraft.world.raid.Raid field_221346_j
|
||||||
|
public net.minecraft.world.raid.Raid field_221351_o
|
||||||
|
public net.minecraft.item.crafting.Ingredient$SingleItemList <init>(Lnet/minecraft/item/ItemStack;)V
|
||||||
|
public net.minecraft.tileentity.BeehiveTileEntity field_226959_b_
|
||||||
|
public net.minecraft.tileentity.StructureBlockTileEntity field_184427_l
|
||||||
|
public net.minecraft.world.World field_217407_c
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "io.izzel.arclight.common.mixin.v1_15",
|
||||||
|
"target": "@env(DEFAULT)",
|
||||||
|
"refmap": "mixins.arclight.refmap.json",
|
||||||
|
"setSourceFile": true,
|
||||||
|
"plugin": "io.izzel.arclight.common.mod.ArclightMixinPlugin",
|
||||||
|
"injectors": {
|
||||||
|
"maxShiftBy": 2
|
||||||
|
},
|
||||||
|
"mixins": [
|
||||||
|
"world.biome.BiomeContainerMixin"
|
||||||
|
]
|
||||||
|
}
|
|
@ -7,7 +7,8 @@
|
||||||
"setSourceFile": true,
|
"setSourceFile": true,
|
||||||
"plugin": "io.izzel.arclight.common.mod.ArclightMixinPlugin",
|
"plugin": "io.izzel.arclight.common.mod.ArclightMixinPlugin",
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"maxShiftBy": 2
|
"maxShiftBy": 2,
|
||||||
|
"defaultRequire": 1
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"advancements.AdvancementMixin",
|
"advancements.AdvancementMixin",
|
||||||
|
@ -91,6 +92,7 @@
|
||||||
"block.WitherSkeletonSkullBlockMixin",
|
"block.WitherSkeletonSkullBlockMixin",
|
||||||
"command.CommandSourceMixin",
|
"command.CommandSourceMixin",
|
||||||
"command.ICommandSourceMixin",
|
"command.ICommandSourceMixin",
|
||||||
|
"command.arguments.BlockStateParserMixin",
|
||||||
"command.arguments.EntityArgumentMixin",
|
"command.arguments.EntityArgumentMixin",
|
||||||
"command.arguments.EntitySelectorMixin",
|
"command.arguments.EntitySelectorMixin",
|
||||||
"command.arguments.EntitySelectorParserMixin",
|
"command.arguments.EntitySelectorParserMixin",
|
||||||
|
@ -106,7 +108,8 @@
|
||||||
"entity.EntityTypeMixin",
|
"entity.EntityTypeMixin",
|
||||||
"entity.LivingEntityMixin",
|
"entity.LivingEntityMixin",
|
||||||
"entity.MobEntityMixin",
|
"entity.MobEntityMixin",
|
||||||
"entity.ai.attributes.RangedAttributeMixin_Accessor",
|
"entity.ai.attributes.RangedAttributeMixin",
|
||||||
|
"entity.ai.brain.BrainUtilMixin",
|
||||||
"entity.ai.brain.task.AssignProfessionTaskMixin",
|
"entity.ai.brain.task.AssignProfessionTaskMixin",
|
||||||
"entity.ai.brain.task.ChangeJobTaskMixin",
|
"entity.ai.brain.task.ChangeJobTaskMixin",
|
||||||
"entity.ai.brain.task.CreateBabyVillagerTaskMixin",
|
"entity.ai.brain.task.CreateBabyVillagerTaskMixin",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user