forked from Nova-Committee/Elytra-Bombing
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
8 changed files
with
172 additions
and
69 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
6 changes: 0 additions & 6 deletions
6
src/main/java/committee/nova/plr/elytraBombing/client/proxy/ClientProxy.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
src/main/java/committee/nova/plr/elytraBombing/common/event/EEBContext.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package committee.nova.plr.elytraBombing.common.event; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class EEBContext { | ||
//not null | ||
public EntityPlayer player; | ||
//may be null @ACCESS_IGNITER | ||
public ItemStack tntStack; | ||
//not null | ||
public ItemStack igniterStack; | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/committee/nova/plr/elytraBombing/common/event/EEBEvents.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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package committee.nova.plr.elytraBombing.common.event; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fml.common.eventhandler.Event; | ||
|
||
import java.util.HashMap; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.Consumer; | ||
import java.util.function.Predicate; | ||
|
||
|
||
public class EEBEvents | ||
{ | ||
public static HashMap<Predicate<ItemStack>, Consumer<EEBContext>> ACCESS_IGNITER=new HashMap<>(); | ||
public static List<Predicate<EntityPlayer>> ACCESS_FLYING=new LinkedList<>(); | ||
public static Map<Predicate<ItemStack>,Consumer<EEBContext>> ACCESS_TNT=new HashMap<>(); | ||
|
||
/** @Fire{@link net.minecraftforge.common.MinecraftForge.EVENT_BUS} **/ | ||
|
||
public static class RegisterBomb extends Event { | ||
@Override | ||
public boolean isCancelable() { | ||
return false; | ||
} | ||
public void registerTNT(Predicate<ItemStack> canBeUsed,Consumer<EEBContext> useResult){ | ||
ACCESS_TNT.put(canBeUsed,useResult); | ||
} | ||
public void registerIgniter(Predicate<ItemStack> canBeUsed ,Consumer<EEBContext> useResult){ | ||
ACCESS_IGNITER.put(canBeUsed,useResult); | ||
} | ||
public void registerFlying(Predicate<EntityPlayer> returnIsFlying){ | ||
ACCESS_FLYING.add(returnIsFlying); | ||
} | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/committee/nova/plr/elytraBombing/common/event/EEBHandler.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package committee.nova.plr.elytraBombing.common.event; | ||
|
||
import committee.nova.plr.elytraBombing.ElytraBombing; | ||
import committee.nova.plr.elytraBombing.common.tools.player.PlayerHandler; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.init.Items; | ||
import net.minecraft.item.Item; | ||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
|
||
@Mod.EventBusSubscriber(modid= ElytraBombing.MOD_ID) | ||
public class EEBHandler { | ||
@SubscribeEvent | ||
public static void register(EEBEvents.RegisterBomb registerBomb){ | ||
registerBomb.registerTNT( | ||
(stack)->stack.getItem()== Item.getItemFromBlock(Blocks.TNT), | ||
PlayerHandler::preLaunchTnt | ||
); | ||
registerBomb.registerFlying(EntityLivingBase::isElytraFlying); | ||
registerBomb.registerIgniter( | ||
(stack)-> stack.getItem()== Items.FLINT_AND_STEEL || stack.getItem()==Items.FIRE_CHARGE, | ||
PlayerHandler::damageStack | ||
); | ||
} | ||
} |
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
16 changes: 0 additions & 16 deletions
16
src/main/java/committee/nova/plr/elytraBombing/common/proxy/CommonProxy.java
This file was deleted.
Oops, something went wrong.
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