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