Code Cleaning
1. Cleaned up some spacing and unused imports in EventHookContainer. Also changed an indirect reference to BaseItemDoor.trytoPlaceDoor() to a direct reference seeing as the function is static and should be accessed that way. 2. Renamed getDoortoItemMapping() to getDoorBlock(). The original named had a minor capitalization mistake and implied that it would return a mapping table or would associate doors to items. The function actually associates items to door blocks.
This commit is contained in:
parent
161da193ad
commit
660ff4255e
6 changed files with 10 additions and 14 deletions
|
@ -1,14 +1,11 @@
|
|||
package StevenDimDoors.mod_pocketDim;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.sound.PlayBackgroundMusicEvent;
|
||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||
|
@ -20,7 +17,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import net.minecraftforge.event.terraingen.InitMapGenEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
|
||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
|
@ -84,7 +80,7 @@ public class EventHookContainer
|
|||
public void onPlayerEvent(PlayerInteractEvent event)
|
||||
{
|
||||
// Handle all door placement here
|
||||
if(event.action == Action.LEFT_CLICK_BLOCK)
|
||||
if (event.action == Action.LEFT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -92,9 +88,9 @@ public class EventHookContainer
|
|||
ItemStack stack = event.entityPlayer.inventory.getCurrentItem();
|
||||
if (stack != null && stack.getItem() instanceof ItemDoor)
|
||||
{
|
||||
if(BaseItemDoor.getDoorToPlace(stack.getItem())!=null)
|
||||
if (BaseItemDoor.getDoorToPlace(stack.getItem()) != null)
|
||||
{
|
||||
if (mod_pocketDim.itemDimensionalDoor.tryToPlaceDoor(stack, event.entityPlayer, world,
|
||||
if (BaseItemDoor.tryToPlaceDoor(stack, event.entityPlayer, world,
|
||||
event.x, event.y, event.z, event.face))
|
||||
{
|
||||
// Cancel the event so that we don't get two doors from vanilla doors
|
||||
|
|
|
@ -2,6 +2,7 @@ package StevenDimDoors.mod_pocketDim.items;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
|
@ -64,7 +65,7 @@ public abstract class BaseItemDoor extends ItemDoor
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
protected abstract BaseDimDoor getDoortoItemMapping();
|
||||
protected abstract BaseDimDoor getDoorBlock();
|
||||
|
||||
/**
|
||||
* Overriden here to remove vanilla block placement functionality from
|
||||
|
@ -73,7 +74,6 @@ public abstract class BaseItemDoor extends ItemDoor
|
|||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public abstract class BaseItemDoor extends ItemDoor
|
|||
{
|
||||
return null;
|
||||
}
|
||||
return ((BaseItemDoor) item).getDoortoItemMapping();
|
||||
return ((BaseItemDoor) item).getDoorBlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ItemDimensionalDoor extends BaseItemDoor
|
|||
}
|
||||
|
||||
@Override
|
||||
protected BaseDimDoor getDoortoItemMapping()
|
||||
protected BaseDimDoor getDoorBlock()
|
||||
{
|
||||
return (BaseDimDoor) mod_pocketDim.dimensionalDoor;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ItemGoldDimDoor extends BaseItemDoor
|
|||
}
|
||||
|
||||
@Override
|
||||
protected BaseDimDoor getDoortoItemMapping()
|
||||
protected BaseDimDoor getDoorBlock()
|
||||
{
|
||||
return (BaseDimDoor) mod_pocketDim.goldenDimensionalDoor;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ItemUnstableDoor extends BaseItemDoor
|
|||
}
|
||||
|
||||
@Override
|
||||
protected BaseDimDoor getDoortoItemMapping()
|
||||
protected BaseDimDoor getDoorBlock()
|
||||
{
|
||||
return (BaseDimDoor) mod_pocketDim.unstableDoor;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ItemWarpDoor extends BaseItemDoor
|
|||
}
|
||||
|
||||
@Override
|
||||
protected BaseDimDoor getDoortoItemMapping()
|
||||
protected BaseDimDoor getDoorBlock()
|
||||
{
|
||||
return (BaseDimDoor) mod_pocketDim.warpDoor;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue