mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-28 09:48:34 +01:00
Compare commits
No commits in common. "4d3ba552eb619c1c1fcee48db221c3c919bfea5e" and "a841121dde1a1162575bff0f9d63f42d35f13df9" have entirely different histories.
4d3ba552eb
...
a841121dde
2 changed files with 15 additions and 24 deletions
|
@ -10,9 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.entity;
|
package de.ellpeck.actuallyadditions.mod.entity;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.farmer.DefaultFarmerBehavior;
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
@ -80,9 +78,7 @@ public class EntityWorm extends Entity {
|
||||||
if (waterTicket != null)
|
if (waterTicket != null)
|
||||||
waterTicket.invalidate();
|
waterTicket.invalidate();
|
||||||
|
|
||||||
AABB aabb = new AABB(getX() - 1.5, getY() - 1.5, getZ() - 1.0, getX() + 1.5, getY() + 0.5, getZ() + 1.5);
|
waterTicket = FarmlandWaterManager.addAABBTicket(this.level(), new AABB(getX() - 2, getY() - 1.5, getZ() - 2, getX() + 2, getY(), getZ() + 2));
|
||||||
//ActuallyAdditions.LOGGER.info("Worm AABB: " + aabb);
|
|
||||||
waterTicket = FarmlandWaterManager.addAABBTicket(this.level(), aabb);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -105,11 +101,21 @@ public class EntityWorm extends Entity {
|
||||||
|
|
||||||
if (canWormify(this.level(), pos, state)) {
|
if (canWormify(this.level(), pos, state)) {
|
||||||
boolean isFarmland = block instanceof FarmBlock;
|
boolean isFarmland = block instanceof FarmBlock;
|
||||||
if (!isFarmland) {
|
|
||||||
|
/* if (!isFarmland || state.getValue(FarmlandBlock.MOISTURE) < 7) {
|
||||||
if (isMiddlePose || this.level().random.nextFloat() >= 0.45F) {
|
if (isMiddlePose || this.level().random.nextFloat() >= 0.45F) {
|
||||||
DefaultFarmerBehavior.useHoeAt(this.level(), pos);
|
|
||||||
|
if (!isFarmland) {
|
||||||
|
DefaultFarmerBehavior.useHoeAt(this.level, pos);
|
||||||
|
}
|
||||||
|
state = this.level().getBlockState(pos);
|
||||||
|
isFarmland = state.getBlock() instanceof FarmlandBlock;
|
||||||
|
|
||||||
|
if (isFarmland) {
|
||||||
|
this.level().setBlock(pos, state.setValue(FarmlandBlock.MOISTURE, 7), 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (isFarmland && this.level().random.nextFloat() >= 0.95F) {
|
if (isFarmland && this.level().random.nextFloat() >= 0.95F) {
|
||||||
BlockPos plant = pos.above();
|
BlockPos plant = pos.above();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.items;
|
package de.ellpeck.actuallyadditions.mod.items;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.item.DiggerItem;
|
import net.minecraft.world.item.DiggerItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -9,24 +8,12 @@ import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.Tier;
|
import net.minecraft.world.item.Tier;
|
||||||
import net.minecraft.world.item.context.UseOnContext;
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
import net.minecraft.world.item.enchantment.Enchantment;
|
import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import net.neoforged.neoforge.common.ToolAction;
|
import net.neoforged.neoforge.common.ToolAction;
|
||||||
import net.neoforged.neoforge.common.ToolActions;
|
import net.neoforged.neoforge.common.ToolActions;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AllInOneTool extends DiggerItem {
|
public class AllInOneTool extends DiggerItem {
|
||||||
private final Tier tier;
|
private final Tier tier;
|
||||||
|
|
||||||
private static List<ToolAction> ACTIONS = List.of(
|
|
||||||
ToolActions.AXE_DIG,
|
|
||||||
ToolActions.HOE_DIG,
|
|
||||||
ToolActions.PICKAXE_DIG,
|
|
||||||
ToolActions.SHOVEL_DIG,
|
|
||||||
ToolActions.HOE_TILL,
|
|
||||||
ToolActions.SHOVEL_FLATTEN
|
|
||||||
);
|
|
||||||
|
|
||||||
public AllInOneTool(Tier tier) {
|
public AllInOneTool(Tier tier) {
|
||||||
super(
|
super(
|
||||||
4.0f,
|
4.0f,
|
||||||
|
@ -43,7 +30,7 @@ public class AllInOneTool extends DiggerItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPerformAction(ItemStack stack, ToolAction toolAction) {
|
public boolean canPerformAction(ItemStack stack, ToolAction toolAction) {
|
||||||
if (ACTIONS.contains(toolAction))
|
if (toolAction == ToolActions.AXE_DIG || toolAction == ToolActions.HOE_DIG || toolAction == ToolActions.PICKAXE_DIG || toolAction == ToolActions.SHOVEL_DIG)
|
||||||
return true;
|
return true;
|
||||||
return super.canPerformAction(stack, toolAction);
|
return super.canPerformAction(stack, toolAction);
|
||||||
}
|
}
|
||||||
|
@ -57,8 +44,6 @@ public class AllInOneTool extends DiggerItem {
|
||||||
|
|
||||||
// Player not sneaking? Act as a Hoe to the block, else, Act as a shovel
|
// Player not sneaking? Act as a Hoe to the block, else, Act as a shovel
|
||||||
if (!context.getPlayer().isCrouching()) {
|
if (!context.getPlayer().isCrouching()) {
|
||||||
BlockState toolModifiedState = context.getLevel().getBlockState(context.getClickedPos()).getToolModifiedState(context, ToolActions.HOE_TILL, false);
|
|
||||||
ActuallyAdditions.LOGGER.info("Tool Modified State: " + toolModifiedState);
|
|
||||||
return Items.IRON_HOE.useOn(context);
|
return Items.IRON_HOE.useOn(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue