mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-05 01:45:00 +01:00
Do some packaging for easier maintenance
This commit is contained in:
parent
838eeeee10
commit
19fa27c54b
7 changed files with 35 additions and 24 deletions
|
@ -1,5 +1,11 @@
|
||||||
package com.simibubi.create.content.optics;
|
package com.simibubi.create.content.optics;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
|
@ -8,12 +14,6 @@ import net.minecraft.item.DyeColor;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class Beam extends ArrayList<BeamSegment> {
|
public class Beam extends ArrayList<BeamSegment> {
|
||||||
private final Set<ILightHandler> lightEventListeners;
|
private final Set<ILightHandler> lightEventListeners;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -1,6 +1,19 @@
|
||||||
package com.simibubi.create.content.optics;
|
package com.simibubi.create.content.optics.behaviour;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.Iterators;
|
import com.google.common.collect.Iterators;
|
||||||
|
import com.simibubi.create.content.optics.Beam;
|
||||||
|
import com.simibubi.create.content.optics.ILightHandler;
|
||||||
|
import com.simibubi.create.content.optics.ILightHandlerProvider;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.utility.BeaconHelper;
|
import com.simibubi.create.foundation.utility.BeaconHelper;
|
||||||
|
@ -9,12 +22,6 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
import net.minecraft.tileentity.BeaconTileEntity;
|
import net.minecraft.tileentity.BeaconTileEntity;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
public abstract class LightHandlingBehaviour<T extends SmartTileEntity & ILightHandlerProvider> extends TileEntityBehaviour implements ILightHandler {
|
public abstract class LightHandlingBehaviour<T extends SmartTileEntity & ILightHandlerProvider> extends TileEntityBehaviour implements ILightHandler {
|
||||||
protected final T handler;
|
protected final T handler;
|
||||||
public Set<Beam> beams;
|
public Set<Beam> beams;
|
|
@ -1,7 +1,7 @@
|
||||||
package com.simibubi.create.content.optics;
|
package com.simibubi.create.content.optics.behaviour;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.optics.mirror.RotationMode;
|
import com.simibubi.create.content.optics.ILightHandlerProvider;
|
||||||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.simibubi.create.content.optics.mirror;
|
package com.simibubi.create.content.optics.behaviour;
|
||||||
|
|
||||||
import com.simibubi.create.foundation.gui.AllIcons;
|
import com.simibubi.create.foundation.gui.AllIcons;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions;
|
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions;
|
|
@ -1,7 +1,11 @@
|
||||||
package com.simibubi.create.content.optics.mirror;
|
package com.simibubi.create.content.optics.mirror;
|
||||||
|
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import com.simibubi.create.content.optics.Beam;
|
import com.simibubi.create.content.optics.Beam;
|
||||||
import com.simibubi.create.content.optics.RotatedLightHandlingBehaviour;
|
import com.simibubi.create.content.optics.behaviour.RotatedLightHandlingBehaviour;
|
||||||
import com.simibubi.create.foundation.collision.Matrix3d;
|
import com.simibubi.create.foundation.collision.Matrix3d;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
@ -10,10 +14,6 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
public class MirrorBehaviour extends RotatedLightHandlingBehaviour<MirrorTileEntity> {
|
public class MirrorBehaviour extends RotatedLightHandlingBehaviour<MirrorTileEntity> {
|
||||||
public static final BehaviourType<MirrorBehaviour> TYPE = new BehaviourType<>();
|
public static final BehaviourType<MirrorBehaviour> TYPE = new BehaviourType<>();
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@ public class MirrorRenderer extends KineticTileEntityRenderer {
|
||||||
MirrorTileEntity mirrorTe = (MirrorTileEntity) te;
|
MirrorTileEntity mirrorTe = (MirrorTileEntity) te;
|
||||||
|
|
||||||
renderMirror(mirrorTe, partialTicks, ms, buffer, light);
|
renderMirror(mirrorTe, partialTicks, ms, buffer, light);
|
||||||
((MirrorTileEntity) te).getHandler().getRenderBeams()
|
((MirrorTileEntity) te).getHandler()
|
||||||
|
.getRenderBeams()
|
||||||
.forEachRemaining(beam -> beam.render(ms, buffer, partialTicks));
|
.forEachRemaining(beam -> beam.render(ms, buffer, partialTicks));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,9 +37,11 @@ public class MirrorRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
final Direction.Axis facing = te.getBlockState()
|
final Direction.Axis facing = te.getBlockState()
|
||||||
.get(BlockStateProperties.AXIS);
|
.get(BlockStateProperties.AXIS);
|
||||||
SuperByteBuffer superBuffer = AllBlockPartials.MIRROR_PLANE.renderOnDirectionalSouth(te.getBlockState(), te.getHandler().getBeamRotationAround());
|
SuperByteBuffer superBuffer = AllBlockPartials.MIRROR_PLANE.renderOnDirectionalSouth(te.getBlockState(), te.getHandler()
|
||||||
|
.getBeamRotationAround());
|
||||||
|
|
||||||
float interpolatedAngle = te.getHandler().getInterpolatedAngle(partialTicks - 1);
|
float interpolatedAngle = te.getHandler()
|
||||||
|
.getInterpolatedAngle(partialTicks - 1);
|
||||||
kineticRotationTransform(superBuffer, te, facing, (float) (interpolatedAngle / 180 * Math.PI), light);
|
kineticRotationTransform(superBuffer, te, facing, (float) (interpolatedAngle / 180 * Math.PI), light);
|
||||||
superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getTranslucent()));
|
superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getTranslucent()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.optics.ILightHandler;
|
import com.simibubi.create.content.optics.ILightHandler;
|
||||||
import com.simibubi.create.content.optics.ILightHandlerProvider;
|
import com.simibubi.create.content.optics.ILightHandlerProvider;
|
||||||
|
import com.simibubi.create.content.optics.behaviour.RotationMode;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform;
|
import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
|
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
|
||||||
|
|
Loading…
Reference in a new issue