-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6db4664
commit 93b9fab
Showing
10 changed files
with
29 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
# Change Log | ||
## Common | ||
- [1.18.2] Fix crash when using deployer | ||
- New method `getX()` `getY()` `getZ()` for cannon mount peripheral - by [nosqd](https://github.com/nosqd) | ||
- Fix `fire()` method of cannon mount peripheral didn't work for auto cannons | ||
- Move config file item (which means backing up configuration values and deleting old configuration files) | ||
- Fix a crash when launching with create without clockwork | ||
## Fabric | ||
## Forge | ||
- Fix rotary cannon can't fire again while on a ship (not caused by vs2) | ||
- Add recoil for rotary cannon | ||
- Fix medium cannon mechanical arm interaction (also not caused by vs2) | ||
- Fix a crash when CBC Modern Warfare is not installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 0 additions & 88 deletions
88
...o/github/xiewuzhiying/vs_addition/forge/mixin/cbcmodernwarfare/MixinCannonMountPoint.java
This file was deleted.
Oops, something went wrong.
72 changes: 16 additions & 56 deletions
72
...b/xiewuzhiying/vs_addition/forge/mixin/cbcmodernwarfare/MixinCompactCannonMountPoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,46 @@ | ||
package io.github.xiewuzhiying.vs_addition.forge.mixin.cbcmodernwarfare; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.block.entity.BlockEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
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.CallbackInfoReturnable; | ||
import rbasamoyai.createbigcannons.cannon_control.contraption.AbstractMountedCannonContraption; | ||
import rbasamoyai.createbigcannons.cannon_control.contraption.PitchOrientedContraptionEntity; | ||
import rbasamoyai.createbigcannons.config.CBCConfigs; | ||
import riftyboi.cbcmodernwarfare.cannon_control.compact_mount.CompactCannonMountPoint; | ||
import riftyboi.cbcmodernwarfare.cannon_control.contraption.MountedMediumcannonContraption; | ||
import riftyboi.cbcmodernwarfare.cannons.medium_cannon.breech.MediumcannonBreechBlockEntity; | ||
import riftyboi.cbcmodernwarfare.index.CBCModernWarfareItem; | ||
import riftyboi.cbcmodernwarfare.munitions.medium_cannon.MediumcannonAmmoItem; | ||
import riftyboi.cbcmodernwarfare.munitions.medium_cannon.MediumcannonCartridgeItem; | ||
|
||
@Mixin(CompactCannonMountPoint.class) | ||
public abstract class MixinCompactCannonMountPoint { | ||
@Shadow(remap = false) | ||
private static int getLoadingCooldown() { | ||
throw new AssertionError(); | ||
} | ||
|
||
@Inject( | ||
method = "getInsertedResultAndDoSomething", | ||
at = @At("RETURN"), | ||
method = "mediumcannonInsert", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lriftyboi/cbcmodernwarfare/cannons/medium_cannon/breech/MediumcannonBreechBlockEntity;canBeAutomaticallyLoaded()Z", | ||
shift = At.Shift.AFTER | ||
), | ||
cancellable = true, | ||
remap = false | ||
) | ||
private void add(ItemStack stack, boolean simulate, AbstractMountedCannonContraption cannon, PitchOrientedContraptionEntity poce, CallbackInfoReturnable<ItemStack> cir) { | ||
if (cannon instanceof MountedMediumcannonContraption mediumCannon) { | ||
cir.setReturnValue(mediumcannonInsert(stack, simulate, mediumCannon, poce)); | ||
} | ||
} | ||
|
||
@Unique | ||
private static ItemStack mediumcannonInsert(ItemStack stack, boolean simulate, MountedMediumcannonContraption mediumcannon, PitchOrientedContraptionEntity poce) { | ||
Item item = stack.getItem(); | ||
if (!(item instanceof MediumcannonAmmoItem ammoItem)) { | ||
return stack; | ||
} | ||
|
||
BlockEntity blockEntity = mediumcannon.presentBlockEntities.get(mediumcannon.getStartPos()); | ||
if (!(blockEntity instanceof MediumcannonBreechBlockEntity breech)) { | ||
return stack; | ||
} | ||
|
||
if (!breech.canBeAutomaticallyLoaded()) { | ||
return stack; | ||
} | ||
|
||
if (!(ammoItem instanceof MediumcannonCartridgeItem)) { | ||
return stack; | ||
} | ||
|
||
if(breech.getInputBuffer().isEmpty()) { | ||
if (!simulate) { | ||
breech.setInputBuffer(stack); | ||
breech.setLoadingCooldown(getLoadingCooldown()); | ||
} | ||
|
||
ItemStack copy = stack.copy(); | ||
copy.shrink(1); | ||
return copy; | ||
} | ||
|
||
private static void mediumcannonInsert(ItemStack stack, boolean simulate, MountedMediumcannonContraption mediumcannon, PitchOrientedContraptionEntity poce, CallbackInfoReturnable<ItemStack> cir, @Local MediumcannonBreechBlockEntity breech) { | ||
Item item2 = breech.getInputBuffer().getItem(); | ||
if (CBCModernWarfareItem.EMPTY_MEDIUMCANNON_CARTRIDGE.get().equals(item2)) { | ||
if (!simulate) { | ||
breech.setInputBuffer(stack); | ||
breech.setLoadingCooldown(getLoadingCooldown()); | ||
} | ||
if (simulate) { | ||
stack.setCount(1); | ||
} | ||
return new ItemStack(item2); | ||
stack.setCount(1); | ||
cir.setReturnValue(new ItemStack(item2)); | ||
} | ||
|
||
return stack; | ||
} | ||
|
||
|
||
@Unique | ||
private static int getLoadingCooldown() { | ||
return CBCConfigs.SERVER.cannons.quickfiringBreechLoadingCooldown.get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters