Fixes anchor rendering (#2698)
* Fixes #2680: Use a shorter cable anchor model when blocked by a facade. * Fixes #2664: Prevent anchors from creating intersection. Replaced the simple List<ResourceLocation> for the static models with a new container also indicating a solid part, which can be used to prevent the creation of an intersection.
This commit is contained in:
@@ -24,12 +24,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.parts.PartModel;
|
||||
|
||||
|
||||
/**
|
||||
@@ -42,26 +43,26 @@ class PlaneModels
|
||||
public static final ResourceLocation MODEL_CHASSIS_ON = new ResourceLocation( AppEng.MOD_ID, "part/transition_plane_on" );
|
||||
public static final ResourceLocation MODEL_CHASSIS_HAS_CHANNEL = new ResourceLocation( AppEng.MOD_ID, "part/transition_plane_has_channel" );
|
||||
|
||||
private final Map<PlaneConnections, List<ResourceLocation>> modelsOff;
|
||||
private final Map<PlaneConnections, IPartModel> modelsOff;
|
||||
|
||||
private final Map<PlaneConnections, List<ResourceLocation>> modelsOn;
|
||||
private final Map<PlaneConnections, IPartModel> modelsOn;
|
||||
|
||||
private final Map<PlaneConnections, List<ResourceLocation>> modelsHasChannel;
|
||||
private final Map<PlaneConnections, IPartModel> modelsHasChannel;
|
||||
|
||||
public PlaneModels( String prefixOff, String prefixOn )
|
||||
{
|
||||
Map<PlaneConnections, List<ResourceLocation>> modelsOff = new HashMap<>();
|
||||
Map<PlaneConnections, List<ResourceLocation>> modelsOn = new HashMap<>();
|
||||
Map<PlaneConnections, List<ResourceLocation>> modelsHasChannel = new HashMap<>();
|
||||
Map<PlaneConnections, IPartModel> modelsOff = new HashMap<>();
|
||||
Map<PlaneConnections, IPartModel> modelsOn = new HashMap<>();
|
||||
Map<PlaneConnections, IPartModel> modelsHasChannel = new HashMap<>();
|
||||
|
||||
for( PlaneConnections permutation : PlaneConnections.PERMUTATIONS )
|
||||
{
|
||||
ResourceLocation planeOff = new ResourceLocation( AppEng.MOD_ID, prefixOff + permutation.getFilenameSuffix() );
|
||||
ResourceLocation planeOn = new ResourceLocation( AppEng.MOD_ID, prefixOn + permutation.getFilenameSuffix() );
|
||||
|
||||
modelsOff.put( permutation, ImmutableList.of( MODEL_CHASSIS_OFF, planeOff ) );
|
||||
modelsOn.put( permutation, ImmutableList.of( MODEL_CHASSIS_ON, planeOff ) );
|
||||
modelsHasChannel.put( permutation, ImmutableList.of( MODEL_CHASSIS_HAS_CHANNEL, planeOn ) );
|
||||
modelsOff.put( permutation, new PartModel( MODEL_CHASSIS_OFF, planeOff ) );
|
||||
modelsOn.put( permutation, new PartModel( MODEL_CHASSIS_ON, planeOff ) );
|
||||
modelsHasChannel.put( permutation, new PartModel( MODEL_CHASSIS_HAS_CHANNEL, planeOn ) );
|
||||
}
|
||||
|
||||
this.modelsOff = ImmutableMap.copyOf( modelsOff );
|
||||
@@ -69,7 +70,7 @@ class PlaneModels
|
||||
this.modelsHasChannel = ImmutableMap.copyOf( modelsHasChannel );
|
||||
}
|
||||
|
||||
public List<ResourceLocation> getModel( PlaneConnections connections, boolean hasPower, boolean hasChannel )
|
||||
public IPartModel getModel( PlaneConnections connections, boolean hasPower, boolean hasChannel )
|
||||
{
|
||||
if( hasPower && hasChannel )
|
||||
{
|
||||
@@ -85,12 +86,12 @@ class PlaneModels
|
||||
}
|
||||
}
|
||||
|
||||
public List<ResourceLocation> getModels()
|
||||
public List<IPartModel> getModels()
|
||||
{
|
||||
List<ResourceLocation> result = new ArrayList<>();
|
||||
modelsOff.values().forEach( result::addAll );
|
||||
modelsOn.values().forEach( result::addAll );
|
||||
modelsHasChannel.values().forEach( result::addAll );
|
||||
List<IPartModel> result = new ArrayList<>();
|
||||
modelsOff.values().forEach( result::add );
|
||||
modelsOn.values().forEach( result::add );
|
||||
modelsHasChannel.values().forEach( result::add );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user