修复滚轮问题,优化代码
This commit is contained in:
parent
f2fc7943e1
commit
380dbf79b7
2 changed files with 8 additions and 12 deletions
|
@ -213,16 +213,14 @@ public class ClickHandler {
|
|||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
Entity looking = TraceTool.findLookingEntity(player, 6);
|
||||
if (looking == null) return;
|
||||
if (looking instanceof MortarEntity && player.isShiftKeyDown()) {
|
||||
PacketDistributor.sendToServer(new AdjustMortarAngleMessage(scroll));
|
||||
if (player.isUsingItem() && player.getUseItem().is(ModItems.ARTILLERY_INDICATOR.get())) {
|
||||
artilleryIndicatorCustomZoom = Mth.clamp(artilleryIndicatorCustomZoom + 0.4 * scroll, 0, 9);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
//TODO 为啥还能滚轮换物品?
|
||||
if (player.isUsingItem() && player.getUseItem().is(ModItems.ARTILLERY_INDICATOR.get())) {
|
||||
artilleryIndicatorCustomZoom = Mth.clamp(artilleryIndicatorCustomZoom + 0.4 * scroll, 0, 9);
|
||||
Entity looking = TraceTool.findLookingEntity(player, 6);
|
||||
if (looking instanceof MortarEntity && player.isShiftKeyDown()) {
|
||||
PacketDistributor.sendToServer(new AdjustMortarAngleMessage(scroll));
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,9 @@ public class MortarEntity extends VehicleEntity implements GeoEntity, Container,
|
|||
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
||||
private LivingEntity shooter = null;
|
||||
public ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
public MortarEntity(EntityType<MortarEntity> type, Level level) {
|
||||
super(type, level);
|
||||
}
|
||||
|
@ -140,9 +143,6 @@ public class MortarEntity extends VehicleEntity implements GeoEntity, Container,
|
|||
return this.entityData.get(OWNER_UUID).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
private LivingEntity shooter = null;
|
||||
|
||||
public void fire(@Nullable LivingEntity shooter) {
|
||||
if (!(this.stack.getItem() instanceof MortarShell)) return;
|
||||
|
||||
|
@ -356,8 +356,6 @@ public class MortarEntity extends VehicleEntity implements GeoEntity, Container,
|
|||
return this.cache;
|
||||
}
|
||||
|
||||
public ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
@Override
|
||||
public int getContainerSize() {
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue