Browse Source

optimize material registry a bit; move experiments.projector to optics.projector and laser to optics.laser; allow projector to work without lasers

pull/193/head
Adrian Siekierka 1 year ago
parent
commit
03ff7a059f
51 changed files with 170 additions and 228 deletions
  1. 0
    5
      src/main/java/pl/asie/charset/lib/block/BlockBase.java
  2. 9
    11
      src/main/java/pl/asie/charset/lib/material/ItemMaterialHeuristics.java
  3. 14
    6
      src/main/java/pl/asie/charset/lib/material/ItemMaterialRegistry.java
  4. 0
    1
      src/main/java/pl/asie/charset/module/audio/storage/BlockRecordPlayer.java
  5. 0
    4
      src/main/java/pl/asie/charset/module/audio/storage/TileRecordPlayerRenderer.java
  6. 0
    3
      src/main/java/pl/asie/charset/module/misc/shelf/CharsetMiscShelf.java
  7. 5
    6
      src/main/java/pl/asie/charset/module/optics/laser/CharsetLaser.java
  8. 4
    8
      src/main/java/pl/asie/charset/module/optics/laser/ProxyClient.java
  9. 1
    1
      src/main/java/pl/asie/charset/module/optics/laser/ProxyCommon.java
  10. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/BlockCrystal.java
  11. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/BlockJar.java
  12. 1
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/BlockPrism.java
  13. 2
    5
      src/main/java/pl/asie/charset/module/optics/laser/blocks/BlockReflector.java
  14. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/ItemBlockCrystal.java
  15. 2
    8
      src/main/java/pl/asie/charset/module/optics/laser/blocks/ItemBlockJar.java
  16. 2
    4
      src/main/java/pl/asie/charset/module/optics/laser/blocks/ItemBlockReflector.java
  17. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/LaserTintHandler.java
  18. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/TileCrystal.java
  19. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/TileJar.java
  20. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/TileLaserSourceBase.java
  21. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/TilePrism.java
  22. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/blocks/TileReflector.java
  23. 1
    1
      src/main/java/pl/asie/charset/module/optics/laser/system/DummyLaserSource.java
  24. 1
    1
      src/main/java/pl/asie/charset/module/optics/laser/system/ILaserEndpoint.java
  25. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/system/LaserBeam.java
  26. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/system/LaserBeamFactory.java
  27. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/system/LaserRedstoneHelper.java
  28. 2
    7
      src/main/java/pl/asie/charset/module/optics/laser/system/LaserRenderer.java
  29. 1
    1
      src/main/java/pl/asie/charset/module/optics/laser/system/LaserStorage.java
  30. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/system/LaserWorldStorage.java
  31. 1
    3
      src/main/java/pl/asie/charset/module/optics/laser/system/LaserWorldStorageClient.java
  32. 2
    10
      src/main/java/pl/asie/charset/module/optics/laser/system/LaserWorldStorageServer.java
  33. 2
    5
      src/main/java/pl/asie/charset/module/optics/laser/system/PacketBeamAdd.java
  34. 2
    4
      src/main/java/pl/asie/charset/module/optics/laser/system/PacketBeamRemove.java
  35. 2
    2
      src/main/java/pl/asie/charset/module/optics/laser/system/SubCommandDebugLasers.java
  36. 1
    4
      src/main/java/pl/asie/charset/module/optics/laser/system/SubCommandDebugLasersClient.java
  37. 1
    4
      src/main/java/pl/asie/charset/module/optics/laser/system/SubCommandSetSpeedOfLight.java
  38. 13
    4
      src/main/java/pl/asie/charset/module/optics/projector/BlockProjector.java
  39. 19
    10
      src/main/java/pl/asie/charset/module/optics/projector/CharsetProjector.java
  40. 1
    1
      src/main/java/pl/asie/charset/module/optics/projector/IProjector.java
  41. 1
    3
      src/main/java/pl/asie/charset/module/optics/projector/IProjectorHandler.java
  42. 1
    1
      src/main/java/pl/asie/charset/module/optics/projector/IProjectorSurface.java
  43. 1
    2
      src/main/java/pl/asie/charset/module/optics/projector/PacketRequestMapData.java
  44. 1
    1
      src/main/java/pl/asie/charset/module/optics/projector/ProjectorCacheInfo.java
  45. 1
    1
      src/main/java/pl/asie/charset/module/optics/projector/ProjectorHelper.java
  46. 1
    2
      src/main/java/pl/asie/charset/module/optics/projector/ProjectorModel.java
  47. 18
    38
      src/main/java/pl/asie/charset/module/optics/projector/ProjectorRenderer.java
  48. 23
    2
      src/main/java/pl/asie/charset/module/optics/projector/TileProjector.java
  49. 1
    24
      src/main/java/pl/asie/charset/module/optics/projector/TileProjectorRenderer.java
  50. 5
    5
      src/main/java/pl/asie/charset/module/optics/projector/handlers/ProjectorHandlerBook.java
  51. 2
    2
      src/main/java/pl/asie/charset/module/optics/projector/handlers/ProjectorHandlerMap.java

+ 0
- 5
src/main/java/pl/asie/charset/lib/block/BlockBase.java View File

@@ -19,7 +19,6 @@

package pl.asie.charset.lib.block;

import com.google.common.collect.ImmutableList;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.MapColor;
@@ -55,13 +54,9 @@ import pl.asie.charset.lib.Properties;
import pl.asie.charset.lib.item.ISubItemProvider;
import pl.asie.charset.lib.render.ParticleDiggingCharset;
import pl.asie.charset.lib.render.model.IStateParticleBakedModel;
import pl.asie.charset.lib.render.model.ModelFactory;
import pl.asie.charset.lib.utils.Utils;
import pl.asie.charset.module.experiments.projector.TileProjector;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;

public abstract class BlockBase extends Block {
private final boolean isTileProvider;

+ 9
- 11
src/main/java/pl/asie/charset/lib/material/ItemMaterialHeuristics.java View File

@@ -99,21 +99,19 @@ public final class ItemMaterialHeuristics {
int height = craftMatrix.getHeight();

for (IRecipe irecipe : ForgeRegistries.RECIPES) {
// These cut the search time significantly.
if (irecipe.getClass() == ShapedRecipes.class || irecipe.getClass() == ShapedOreRecipe.class || (irecipe instanceof RecipeCharset.Shaped)) {
// I don't trust non-vanilla/non-Charset recipes to be correct with this
if (((IShapedRecipe) irecipe).getRecipeWidth() != width || ((IShapedRecipe) irecipe).getRecipeHeight() != height) {
continue;
}
}

if (noShapeless && (irecipe instanceof ShapelessRecipes || irecipe instanceof ShapelessOreRecipe
|| (irecipe instanceof RecipeCharset && ((RecipeCharset) irecipe).getType() == RecipeCharset.Type.SHAPELESS))) {
|| (irecipe instanceof RecipeCharset && ((RecipeCharset) irecipe).getType() == RecipeCharset.Type.SHAPELESS))) {
continue;
}

if (!irecipe.canFit(width, height)) {
continue;
if (irecipe instanceof IShapedRecipe && !irecipe.isDynamic()) {
if (((IShapedRecipe) irecipe).getRecipeWidth() != width || ((IShapedRecipe) irecipe).getRecipeHeight() != height) {
continue;
}
} else {
if (!irecipe.canFit(width, height)) {
continue;
}
}

if (irecipe.matches(craftMatrix, worldIn)) {

+ 14
- 6
src/main/java/pl/asie/charset/lib/material/ItemMaterialRegistry.java View File

@@ -27,10 +27,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagString;
import pl.asie.charset.lib.utils.ItemUtils;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

public class ItemMaterialRegistry {
public static final ItemMaterialRegistry INSTANCE = new ItemMaterialRegistry();
@@ -102,8 +99,19 @@ public class ItemMaterialRegistry {

// TODO: slow - optimize
public Collection<ItemMaterial> getMaterialsByTypes(String... types) {
Collection<ItemMaterial> startingPoint = materialsById.values();

for (String type : types) {
if (type.charAt(0) != '!') {
Collection<ItemMaterial> collection = materialsByType.get(type);
if (collection.size() < startingPoint.size()) {
startingPoint = collection;
}
}
}

ImmutableSet.Builder<ItemMaterial> set = new ImmutableSet.Builder<>();
for (ItemMaterial material : materialsById.values()) {
for (ItemMaterial material : startingPoint) {
Collection<String> srcTypes = material.getTypes();
boolean valid = true;
for (String type : types) {
@@ -184,7 +192,7 @@ public class ItemMaterialRegistry {

public boolean matches(ItemMaterial mat, String... mats) {
for (String matStr : mats) {
if (matStr.startsWith("!")) {
if (matStr.length() > 0 && matStr.charAt(0) == '!') {
matStr = matStr.substring(1);
if (mat.getTypes().contains(matStr)) {
return false;

+ 0
- 1
src/main/java/pl/asie/charset/module/audio/storage/BlockRecordPlayer.java View File

@@ -36,7 +36,6 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import pl.asie.charset.lib.Properties;
import pl.asie.charset.lib.block.BlockBase;
import pl.asie.charset.module.experiments.projector.TileProjector;

import javax.annotation.Nullable;


+ 0
- 4
src/main/java/pl/asie/charset/module/audio/storage/TileRecordPlayerRenderer.java View File

@@ -29,16 +29,12 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.model.TRSRTransformation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import org.lwjgl.opengl.GLSync;
import pl.asie.charset.lib.Properties;
import pl.asie.charset.module.laser.CharsetLaser;

public class TileRecordPlayerRenderer extends TileEntitySpecialRenderer<TileRecordPlayer> {
public static final TileRecordPlayerRenderer INSTANCE = new TileRecordPlayerRenderer();

+ 0
- 3
src/main/java/pl/asie/charset/module/misc/shelf/CharsetMiscShelf.java View File

@@ -20,7 +20,6 @@
package pl.asie.charset.module.misc.shelf;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
@@ -42,8 +41,6 @@ import pl.asie.charset.lib.loader.ModuleProfile;
import pl.asie.charset.lib.render.ShadingTintColorHandler;
import pl.asie.charset.lib.utils.RegistryUtils;
import pl.asie.charset.lib.utils.RenderUtils;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.laser.blocks.LaserTintHandler;

@CharsetModule(
name = "misc.shelf",

src/main/java/pl/asie/charset/module/laser/CharsetLaser.java → src/main/java/pl/asie/charset/module/optics/laser/CharsetLaser.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser;
package pl.asie.charset.module.optics.laser;

import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
@@ -30,7 +30,6 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
@@ -54,8 +53,8 @@ import pl.asie.charset.lib.utils.RegistryUtils;
import pl.asie.charset.api.laser.ILaserReceiver;
import pl.asie.charset.api.laser.LaserColor;
import pl.asie.charset.lib.utils.RenderUtils;
import pl.asie.charset.module.laser.blocks.*;
import pl.asie.charset.module.laser.system.*;
import pl.asie.charset.module.optics.laser.blocks.*;
import pl.asie.charset.module.optics.laser.system.*;
import pl.asie.charset.patchwork.LaserRedstoneHook;
import pl.asie.charset.patchwork.PatchworkHelper;

@@ -63,7 +62,7 @@ import java.util.HashSet;
import java.util.Set;

@CharsetModule(
name = "laser",
name = "optics.laser",
description = "Lasers!",
profile = ModuleProfile.TESTING
)
@@ -99,7 +98,7 @@ public class CharsetLaser {
@CharsetModule.PacketRegistry
public static PacketRegistry packet;

@CharsetModule.SidedProxy(clientSide = "pl.asie.charset.module.laser.ProxyClient", serverSide = "pl.asie.charset.module.laser.ProxyCommon")
@CharsetModule.SidedProxy(clientSide = "pl.asie.charset.module.optics.laser.ProxyClient", serverSide = "pl.asie.charset.module.optics.laser.ProxyCommon")
public static ProxyCommon proxy;

@Mod.EventHandler

src/main/java/pl/asie/charset/module/laser/ProxyClient.java → src/main/java/pl/asie/charset/module/optics/laser/ProxyClient.java View File

@@ -17,10 +17,9 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser;
package pl.asie.charset.module.optics.laser;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -44,12 +43,9 @@ import pl.asie.charset.lib.utils.Orientation;
import pl.asie.charset.lib.utils.RegistryUtils;
import pl.asie.charset.lib.utils.RenderUtils;
import pl.asie.charset.api.laser.LaserColor;
import pl.asie.charset.module.laser.blocks.BlockCrystal;
import pl.asie.charset.module.laser.blocks.LaserTintHandler;
import pl.asie.charset.module.laser.system.LaserRenderer;
import pl.asie.charset.module.laser.system.SubCommandDebugLasers;
import pl.asie.charset.module.laser.system.SubCommandDebugLasersClient;
import pl.asie.charset.module.storage.tanks.TankTintHandler;
import pl.asie.charset.module.optics.laser.blocks.LaserTintHandler;
import pl.asie.charset.module.optics.laser.system.LaserRenderer;
import pl.asie.charset.module.optics.laser.system.SubCommandDebugLasersClient;

public class ProxyClient extends ProxyCommon {
private static IModel prismModel;

src/main/java/pl/asie/charset/module/laser/ProxyCommon.java → src/main/java/pl/asie/charset/module/optics/laser/ProxyCommon.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser;
package pl.asie.charset.module.optics.laser;

public class ProxyCommon {
public void init() {

src/main/java/pl/asie/charset/module/laser/blocks/BlockCrystal.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/BlockCrystal.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
@@ -35,7 +35,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.lib.block.BlockBase;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;
import pl.asie.charset.api.laser.LaserColor;

import javax.annotation.Nullable;

src/main/java/pl/asie/charset/module/laser/blocks/BlockJar.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/BlockJar.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
@@ -43,7 +43,7 @@ import pl.asie.charset.api.laser.LaserColor;
import pl.asie.charset.lib.Properties;
import pl.asie.charset.lib.block.BlockBase;
import pl.asie.charset.lib.utils.RotationUtils;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

import javax.annotation.Nullable;


src/main/java/pl/asie/charset/module/laser/blocks/BlockPrism.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/BlockPrism.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
@@ -26,7 +26,6 @@ import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;

src/main/java/pl/asie/charset/module/laser/blocks/BlockReflector.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/BlockReflector.java View File

@@ -17,9 +17,8 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
@@ -37,11 +36,9 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.lib.Properties;
import pl.asie.charset.lib.block.BlockBase;
import pl.asie.charset.lib.utils.RotationUtils;
import pl.asie.charset.lib.utils.SpaceUtils;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

src/main/java/pl/asie/charset/module/laser/blocks/ItemBlockCrystal.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/ItemBlockCrystal.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
@@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.lib.item.ItemBlockBase;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

public class ItemBlockCrystal extends ItemBlockBase {
public ItemBlockCrystal(Block block) {

src/main/java/pl/asie/charset/module/laser/blocks/ItemBlockJar.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/ItemBlockJar.java View File

@@ -17,21 +17,15 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.lib.item.ItemBlockBase;
import pl.asie.charset.module.laser.CharsetLaser;

import javax.annotation.Nullable;
import java.util.List;
import pl.asie.charset.module.optics.laser.CharsetLaser;

public class ItemBlockJar extends ItemBlockBase {
public ItemBlockJar(Block block) {

src/main/java/pl/asie/charset/module/laser/blocks/ItemBlockReflector.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/ItemBlockReflector.java View File

@@ -17,17 +17,15 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.Block;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.api.CharsetAPI;
import pl.asie.charset.lib.CharsetLib;
import pl.asie.charset.lib.item.ItemBlockBase;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

public class ItemBlockReflector extends ItemBlockBase {
public ItemBlockReflector(Block block) {

src/main/java/pl/asie/charset/module/laser/blocks/LaserTintHandler.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/LaserTintHandler.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor;
@@ -25,7 +25,7 @@ import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

import javax.annotation.Nullable;


src/main/java/pl/asie/charset/module/laser/blocks/TileCrystal.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/TileCrystal.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
@@ -28,7 +28,7 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.capabilities.Capability;
import pl.asie.charset.lib.scheduler.Scheduler;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;
import pl.asie.charset.api.laser.ILaserReceiver;
import pl.asie.charset.api.laser.ILaserBeamFactory;
import pl.asie.charset.api.laser.ILaserSource;

src/main/java/pl/asie/charset/module/laser/blocks/TileJar.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/TileJar.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@@ -30,7 +30,7 @@ import net.minecraftforge.common.capabilities.Capability;
import pl.asie.charset.lib.Properties;
import pl.asie.charset.lib.block.TileBase;
import pl.asie.charset.lib.scheduler.Scheduler;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;
import pl.asie.charset.api.laser.ILaserReceiver;
import pl.asie.charset.api.laser.ILaserBeamFactory;
import pl.asie.charset.api.laser.ILaserSource;

src/main/java/pl/asie/charset/module/laser/blocks/TileLaserSourceBase.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/TileLaserSourceBase.java View File

@@ -17,12 +17,12 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.capabilities.Capability;
import pl.asie.charset.lib.block.TileBase;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;
import pl.asie.charset.api.laser.ILaserBeamFactory;
import pl.asie.charset.api.laser.ILaserSource;
import pl.asie.charset.api.laser.LaserColor;

src/main/java/pl/asie/charset/module/laser/blocks/TilePrism.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/TilePrism.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
@@ -28,7 +28,7 @@ import pl.asie.charset.api.lib.IAxisRotatable;
import pl.asie.charset.lib.block.ITileWrenchRotatable;
import pl.asie.charset.lib.capability.Capabilities;
import pl.asie.charset.lib.utils.Orientation;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;
import pl.asie.charset.api.laser.ILaserReceiver;
import pl.asie.charset.api.laser.LaserColor;


src/main/java/pl/asie/charset/module/laser/blocks/TileReflector.java → src/main/java/pl/asie/charset/module/optics/laser/blocks/TileReflector.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.blocks;
package pl.asie.charset.module.optics.laser.blocks;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@@ -29,7 +29,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import pl.asie.charset.lib.utils.Orientation;
import pl.asie.charset.lib.utils.SpaceUtils;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;
import pl.asie.charset.api.laser.ILaserReceiver;
import pl.asie.charset.api.laser.LaserColor;


src/main/java/pl/asie/charset/module/laser/system/DummyLaserSource.java → src/main/java/pl/asie/charset/module/optics/laser/system/DummyLaserSource.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.tileentity.TileEntity;
import pl.asie.charset.api.laser.ILaserBeamFactory;

src/main/java/pl/asie/charset/module/laser/system/ILaserEndpoint.java → src/main/java/pl/asie/charset/module/optics/laser/system/ILaserEndpoint.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;

src/main/java/pl/asie/charset/module/laser/system/LaserBeam.java → src/main/java/pl/asie/charset/module/optics/laser/system/LaserBeam.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
@@ -33,7 +33,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.api.laser.ILaserBeam;
import pl.asie.charset.api.laser.ILaserSource;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;
import pl.asie.charset.api.laser.ILaserReceiver;
import pl.asie.charset.api.laser.LaserColor;


src/main/java/pl/asie/charset/module/laser/system/LaserBeamFactory.java → src/main/java/pl/asie/charset/module/optics/laser/system/LaserBeamFactory.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
@@ -27,7 +27,7 @@ import pl.asie.charset.api.laser.ILaserBeam;
import pl.asie.charset.api.laser.ILaserBeamFactory;
import pl.asie.charset.api.laser.ILaserSource;
import pl.asie.charset.api.laser.LaserColor;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

public final class LaserBeamFactory implements ILaserBeamFactory {
public static final LaserBeamFactory INSTANCE = new LaserBeamFactory();

src/main/java/pl/asie/charset/module/laser/system/LaserRedstoneHelper.java → src/main/java/pl/asie/charset/module/optics/laser/system/LaserRedstoneHelper.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
@@ -25,7 +25,7 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;
import pl.asie.charset.patchwork.LaserRedstoneHook;

public class LaserRedstoneHelper implements LaserRedstoneHook.Handler {

src/main/java/pl/asie/charset/module/laser/system/LaserRenderer.java → src/main/java/pl/asie/charset/module/optics/laser/system/LaserRenderer.java View File

@@ -17,9 +17,8 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.EnumFaceDirection;
@@ -29,22 +28,18 @@ import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.culling.ICamera;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import pl.asie.charset.lib.utils.EntityUtils;
import pl.asie.charset.lib.utils.MathUtils;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

import java.util.*;


src/main/java/pl/asie/charset/module/laser/system/LaserStorage.java → src/main/java/pl/asie/charset/module/optics/laser/system/LaserStorage.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;

src/main/java/pl/asie/charset/module/laser/system/LaserWorldStorage.java → src/main/java/pl/asie/charset/module/optics/laser/system/LaserWorldStorage.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import com.google.common.collect.*;
import it.unimi.dsi.fastutil.longs.*;
@@ -35,7 +35,7 @@ import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import org.apache.commons.lang3.tuple.Pair;
import pl.asie.charset.api.laser.ILaserSource;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

import javax.annotation.Nullable;
import java.util.*;

src/main/java/pl/asie/charset/module/laser/system/LaserWorldStorageClient.java → src/main/java/pl/asie/charset/module/optics/laser/system/LaserWorldStorageClient.java View File

@@ -17,10 +17,8 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import gnu.trove.map.TLongObjectMap;
import gnu.trove.map.hash.TLongObjectHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import net.minecraft.world.World;


src/main/java/pl/asie/charset/module/laser/system/LaserWorldStorageServer.java → src/main/java/pl/asie/charset/module/optics/laser/system/LaserWorldStorageServer.java View File

@@ -17,24 +17,16 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.management.PlayerChunkMap;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.event.world.ChunkWatchEvent;
import pl.asie.charset.lib.network.Packet;
import pl.asie.charset.lib.scheduler.Scheduler;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;

public class LaserWorldStorageServer extends LaserWorldStorage {

src/main/java/pl/asie/charset/module/laser/system/PacketBeamAdd.java → src/main/java/pl/asie/charset/module/optics/laser/system/PacketBeamAdd.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.network.INetHandler;
import net.minecraft.network.PacketBuffer;
@@ -25,10 +25,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import pl.asie.charset.ModCharset;
import pl.asie.charset.lib.network.Packet;
import pl.asie.charset.lib.utils.Utils;
import pl.asie.charset.module.laser.CharsetLaser;

import java.io.IOException;
import pl.asie.charset.module.optics.laser.CharsetLaser;

public class PacketBeamAdd extends Packet {
private LaserBeam beam;

src/main/java/pl/asie/charset/module/laser/system/PacketBeamRemove.java → src/main/java/pl/asie/charset/module/optics/laser/system/PacketBeamRemove.java View File

@@ -17,15 +17,13 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetHandler;
import net.minecraft.network.PacketBuffer;
import net.minecraft.world.World;
import pl.asie.charset.lib.network.Packet;
import pl.asie.charset.lib.utils.Utils;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

public class PacketBeamRemove extends Packet {
private LaserBeam beam;

src/main/java/pl/asie/charset/module/laser/system/SubCommandDebugLasers.java → src/main/java/pl/asie/charset/module/optics/laser/system/SubCommandDebugLasers.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
@@ -26,7 +26,7 @@ import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side;
import pl.asie.charset.lib.command.SubCommand;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

public class SubCommandDebugLasers extends SubCommand {
public SubCommandDebugLasers() {

src/main/java/pl/asie/charset/module/laser/system/SubCommandDebugLasersClient.java → src/main/java/pl/asie/charset/module/optics/laser/system/SubCommandDebugLasersClient.java View File

@@ -17,16 +17,13 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side;
import pl.asie.charset.lib.command.SubCommand;
import pl.asie.charset.module.laser.CharsetLaser;

public class SubCommandDebugLasersClient extends SubCommand {
public static boolean enabled = false;

src/main/java/pl/asie/charset/module/laser/system/SubCommandSetSpeedOfLight.java → src/main/java/pl/asie/charset/module/optics/laser/system/SubCommandSetSpeedOfLight.java View File

@@ -17,16 +17,13 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.laser.system;
package pl.asie.charset.module.optics.laser.system;

import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side;
import pl.asie.charset.lib.command.SubCommand;
import pl.asie.charset.module.laser.CharsetLaser;

public class SubCommandSetSpeedOfLight extends SubCommand {
public SubCommandSetSpeedOfLight() {

src/main/java/pl/asie/charset/module/experiments/projector/BlockProjector.java → src/main/java/pl/asie/charset/module/optics/projector/BlockProjector.java View File

@@ -17,8 +17,9 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@@ -37,11 +38,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import pl.asie.charset.lib.block.BlockBase;
import pl.asie.charset.lib.utils.Orientation;
import pl.asie.charset.lib.utils.Quaternion;
import pl.asie.charset.lib.utils.SpaceUtils;
import pl.asie.charset.lib.utils.UnlistedPropertyGeneric;
import pl.asie.charset.module.storage.barrels.TileEntityDayBarrel;

import javax.annotation.Nullable;

@@ -55,6 +53,17 @@ public class BlockProjector extends BlockBase implements ITileEntityProvider {
return new ExtendedBlockState(this, new IProperty[]{}, new IUnlistedProperty[]{INFO});
}

@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
super.neighborChanged(state, world, pos, blockIn, fromPos);
if (!CharsetProjector.useLasers) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileProjector) {
((TileProjector) tile).updateRedstone();
}
}
}

public BlockProjector() {
super(Material.CIRCUITS);
setHardness(2.5F);

src/main/java/pl/asie/charset/module/experiments/projector/CharsetProjector.java → src/main/java/pl/asie/charset/module/optics/projector/CharsetProjector.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@@ -28,15 +28,19 @@ import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.ModCharset;
import pl.asie.charset.lib.CharsetLib;
import pl.asie.charset.lib.config.CharsetLoadConfigEvent;
import pl.asie.charset.lib.config.ConfigUtils;
import pl.asie.charset.lib.item.ItemBlockBase;
import pl.asie.charset.lib.loader.CharsetModule;
import pl.asie.charset.lib.loader.ModuleProfile;
@@ -44,31 +48,36 @@ import pl.asie.charset.lib.network.PacketRegistry;
import pl.asie.charset.lib.render.ArrowHighlightHandler;
import pl.asie.charset.lib.utils.RegistryUtils;
import pl.asie.charset.lib.utils.RenderUtils;
import pl.asie.charset.module.experiments.projector.handlers.ProjectorHandlerBook;
import pl.asie.charset.module.experiments.projector.handlers.ProjectorHandlerMap;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.storage.barrels.BarrelModel;
import pl.asie.charset.module.storage.barrels.TileEntityDayBarrel;
import pl.asie.charset.module.storage.barrels.TileEntityDayBarrelRenderer;
import pl.asie.charset.module.optics.projector.handlers.ProjectorHandlerBook;
import pl.asie.charset.module.optics.projector.handlers.ProjectorHandlerMap;

import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;

@CharsetModule(
name = "experiments.projector",
name = "optics.projector",
description = "Projectors!",
dependencies = {"laser"},
profile = ModuleProfile.EXPERIMENTAL
)
public class CharsetProjector {
@CharsetModule.Configuration
public static Configuration config;

@CharsetModule.PacketRegistry
public static PacketRegistry packet;

public static boolean useLasers;
public static Block blockProjector;
public static Item itemProjector;
private static List<IProjectorHandler<ItemStack>> handlerStack = new ArrayList<>();

@Mod.EventHandler
public void onLoadConfig(CharsetLoadConfigEvent event) {
boolean forceLasers = ConfigUtils.getBoolean(config, "general", "forceLasers", false, "Forces usage of the laser API even if the optics.laser module is not present.", true);
useLasers = forceLasers || ModCharset.isModuleLoaded("optics.laser");
}

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
blockProjector = new BlockProjector();

src/main/java/pl/asie/charset/module/experiments/projector/IProjector.java → src/main/java/pl/asie/charset/module/optics/projector/IProjector.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

public interface IProjector {
int getPage();

src/main/java/pl/asie/charset/module/experiments/projector/IProjectorHandler.java → src/main/java/pl/asie/charset/module/optics/projector/IProjectorHandler.java View File

@@ -17,10 +17,8 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;


src/main/java/pl/asie/charset/module/experiments/projector/IProjectorSurface.java → src/main/java/pl/asie/charset/module/optics/projector/IProjectorSurface.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.Vec3d;

src/main/java/pl/asie/charset/module/experiments/projector/PacketRequestMapData.java → src/main/java/pl/asie/charset/module/optics/projector/PacketRequestMapData.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import gnu.trove.map.TIntLongMap;
import gnu.trove.map.hash.TIntLongHashMap;
@@ -29,7 +29,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.network.INetHandler;
import net.minecraft.network.PacketBuffer;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.fml.common.FMLCommonHandler;
import pl.asie.charset.lib.network.Packet;

public class PacketRequestMapData extends Packet {

src/main/java/pl/asie/charset/module/experiments/projector/ProjectorCacheInfo.java → src/main/java/pl/asie/charset/module/optics/projector/ProjectorCacheInfo.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.item.ItemStack;
import pl.asie.charset.lib.render.model.IRenderComparable;

src/main/java/pl/asie/charset/module/experiments/projector/ProjectorHelper.java → src/main/java/pl/asie/charset/module/optics/projector/ProjectorHelper.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.EnumFaceDirection;

src/main/java/pl/asie/charset/module/experiments/projector/ProjectorModel.java → src/main/java/pl/asie/charset/module/optics/projector/ProjectorModel.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -29,7 +29,6 @@ import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.model.IModelState;
import pl.asie.charset.lib.render.model.ModelFactory;
import pl.asie.charset.lib.render.model.WrappedBakedModel;
import pl.asie.charset.lib.utils.RenderUtils;

public class ProjectorModel extends ModelFactory<ProjectorCacheInfo> {
public static final ProjectorModel INSTANCE = new ProjectorModel();

src/main/java/pl/asie/charset/module/experiments/projector/ProjectorRenderer.java → src/main/java/pl/asie/charset/module/optics/projector/ProjectorRenderer.java View File

@@ -17,57 +17,29 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.block.BlockStainedGlass;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiUtilRenderComponents;
import net.minecraft.client.gui.MapItemRenderer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.EnumFaceDirection;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.block.model.BlockFaceUV;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.culling.ICamera;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemWrittenBook;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.*;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import pl.asie.charset.api.laser.LaserColor;
import pl.asie.charset.lib.utils.*;
import scala.xml.dtd.MIXED;

import java.lang.invoke.MethodHandle;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class ProjectorRenderer {
public static class Surface implements IProjectorSurface {
@@ -261,17 +233,21 @@ public class ProjectorRenderer {
LaserColor color = LaserColor.NONE;
Orientation orientation = ((TileProjector) tileEntity).getOrientation();

for (int d = 0; d < 6; d++) {
LaserColor color2 = ((TileProjector) tileEntity).colors[d];
if (color2 != null && color2 != LaserColor.NONE) {
if (d == orientation.facing.getOpposite().ordinal()) {
// not rendering anything - laser in the way
color = LaserColor.NONE;
break;
} else {
color = color.union(color2);
if (CharsetProjector.useLasers) {
for (int d = 0; d < 6; d++) {
LaserColor color2 = ((TileProjector) tileEntity).colors[d];
if (color2 != null && color2 != LaserColor.NONE) {
if (d == orientation.facing.getOpposite().ordinal()) {
// not rendering anything - laser in the way
color = LaserColor.NONE;
break;
} else {
color = color.union(color2);
}
}
}
} else {
color = ((TileProjector) tileEntity).redstoneLevel > 0 ? LaserColor.WHITE : LaserColor.NONE;
}

if (color != LaserColor.NONE) {
@@ -295,6 +271,10 @@ public class ProjectorRenderer {
surface.b = color.blue ? 1.0f : 0.0f;
surface.a = 0.5f;

if (!CharsetProjector.useLasers) {
surface.a *= ((TileProjector) tileEntity).redstoneLevel / 15.0f;
}

EnumDyeColor dyeColor = null;

BlockPos inFrontPos = tileEntity.getPos().offset(((TileProjector) tileEntity).getOrientation().facing);

src/main/java/pl/asie/charset/module/experiments/projector/TileProjector.java → src/main/java/pl/asie/charset/module/optics/projector/TileProjector.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
@@ -38,12 +38,13 @@ import pl.asie.charset.lib.block.TraitItemHolder;
import pl.asie.charset.lib.capability.Capabilities;
import pl.asie.charset.lib.utils.Orientation;
import pl.asie.charset.lib.utils.SpaceUtils;
import pl.asie.charset.module.laser.CharsetLaser;
import pl.asie.charset.module.optics.laser.CharsetLaser;

import javax.annotation.Nullable;

public class TileProjector extends TileBase implements IAxisRotatable, IProjector, ITileWrenchRotatable {
protected final LaserColor[] colors = new LaserColor[6];
protected int redstoneLevel;
private TraitItemHolder holder;
private final ILaserReceiver[] receivers = new ILaserReceiver[6];
private int page;
@@ -79,6 +80,12 @@ public class TileProjector extends TileBase implements IAxisRotatable, IProjecto
holder.setStack(new ItemStack(compound.getCompoundTag("stack")));
}

if (compound.hasKey("rl", Constants.NBT.TAG_ANY_NUMERIC)) {
redstoneLevel = compound.getByte("rl");
} else {
redstoneLevel = 0;
}

if (isClient) {
markBlockForRenderUpdate();
}
@@ -89,6 +96,9 @@ public class TileProjector extends TileBase implements IAxisRotatable, IProjecto
compound = super.writeNBTData(compound, isClient);
compound.setByte("o", (byte) orientation.ordinal());
compound.setInteger("p", page);
if (!CharsetProjector.useLasers) {
compound.setByte("rl", (byte) redstoneLevel);
}

return compound;
}
@@ -219,4 +229,15 @@ public class TileProjector extends TileBase implements IAxisRotatable, IProjecto
public int getPage() {
return page;
}

protected void updateRedstone() {
int oldRedstoneLevel = redstoneLevel;
redstoneLevel = 0;
for (EnumFacing facing : EnumFacing.VALUES) {
redstoneLevel = Math.max(redstoneLevel, world.getRedstonePower(pos.offset(facing), facing));
}
if (redstoneLevel != oldRedstoneLevel) {
markBlockForUpdate();
}
}
}

src/main/java/pl/asie/charset/module/experiments/projector/TileProjectorRenderer.java → src/main/java/pl/asie/charset/module/optics/projector/TileProjectorRenderer.java View File

@@ -17,41 +17,18 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector;
package pl.asie.charset.module.optics.projector;

import gnu.trove.impl.Constants;
import gnu.trove.map.TCharIntMap;
import gnu.trove.map.hash.TCharIntHashMap;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.GL11;
import pl.asie.charset.lib.CharsetLib;
import pl.asie.charset.lib.render.model.ModelTransformer;
import pl.asie.charset.lib.utils.ItemUtils;
import pl.asie.charset.lib.utils.Orientation;
import pl.asie.charset.lib.utils.Quaternion;
import pl.asie.charset.lib.utils.SpaceUtils;
import pl.asie.charset.module.storage.barrels.BarrelModel;
import pl.asie.charset.module.storage.barrels.CharsetStorageBarrels;
import pl.asie.charset.module.storage.barrels.TileEntityDayBarrel;

import java.util.Calendar;

public class TileProjectorRenderer extends TileEntitySpecialRenderer<TileProjector> {
@Override

src/main/java/pl/asie/charset/module/experiments/projector/handlers/ProjectorHandlerBook.java → src/main/java/pl/asie/charset/module/optics/projector/handlers/ProjectorHandlerBook.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector.handlers;
package pl.asie.charset.module.optics.projector.handlers;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -35,10 +35,10 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.lib.utils.Orientation;
import pl.asie.charset.lib.utils.Quaternion;
import pl.asie.charset.module.experiments.projector.IProjector;
import pl.asie.charset.module.experiments.projector.IProjectorHandler;
import pl.asie.charset.module.experiments.projector.IProjectorSurface;
import pl.asie.charset.module.experiments.projector.ProjectorHelper;
import pl.asie.charset.module.optics.projector.IProjector;
import pl.asie.charset.module.optics.projector.IProjectorHandler;
import pl.asie.charset.module.optics.projector.IProjectorSurface;
import pl.asie.charset.module.optics.projector.ProjectorHelper;

import java.util.List;


src/main/java/pl/asie/charset/module/experiments/projector/handlers/ProjectorHandlerMap.java → src/main/java/pl/asie/charset/module/optics/projector/handlers/ProjectorHandlerMap.java View File

@@ -17,7 +17,7 @@
* along with Charset. If not, see <http://www.gnu.org/licenses/>.
*/

package pl.asie.charset.module.experiments.projector.handlers;
package pl.asie.charset.module.optics.projector.handlers;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.MapItemRenderer;
@@ -29,7 +29,7 @@ import net.minecraft.world.storage.MapData;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import pl.asie.charset.lib.utils.MethodHandleHelper;
import pl.asie.charset.module.experiments.projector.*;
import pl.asie.charset.module.optics.projector.*;

import java.lang.invoke.MethodHandle;


Loading…
Cancel
Save