mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-24 22:04:23 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
6b208b98bc
commit
a309488cdf
214 files changed
+9283
-9265
No files matched your search
@@ -1,14 +1,12 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
* To change this license header, choose License Headers in Project Properties. To change this template file, choose
|
||||
* Tools | Templates and open the template in the editor.
|
||||
*/
|
||||
|
||||
package minetweaker.mc1710;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.*;
|
||||
|
||||
import minetweaker.*;
|
||||
import minetweaker.api.entity.*;
|
||||
import minetweaker.api.formatting.IFormattedText;
|
||||
@@ -17,6 +15,7 @@ import minetweaker.api.minecraft.MineTweakerMC;
|
||||
import minetweaker.api.tooltip.IngredientTooltips;
|
||||
import minetweaker.mc1710.formatting.IMCFormattedString;
|
||||
import minetweaker.mc1710.item.*;
|
||||
|
||||
import net.minecraft.client.multiplayer.GuiConnecting;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.item.*;
|
||||
@@ -26,22 +25,27 @@ import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import stanhebben.zenscript.value.*;
|
||||
|
||||
import java.util.*;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import stanhebben.zenscript.value.*;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* @author Stan
|
||||
*/
|
||||
public class ForgeEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerInteract(PlayerInteractEvent ev) {
|
||||
minetweaker.api.event.PlayerInteractEvent event = new minetweaker.api.event.PlayerInteractEvent(
|
||||
MineTweakerMC.getIPlayer(ev.entityPlayer),
|
||||
MineTweakerMC.getDimension(ev.world),
|
||||
ev.x, ev.y, ev.z
|
||||
);
|
||||
ev.x,
|
||||
ev.y,
|
||||
ev.z);
|
||||
|
||||
MineTweakerImplementationAPI.events.publishPlayerInteract(event);
|
||||
}
|
||||
@@ -54,64 +58,83 @@ public class ForgeEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onItemTooltip(ItemTooltipEvent ev) {
|
||||
if(ev.itemStack!= null) {
|
||||
if (ev.itemStack != null) {
|
||||
IItemStack itemStack = MineTweakerMC.getIItemStack(ev.itemStack);
|
||||
for(IFormattedText tooltip : IngredientTooltips.getTooltips(itemStack)) {
|
||||
for (IFormattedText tooltip : IngredientTooltips.getTooltips(itemStack)) {
|
||||
ev.toolTip.add(((IMCFormattedString) tooltip).getTooltipString());
|
||||
}
|
||||
|
||||
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
for(IFormattedText tooltip : IngredientTooltips.getShiftTooltips(itemStack)) {
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
for (IFormattedText tooltip : IngredientTooltips.getShiftTooltips(itemStack)) {
|
||||
ev.toolTip.add(((IMCFormattedString) tooltip).getTooltipString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingDeathDrops(LivingDropsEvent ev) {
|
||||
final EntityLivingBase entity = ev.entityLiving;
|
||||
final IEntityDefinition iEntity = MineTweakerAPI.game.getEntity(EntityList.getEntityString(entity));
|
||||
if(iEntity == null) {
|
||||
if (iEntity == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!iEntity.getDropsToAdd().isEmpty()) {
|
||||
for(Map.Entry<IItemStack, IntRange> dropToAdd : iEntity.getDropsToAdd().entrySet()) {
|
||||
|
||||
if (!iEntity.getDropsToAdd().isEmpty()) {
|
||||
for (Map.Entry<IItemStack, IntRange> dropToAdd : iEntity.getDropsToAdd().entrySet()) {
|
||||
final IItemStack key = dropToAdd.getKey();
|
||||
final IntRange val = dropToAdd.getValue();
|
||||
|
||||
|
||||
final EntityItem item;
|
||||
if(val.getMin() == 0 && val.getMax() == 0) {
|
||||
item = new EntityItem(entity.worldObj, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5, ((ItemStack) key.getInternal()).copy());
|
||||
if (val.getMin() == 0 && val.getMax() == 0) {
|
||||
item = new EntityItem(
|
||||
entity.worldObj,
|
||||
entity.posX + 0.5,
|
||||
entity.posY + 0.5,
|
||||
entity.posZ + 0.5,
|
||||
((ItemStack) key.getInternal()).copy());
|
||||
} else {
|
||||
item = new EntityItem(entity.worldObj, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5, ((ItemStack) key.withAmount(val.getRandom()).getInternal()).copy());
|
||||
item = new EntityItem(
|
||||
entity.worldObj,
|
||||
entity.posX + 0.5,
|
||||
entity.posY + 0.5,
|
||||
entity.posZ + 0.5,
|
||||
((ItemStack) key.withAmount(val.getRandom()).getInternal()).copy());
|
||||
}
|
||||
ev.drops.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if(!iEntity.getDropsToAddPlayerOnly().isEmpty() && ev.source.getEntity() instanceof EntityPlayer) {
|
||||
for(Map.Entry<IItemStack, IntRange> dropToAdd : iEntity.getDropsToAddPlayerOnly().entrySet()) {
|
||||
|
||||
if (!iEntity.getDropsToAddPlayerOnly().isEmpty() && ev.source.getEntity() instanceof EntityPlayer) {
|
||||
for (Map.Entry<IItemStack, IntRange> dropToAdd : iEntity.getDropsToAddPlayerOnly().entrySet()) {
|
||||
final IItemStack key = dropToAdd.getKey();
|
||||
final IntRange val = dropToAdd.getValue();
|
||||
|
||||
|
||||
final EntityItem item;
|
||||
if(val.getMin() == 0 && val.getMax() == 0) {
|
||||
item = new EntityItem(entity.worldObj, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5, ((ItemStack) key.getInternal()).copy());
|
||||
if (val.getMin() == 0 && val.getMax() == 0) {
|
||||
item = new EntityItem(
|
||||
entity.worldObj,
|
||||
entity.posX + 0.5,
|
||||
entity.posY + 0.5,
|
||||
entity.posZ + 0.5,
|
||||
((ItemStack) key.getInternal()).copy());
|
||||
} else {
|
||||
item = new EntityItem(entity.worldObj, entity.posX + 0.5, entity.posY + 0.5, entity.posZ + 0.5, ((ItemStack) key.withAmount(val.getRandom()).getInternal()).copy());
|
||||
item = new EntityItem(
|
||||
entity.worldObj,
|
||||
entity.posX + 0.5,
|
||||
entity.posY + 0.5,
|
||||
entity.posZ + 0.5,
|
||||
((ItemStack) key.withAmount(val.getRandom()).getInternal()).copy());
|
||||
}
|
||||
ev.drops.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if(!iEntity.getDropsToRemove().isEmpty()) {
|
||||
for(IItemStack iItemStack : iEntity.getDropsToRemove()) {
|
||||
for(Iterator<EntityItem> iterator = ev.drops.iterator(); iterator.hasNext(); ) {
|
||||
|
||||
if (!iEntity.getDropsToRemove().isEmpty()) {
|
||||
for (IItemStack iItemStack : iEntity.getDropsToRemove()) {
|
||||
for (Iterator<EntityItem> iterator = ev.drops.iterator(); iterator.hasNext();) {
|
||||
EntityItem drop = iterator.next();
|
||||
if(iItemStack.matches(new MCItemStack(drop.getEntityItem()))) {
|
||||
if (iItemStack.matches(new MCItemStack(drop.getEntityItem()))) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user